#include <gdcmFile.h>
Inheritance diagram for GDCM_NAME_SPACE::File:
Public Types | |
typedef std::list< DicomElement > | ListElements |
Public Member Functions | |
bool | Load () |
Loader. | |
bool | IsReadable () |
This predicate, based on hopefully reasonable heuristics, decides whether or not the current File was properly parsed and contains the mandatory information for being considered as a well formed and usable Dicom/Acr File. | |
void | SetFourthDimensionLocation (uint16_t group, uint16_t elem) |
int | GetImageNumber () |
gets the info from 0020,0013 : Image Number else 0. | |
ModalityType | GetModality () |
gets the info from 0008,0060 : Modality | |
int | GetXSize () |
Retrieve the number of columns of image. | |
int | GetYSize () |
Retrieve the number of lines of image. | |
int | GetZSize () |
Retrieve the number of planes of volume or the number of frames of a multiframe. | |
int | GetTSize () |
Retrieve the -unnormalized- number of 'times' of '4D image'. User has to tell gdcm the location of this '4th Dimension component' using SetFourthDimensionLocation() method before. | |
bool | GetSpacing (float &xspacing, float &yspacing, float &zspacing) |
float | GetXSpacing () |
gets the info from 0018,1164 : ImagerPixelSpacing then 0028,0030 : Pixel Spacing else 1.0 | |
float | GetYSpacing () |
gets the info from 0018,1164 : ImagerPixelSpacing then from 0028,0030 : Pixel Spacing else 1.0 | |
float | GetZSpacing () |
gets the info from 0018,0088 : Space Between Slices else from 0018,0050 : Slice Thickness else 1.0 | |
float | GetXOrigin () |
gets the info from 0020,0032 : Image Position Patient else from 0020,0030 : Image Position (RET) else 0. | |
float | GetYOrigin () |
gets the info from 0020,0032 : Image Position Patient else from 0020,0030 : Image Position (RET) else 0. | |
float | GetZOrigin () |
gets the info from 0020,0032 : Image Position Patient else from 0020,0030 : Image Position (RET) else from 0020,1041 : Slice Location else from 0020,0050 : Location else 0. | |
float | GetXCosineOnX () |
gets the cosine of image X axis, against patient X axis (Sorry, but Python needs it :-( ) | |
float | GetXCosineOnY () |
gets the cosine of image X axis, against patient Y axis (Sorry, but Python needs it :-( ) | |
float | GetXCosineOnZ () |
gets the cosine of image X axis, against patient Z axis (Sorry, but Python needs it :-( ) | |
float | GetYCosineOnX () |
gets the cosine of image Y axis, against patient X axis (Sorry, but Python needs it :-( ) | |
float | GetYCosineOnY () |
gets the cosine of image Y axis, against patient Y axis (Sorry, but Python needs it :-( ) | |
float | GetYCosineOnZ () |
gets the cosine of image Y axis, against patient Z axis (Sorry, but Python needs it :-( ) | |
bool | GetImageOrientationPatient (float iop[6]) |
gets the info from 0020,0037 : Image Orientation Patient or from 0020 0035 : Image Orientation (RET) | |
bool | GetImagePositionPatient (float ipp[3]) |
gets the info from 0020,0032 : Image Position Patient or from 0020 0030 : Image Position (RET) | |
int | GetBitsStored () |
Retrieve the number of Bits Stored (actually used) (as opposed to number of Bits Allocated). | |
int | GetBitsAllocated () |
Retrieve the number of Bits Allocated (8, 12 -compacted ACR-NEMA files-, 16, 24 -old RGB ACR-NEMA files-,). | |
int | GetHighBitPosition () |
Retrieve the high bit position. | |
int | GetSamplesPerPixel () |
Retrieve the number of Samples Per Pixel (1 : gray level, 3 : RGB/YBR -1 or 3 Planes-). | |
int | GetPlanarConfiguration () |
Retrieve the Planar Configuration for RGB images (0 : RGB Pixels , 1 : R Plane + G Plane + B Plane). | |
int | GetPixelSize () |
Return the size (in bytes) of a single pixel of data. | |
std::string | GetPixelType () |
Build the Pixel Type of the image. Possible values are:
| |
bool | IsSignedPixelData () |
Check whether the pixels are signed (1) or UNsigned (0) data. | |
bool | IsMonochrome () |
Check whether this a monochrome picture (gray levels) or not, using "Photometric Interpretation" tag (0x0028,0x0004). | |
bool | IsMonochrome1 () |
Check whether this a MONOCHROME1 picture (high values = dark) or not using "Photometric Interpretation" tag (0x0028,0x0004). | |
bool | IsPaletteColor () |
Check whether this a "PALETTE COLOR" picture or not by accessing the "Photometric Interpretation" tag ( 0x0028, 0x0004 ). | |
bool | IsYBRFull () |
Check whether this a "YBR_FULL" color picture or not by accessing the "Photometric Interpretation" tag ( 0x0028, 0x0004 ). | |
bool | HasLUT () |
tells us if LUT are used | |
int | GetLUTNbits () |
gets the info from 0028,1101 : Lookup Table Desc-Red else 0 | |
bool | GetRescaleSlopeIntercept (double &slope, double &intercept) |
double | GetRescaleIntercept () |
gets the info from 0028,1052 : Rescale Intercept | |
double | GetRescaleSlope () |
gets the info from 0028,1053 : Rescale Slope | |
int | GetNumberOfScalarComponents () |
This function is intended to user who doesn't want to have to manage a LUT and expects to get an RBG Pixel image (or a monochrome one, if no LUT found ...). | |
int | GetNumberOfScalarComponentsRaw () |
This function is intended to user that DOESN'T want to get RGB pixels image when it's stored as a PALETTE COLOR image
| |
uint16_t | GetGrPixel () |
Accessor to File::GrPixel. | |
uint16_t | GetNumPixel () |
Accessor to File::NumPixel. | |
size_t | GetPixelOffset () |
Recover the offset (from the beginning of the file) of *image* pixels (not *icone image* pixels, if any !). | |
size_t | GetPixelAreaLength () |
Recover the pixel area length (in Bytes). | |
RLEFramesInfo * | GetRLEInfo () |
returns the RLE info | |
JPEGFragmentsInfo * | GetJPEGInfo () |
Returns the JPEG Fragments info. | |
void | AddAnonymizeElement (uint16_t group, uint16_t elem, std::string const &value) |
Adds the characteristics of a new element we want to anonymize. | |
void | ClearAnonymizeList () |
Clears the list of elements to be anonymized. | |
void | AnonymizeNoLoad () |
Overwrites in the file the values of the DicomElements held in the list. | |
bool | AnonymizeFile () |
anonymize a File (remove Patient's personal info passed with AddAnonymizeElement() | |
bool | Write (std::string fileName, FileType filetype) |
Performs some consistency checking on various 'File related' (as opposed to 'DicomDir related') entries then writes in a file all the (Dicom Elements) included the Pixels. | |
Dict * | GetPubDict () |
Get the public dictionary used. | |
Dict * | GetShaDict () |
Get the shadow dictionary used. | |
bool | SetShaDict (Dict *dict) |
Set the shadow dictionary used. | |
bool | SetShaDict (DictKey const &dictName) |
Set the shadow dictionary used. | |
bool | IsParsable () |
This predicate tells us whether or not the current Document was properly parsed and contains at least *one* Dicom Element (and nothing more, sorry). | |
bool | IsDicomV3 () |
Predicate for dicom version 3 file. | |
bool | IsPapyrus () |
Predicate for Papyrus file Dedicated to whomsoever it may concern. | |
FileType | GetFileType () |
returns the File Type (ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown) | |
std::string | GetTransferSyntax () |
Accessor to the Transfer Syntax (when present) of the current document (it internally handles reading the value from disk when only parsing occured). | |
std::string | GetTransferSyntaxName () |
Accesses the info from 0002,0010 : Transfer Syntax and TS. | |
int | GetSwapCode () |
'Swap code' accessor (see SwapCode ) | |
const std::string & | GetFileName () const |
Accessor to Filename. | |
virtual void | SetFileName (std::string const &fileName) |
Accessor to Filename. | |
std::ifstream * | OpenFile () |
Tries to open the file Document::Filename and checks the preamble when existing, or if the file starts with an ACR-NEMA look-like element. | |
bool | CloseFile () |
closes the file | |
void | WriteContent (std::ofstream *fp, FileType type) |
Writes in a file all the Entries (Dicom Elements). | |
void | WriteContent (std::ofstream *fp, FileType filetype, bool insideMetaElements) |
Writes the Header Entries (Dicom Elements) from the H Table. | |
virtual void | LoadEntryBinArea (uint16_t group, uint16_t elem) |
Loads (from disk) the element content when a string is not suitable. | |
virtual void | LoadEntryBinArea (DataEntry *entry) |
Loads (from disk) the element content when a string is not suitable. | |
void | SetMaxSizeLoadEntry (long) |
during parsing, Header Elements too long are not loaded in memory | |
void | AddForceLoadElement (uint16_t group, uint16_t elem) |
Adds a new element we want to load anyway. | |
bool | operator< (Document &document) |
Loads the element while preserving the current underlying file position indicator as opposed to LoadDocEntry that modifies it Compares two documents, according to DicomDir rules. | |
void | SetLoadMode (int mode) |
Sets the LoadMode as a boolean string. LD_NOSEQ, LD_NOSHADOW, LD_NOSHADOWSEQ ... (nothing more, right now) WARNING : before using NO_SHADOW, be sure *all* your files contain accurate values in the 0x0000 element (if any) of *each* Shadow Group. The parser will fail if the size is wrong ! | |
virtual void | Print (std::ostream &os=std::cout, std::string const &indent="") |
Prints the Header Entries (Dicom Elements) from the H Table. | |
bool | AddEntry (DocEntry *Entry) |
add a new Dicom Element pointer to the H Table | |
bool | RemoveEntry (DocEntry *EntryToRemove) |
Clear the hash table from given entry AND delete the entry. | |
void | ClearEntry () |
delete all entries in the ElementSet | |
DocEntry * | GetFirstEntry () |
Get the first entry while visiting *the* 'zero level' DocEntrySet (DocEntries out of any Sequence). | |
DocEntry * | GetNextEntry () |
Get the next entry while visiting *the* 'zero level' DocEntrySet (DocEntries out of any Sequence). | |
DocEntry * | GetDocEntry (uint16_t group, uint16_t elem) |
retrieves a Dicom Element using (group, element) | |
bool | IsEmpty () |
Tells us if the ElementSet contains no entry. | |
int | IsVRCoherent (uint16_t group) |
Checks whether *all* the DataEntries of the group have all the same type for VR (ImplicitVR or ExplicitVR). | |
virtual void | Copy (DocEntrySet *set) |
Copies all the attributes from an other DocEntrySet. | |
virtual std::string | GetEntryString (uint16_t group, uint16_t elem) |
Get the "std::string representable" value of the Dicom entry. | |
virtual void * | GetEntryBinArea (uint16_t group, uint16_t elem) |
Gets (from Header) a 'non string' element value. | |
virtual int | GetEntryLength (uint16_t group, uint16_t elem) |
Searches within the DocEntrySet for the value length of a given tag.. | |
DataEntry * | GetDataEntry (uint16_t group, uint16_t elem) |
Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type DataEntry. | |
SeqEntry * | GetSeqEntry (uint16_t group, uint16_t elem) |
Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type SeqEntry. | |
bool | SetEntryString (std::string const &content, uint16_t group, uint16_t elem) |
Accesses an existing DocEntry (i.e. a Dicom Element) through its (group, element) and modifies its content with the given value. | |
bool | SetEntryString (std::string const &content, DataEntry *entry) |
Accesses an existing DocEntry (i.e. a Dicom Element) and modifies its content with the given value. | |
bool | SetEntryBinArea (uint8_t *content, int lgth, uint16_t group, uint16_t elem) |
Accesses an existing DocEntry (i.e. a Dicom Element) through its (group, element) and modifies its content with the given value. | |
bool | SetEntryBinArea (uint8_t *content, int lgth, DataEntry *entry) |
Accesses an existing DataEntry (i.e. a Dicom Element) and modifies its content with the given value. | |
DataEntry * | InsertEntryString (std::string const &value, uint16_t group, uint16_t elem, VRKey const &vr=GDCM_VRUNKNOWN) |
Modifies the value of a given Doc Entry (Dicom Element) when it exists. Creates it with the given value when unexistant. | |
DataEntry * | InsertEntryBinArea (uint8_t *binArea, int lgth, uint16_t group, uint16_t elem, VRKey const &vr=GDCM_VRUNKNOWN) |
Modifies the value of a given Header Entry (Dicom Element) when it exists. Create it with the given value when unexistant. A copy of the binArea is made to be kept in the Document. | |
SeqEntry * | InsertSeqEntry (uint16_t group, uint16_t elem) |
Creates a new gdcm::SeqEntry and adds it to the current DocEntrySet. (remove any existing entry with same group,elem). | |
virtual bool | CheckIfEntryExist (uint16_t group, uint16_t elem) |
Checks if a given Dicom Element exists within the DocEntrySet. | |
DataEntry * | NewDataEntry (uint16_t group, uint16_t elem, VRKey const &vr=GDCM_VRUNKNOWN) |
Build a new DataEntry from all the low level arguments. | |
SeqEntry * | NewSeqEntry (uint16_t group, uint16_t elem) |
Build a new SeqEntry from all the low level arguments. | |
void | Delete () |
Delete the object. | |
void | Register () |
Register the object. | |
void | Unregister () |
Unregister the object. | |
const unsigned long & | GetRefCount () const |
Get the reference counting. | |
void | SetPrintLevel (int level) |
Sets the print level for the Dicom Header Elements. | |
int | GetPrintLevel () |
Gets the print level for the Dicom Entries. | |
Static Public Member Functions | |
static File * | New () |
Protected Member Functions | |
File () | |
Constructor used when we want to generate dicom files from scratch. | |
virtual | ~File () |
Canonical destructor. | |
bool | MayIWrite (uint16_t group) |
Protect the Writer from writing illegal groups. | |
virtual void | CallStartMethod () |
CallStartMethod. | |
virtual void | CallProgressMethod () |
CallProgressMethod. | |
virtual void | CallEndMethod () |
CallEndMethod. | |
uint16_t | ReadInt16 () throw ( FormatError ) |
Reads a supposed to be 16 Bits integer (swaps it depending on processor endianness). | |
uint32_t | ReadInt32 () throw ( FormatError ) |
Reads a supposed to be 32 Bits integer (swaps it depending on processor endianness). | |
void | SkipBytes (uint32_t nBytes) |
skips bytes inside the source file | |
int | ComputeGroup0002Length () |
Re-computes the length of the Dicom group 0002. | |
DictEntry * | GetDictEntry (uint16_t group, uint16_t elem) |
Searches [both] the public [and the shadow dictionary (when they exist)] for the presence of the DictEntry with given group and element. The public dictionary has precedence on the shadow one(s), if any. | |
Protected Attributes | |
RLEFramesInfo * | RLEInfo |
Store the RLE frames info obtained during parsing of pixels. | |
JPEGFragmentsInfo * | JPEGInfo |
Store the JPEG fragments info obtained during parsing of pixels. | |
uint16_t | NumPixel |
In some cases (e.g. for some ACR-NEMA images) the Entry Element Number of the 'Pixel Element' is *not* found at 0x0010. In order to make things easier the parser shall store the proper value in NumPixel to provide a unique access facility. | |
uint16_t | GrPixel |
In some cases (e.g. for some ACR-NEMA images) the header entry for the group of pixels is *not* found at 0x7fe0. In order to make things easier the parser shall store the proper value in GrPixel to provide a unique access facility. | |
TagKey | FourthDimensionLocation |
allows user to tell gdcm in which DataElement is stored the -unnormalized- 4th Dimension | |
std::string | Filename |
Refering underlying filename. | |
int | SwapCode |
Swap code gives an information on the byte order of a supposed to be an int32, as it's read on disc (depending on the image Transfer Syntax *and* on the processor endianess) as opposed as it should in memory to be dealt as an int32. For instance :
| |
bool | Group0002Parsed |
whether we already parsed group 0002 (Meta Elements) | |
bool | HasDCMPreamble |
whether file has a DCM Preamble | |
std::ifstream * | Fp |
File Pointer, opened during Document parsing. | |
FileType | Filetype |
ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown. | |
ListElements | UserAnonymizeList |
User supplied list of elements to Anonymize. | |
ListElements | UserForceLoadList |
User supplied list of elements to force Load. | |
int | LoadMode |
Bit string integer (each one considered as a boolean) Bit 0 : Skip Sequences, if possible Bit 1 : Skip Shadow Groups if possible Probabely, some more to add. | |
bool | IsDocumentAlreadyLoaded |
Whether the gdcm::Document is already parsed/loaded : False from the creation of the gdcm::Document untill gdcm::Document:Load(). | |
bool | IsDocumentModified |
Whether the gdcm::Document was modified since the last Load(). | |
float | Progress |
value of the ??? for any progress bar | |
bool | Abort |
Dict * | RefPubDict |
Public dictionary used to parse this header. | |
Dict * | RefShaDict |
Optional "shadow dictionary" (private elements) used to parse this header. | |
uint32_t | MaxSizeLoadEntry |
Size threshold above which an element value will NOT be loaded in memory (to avoid loading the image/volume itself). By default, this upper bound is fixed to 1024 bytes (which might look reasonable when one considers the definition of the various VR contents). | |
uint16_t | CurrentGroup |
to allow any inner method to know current tag Group number | |
uint16_t | CurrentElem |
to allow any inner method to know current tag Element number | |
DocEntry * | PreviousDocEntry |
To be able to backtrack (Private Sequence, Implicit VR related pb). | |
int | PrintLevel |
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. | |
Static Protected Attributes | |
static const unsigned int | HEADER_LENGTH_TO_READ |
After opening the file, we read HEADER_LENGTH_TO_READ bytes. | |
static const unsigned int | MAX_SIZE_LOAD_ELEMENT_VALUE = 0xfff |
Elements whose value is longer than MAX_SIZE_LOAD_ELEMENT_VALUE are NOT loaded. | |
Private Member Functions | |
gdcmTypeMacro (File) | |
bool | DoTheLoadingJob () |
Does the Loading Job (internal use only). | |
void | ComputeRLEInfo () |
Parse pixel data from disk of [multi-]fragment RLE encoding. Compute the RLE extra information and store it in RLEInfo for later pixel retrieval usage. | |
void | ComputeJPEGFragmentInfo () |
Parse pixel data from disk of [multi-]fragment Jpeg encoding. Compute the jpeg extra information (fragment[s] offset[s] and length) and store it[them] in JPEGInfo for later pixel retrieval usage. | |
bool | ReadTag (uint16_t, uint16_t) |
Assuming the internal file pointer Document::Fp is placed at the beginning of a tag, check whether this tag is (TestGroup, TestElem). | |
uint32_t | ReadTagLength (uint16_t, uint16_t) |
Assuming the internal file pointer Document::Fp is placed at the beginning of a tag (TestGroup, TestElement), read the length associated to the Tag. | |
void | ReadEncapsulatedBasicOffsetTable () |
When parsing the Pixel Data of an encapsulated file, read the basic offset table (when present, and BTW dump it). | |
Private Attributes | |
uint32_t * | BasicOffsetTableItemValue |
The typical usage of instances of class File is to classify a set of dicom files according to header information e.g. to create a file hierarchy reflecting the Patient/Study/Serie informations, or extracting a given SerieId. Accessing the content (image[s] or volume[s]) is beyond the functionality of this class and belongs to gdcm::FileHelper.
The File::Set*Tag* family members cannot be defined as protected due to Swig limitations for as Has_a dependency between File and FileHelper.
Definition at line 99 of file gdcmFile.h.
|
Definition at line 47 of file gdcmDocument.h. |
|
Constructor used when we want to generate dicom files from scratch.
Definition at line 114 of file gdcmFile.cxx. References BasicOffsetTableItemValue, FourthDimensionLocation, GrPixel, JPEGInfo, NumPixel, and RLEInfo. 00114 : 00115 Document() 00116 { 00117 RLEInfo = new RLEFramesInfo; 00118 JPEGInfo = new JPEGFragmentsInfo; 00119 GrPixel = 0x7fe0; // to avoid further troubles 00120 NumPixel = 0x0010; 00121 BasicOffsetTableItemValue = 0; 00122 FourthDimensionLocation = TagKey(0,0); 00123 }
|
|
Canonical destructor.
Definition at line 129 of file gdcmFile.cxx. References BasicOffsetTableItemValue, JPEGInfo, and RLEInfo. 00130 { 00131 if ( RLEInfo ) 00132 delete RLEInfo; 00133 if ( JPEGInfo ) 00134 delete JPEGInfo; 00135 delete[] BasicOffsetTableItemValue; 00136 }
|
|
Adds the characteristics of a new element we want to anonymize.
Definition at line 1793 of file gdcmFile.cxx. References GDCM_NAME_SPACE::DicomElement::Elem, GDCM_NAME_SPACE::DicomElement::Group, GDCM_NAME_SPACE::Document::UserAnonymizeList, and GDCM_NAME_SPACE::DicomElement::Value. 01795 { 01796 DicomElement el; 01797 el.Group = group; 01798 el.Elem = elem; 01799 el.Value = value; 01800 UserAnonymizeList.push_back(el); 01801 }
|
|
add a new Dicom Element pointer to the H Table
Implements GDCM_NAME_SPACE::DocEntrySet. Definition at line 101 of file gdcmElementSet.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntry::GetKey(), and GDCM_NAME_SPACE::ElementSet::TagHT. Referenced by GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::DocEntryArchive::Restore(). 00102 { 00103 const TagKey &key = newEntry->GetKey(); 00104 00105 if ( TagHT.count(key) == 1 ) 00106 { 00107 gdcmWarningMacro( "Key already present: " << key ); 00108 return false; 00109 } 00110 else 00111 { 00112 TagHT.insert(TagDocEntryHT::value_type(newEntry->GetKey(), newEntry)); 00113 newEntry->Register(); 00114 return true; 00115 } 00116 }
|
|
Adds a new element we want to load anyway.
Definition at line 304 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::DicomElement::Elem, GDCM_NAME_SPACE::DicomElement::Group, and GDCM_NAME_SPACE::Document::UserForceLoadList. 00305 { 00306 DicomElement el; 00307 el.Group = group; 00308 el.Elem = elem; 00309 UserForceLoadList.push_back(el); 00310 }
|
|
anonymize a File (remove Patient's personal info passed with AddAnonymizeElement()
Definition at line 1863 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, GDCM_NAME_SPACE::ElementSet::GetDocEntry(), GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GDCM_NAME_SPACE::DocEntrySet::SetEntryString(), and GDCM_NAME_SPACE::Document::UserAnonymizeList. 01864 { 01865 // If Anonymisation list is empty, let's perform some basic anonymization 01866 if ( UserAnonymizeList.begin() == UserAnonymizeList.end() ) 01867 { 01868 // If exist, replace by spaces 01869 SetEntryString(" ",0x0010, 0x2154); // Telephone 01870 SetEntryString(" ",0x0010, 0x1040); // Adress 01871 SetEntryString(" ",0x0010, 0x0020); // Patient ID 01872 01873 DocEntry *patientNameHE = GetDocEntry (0x0010, 0x0010); 01874 01875 if ( patientNameHE ) // we replace it by Study Instance UID (why not ?) 01876 { 01877 std::string studyInstanceUID = GetEntryString (0x0020, 0x000d); 01878 if ( studyInstanceUID != GDCM_UNFOUND ) 01879 { 01880 SetEntryString(studyInstanceUID, 0x0010, 0x0010); 01881 } 01882 else 01883 { 01884 SetEntryString("anonymized", 0x0010, 0x0010); 01885 } 01886 } 01887 } 01888 else 01889 { 01890 GDCM_NAME_SPACE::DocEntry *d; 01891 for (ListElements::iterator it = UserAnonymizeList.begin(); 01892 it != UserAnonymizeList.end(); 01893 ++it) 01894 { 01895 d = GetDocEntry( (*it).Group, (*it).Elem); 01896 01897 if ( d == NULL) 01898 continue; 01899 01900 if ( dynamic_cast<SeqEntry *>(d) ) 01901 { 01902 gdcmWarningMacro( "You cannot 'Anonymize' a SeqEntry "); 01903 continue; 01904 } 01905 01906 if ( dynamic_cast<DataEntry *>(d) ) 01907 { 01908 gdcmWarningMacro( "To 'Anonymize' a DataEntry, better use AnonymizeNoLoad (FIXME) "); 01909 continue; 01910 } 01911 else 01912 SetEntryString ((*it).Value, (*it).Group, (*it).Elem); 01913 } 01914 } 01915 01916 // In order to make definitively impossible any further identification 01917 // remove or replace all the stuff that contains a Date 01918 01919 //0008 0012 DA ID Instance Creation Date 01920 //0008 0020 DA ID Study Date 01921 //0008 0021 DA ID Series Date 01922 //0008 0022 DA ID Acquisition Date 01923 //0008 0023 DA ID Content Date 01924 //0008 0024 DA ID Overlay Date 01925 //0008 0025 DA ID Curve Date 01926 //0008 002a DT ID Acquisition Datetime 01927 //0018 9074 DT ACQ Frame Acquisition Datetime 01928 //0018 9151 DT ACQ Frame Reference Datetime 01929 //0018 a002 DT ACQ Contribution Date Time 01930 //0020 3403 SH REL Modified Image Date (RET) 01931 //0032 0032 DA SDY Study Verified Date 01932 //0032 0034 DA SDY Study Read Date 01933 //0032 1000 DA SDY Scheduled Study Start Date 01934 //0032 1010 DA SDY Scheduled Study Stop Date 01935 //0032 1040 DA SDY Study Arrival Date 01936 //0032 1050 DA SDY Study Completion Date 01937 //0038 001a DA VIS Scheduled Admission Date 01938 //0038 001c DA VIS Scheduled Discharge Date 01939 //0038 0020 DA VIS Admitting Date 01940 //0038 0030 DA VIS Discharge Date 01941 //0040 0002 DA PRC Scheduled Procedure Step Start Date 01942 //0040 0004 DA PRC Scheduled Procedure Step End Date 01943 //0040 0244 DA PRC Performed Procedure Step Start Date 01944 //0040 0250 DA PRC Performed Procedure Step End Date 01945 //0040 2004 DA PRC Issue Date of Imaging Service Request 01946 //0040 4005 DT PRC Scheduled Procedure Step Start Date and Time 01947 //0040 4011 DT PRC Expected Completion Date and Time 01948 //0040 a030 DT PRC Verification Date Time 01949 //0040 a032 DT PRC Observation Date Time 01950 //0040 a120 DT PRC DateTime 01951 //0040 a121 DA PRC Date 01952 //0040 a13a DT PRC Referenced Datetime 01953 //0070 0082 DA ??? Presentation Creation Date 01954 //0100 0420 DT ??? SOP Autorization Date and Time 01955 //0400 0105 DT ??? Digital Signature DateTime 01956 //2100 0040 DA PJ Creation Date 01957 //3006 0008 DA SSET Structure Set Date 01958 //3008 0024 DA ??? Treatment Control Point Date 01959 //3008 0054 DA ??? First Treatment Date 01960 //3008 0056 DA ??? Most Recent Treatment Date 01961 //3008 0162 DA ??? Safe Position Exit Date 01962 //3008 0166 DA ??? Safe Position Return Date 01963 //3008 0250 DA ??? Treatment Date 01964 //300a 0006 DA RT RT Plan Date 01965 //300a 022c DA RT Air Kerma Rate Reference Date 01966 //300e 0004 DA RT Review Date 01967 01968 return true; 01969 }
|
|
Overwrites in the file the values of the DicomElements held in the list.
Definition at line 1807 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Document::Filename, gdcmWarningMacro, GDCM_NAME_SPACE::ElementSet::GetDocEntry(), and GDCM_NAME_SPACE::Document::UserAnonymizeList. 01808 { 01809 std::fstream *fp = new std::fstream(Filename.c_str(), 01810 std::ios::in | std::ios::out | std::ios::binary); 01811 GDCM_NAME_SPACE::DocEntry *d; 01812 uint32_t offset; 01813 uint32_t lgth; 01814 uint32_t valLgth = 0; 01815 std::string *spaces; 01816 for (ListElements::iterator it = UserAnonymizeList.begin(); 01817 it != UserAnonymizeList.end(); 01818 ++it) 01819 { 01820 01821 //std::cout << "File::AnonymizeNoLoad -------" << std::hex <<(*it).Group <<"|"<< 01822 // (*it).Elem 01823 // << "[" << (*it).Value << "] "<< std::dec << std::endl; 01824 d = GetDocEntry( (*it).Group, (*it).Elem); 01825 01826 if ( d == NULL) 01827 continue; 01828 01829 if ( dynamic_cast<SeqEntry *>(d) ) 01830 { 01831 gdcmWarningMacro( "You cannot 'Anonymize' a SeqEntry "); 01832 continue; 01833 } 01834 01835 valLgth = (*it).Value.size(); 01836 if (valLgth == 0) 01837 continue; 01838 01839 offset = d->GetOffset(); 01840 lgth = d->GetLength(); 01841 01842 //std::cout << "lgth " << lgth << " valLgth " << valLgth << std::endl; 01843 if (valLgth < lgth) 01844 { 01845 spaces = new std::string( lgth-valLgth, ' '); 01846 (*it).Value = (*it).Value + *spaces; 01847 //std::cout << "[" << (*it).Value << "] " << lgth << std::endl; 01848 delete spaces; 01849 } 01850 fp->seekp( offset, std::ios::beg ); 01851 fp->write( (*it).Value.c_str(), lgth ); 01852 01853 } 01854 fp->close(); 01855 delete fp; 01856 }
|
|
CallEndMethod.
Definition at line 1074 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::CMD_ENDPROGRESS, GDCM_NAME_SPACE::CommandManager::ExecuteCommand(), and GDCM_NAME_SPACE::Document::Progress. 01075 { 01076 Progress = 1.0f; 01077 CommandManager::ExecuteCommand(this,CMD_ENDPROGRESS); 01078 }
|
|
CallProgressMethod.
Definition at line 1066 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::CMD_PROGRESS, and GDCM_NAME_SPACE::CommandManager::ExecuteCommand(). Referenced by GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(). 01067 { 01068 CommandManager::ExecuteCommand(this,CMD_PROGRESS); 01069 }
|
|
CallStartMethod.
Definition at line 1056 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::Document::Abort, GDCM_NAME_SPACE::CMD_STARTPROGRESS, GDCM_NAME_SPACE::CommandManager::ExecuteCommand(), and GDCM_NAME_SPACE::Document::Progress. Referenced by GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(). 01057 { 01058 Progress = 0.0f; 01059 Abort = false; 01060 CommandManager::ExecuteCommand(this,CMD_STARTPROGRESS); 01061 }
|
|
Checks if a given Dicom Element exists within the DocEntrySet.
Definition at line 412 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetDocEntry(). 00413 { 00414 return GetDocEntry(group,elem)!=NULL; 00415 }
|
|
Clears the list of elements to be anonymized.
Definition at line 184 of file gdcmFile.h. 00184 { UserAnonymizeList.clear(); }
|
|
delete all entries in the ElementSet
Implements GDCM_NAME_SPACE::DocEntrySet. Definition at line 139 of file gdcmElementSet.cxx. References GDCM_NAME_SPACE::ElementSet::TagHT. Referenced by GDCM_NAME_SPACE::ElementSet::Copy(), GDCM_NAME_SPACE::DicomDir::CreateDicomDir(), GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), GDCM_NAME_SPACE::DicomDir::SetElements(), and GDCM_NAME_SPACE::ElementSet::~ElementSet(). 00140 { 00141 for(TagDocEntryHT::iterator cc = TagHT.begin();cc != TagHT.end(); ++cc) 00142 { 00143 if ( cc->second ) 00144 { 00145 cc->second->Unregister(); 00146 } 00147 } 00148 TagHT.clear(); 00149 }
|
|
closes the file
Definition at line 679 of file gdcmDocument.cxx. Referenced by GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), GDCM_NAME_SPACE::FileHelper::GetRaw(), and GDCM_NAME_SPACE::Document::~Document(). 00680 { 00681 if ( Fp ) 00682 { 00683 Fp->close(); 00684 delete Fp; 00685 Fp = 0; 00686 } 00687 return true; 00688 }
|
|
Re-computes the length of the Dicom group 0002.
Definition at line 1013 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::DocEntry::GetElement(), GDCM_NAME_SPACE::ElementSet::GetFirstEntry(), GDCM_NAME_SPACE::DocEntry::GetGroup(), GDCM_NAME_SPACE::DocEntry::GetLength(), GDCM_NAME_SPACE::ElementSet::GetNextEntry(), and GDCM_NAME_SPACE::DocEntry::GetVR(). Referenced by Write(). 01014 { 01015 uint16_t gr; 01016 VRKey vr; 01017 01018 int groupLength = 0; 01019 bool found0002 = false; 01020 01021 // for each zero-level Tag in the DCM Header 01022 DocEntry *entry = GetFirstEntry(); 01023 while( entry ) 01024 { 01025 gr = entry->GetGroup(); 01026 01027 if ( gr == 0x0002 ) 01028 { 01029 found0002 = true; 01030 01031 if ( entry->GetElement() != 0x0000 ) 01032 { 01033 vr = entry->GetVR(); 01034 01035 //if ( (vr == "OB")||(vr == "OW")||(vr == "UT")||(vr == "SQ")) 01036 // (no SQ, OW, UT in group 0x0002;) 01037 if ( vr == "OB" ) 01038 { 01039 // explicit VR AND (OB, OW, SQ, UT) : 4 more bytes 01040 groupLength += 4; 01041 } 01042 groupLength += 2 + 2 + 4 + entry->GetLength(); 01043 } 01044 } 01045 else if (found0002 ) 01046 break; 01047 01048 entry = GetNextEntry(); 01049 } 01050 return groupLength; 01051 }
|
|
Parse pixel data from disk of [multi-]fragment Jpeg encoding. Compute the jpeg extra information (fragment[s] offset[s] and length) and store it[them] in JPEGInfo for later pixel retrieval usage.
Definition at line 2142 of file gdcmFile.cxx. References GDCM_NAME_SPACE::JPEGFragmentsInfo::AddFragment(), BasicOffsetTableItemValue, GDCM_NAME_SPACE::Document::Fp, gdcmWarningMacro, GDCM_NAME_SPACE::Document::GetTransferSyntax(), GDCM_NAME_SPACE::Global::GetTS(), JPEGInfo, ReadEncapsulatedBasicOffsetTable(), ReadTag(), ReadTagLength(), GDCM_NAME_SPACE::JPEGFragment::SetLength(), GDCM_NAME_SPACE::JPEGFragment::SetOffset(), and GDCM_NAME_SPACE::Document::SkipBytes(). Referenced by DoTheLoadingJob(). 02143 { 02144 // If you need to, look for comments of ComputeRLEInfo(). 02145 std::string ts = GetTransferSyntax(); 02146 if ( ! Global::GetTS()->IsJPEG(ts) ) 02147 { 02148 return; 02149 } 02150 02151 ReadEncapsulatedBasicOffsetTable(); 02152 02153 // Loop on the fragments[s] and store the parsed information in a 02154 // JPEGInfo. 02155 long fragmentLength; 02156 int i=0; 02157 uint32_t sum = 0; 02158 while ( (fragmentLength = ReadTagLength(0xfffe, 0xe000)) != 0 ) 02159 { 02160 // Since we have read the basic offset table, let's check the value were correct 02161 // or else produce a warning: 02162 // A.4 Transfer syntaxes for encapsulation of encoded pixel data: 02163 // When the Item Value is present, the Basic Offset Table Item Value shall contain 02164 // concatenated 32-bit unsigned integer values that are byte offsets to the first 02165 // byte of the Item Tag of the first fragment for each frame in the Sequence of 02166 // Items. These offsets are measured from the first byte of the first Item Tag 02167 // following the Basic Offset Table item (See Table A.4-2). 02168 02169 if ( BasicOffsetTableItemValue ) 02170 { 02171 // If a BasicOffsetTableItemValue was read 02172 uint32_t individualLength = BasicOffsetTableItemValue[i]; 02173 //assert( individualLength == sum ); // Seems like 00191113.dcm is off by one ?? 02174 if( individualLength != sum ) 02175 { 02176 gdcmWarningMacro( "BasicOffsetTableItemValue differs from the fragment lenght:" << 02177 individualLength << " != " << sum ); 02178 } 02179 sum += fragmentLength + 8; 02180 i++; 02181 } 02182 02183 long fragmentOffset = Fp->tellg(); // Once per fragment 02184 // Store the collected info 02185 JPEGFragment *newFragment = new JPEGFragment; 02186 newFragment->SetOffset(fragmentOffset); 02187 newFragment->SetLength(fragmentLength); 02188 JPEGInfo->AddFragment(newFragment); 02189 02190 SkipBytes(fragmentLength); 02191 } 02192 02193 // Make sure that we encounter a 'Sequence Delimiter Item' 02194 // at the end of the item : 02195 if ( !ReadTag(0xfffe, 0xe0dd) ) 02196 { 02197 gdcmWarningMacro( "No sequence delimiter item at end of JPEG item sequence"); 02198 } 02199 }
|
|
Parse pixel data from disk of [multi-]fragment RLE encoding. Compute the RLE extra information and store it in RLEInfo for later pixel retrieval usage.
Definition at line 2030 of file gdcmFile.cxx. References BasicOffsetTableItemValue, GDCM_NAME_SPACE::Document::Fp, gdcmWarningMacro, GDCM_NAME_SPACE::Document::GetTransferSyntax(), GDCM_NAME_SPACE::Global::GetTS(), ReadEncapsulatedBasicOffsetTable(), GDCM_NAME_SPACE::Document::ReadInt32(), ReadTagLength(), and GDCM_NAME_SPACE::Document::SkipBytes(). Referenced by DoTheLoadingJob(). 02031 { 02032 std::string ts = GetTransferSyntax(); 02033 if ( !Global::GetTS()->IsRLELossless(ts) ) 02034 { 02035 return; 02036 } 02037 02038 // Encoded pixel data: for the time being we are only concerned with 02039 // Jpeg or RLE Pixel data encodings. 02040 // As stated in PS 3.5-2003, section 8.2 p44: 02041 // "If sent in Encapsulated Format (i.e. other than the Native Format) the 02042 // value representation OB is used". 02043 // Hence we expect an OB value representation. Concerning OB VR, 02044 // the section PS 3.5-2003, section A.4.c p 58-59, states: 02045 // "For the Value Representations OB and OW, the encoding shall meet the 02046 // following specifications depending on the Data element tag:" 02047 // [...snip...] 02048 // - the first item in the sequence of items before the encoded pixel 02049 // data stream shall be basic offset table item. The basic offset table 02050 // item value, however, is not required to be present" 02051 ReadEncapsulatedBasicOffsetTable(); 02052 02053 // Encapsulated RLE Compressed Images (see PS 3.5-2003, Annex G) 02054 // Loop on the individual frame[s] and store the information 02055 // on the RLE fragments in a RLEFramesInfo. 02056 // Note: - when only a single frame is present, this is a 02057 // classical image. 02058 // - when more than one frame are present, then we are in 02059 // the case of a multi-frame image. 02060 long frameLength; 02061 int i=0; 02062 uint32_t sum = 0; 02063 while ( (frameLength = ReadTagLength(0xfffe, 0xe000)) != 0 ) 02064 { 02065 // Since we have read the basic offset table, let's check the value were correct 02066 // or else produce a warning: 02067 if ( BasicOffsetTableItemValue ) 02068 { 02069 // If a BasicOffsetTableItemValue was read 02070 uint32_t individualLength = BasicOffsetTableItemValue[i]; 02071 assert( individualLength == sum ); // REMOVE that if this is a problem 02072 if( individualLength != sum ) 02073 { 02074 gdcmWarningMacro( "BasicOffsetTableItemValue differs from the fragment lenght" ); 02075 } 02076 sum += frameLength + 8; 02077 i++; 02078 } 02079 // Parse the RLE Header and store the corresponding RLE Segment 02080 // Offset Table information on fragments of this current Frame. 02081 // Note that the fragment pixels themselves are not loaded 02082 // (but just skipped). 02083 long frameOffset = Fp->tellg(); // once per fragment 02084 02085 uint32_t nbRleSegments = ReadInt32(); 02086 if ( nbRleSegments > 16 ) 02087 { 02088 // There should be at most 15 segments (refer to RLEFrame class) 02089 gdcmWarningMacro( "Too many segments."); 02090 } 02091 02092 uint32_t rleSegmentOffsetTable[16]; 02093 for( int k = 1; k <= 15; k++ ) 02094 { 02095 rleSegmentOffsetTable[k] = ReadInt32(); 02096 } 02097 02098 // Deduce from both RLE Header and frameLength 02099 // the fragment length, and again store this info 02100 // in a RLEFramesInfo. 02101 long rleSegmentLength[15]; 02102 // skipping (not reading) RLE Segments 02103 if ( nbRleSegments > 1) 02104 { 02105 for(unsigned int k = 1; k <= nbRleSegments-1; k++) 02106 { 02107 rleSegmentLength[k] = rleSegmentOffsetTable[k+1] 02108 - rleSegmentOffsetTable[k]; 02109 SkipBytes(rleSegmentLength[k]); 02110 } 02111 } 02112 02113 rleSegmentLength[nbRleSegments] = frameLength 02114 - rleSegmentOffsetTable[nbRleSegments]; 02115 SkipBytes(rleSegmentLength[nbRleSegments]); 02116 02117 // Store the collected info 02118 RLEFrame *newFrame = new RLEFrame; 02119 newFrame->SetNumberOfFragments(nbRleSegments); 02120 for( unsigned int uk = 1; uk <= nbRleSegments; uk++ ) 02121 { 02122 newFrame->SetOffset(uk,frameOffset + rleSegmentOffsetTable[uk]); 02123 newFrame->SetLength(uk,rleSegmentLength[uk]); 02124 } 02125 RLEInfo->AddFrame(newFrame); 02126 } 02127 02128 // Make sure that we encounter a 'Sequence Delimiter Item' 02129 // at the end of the item : 02130 if ( !ReadTag(0xfffe, 0xe0dd) ) // once per RLE File 02131 { 02132 gdcmWarningMacro( "No sequence delimiter item at end of RLE item sequence"); 02133 } 02134 }
|
|
Copies all the attributes from an other DocEntrySet.
Reimplemented from GDCM_NAME_SPACE::DocEntrySet. Reimplemented in GDCM_NAME_SPACE::DicomDir. Definition at line 201 of file gdcmElementSet.cxx. References GDCM_NAME_SPACE::ElementSet::ClearEntry(), GDCM_NAME_SPACE::DocEntrySet::Copy(), GDCM_NAME_SPACE::ElementSet::ItTagHT, and GDCM_NAME_SPACE::ElementSet::TagHT. Referenced by GDCM_NAME_SPACE::DicomDir::Copy(). 00202 { 00203 // Remove all previous entries 00204 ClearEntry(); 00205 00206 DocEntrySet::Copy(set); 00207 00208 ElementSet *eltSet = dynamic_cast<ElementSet *>(set); 00209 if( eltSet ) 00210 { 00211 TagHT = eltSet->TagHT; 00212 for(ItTagHT = TagHT.begin();ItTagHT != TagHT.end();++ItTagHT) 00213 { 00214 (ItTagHT->second)->Register(); 00215 } 00216 } 00217 }
|
|
|
Does the Loading Job (internal use only).
Definition at line 158 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Document::CloseFile(), ComputeJPEGFragmentInfo(), ComputeRLEInfo(), GDCM_NAME_SPACE::Document::Fp, GDCM_NAME_SPACE::GDCM_UNFOUND, GetBitsAllocated(), GDCM_NAME_SPACE::ElementSet::GetDocEntry(), GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GDCM_NAME_SPACE::DocEntry::GetOffset(), GDCM_NAME_SPACE::Document::GetTransferSyntax(), GDCM_NAME_SPACE::Global::GetTS(), GDCM_NAME_SPACE::DocEntry::GetVR(), GrPixel, NumPixel, GDCM_NAME_SPACE::Document::OpenFile(), and GDCM_NAME_SPACE::DocEntry::SetVR(). Referenced by Load(). 00159 { 00160 // for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010 00161 // We may encounter the 'RETired' (0x0028, 0x0200) tag 00162 // (Image Location") . This entry contains the number of 00163 // the group that contains the pixel data (hence the "Pixel Data" 00164 // is found by indirection through the "Image Location"). 00165 // Inside the group pointed by "Image Location" the searched element 00166 // is conventionally the element 0x0010 (when the norm is respected). 00167 // When the "Image Location" is missing we default to group 0x7fe0. 00168 // Note: this IS the right place for the code 00169 00170 // Image Location 00171 const std::string &imgLocation = GetEntryString(0x0028, 0x0200); 00172 if ( imgLocation == GDCM_UNFOUND ) 00173 { 00174 // default value 00175 GrPixel = 0x7fe0; 00176 } 00177 else 00178 { 00179 GrPixel = (uint16_t) atoi( imgLocation.c_str() ); 00180 } 00181 00182 // sometimes Image Location value doesn't follow 00183 // the supposed processor endianness. 00184 // see gdcmData/cr172241.dcm 00185 if ( GrPixel == 0xe07f ) 00186 { 00187 GrPixel = 0x7fe0; 00188 } 00189 00190 if ( GrPixel != 0x7fe0 ) 00191 { 00192 // This is a kludge for old dirty Philips imager. 00193 NumPixel = 0x1010; 00194 } 00195 else 00196 { 00197 NumPixel = 0x0010; 00198 } 00199 00200 // Now, we know GrPixel and NumPixel. 00201 // Let's create a VirtualDictEntry to allow a further VR modification 00202 // and force VR to match with BitsAllocated. 00203 DocEntry *entry = GetDocEntry(GrPixel, NumPixel); 00204 if ( entry != 0 ) 00205 { 00206 // Compute the RLE or JPEG info 00207 OpenFile(); 00208 const std::string &ts = GetTransferSyntax(); 00209 Fp->seekg( entry->GetOffset(), std::ios::beg ); 00210 if ( Global::GetTS()->IsRLELossless(ts) ) 00211 ComputeRLEInfo(); 00212 else if ( Global::GetTS()->IsJPEG(ts) ) 00213 ComputeJPEGFragmentInfo(); 00214 CloseFile(); 00215 00216 // Create a new DataEntry to change the DictEntry 00217 // The changed DictEntry will have 00218 // - a correct PixelVR OB or OW) 00219 // - the name to "Pixel Data" 00220 00221 //==>Take it easy! 00222 //==> Just change the VR ! 00223 00224 /* 00225 DataEntry *oldEntry = dynamic_cast<DataEntry *>(entry); 00226 if (oldEntry) 00227 { 00228 VRKey PixelVR; 00229 // 8 bits allocated is a 'O Bytes' , as well as 24 (old ACR-NEMA RGB) 00230 // more than 8 (i.e 12, 16) is a 'O Words' 00231 if ( GetBitsAllocated() == 8 || GetBitsAllocated() == 24 ) 00232 PixelVR = "OB"; 00233 else 00234 PixelVR = "OW"; 00235 00236 // Change only made if usefull 00237 if ( PixelVR != oldEntry->GetVR() ) 00238 { 00239 //DictEntry* newDict = DictEntry::New(GrPixel,NumPixel, 00240 // PixelVR,"1","Pixel Data"); 00241 //DataEntry *newEntry = DataEntry::New(newDict); 00242 //newDict->Delete(); 00243 //newEntry->Copy(entry); 00244 //newEntry->SetBinArea(oldEntry->GetBinArea(),oldEntry->IsSelfArea()); 00245 //oldEntry->SetSelfArea(false); 00246 00247 //RemoveEntry(oldEntry); 00248 //AddEntry(newEntry); 00249 //newEntry->Delete(); 00250 } 00251 } 00252 */ 00253 VRKey PixelVR; 00254 // 8 bits allocated is a 'OB(ytes)' , as well as 24 (old ACR-NEMA RGB) 00255 // more than 8 (i.e 12, 16) is a 'OW(ords)' 00256 if ( GetBitsAllocated() == 8 || GetBitsAllocated() == 24 ) 00257 PixelVR = "OB"; 00258 else 00259 PixelVR = "OW"; 00260 // Change only made if usefull 00261 if ( PixelVR != entry->GetVR() ) 00262 { 00263 entry->SetVR(PixelVR); 00264 } 00265 } 00266 return true; 00267 }
|
|
|
|
Retrieve the number of Bits Allocated (8, 12 -compacted ACR-NEMA files-, 16, 24 -old RGB ACR-NEMA files-,).
Definition at line 1230 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by GDCM_NAME_SPACE::FileHelper::CheckWriteIntegrity(), GDCM_NAME_SPACE::FileHelper::ConvertFixGreyLevels(), DoTheLoadingJob(), GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(), GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEG2000UserData(), and GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEGUserData(). 01231 { 01232 DataEntry *entry = GetDataEntry(0x0028,0x0100); 01233 if( !entry ) 01234 { 01235 gdcmWarningMacro("BitsAllocated (0028,0100) is supposed to be mandatory"); 01236 return 0; 01237 } 01238 return (int)entry->GetValue(0); 01239 }
|
|
Retrieve the number of Bits Stored (actually used) (as opposed to number of Bits Allocated).
Definition at line 1213 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by GDCM_NAME_SPACE::FileHelper::ConvertFixGreyLevels(), and GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(). 01214 { 01215 DataEntry *entry = GetDataEntry(0x0028,0x0101); 01216 if( !entry ) 01217 { 01218 gdcmWarningMacro("BitsStored (0028,0101) is supposed to be mandatory"); 01219 return 0; 01220 } 01221 return (int)entry->GetValue(0); 01222 }
|
|
|
Searches [both] the public [and the shadow dictionary (when they exist)] for the presence of the DictEntry with given group and element. The public dictionary has precedence on the shadow one(s), if any.
Definition at line 473 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DictSet::GetDefaultPubDict(), GDCM_NAME_SPACE::Global::GetDicts(), GDCM_NAME_SPACE::Dict::GetEntry(), and GDCM_NAME_SPACE::RefCounter::Register(). Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(). 00474 { 00475 DictEntry *found = 0; 00478 Dict *pubDict = Global::GetDicts()->GetDefaultPubDict(); 00479 if (!pubDict) 00480 { 00481 gdcmWarningMacro( "We SHOULD have a default dictionary"); 00482 } 00483 else 00484 { 00485 found = pubDict->GetEntry(group, elem); 00486 if( found ) 00487 found->Register(); 00488 } 00489 return found; 00490 }
|
|
retrieves a Dicom Element using (group, element)
Implements GDCM_NAME_SPACE::DocEntrySet. Definition at line 186 of file gdcmElementSet.cxx. References GDCM_NAME_SPACE::ElementSet::TagHT, and GDCM_NAME_SPACE::DictEntry::TranslateToKey(). Referenced by AnonymizeFile(), AnonymizeNoLoad(), GDCM_NAME_SPACE::FileHelper::CopyDataEntry(), GDCM_NAME_SPACE::DicomDir::CreateDicomDir(), DoTheLoadingJob(), GDCM_NAME_SPACE::DicomDir::DoTheLoadingJob(), GetPixelAreaLength(), GetPixelOffset(), GDCM_NAME_SPACE::Document::GetTransferSyntax(), HasLUT(), GDCM_NAME_SPACE::Document::IsDicomV3(), GDCM_NAME_SPACE::Document::IsPapyrus(), IsReadable(), GDCM_NAME_SPACE::Document::LoadEntryBinArea(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::DocEntryArchive::Restore(). 00187 { 00188 TagKey key = DictEntry::TranslateToKey(group, elem); 00189 TagDocEntryHT::iterator it = TagHT.find(key); 00190 00191 if ( it!=TagHT.end() ) 00192 return it->second; 00193 return NULL; 00194 }
|
|
Gets (from Header) a 'non string' element value.
Definition at line 73 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DataEntry::GetBinArea(), and GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(). 00074 { 00075 DataEntry *entry = GetDataEntry(group, elem); 00076 if ( entry ) 00077 return entry->GetBinArea(); 00078 return 0; 00079 }
|
|
Searches within the DocEntrySet for the value length of a given tag..
Definition at line 88 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetDocEntry(), and GDCM_NAME_SPACE::DocEntry::GetLength(). Referenced by GDCM_NAME_SPACE::DicomDir::SetElement(), and Write(). 00089 { 00090 DocEntry *entry = GetDocEntry(group, elem); 00091 if ( entry ) 00092 return entry->GetLength(); 00093 return -1; 00094 }
|
|
Get the "std::string representable" value of the Dicom entry.
Definition at line 51 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::GDCM_NOTLOADED, GDCM_NAME_SPACE::GDCM_UNFOUND, GDCM_NAME_SPACE::GDCM_UNREAD, GDCM_NAME_SPACE::DocEntrySet::GetDocEntry(), GDCM_NAME_SPACE::DataEntry::GetString(), GDCM_NAME_SPACE::DataEntry::IsNotLoaded(), GDCM_NAME_SPACE::DataEntry::IsUnfound(), and GDCM_NAME_SPACE::DataEntry::IsUnread(). Referenced by GDCM_NAME_SPACE::SerieHelper::AddFile(), AnonymizeFile(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::SerieHelper::CreateUniqueSeriesIdentifier(), GDCM_NAME_SPACE::SerieHelper::CreateUserDefinedFileIdentifier(), GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), GDCM_NAME_SPACE::DirList::Explore(), GetImageNumber(), GetImageOrientationPatient(), GetImagePositionPatient(), GetLUTNbits(), GetModality(), GetNumberOfScalarComponents(), GetNumberOfScalarComponentsRaw(), GetPixelSize(), GetPixelType(), GetRescaleSlope(), GetRescaleSlopeIntercept(), GetSpacing(), GDCM_NAME_SPACE::Document::GetTransferSyntaxName(), GetXSpacing(), GetYSpacing(), IsMonochrome(), IsMonochrome1(), IsPaletteColor(), IsReadable(), IsYBRFull(), GDCM_NAME_SPACE::Document::operator<(), and GDCM_NAME_SPACE::DicomDir::SetElement(). 00052 { 00053 DataEntry *entry = dynamic_cast<DataEntry *>(GetDocEntry(group,elem)); 00054 if ( entry ) 00055 { 00056 if( entry->IsNotLoaded() ) 00057 return GDCM_NOTLOADED; 00058 if( entry->IsUnfound() ) 00059 return GDCM_UNFOUND; 00060 if( entry->IsUnread() ) 00061 return GDCM_UNREAD; 00062 return entry->GetString(); 00063 } 00064 return GDCM_UNFOUND; 00065 }
|
|
Accessor to Filename.
Definition at line 78 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::DicomDir::DoTheLoadingJob(), GDCM_NAME_SPACE::SerieHelper::FileNameGreaterThan(), GDCM_NAME_SPACE::SerieHelper::FileNameLessThan(), GDCM_NAME_SPACE::Document::IsParsable(), GDCM_NAME_SPACE::DicomDir::IsReadable(), GDCM_NAME_SPACE::Document::Load(), vtkGdcmReader::LoadImageInMemory(), GDCM_NAME_SPACE::DicomDir::ParseDirectory(), GDCM_NAME_SPACE::DicomDir::SetElement(), vtkGdcmReader::TestFileInformation(), and userSuppliedLessThanFunction2(). 00078 { return Filename; }
|
|
returns the File Type (ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown)
Definition at line 417 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::Document::Filetype. 00418 { 00419 return Filetype; 00420 }
|
|
Get the first entry while visiting *the* 'zero level' DocEntrySet (DocEntries out of any Sequence).
Implements GDCM_NAME_SPACE::DocEntrySet. Definition at line 156 of file gdcmElementSet.cxx. References GDCM_NAME_SPACE::ElementSet::ItTagHT, and GDCM_NAME_SPACE::ElementSet::TagHT. Referenced by GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), GDCM_NAME_SPACE::DicomDir::DoTheLoadingJob(), GDCM_NAME_SPACE::DicomDir::NewMeta(), and GDCM_NAME_SPACE::Validator::SetInput(). 00157 { 00158 ItTagHT = TagHT.begin(); 00159 if (ItTagHT != TagHT.end()) 00160 return ItTagHT->second; 00161 return NULL; 00162 }
|
|
Accessor to File::GrPixel.
Definition at line 168 of file gdcmFile.h. 00168 { return GrPixel; }
|
|
Retrieve the high bit position.
Definition at line 1247 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(). 01248 { 01249 DataEntry *entry = GetDataEntry(0x0028,0x0102); 01250 if( !entry ) 01251 { 01252 gdcmWarningMacro("HighBitPosition (0028,0102) is supposed to be mandatory"); 01253 return 0; 01254 } 01255 return (int)entry->GetValue(0); 01256 }
|
|
gets the info from 0020,0013 : Image Number else 0.
Definition at line 338 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, and GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). Referenced by GDCM_NAME_SPACE::SerieHelper::ImageNumberGreaterThan(), and GDCM_NAME_SPACE::SerieHelper::ImageNumberLessThan(). 00339 { 00340 //0020 0013 : Image Number 00341 std::string strImNumber = GetEntryString(0x0020,0x0013); 00342 if ( strImNumber != GDCM_UNFOUND ) 00343 { 00344 return atoi( strImNumber.c_str() ); 00345 } 00346 return 0; //Hopeless 00347 }
|
|
gets the info from 0020,0037 : Image Orientation Patient or from 0020 0035 : Image Orientation (RET) (needed to organize DICOM files based on their x,y,z position)
Definition at line 1056 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, and GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). Referenced by GDCM_NAME_SPACE::Orientation::GetOrientation(), GDCM_NAME_SPACE::Orientation::GetOrientationType(), GetXCosineOnX(), GetXCosineOnY(), GetXCosineOnZ(), GetYCosineOnX(), GetYCosineOnY(), and GetYCosineOnZ(). 01057 { 01058 std::string strImOriPat; 01059 //iop is supposed to be float[6] 01060 iop[0] = iop[4] = 1.; 01061 iop[1] = iop[2] = iop[3] = iop[5] = 0.; 01062 01063 // 0020 0037 DS REL Image Orientation (Patient) 01064 if ( (strImOriPat = GetEntryString(0x0020,0x0037)) != GDCM_UNFOUND ) 01065 { 01066 if ( sscanf( strImOriPat.c_str(), "%f \\ %f \\%f \\%f \\%f \\%f ", 01067 &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 ) 01068 { 01069 gdcmWarningMacro( "Wrong Image Orientation Patient (0020,0037)." 01070 << " Less than 6 values were found." ); 01071 return false; 01072 } 01073 return true; 01074 } 01075 //For ACR-NEMA 01076 // 0020 0035 DS REL Image Orientation (RET) 01077 else if ( (strImOriPat = GetEntryString(0x0020,0x0035)) != GDCM_UNFOUND ) 01078 { 01079 if ( sscanf( strImOriPat.c_str(), "%f \\ %f \\%f \\%f \\%f \\%f ", 01080 &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 ) 01081 { 01082 gdcmWarningMacro( "wrong Image Orientation Patient (0020,0035). " 01083 << "Less than 6 values were found." ); 01084 return false; 01085 } 01086 return true; 01087 } 01088 return false; 01089 }
|
|
gets the info from 0020,0032 : Image Position Patient or from 0020 0030 : Image Position (RET)
Definition at line 1172 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, and GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). 01173 { 01174 std::string strImPosiPat; 01175 //ipp is supposed to be float[3] 01176 ipp[0] = ipp[1] = ipp[2] = 0.; 01177 01178 // 0020 0032 DS REL Image Position (Patient) 01179 strImPosiPat = GetEntryString(0x0020,0x0032); 01180 if ( strImPosiPat != GDCM_UNFOUND ) 01181 { 01182 if ( sscanf( strImPosiPat.c_str(), "%f \\ %f \\%f ", 01183 &ipp[0], &ipp[1], &ipp[2]) != 3 ) 01184 { 01185 gdcmWarningMacro( "Wrong Image Position Patient (0020,0032)." 01186 << " Less than 3 values were found." ); 01187 return false; 01188 } 01189 return true; 01190 } 01191 //For ACR-NEMA 01192 // 0020 0030 DS REL Image Position (RET) 01193 else if ( (strImPosiPat = GetEntryString(0x0020,0x0030)) != GDCM_UNFOUND ) 01194 { 01195 if ( sscanf( strImPosiPat.c_str(), "%f \\ %f \\%f ", 01196 &ipp[0], &ipp[1], &ipp[2]) != 3 ) 01197 { 01198 gdcmWarningMacro( "wrong Image Position Patient (0020,0030). " 01199 << "Less than 3 values were found." ); 01200 return false; 01201 } 01202 return true; 01203 } 01204 return false; 01205 }
|
|
Returns the JPEG Fragments info.
Definition at line 178 of file gdcmFile.h. 00178 { return JPEGInfo; }
|
|
gets the info from 0028,1101 : Lookup Table Desc-Red else 0
Definition at line 1538 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), and GDCM_NAME_SPACE::Util::Tokenize(). 01539 { 01540 std::vector<std::string> tokens; 01541 int lutNbits; 01542 01543 //Just hope Lookup Table Desc-Red = Lookup Table Desc-Red 01544 // = Lookup Table Desc-Blue 01545 // Consistency already checked in GetLUTLength 01546 std::string lutDescription = GetEntryString(0x0028,0x1101); 01547 if ( lutDescription == GDCM_UNFOUND ) 01548 { 01549 return 0; 01550 } 01551 01552 tokens.clear(); // clean any previous value 01553 Util::Tokenize ( lutDescription, tokens, "\\" ); 01554 //LutLength=atoi(tokens[0].c_str()); 01555 //LutDepth=atoi(tokens[1].c_str()); 01556 01557 lutNbits = atoi( tokens[2].c_str() ); 01558 tokens.clear(); 01559 01560 return lutNbits; 01561 }
|
|
gets the info from 0008,0060 : Modality
Definition at line 353 of file gdcmFile.cxx. References GDCM_NAME_SPACE::AS, GDCM_NAME_SPACE::AU, GDCM_NAME_SPACE::BI, GDCM_NAME_SPACE::CF, GDCM_NAME_SPACE::CP, GDCM_NAME_SPACE::CR, GDCM_NAME_SPACE::CS, GDCM_NAME_SPACE::CT, GDCM_NAME_SPACE::DD, GDCM_NAME_SPACE::DF, GDCM_NAME_SPACE::DG, GDCM_NAME_SPACE::DM, GDCM_NAME_SPACE::DS, GDCM_NAME_SPACE::DX, GDCM_NAME_SPACE::ECG, GDCM_NAME_SPACE::EPS, GDCM_NAME_SPACE::FA, GDCM_NAME_SPACE::FS, GDCM_NAME_SPACE::GDCM_UNFOUND, GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GDCM_NAME_SPACE::HC, GDCM_NAME_SPACE::HD, GDCM_NAME_SPACE::LP, GDCM_NAME_SPACE::LS, GDCM_NAME_SPACE::MA, GDCM_NAME_SPACE::MR, GDCM_NAME_SPACE::NM, GDCM_NAME_SPACE::OT, GDCM_NAME_SPACE::PT, GDCM_NAME_SPACE::RF, GDCM_NAME_SPACE::RG, GDCM_NAME_SPACE::RTDOSE, GDCM_NAME_SPACE::RTIMAGE, GDCM_NAME_SPACE::RTPLAN, GDCM_NAME_SPACE::RTSTRUCT, GDCM_NAME_SPACE::SM, GDCM_NAME_SPACE::ST, GDCM_NAME_SPACE::TG, GDCM_NAME_SPACE::Unknow, GDCM_NAME_SPACE::US, GDCM_NAME_SPACE::VF, GDCM_NAME_SPACE::XA, and GDCM_NAME_SPACE::XC. 00354 { 00355 // 0008 0060 : Modality 00356 std::string strModality = GetEntryString(0x0008,0x0060); 00357 if ( strModality != GDCM_UNFOUND ) 00358 { 00359 if ( strModality.find("AU") < strModality.length()) return AU; 00360 else if ( strModality.find("AS") < strModality.length()) return AS; 00361 else if ( strModality.find("BI") < strModality.length()) return BI; 00362 else if ( strModality.find("CF") < strModality.length()) return CF; 00363 else if ( strModality.find("CP") < strModality.length()) return CP; 00364 else if ( strModality.find("CR") < strModality.length()) return CR; 00365 else if ( strModality.find("CT") < strModality.length()) return CT; 00366 else if ( strModality.find("CS") < strModality.length()) return CS; 00367 else if ( strModality.find("DD") < strModality.length()) return DD; 00368 else if ( strModality.find("DF") < strModality.length()) return DF; 00369 else if ( strModality.find("DG") < strModality.length()) return DG; 00370 else if ( strModality.find("DM") < strModality.length()) return DM; 00371 else if ( strModality.find("DS") < strModality.length()) return DS; 00372 else if ( strModality.find("DX") < strModality.length()) return DX; 00373 else if ( strModality.find("ECG") < strModality.length()) return ECG; 00374 else if ( strModality.find("EPS") < strModality.length()) return EPS; 00375 else if ( strModality.find("FA") < strModality.length()) return FA; 00376 else if ( strModality.find("FS") < strModality.length()) return FS; 00377 else if ( strModality.find("HC") < strModality.length()) return HC; 00378 else if ( strModality.find("HD") < strModality.length()) return HD; 00379 else if ( strModality.find("LP") < strModality.length()) return LP; 00380 else if ( strModality.find("LS") < strModality.length()) return LS; 00381 else if ( strModality.find("MA") < strModality.length()) return MA; 00382 else if ( strModality.find("MR") < strModality.length()) return MR; 00383 else if ( strModality.find("NM") < strModality.length()) return NM; 00384 else if ( strModality.find("OT") < strModality.length()) return OT; 00385 else if ( strModality.find("PT") < strModality.length()) return PT; 00386 else if ( strModality.find("RF") < strModality.length()) return RF; 00387 else if ( strModality.find("RG") < strModality.length()) return RG; 00388 else if ( strModality.find("RTDOSE") 00389 < strModality.length()) return RTDOSE; 00390 else if ( strModality.find("RTIMAGE") 00391 < strModality.length()) return RTIMAGE; 00392 else if ( strModality.find("RTPLAN") 00393 < strModality.length()) return RTPLAN; 00394 else if ( strModality.find("RTSTRUCT") 00395 < strModality.length()) return RTSTRUCT; 00396 else if ( strModality.find("SM") < strModality.length()) return SM; 00397 else if ( strModality.find("ST") < strModality.length()) return ST; 00398 else if ( strModality.find("TG") < strModality.length()) return TG; 00399 else if ( strModality.find("US") < strModality.length()) return US; 00400 else if ( strModality.find("VF") < strModality.length()) return VF; 00401 else if ( strModality.find("XA") < strModality.length()) return XA; 00402 else if ( strModality.find("XC") < strModality.length()) return XC; 00403 00404 else 00405 { 00408 return Unknow; 00409 } 00410 } 00411 return Unknow; 00412 }
|
|
Get the next entry while visiting *the* 'zero level' DocEntrySet (DocEntries out of any Sequence).
Implements GDCM_NAME_SPACE::DocEntrySet. Definition at line 170 of file gdcmElementSet.cxx. References gdcmAssertMacro, GDCM_NAME_SPACE::ElementSet::ItTagHT, and GDCM_NAME_SPACE::ElementSet::TagHT. Referenced by GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), and GDCM_NAME_SPACE::Validator::SetInput(). 00171 { 00172 gdcmAssertMacro (ItTagHT != TagHT.end()); 00173 00174 ++ItTagHT; 00175 if (ItTagHT != TagHT.end()) 00176 return ItTagHT->second; 00177 return NULL; 00178 }
|
|
This function is intended to user who doesn't want to have to manage a LUT and expects to get an RBG Pixel image (or a monochrome one, if no LUT found ...).
Definition at line 1682 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Util::DicomStringEqual(), GDCM_NAME_SPACE::GDCM_UNFOUND, GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GetSamplesPerPixel(), and HasLUT(). Referenced by IsMonochrome(), vtkGdcmReader::LoadImageInMemory(), GDCM_NAME_SPACE::FileHelper::SetWriteToRaw(), GDCM_NAME_SPACE::FileHelper::SetWriteToRGB(), and vtkGdcmReader::TestFileInformation(). 01683 { 01684 if ( GetSamplesPerPixel() == 3 ) 01685 { 01686 return 3; 01687 } 01688 01689 // 0028 0100 US IMG Bits Allocated 01690 // (in order no to be messed up by old RGB images) 01691 if ( GetEntryString(0x0028,0x0100) == "24" ) 01692 { 01693 return 3; 01694 } 01695 01696 std::string strPhotometricInterpretation = GetEntryString(0x0028,0x0004); 01697 01698 if ( ( strPhotometricInterpretation == "PALETTE COLOR ") ) 01699 { 01700 if ( HasLUT() )// PALETTE COLOR is NOT enough 01701 { 01702 return 3; 01703 } 01704 else 01705 { 01706 return 1; 01707 } 01708 } 01709 01710 // beware of trailing space at end of string 01711 // DICOM tags are never of odd length 01712 if ( strPhotometricInterpretation == GDCM_UNFOUND || 01713 Util::DicomStringEqual(strPhotometricInterpretation, "MONOCHROME1") || 01714 Util::DicomStringEqual(strPhotometricInterpretation, "MONOCHROME2") ) 01715 { 01716 return 1; 01717 } 01718 else 01719 { 01720 // we assume that *all* kinds of YBR are dealt with 01721 return 3; 01722 } 01723 }
|
|
This function is intended to user that DOESN'T want to get RGB pixels image when it's stored as a PALETTE COLOR image
Definition at line 1732 of file gdcmFile.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), and GetSamplesPerPixel(). Referenced by vtkGdcmReader::GetFileInformation(), vtkGdcmReader::LoadImageInMemory(), and vtkGdcmReader::TestFileInformation(). 01733 { 01734 // 0028 0100 US IMG Bits Allocated 01735 // (in order no to be messed up by old RGB images) 01736 if ( File::GetEntryString(0x0028,0x0100) == "24" ) 01737 { 01738 return 3; 01739 } 01740 01741 // we assume that *all* kinds of YBR are dealt with 01742 return GetSamplesPerPixel(); 01743 }
|
|
Accessor to File::NumPixel.
Definition at line 170 of file gdcmFile.h. 00170 { return NumPixel; }
|
|
Recover the pixel area length (in Bytes).
Definition at line 1772 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::ElementSet::GetDocEntry(), GDCM_NAME_SPACE::DocEntry::GetLength(), GrPixel, and NumPixel. 01773 { 01774 DocEntry *pxlElement = GetDocEntry(GrPixel, NumPixel); 01775 if ( pxlElement ) 01776 { 01777 return pxlElement->GetLength(); 01778 } 01779 else 01780 { 01781 gdcmWarningMacro( "Big trouble : Pixel Element (" 01782 << std::hex << GrPixel<<","<< NumPixel<< ") NOT found" ); 01783 return 0; 01784 } 01785 }
|
|
Recover the offset (from the beginning of the file) of *image* pixels (not *icone image* pixels, if any !).
Definition at line 1750 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::ElementSet::GetDocEntry(), GDCM_NAME_SPACE::DocEntry::GetOffset(), GrPixel, and NumPixel. 01751 { 01752 DocEntry *pxlElement = GetDocEntry(GrPixel, NumPixel); 01753 if ( pxlElement ) 01754 { 01755 return pxlElement->GetOffset(); 01756 } 01757 else 01758 { 01759 gdcmWarningMacro( "Big trouble : Pixel Element (" 01760 << std::hex << GrPixel<<","<< NumPixel<< ") NOT found" ); 01761 return 0; 01762 } 01763 }
|
|
Return the size (in bytes) of a single pixel of data.
Definition at line 1296 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), and GetPixelType(). Referenced by vtkGdcmReader::GetFileInformation(), vtkGdcmReader::LoadImageInMemory(), and vtkGdcmReader::TestFileInformation(). 01297 { 01298 // 0028 0100 US IMG Bits Allocated 01299 // (in order no to be messed up by old ACR-NEMA RGB images) 01300 assert( !(GetEntryString(0x0028,0x0100) == "24") ); 01301 01302 std::string pixelType = GetPixelType(); 01303 if ( pixelType == "8U" || pixelType == "8S" ) 01304 { 01305 return 1; 01306 } 01307 if ( pixelType == "16U" || pixelType == "16S") 01308 { 01309 return 2; 01310 } 01311 if ( pixelType == "32U" || pixelType == "32S") 01312 { 01313 return 4; 01314 } 01315 if ( pixelType == "FD" ) 01316 { 01317 return 8; 01318 } 01319 gdcmWarningMacro( "Unknown pixel type: " << pixelType); 01320 return 0; 01321 }
|
|
Build the Pixel Type of the image. Possible values are:
Definition at line 1338 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), and IsSignedPixelData(). Referenced by vtkGdcmReader::GetFileInformation(), and GetPixelSize(). 01339 { 01340 std::string bitsAlloc = GetEntryString(0x0028, 0x0100); // Bits Allocated 01341 if ( bitsAlloc == GDCM_UNFOUND ) 01342 { 01343 gdcmWarningMacro( "Bits Allocated (0028,0100) supposed to be mandatory"); 01344 bitsAlloc = "16"; // default and arbitrary value, not to polute the output 01345 } 01346 01347 else if ( bitsAlloc == "64" ) 01348 { 01349 return "FD"; 01350 } 01351 // useless since we have to bypass a bug ( >8 && < 16) 01352 else if ( bitsAlloc == "12" ) 01353 { 01354 // It will be unpacked 01355 bitsAlloc = "16"; 01356 } 01357 01358 else if ( bitsAlloc == "24" ) 01359 { 01360 // (in order no to be messed up by old RGB images) 01361 bitsAlloc = "8"; 01362 } 01363 01364 int i= atoi(bitsAlloc.c_str()); // fix a bug in some headers 01365 if ( i > 8 && i < 16 ) 01366 { 01367 bitsAlloc = "16"; 01368 } 01369 01370 std::string sign; 01371 if( IsSignedPixelData() ) 01372 { 01373 sign = "S"; 01374 } 01375 else 01376 { 01377 sign = "U"; 01378 } 01379 return bitsAlloc + sign; 01380 }
|
|
Retrieve the Planar Configuration for RGB images (0 : RGB Pixels , 1 : R Plane + G Plane + B Plane).
Definition at line 1281 of file gdcmFile.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). 01282 { 01283 DataEntry *entry = GetDataEntry(0x0028,0x0006); 01284 if( !entry ) 01285 { 01286 return 0; 01287 } 01288 return (int)entry->GetValue(0); 01289 }
|
|
Gets the print level for the Dicom Entries.
Definition at line 50 of file gdcmBase.h. 00050 { return PrintLevel; }
|
|
Get the public dictionary used.
Definition at line 314 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::Document::RefPubDict. 00315 { 00316 return RefPubDict; 00317 }
|
|
Get the reference counting.
Definition at line 59 of file gdcmRefCounter.h. 00060 { 00061 return RefCount; 00062 }
|
|
gets the info from 0028,1052 : Rescale Intercept
Definition at line 1636 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). 01637 { 01638 // 0028 1052 DS IMG Rescale Intercept 01639 DataEntry *entry = GetDataEntry(0x0028, 0x1052); 01640 if( !entry ) 01641 { 01642 gdcmWarningMacro( "Missing Rescale Intercept (0028,1052)"); 01643 return 0.0f; 01644 } 01645 return (float)entry->GetValue(0); 01646 01647 }
|
|
gets the info from 0028,1053 : Rescale Slope
Definition at line 1653 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), and GetRescaleSlopeIntercept(). 01654 { 01655 double resInter = 0.; 01656 double resSlope = 1.; 01657 if ( GetRescaleSlopeIntercept(resSlope, resInter) ) 01658 { 01659 return resSlope; 01660 } 01661 //0028 1053 DS IMG Rescale Slope 01662 std::string strRescSlope = GetEntryString(0x0028,0x1053); 01663 if ( strRescSlope != GDCM_UNFOUND ) 01664 { 01665 if ( sscanf( strRescSlope.c_str(), "%lf ", &resSlope) != 1 ) 01666 { 01667 // bug in the element 0x0028,0x1053 01668 gdcmWarningMacro( "Rescale Slope (0028,1053) is empty."); 01669 } 01670 } 01671 01672 return resSlope; 01673 }
|
|
Definition at line 1565 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, GDCM_NAME_SPACE::SQItem::GetDocEntry(), GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GDCM_NAME_SPACE::SeqEntry::GetFirstSQItem(), GDCM_NAME_SPACE::SeqEntry::GetNumberOfSQItems(), GDCM_NAME_SPACE::DocEntrySet::GetSeqEntry(), GDCM_NAME_SPACE::DataEntry::GetString(), and GDCM_NAME_SPACE::Global::GetTS(). Referenced by GetRescaleSlope(). 01566 { 01567 slope = 1.0; 01568 intercept = 0.0; 01569 TS *ts = Global::GetTS(); 01570 std::string sopclassuid_used; 01571 // D 0002|0002 [UI] [Media Storage SOP Class UID] 01572 const std::string &mediastoragesopclassuid_str = GetEntryString(0x0002,0x0002); 01573 const std::string &mediastoragesopclassuid = ts->GetValue(mediastoragesopclassuid_str); 01574 //D 0008|0016 [UI] [SOP Class UID] 01575 const std::string &sopclassuid_str = GetEntryString(0x0008,0x0016); 01576 const std::string &sopclassuid = ts->GetValue(sopclassuid_str); 01577 if ( mediastoragesopclassuid == GDCM_UNFOUND && sopclassuid == GDCM_UNFOUND ) 01578 { 01579 return false; 01580 } 01581 else 01582 { 01583 if( mediastoragesopclassuid == sopclassuid ) 01584 { 01585 sopclassuid_used = mediastoragesopclassuid; 01586 } 01587 else 01588 { 01589 gdcmWarningMacro( "Inconsistant SOP Class UID: " 01590 << mediastoragesopclassuid << " and " << sopclassuid ); 01591 return false; 01592 } 01593 } 01594 // ok we have now the correc SOP Class UID 01595 if( sopclassuid_used == "Enhanced MR Image Storage" ) 01596 { 01597 SeqEntry *PerframeFunctionalGroupsSequence = GetSeqEntry(0x5200,0x9230); 01598 unsigned int n = PerframeFunctionalGroupsSequence->GetNumberOfSQItems(); 01599 if( !n ) return false; 01600 SQItem *item1 = PerframeFunctionalGroupsSequence->GetFirstSQItem(); 01601 DocEntry *p = item1->GetDocEntry(0x0028,0x9145); 01602 if( !p ) return false; 01603 SeqEntry *seq = dynamic_cast<SeqEntry*>(p); 01604 unsigned int n1 = seq->GetNumberOfSQItems(); 01605 if( !n1 ) return false; 01606 SQItem *item2 = seq->GetFirstSQItem(); 01607 // D 0028|1052 [DS] [Rescale Intercept] [0 ] 01608 DocEntry *p2 = item2->GetDocEntry(0x0028,0x1052); 01609 if( !p2 ) return false; 01610 DataEntry *entry = dynamic_cast<DataEntry *>(p2); 01611 std::string intercept_str = entry->GetString(); 01612 if ( sscanf( intercept_str.c_str(), "%lf", &intercept) != 1 ) 01613 { 01614 intercept = 0.; 01615 return false; 01616 } 01617 // D 0028|1053 [DS] [Rescale Slope] [5.65470085470085] 01618 DocEntry *p3 = item2->GetDocEntry(0x0028,0x1053); 01619 if( !p3 ) return false; 01620 DataEntry *entry2 = dynamic_cast<DataEntry *>(p3); 01621 std::string slope_str = entry2->GetString(); 01622 if ( sscanf( slope_str.c_str(), "%lf", &slope) != 1 ) 01623 { 01624 slope = 1.; 01625 return false; 01626 } 01627 return true; 01628 } 01629 return false; 01630 }
|
|
returns the RLE info
Definition at line 176 of file gdcmFile.h. 00176 { return RLEInfo; }
|
|
Retrieve the number of Samples Per Pixel (1 : gray level, 3 : RGB/YBR -1 or 3 Planes-).
Definition at line 1264 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by GDCM_NAME_SPACE::FileHelper::CheckWriteIntegrity(), GetNumberOfScalarComponents(), GetNumberOfScalarComponentsRaw(), GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(), GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEG2000UserData(), and GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEGUserData(). 01265 { 01266 DataEntry *entry = GetDataEntry(0x0028,0x0002); 01267 if( !entry ) 01268 { 01269 gdcmWarningMacro("SamplesPerPixel (0028,0002) is supposed to be mandatory"); 01270 return 1; // Well, it's supposed to be mandatory ... 01271 // but sometimes it's missing : *we* assume Gray pixels 01272 } 01273 return (int)entry->GetValue(0); 01274 }
|
|
Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type SeqEntry.
Definition at line 119 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetDocEntry(). Referenced by GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), GetRescaleSlopeIntercept(), and GetSpacing(). 00120 { 00121 DocEntry *currentEntry = GetDocEntry(group, elem); 00122 if ( !currentEntry ) 00123 return NULL; 00124 00125 return dynamic_cast<SeqEntry*>(currentEntry); 00126 }
|
|
Get the shadow dictionary used.
Definition at line 322 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::Document::RefShaDict. 00323 { 00324 return RefShaDict; 00325 }
|
|
Definition at line 475 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, GDCM_NAME_SPACE::SQItem::GetDocEntry(), GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GDCM_NAME_SPACE::SeqEntry::GetFirstSQItem(), GDCM_NAME_SPACE::SeqEntry::GetNumberOfSQItems(), GDCM_NAME_SPACE::DocEntrySet::GetSeqEntry(), GDCM_NAME_SPACE::DataEntry::GetString(), and GDCM_NAME_SPACE::Global::GetTS(). Referenced by GetXSpacing(), GetYSpacing(), and GetZSpacing(). 00476 { 00477 xspacing = yspacing = zspacing = 1.0; 00478 TS *ts = Global::GetTS(); 00479 std::string sopclassuid_used; 00480 // D 0002|0002 [UI] [Media Storage SOP Class UID] 00481 00482 //const std::string &mediastoragesopclassuid_str = GetEntryValue(0x0002,0x0002); 00483 const std::string &mediastoragesopclassuid_str = GetEntryString(0x0002,0x0002); 00484 const std::string &mediastoragesopclassuid = ts->GetValue(mediastoragesopclassuid_str); 00485 //D 0008|0016 [UI] [SOP Class UID] 00486 const std::string &sopclassuid_str = GetEntryString(0x0008,0x0016); 00487 const std::string &sopclassuid = ts->GetValue(sopclassuid_str); 00488 if ( mediastoragesopclassuid == GDCM_UNFOUND && sopclassuid == GDCM_UNFOUND ) 00489 { 00490 return false; 00491 } 00492 else 00493 { 00494 if( mediastoragesopclassuid == sopclassuid ) 00495 { 00496 sopclassuid_used = mediastoragesopclassuid; 00497 } 00498 else 00499 { 00500 gdcmWarningMacro( "Inconsistant SOP Class UID: " 00501 << mediastoragesopclassuid << " and " << sopclassuid ); 00502 return false; 00503 } 00504 } 00505 // ok we have now the correc SOP Class UID 00506 if( sopclassuid_used == "Enhanced MR Image Storage" ) 00507 { 00508 SeqEntry *PerframeFunctionalGroupsSequence = GetSeqEntry(0x5200,0x9230); 00509 unsigned int n = PerframeFunctionalGroupsSequence->GetNumberOfSQItems(); 00510 if( !n ) return false; 00511 SQItem *item1 = PerframeFunctionalGroupsSequence->GetFirstSQItem(); 00512 DocEntry *p = item1->GetDocEntry(0x0028,0x9110); 00513 if( !p ) return false; 00514 SeqEntry *seq = dynamic_cast<SeqEntry*>(p); 00515 unsigned int n1 = seq->GetNumberOfSQItems(); 00516 if( !n1 ) return false; 00517 SQItem *item2 = seq->GetFirstSQItem(); 00518 // D 0028|0030 [DS] [Pixel Spacing] [0.83333331346511\0.83333331346511 ] 00519 DocEntry *p2 = item2->GetDocEntry(0x0028,0x0030); 00520 if( !p2 ) return false; 00521 DataEntry *entry = dynamic_cast<DataEntry *>(p2); 00522 std::string spacing = entry->GetString(); 00523 if ( sscanf( spacing.c_str(), "%f\\%f", &yspacing, &xspacing) != 2 ) 00524 { 00525 xspacing = yspacing = 1.; 00526 return false; 00527 } 00528 // D 0018|0050 [DS] [Slice Thickness] [1 ] 00529 DocEntry *p3 = item2->GetDocEntry(0x0018,0x0050); 00530 if( !p3 ) return false; 00531 DataEntry *entry2 = dynamic_cast<DataEntry *>(p3); 00532 std::string thickness = entry2->GetString(); 00533 if ( sscanf( thickness.c_str(), "%f", &zspacing) != 1 ) 00534 { 00535 zspacing = 1.; 00536 return false; 00537 } 00538 return true; 00539 } 00540 return false; 00541 }
|
|
'Swap code' accessor (see SwapCode )
Definition at line 74 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(). 00074 { return SwapCode; }
|
|
Accessor to the Transfer Syntax (when present) of the current document (it internally handles reading the value from disk when only parsing occured).
Definition at line 429 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::GDCM_UNKNOWN, gdcmWarningMacro, and GDCM_NAME_SPACE::ElementSet::GetDocEntry(). Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), DoTheLoadingJob(), and GDCM_NAME_SPACE::Document::HandleOutOfGroup0002(). 00430 { 00431 DocEntry *entry = GetDocEntry(0x0002, 0x0010); 00432 if ( !entry ) 00433 { 00434 return GDCM_UNKNOWN; 00435 } 00436 00437 // The entry might be present but not loaded (parsing and loading 00438 // happen at different stages): try loading and proceed with check... 00439 00440 // Well ... 00441 // (parsing and loading happen at the very same stage!) 00442 //LoadDocEntrySafe(entry); //JPRx 00443 if (DataEntry *dataEntry = dynamic_cast<DataEntry *>(entry) ) 00444 { 00445 std::string transfer = dataEntry->GetString(); 00446 // The actual transfer (as read from disk) might be padded. We 00447 // first need to remove the potential padding. We can make the 00448 // weak assumption that padding was not executed with digits... 00449 if ( transfer.length() == 0 ) 00450 { 00451 // for brain damaged headers 00452 gdcmWarningMacro( "Transfer Syntax has length = 0."); 00453 return GDCM_UNKNOWN; 00454 } 00455 while ( !isdigit((unsigned char)transfer[transfer.length()-1]) ) 00456 { 00457 transfer.erase(transfer.length()-1, 1); 00458 if ( transfer.length() == 0 ) 00459 { 00460 // for brain damaged headers 00461 gdcmWarningMacro( "Transfer Syntax contains no valid character."); 00462 return GDCM_UNKNOWN; 00463 } 00464 } 00465 return transfer; 00466 } 00467 return GDCM_UNKNOWN; 00468 }
|
|
Accesses the info from 0002,0010 : Transfer Syntax and TS.
Definition at line 474 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::GDCM_NOTLOADED, GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmDebugMacro, gdcmErrorMacro, GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), and GDCM_NAME_SPACE::Global::GetTS(). Referenced by GDCM_NAME_SPACE::Document::HandleOutOfGroup0002(). 00475 { 00476 // use the TS (TS : Transfer Syntax) 00477 std::string transferSyntax = GetEntryString(0x0002,0x0010); 00478 00479 if ( (transferSyntax.find(GDCM_NOTLOADED) < transferSyntax.length()) ) 00480 { 00481 gdcmErrorMacro( "Transfer Syntax not loaded. " << std::endl 00482 << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE" ); 00483 return "Uncompressed ACR-NEMA"; 00484 } 00485 if ( transferSyntax == GDCM_UNFOUND ) 00486 { 00487 gdcmDebugMacro( "Unfound Transfer Syntax (0002,0010)"); 00488 return "Uncompressed ACR-NEMA"; 00489 } 00490 00491 // we do it only when we need it 00492 const TSKey &tsName = Global::GetTS()->GetValue( transferSyntax ); 00493 00494 // Global::GetTS() is a global static you shall never try to delete it! 00495 return tsName; 00496 }
|
|
Retrieve the -unnormalized- number of 'times' of '4D image'. User has to tell gdcm the location of this '4th Dimension component' using SetFourthDimensionLocation() method before.
Definition at line 551 of file gdcmFile.cxx. References FourthDimensionLocation, gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::TagKey::GetElement(), GDCM_NAME_SPACE::TagKey::GetGroup(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by GDCM_NAME_SPACE::FileHelper::CheckWriteIntegrity(), and GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(). 00552 { 00553 if (FourthDimensionLocation == TagKey(0,0) )// 4D location is not set : not a 4D object 00554 return 1; 00555 00556 DataEntry *entry = GetDataEntry(FourthDimensionLocation.GetGroup(), 00557 FourthDimensionLocation.GetElement() ); 00558 if( !entry ) 00559 { 00560 gdcmWarningMacro( " FourthDimensionLocation not found at : " << 00561 std::hex << FourthDimensionLocation.GetGroup() 00562 << "|" << FourthDimensionLocation.GetElement()); 00563 return 1; 00564 } 00565 else 00566 { 00567 return (int)entry->GetValue(0); 00568 } 00569 }
|
|
gets the cosine of image X axis, against patient X axis (Sorry, but Python needs it :-( )
Definition at line 1096 of file gdcmFile.cxx. References GetImageOrientationPatient(). 01097 { 01098 float iop[6]; 01099 GetImageOrientationPatient( iop ); 01100 return(iop[0]); 01101 }
|
|
gets the cosine of image X axis, against patient Y axis (Sorry, but Python needs it :-( )
Definition at line 1108 of file gdcmFile.cxx. References GetImageOrientationPatient(). 01109 { 01110 float iop[6]; 01111 GetImageOrientationPatient( iop ); 01112 return(iop[1]); 01113 }
|
|
gets the cosine of image X axis, against patient Z axis (Sorry, but Python needs it :-( )
Definition at line 1120 of file gdcmFile.cxx. References GetImageOrientationPatient(). 01121 { 01122 float iop[6]; 01123 GetImageOrientationPatient( iop ); 01124 return(iop[2]); 01125 }
|
|
gets the info from 0020,0032 : Image Position Patient else from 0020,0030 : Image Position (RET) else 0.
Definition at line 915 of file gdcmFile.cxx. References gdcmErrorMacro, gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::DataEntry::GetValueCount(), and GDCM_NAME_SPACE::DataEntry::IsValueCountValid(). 00916 { 00917 DataEntry *entry = GetDataEntry(0x0020,0x0032); 00918 if( !entry ) 00919 { 00920 gdcmWarningMacro( "Unfound Image Position Patient (0020,0032)"); 00921 entry = GetDataEntry(0x0020,0x0030); 00922 if( !entry ) 00923 { 00924 gdcmWarningMacro( "Unfound Image Position (RET) (0020,0030)"); 00925 return 0.0f; 00926 } 00927 } 00928 00929 if( entry->GetValueCount() == 3 ) 00930 { 00931 if (!entry->IsValueCountValid() ) 00932 { 00933 gdcmErrorMacro( "Invalid Value Count" ); 00934 } 00935 return (float)entry->GetValue(0); 00936 } 00937 return 0.0f; 00938 }
|
|
Retrieve the number of columns of image.
Definition at line 419 of file gdcmFile.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by GDCM_NAME_SPACE::FileHelper::CheckWriteIntegrity(), vtkGdcmReader::GetFileInformation(), GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(), vtkGdcmReader::LoadImageInMemory(), GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEG2000UserData(), GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEGUserData(), and vtkGdcmReader::TestFileInformation(). 00420 { 00421 DataEntry *entry = GetDataEntry(0x0028,0x0011); 00422 if( entry ) 00423 return (int)entry->GetValue(0); 00424 return 0; 00425 }
|
|
gets the info from 0018,1164 : ImagerPixelSpacing then 0028,0030 : Pixel Spacing else 1.0
Definition at line 579 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Util::DicomStringEqual(), gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GetSpacing(), GDCM_NAME_SPACE::DataEntry::GetValue(), and GDCM_NAME_SPACE::DataEntry::GetValueCount(). Referenced by vtkGdcmReader::GetFileInformation(). 00580 { 00581 float xspacing = 1.0; 00582 float yspacing = 1.0; 00583 float zspacing = 1.0; 00584 00585 uint32_t nbValue; 00586 DataEntry *entry; 00587 bool ok = false; 00588 if ( GetSpacing(xspacing,yspacing,zspacing) ) 00589 { 00590 return xspacing; 00591 } 00592 // else fallback 00593 00594 /* 00595 From:David Clunie - view profile 00596 Date:Wed, May 24 2006 1:12 pm 00597 Email:David Clunie <dclu...@dclunie.com> 00598 Groups:comp.protocols.dicom 00599 00600 The short answer is that: 00601 00602 - (0018,1164) describes a spacing equivalent to that which 00603 would be measured off a film in projection radiography 00604 00605 - (0018,7022) does not describe the image pixels themselves, 00606 since detector elements may have been binned to produce 00607 pixels 00608 00609 - (0018,7020) may be different from (0018,7022) since there 00610 may be non-sensitive material separating individual 00611 detectors (i.e. the size is smaller than the spacing 00612 between centers) 00613 00614 Only (0018,1164) is relevant when measuring things; the 00615 detector-specific attributes are there to describe the 00616 acquisition. 00617 00618 David 00619 00620 PS. For ultrasound you need to use Region Calibration. 00621 */ 00622 00623 /* 00624 It *SHOULD* first find the IOD and then deduce which tags to read 00625 Eg: Cross section this is in Pixel Spacing (0028,0030) 00626 CR is in Imager Pixel Spacing (0018,1164) 00627 US is in Pixel Aspect Ratio (0028,0034) 00628 RT is in : 00629 (3002,0011) Image Plane Pixel Spacing 00630 (3002,0012) RT Image Position 00631 and 00632 (3004,000c) for deducing Z spacing 00633 */ 00634 00635 std::string SOPClassUID = GetEntryString(0x0008,0x0016); 00636 00639 00641 00642 if (Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.6") 00643 // Ultrasound Image Storage (Retired) 00644 || Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.6.1") 00645 // Ultrasound Image Storage 00646 || Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.3") 00647 // Ultrasound Multi-Frame Storage (Retired) 00648 || Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.3.1") ) 00649 // Ultrasound Multi-FrameImage Storage 00650 { 00651 // - check if SOPClassUID contains 2 parts (e.g. "4\3") 00652 // - guess how to deduce the spacing (FOV ?, ??) 00653 00654 entry = GetDataEntry(0x0028,0x0034); 00655 if ( entry ) 00656 { 00657 nbValue = entry->GetValueCount(); 00658 if( nbValue !=2 ) { 00659 gdcmWarningMacro("PixelAspectRatio (0x0028,0x0034) " 00660 << "has a wrong number of values :" << nbValue); 00661 } 00662 xspacing = 1.0; // We get Pixel Aspect Ratio, not Spacing ... 00663 ok = true; 00664 } 00665 00666 if (ok) 00667 return xspacing; 00668 } 00669 /* 00670 if (Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.1") ) 00671 // Computed Radiography Image Storage 00672 00673 // CR is in Imager Pixel Spacing (0018,1164)// 00674 00675 */ 00676 // go on with old method ... 00677 // --------------------- 00678 // To follow David Clunie's advice, we first check ImagerPixelSpacing 00679 00680 entry = GetDataEntry(0x0018,0x1164); 00681 if( entry ) 00682 { 00683 nbValue = entry->GetValueCount(); 00684 // Can't use IsValueCountValid because of the complex heuristic. 00685 if( nbValue !=2 ) 00686 gdcmWarningMacro("ImagerPixelSpacing (0x0018,0x1164) " 00687 << "has a wrong number of values :" << nbValue); 00688 00689 if( nbValue >= 3 ) 00690 xspacing = (float)entry->GetValue(2); 00691 else if( nbValue >= 2 ) 00692 xspacing = (float)entry->GetValue(1); 00693 else 00694 xspacing = (float)entry->GetValue(0); 00695 00696 if ( xspacing == 0.0 ) 00697 xspacing = 1.0; 00698 return xspacing; 00699 } 00700 else 00701 { 00702 gdcmWarningMacro( "Unfound Imager Pixel Spacing (0018,1164)" ); 00703 } 00704 00705 entry = GetDataEntry(0x0028,0x0030); 00706 if( entry ) 00707 { 00708 nbValue = entry->GetValueCount(); 00709 if( nbValue !=2 ) 00710 gdcmWarningMacro("PixelSpacing (0x0018,0x0030) " 00711 << "has a wrong number of values :" << nbValue); 00712 00713 if( nbValue >= 3 ) 00714 xspacing = (float)entry->GetValue(2); 00715 else if( nbValue >= 2 ) 00716 xspacing = (float)entry->GetValue(1); 00717 else 00718 xspacing = (float)entry->GetValue(0); 00719 00720 if ( xspacing == 0.0 ) 00721 xspacing = 1.0; 00722 return xspacing; 00723 } 00724 else 00725 { 00726 gdcmWarningMacro( "Unfound Pixel Spacing (0028,0030)" ); 00727 } 00728 return xspacing; 00729 }
|
|
gets the cosine of image Y axis, against patient X axis (Sorry, but Python needs it :-( )
Definition at line 1132 of file gdcmFile.cxx. References GetImageOrientationPatient(). 01133 { 01134 float iop[6]; 01135 GetImageOrientationPatient( iop ); 01136 return(iop[3]); 01137 }
|
|
gets the cosine of image Y axis, against patient Y axis (Sorry, but Python needs it :-( )
Definition at line 1144 of file gdcmFile.cxx. References GetImageOrientationPatient(). 01145 { 01146 float iop[6]; 01147 GetImageOrientationPatient( iop ); 01148 return(iop[4]); 01149 }
|
|
gets the cosine of image Y axis, against patient Z axis (Sorry, but Python needs it :-( )
Definition at line 1156 of file gdcmFile.cxx. References GetImageOrientationPatient(). 01157 { 01158 float iop[6]; 01159 GetImageOrientationPatient( iop ); 01160 return(iop[5]); 01161 }
|
|
gets the info from 0020,0032 : Image Position Patient else from 0020,0030 : Image Position (RET) else 0.
Definition at line 946 of file gdcmFile.cxx. References gdcmErrorMacro, gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::DataEntry::GetValueCount(), and GDCM_NAME_SPACE::DataEntry::IsValueCountValid(). 00947 { 00948 DataEntry *entry = GetDataEntry(0x0020,0x0032); 00949 if( !entry ) 00950 { 00951 gdcmWarningMacro( "Unfound Image Position Patient (0020,0032)"); 00952 entry = GetDataEntry(0x0020,0x0030); 00953 if( !entry ) 00954 { 00955 gdcmWarningMacro( "Unfound Image Position (RET) (0020,0030)"); 00956 return 0.0f; 00957 } 00958 } 00959 00960 if( entry->GetValueCount() == 3 ) 00961 { 00962 if (!entry->IsValueCountValid() ) 00963 { 00964 gdcmErrorMacro( "Invalid Value Count" ); 00965 } 00966 return (float)entry->GetValue(1); 00967 } 00968 return 0.0f; 00969 }
|
|
Retrieve the number of lines of image.
Definition at line 433 of file gdcmFile.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::DataEntry::GetValue(), and GDCM_NAME_SPACE::Document::IsDicomV3(). Referenced by GDCM_NAME_SPACE::FileHelper::CheckWriteIntegrity(), vtkGdcmReader::GetFileInformation(), GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(), vtkGdcmReader::LoadImageInMemory(), GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEG2000UserData(), GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEGUserData(), and vtkGdcmReader::TestFileInformation(). 00434 { 00435 DataEntry *entry = GetDataEntry(0x0028,0x0010); 00436 if( entry ) 00437 return (int)entry->GetValue(0); 00438 00439 if ( IsDicomV3() ) 00440 { 00441 return 0; 00442 } 00443 00444 // The Rows (0028,0010) entry was optional for ACR/NEMA. 00445 // (at least some images didn't have it.) 00446 // It might hence be a signal (1D image). So we default to 1: 00447 return 1; 00448 }
|
|
gets the info from 0018,1164 : ImagerPixelSpacing then from 0028,0030 : Pixel Spacing else 1.0
Definition at line 737 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Util::DicomStringEqual(), gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GetSpacing(), GDCM_NAME_SPACE::DataEntry::GetValue(), and GDCM_NAME_SPACE::DataEntry::GetValueCount(). Referenced by vtkGdcmReader::GetFileInformation(). 00738 { 00739 float xspacing = 1., yspacing = 1.0, zspacing = 1.; 00740 uint32_t nbValue; 00741 DataEntry *entry; 00742 bool ok = false; 00743 if ( GetSpacing(xspacing,yspacing,zspacing) ) 00744 { 00745 return yspacing; 00746 } 00747 // else fallback 00748 00749 std::string SOPClassUID = GetEntryString(0x0008,0x0016); 00750 00753 00755 00756 if (Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.6") 00757 // Ultrasound Image Storage (Retired) 00758 || Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.6.1") 00759 // Ultrasound Image Storage 00760 || Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.3") 00761 // Ultrasound Multi-Frame Storage (Retired) 00762 || Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.3.1") ) 00763 // Ultrasound Multi-FrameImage Storage 00764 { 00765 // - check if SOPClassUID contains 2 parts (e.g. "4\3") 00766 // - no way to deduce the spacing/ 00767 00768 entry = GetDataEntry(0x0028,0x0034); 00769 if ( entry ) 00770 { 00771 nbValue = entry->GetValueCount(); 00772 if( nbValue ==2 ) { 00773 yspacing = (float)entry->GetValue(0)/(float)entry->GetValue(1); 00774 //std::cout << "ys " << yspacing << std::endl; 00775 ok = true; 00776 } 00777 else 00778 { 00779 gdcmWarningMacro("PixelAspectRatio (0x0028,0x0034) " 00780 << "has a wrong number of values :" << nbValue); 00781 if (nbValue == 0 ) { 00782 ok = false; 00783 } 00784 else if (nbValue == 1 ) { 00785 yspacing = 1.0; // We get Pixel Aspect Ratio, not Spacing ... 00786 ok = true; 00787 } 00788 } 00789 } 00790 00791 if (ok) 00792 return yspacing; 00793 } 00794 00795 // go on with old method ... 00796 // --------------------- 00797 // To follow David Clunie's advice, we first check ImagerPixelSpacing 00798 yspacing = 1.0; 00799 // To follow David Clunie's advice, we first check ImagerPixelSpacing 00800 00801 entry = GetDataEntry(0x0018,0x1164); 00802 if( entry ) 00803 { 00804 yspacing = (float)entry->GetValue(0); 00805 00806 if ( yspacing == 0.0 ) 00807 yspacing = 1.0; 00808 return yspacing; 00809 } 00810 else 00811 { 00812 gdcmWarningMacro( "Unfound Imager Pixel Spacing (0018,1164)" ); 00813 } 00814 00815 entry = GetDataEntry(0x0028,0x0030); 00816 if( entry ) 00817 { 00818 yspacing = (float)entry->GetValue(0); 00819 00820 if ( yspacing == 0.0 ) 00821 yspacing = 1.0; 00822 return yspacing; 00823 } 00824 else 00825 { 00826 gdcmWarningMacro( "Unfound Pixel Spacing (0028,0030)" ); 00827 } 00828 00829 return yspacing; 00830 }
|
|
gets the info from 0020,0032 : Image Position Patient else from 0020,0030 : Image Position (RET) else from 0020,1041 : Slice Location else from 0020,0050 : Location else 0.
Definition at line 979 of file gdcmFile.cxx. References gdcmErrorMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::DataEntry::GetValue(), GDCM_NAME_SPACE::DataEntry::GetValueCount(), and GDCM_NAME_SPACE::DataEntry::IsValueCountValid(). 00980 { 00981 DataEntry *entry = GetDataEntry(0x0020,0x0032); 00982 if( entry ) 00983 { 00984 if( entry->GetValueCount() == 3 ) 00985 { 00986 if (!entry->IsValueCountValid() ) 00987 { 00988 gdcmErrorMacro( "Invalid Value Count" ); 00989 } 00990 return (float)entry->GetValue(2); 00991 } 00992 gdcmWarningMacro( "Wrong Image Position Patient (0020,0032)"); 00993 return 0.0f; 00994 } 00995 00996 entry = GetDataEntry(0x0020,0x0030); 00997 if( entry ) 00998 { 00999 if( entry->GetValueCount() == 3 ) 01000 { 01001 if (!entry->IsValueCountValid() ) 01002 { 01003 gdcmErrorMacro( "Invalid Value Count" ); 01004 } 01005 return (float)entry->GetValue(2); 01006 } 01007 gdcmWarningMacro( "Wrong Image Position (RET) (0020,0030)"); 01008 return 0.0f; 01009 } 01010 01011 // for *very* old ACR-NEMA images 01012 entry = GetDataEntry(0x0020,0x1041); 01013 if( entry ) 01014 { 01015 if( entry->GetValueCount() == 1 ) 01016 { 01017 if (!entry->IsValueCountValid() ) 01018 { 01019 gdcmErrorMacro( "Invalid Value Count" ); 01020 } 01021 return (float)entry->GetValue(0); // VM=1 ! 01022 } 01023 gdcmWarningMacro( "Wrong Slice Location (0020,1041)"); 01024 return 0.0f; 01025 } 01026 01027 entry = GetDataEntry(0x0020,0x0050); 01028 if( entry ) 01029 { 01030 if( entry->GetValueCount() == 1 ) 01031 { 01032 if (!entry->IsValueCountValid() ) 01033 { 01034 gdcmErrorMacro( "Invalid Value Count" ); 01035 } 01036 return (float)entry->GetValue(0); 01037 } 01038 gdcmWarningMacro( "Wrong Location (0020,0050)"); 01039 return 0.0f; 01040 } 01041 return 0.; // Hopeless 01042 }
|
|
Retrieve the number of planes of volume or the number of frames of a multiframe.
Definition at line 458 of file gdcmFile.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by GDCM_NAME_SPACE::FileHelper::CheckWriteIntegrity(), vtkGdcmReader::GetFileInformation(), GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(), vtkGdcmReader::LoadImageInMemory(), GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEG2000UserData(), GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEGUserData(), vtkGdcmReader::TestFileInformation(), userSuppliedMirrorFunction(), userSuppliedTopDownFunction(), and userSuppliedUpsideDownFunction(). 00459 { 00460 // Both DicomV3 and ACR/Nema consider the "Number of Frames" 00461 // as the third dimension. 00462 DataEntry *entry = GetDataEntry(0x0028,0x0008); 00463 if( entry ) 00464 return (int)entry->GetValue(0); 00465 00466 // We then consider the "Planes" entry as the third dimension 00467 entry = GetDataEntry(0x0028,0x0012); 00468 if( entry ) 00469 return (int)entry->GetValue(0); 00470 return 1; 00471 }
|
|
gets the info from 0018,0088 : Space Between Slices else from 0018,0050 : Slice Thickness else 1.0 When an element is missing, we suppose slices join together (no overlapping, no interslice gap) but we have no way to check it ! For *Dicom* images, ZSpacing *should be* calculated using XOrigin, YOrigin, ZOrigin (of the top left image corner) of 2 consecutive images, and the Orientation Computing ZSpacing on a single image is not really meaningfull !
Definition at line 845 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GetSpacing(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by vtkGdcmReader::GetFileInformation(). 00846 { 00847 00848 float xspacing = 1.0; 00849 float yspacing = 1.0; 00850 float zspacing = 1.0; 00851 if ( GetSpacing(xspacing,yspacing,zspacing) ) 00852 { 00853 return zspacing; 00854 } 00855 00856 // Spacing Between Slices : distance between the middle of 2 slices 00857 // Slices may be : 00858 // jointives (Spacing between Slices = Slice Thickness) 00859 // overlapping (Spacing between Slices < Slice Thickness) 00860 // disjointes (Spacing between Slices > Slice Thickness) 00861 // Slice Thickness : epaisseur de tissus sur laquelle est acquis le signal 00862 // It only concerns the MRI guys, not people wanting to visualize volumes 00863 // If Spacing Between Slices is missing, 00864 // we suppose slices joint together 00865 DataEntry *entry = GetDataEntry(0x0018,0x0088); 00866 if( entry ) 00867 { zspacing = (float)entry->GetValue(0); 00868 00869 if ( zspacing == 0.0 ) 00870 zspacing = 1.0; 00871 return zspacing; 00872 } 00873 else 00874 gdcmWarningMacro("Unfound Spacing Between Slices (0018,0088)"); 00875 00876 // if no 'Spacing Between Slices' is found, 00877 // we assume slices join together 00878 // (no overlapping, no interslice gap) 00879 entry = GetDataEntry(0x0018,0x0050); 00880 if( entry ) 00881 { 00882 zspacing = (float)entry->GetValue(0); 00883 00884 if ( zspacing == 0.0 ) 00885 zspacing = 1.0; 00886 return zspacing; 00887 } 00888 else 00889 gdcmWarningMacro("Unfound Slice Thickness (0018,0050)"); 00890 00891 // if no 'Spacing Between Slices' is found, 00892 // we assume slices join together 00893 // (no overlapping, no interslice gap) 00894 entry = GetDataEntry(0x3004,0x000c); 00895 if( entry ) 00896 { 00897 float z1 = (float)entry->GetValue(0); 00898 float z2 = (float)entry->GetValue(1); 00899 zspacing = z2 - z1; // can be negative... 00900 00901 if ( zspacing == 0.0 ) 00902 zspacing = 1.0; 00903 return zspacing; 00904 } 00905 00906 return zspacing; 00907 }
|
|
tells us if LUT are used
Definition at line 1492 of file gdcmFile.cxx. References GDCM_NAME_SPACE::ElementSet::GetDocEntry(). Referenced by GDCM_NAME_SPACE::FileHelper::CheckWriteIntegrity(), vtkGdcmReader::GetFileInformation(), GetNumberOfScalarComponents(), vtkGdcmReader::LoadImageInMemory(), GDCM_NAME_SPACE::FileHelper::SetWriteToRaw(), and vtkGdcmReader::TestFileInformation(). 01493 { 01494 // Check the presence of the LUT Descriptors, and LUT Tables 01495 // LutDescriptorRed 01496 if ( !GetDocEntry(0x0028,0x1101) ) 01497 { 01498 return false; 01499 } 01500 // LutDescriptorGreen 01501 if ( !GetDocEntry(0x0028,0x1102) ) 01502 { 01503 return false; 01504 } 01505 // LutDescriptorBlue 01506 if ( !GetDocEntry(0x0028,0x1103) ) 01507 { 01508 return false; 01509 } 01510 // Red Palette Color Lookup Table Data 01511 if ( !GetDocEntry(0x0028,0x1201) ) 01512 { 01513 return false; 01514 } 01515 // Green Palette Color Lookup Table Data 01516 if ( !GetDocEntry(0x0028,0x1202) ) 01517 { 01518 return false; 01519 } 01520 // Blue Palette Color Lookup Table Data 01521 if ( !GetDocEntry(0x0028,0x1203) ) 01522 { 01523 return false; 01524 } 01525 01526 // FIXME : (0x0028,0x3006) : LUT Data (CTX dependent) 01527 // NOT taken into account, but we don't know how to use it ... 01528 return true; 01529 }
|
|
Modifies the value of a given Header Entry (Dicom Element) when it exists. Create it with the given value when unexistant. A copy of the binArea is made to be kept in the Document.
Definition at line 290 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DocEntrySet::AddEntry(), GDCM_NAME_SPACE::RefCounter::Delete(), gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDocEntry(), GDCM_NAME_SPACE::DocEntry::GetVR(), GDCM_NAME_SPACE::DocEntrySet::NewDataEntry(), GDCM_NAME_SPACE::DocEntrySet::RemoveEntry(), and GDCM_NAME_SPACE::DocEntrySet::SetEntryBinArea(). Referenced by GDCM_NAME_SPACE::FileHelper::InsertEntryBinArea(). 00293 { 00294 DataEntry *dataEntry = 0; 00295 DocEntry *currentEntry = GetDocEntry( group, elem ); 00296 00297 // Verify the currentEntry 00298 if (currentEntry) 00299 { 00300 dataEntry = dynamic_cast<DataEntry *>(currentEntry); 00301 00302 // Verify the VR 00303 if ( dataEntry ) 00304 if ( dataEntry->GetVR()!=vr ) 00305 dataEntry = NULL; 00306 00307 // if currentEntry doesn't correspond to the requested dataEntry 00308 if ( !dataEntry) 00309 { 00310 if ( !RemoveEntry(currentEntry) ) 00311 { 00312 gdcmWarningMacro( "Removal of previous DocEntry failed."); 00313 return NULL; 00314 } 00315 } 00316 } 00317 00318 // Create a new dataEntry if necessary 00319 if ( !dataEntry) 00320 { 00321 dataEntry = NewDataEntry(group, elem, vr); 00322 00323 if ( !AddEntry(dataEntry) ) 00324 { 00325 gdcmWarningMacro( "AddEntry failed although this is a creation."); 00326 dataEntry->Delete(); 00327 return NULL; 00328 } 00329 dataEntry->Delete(); 00330 } 00331 00332 // Set the dataEntry value 00333 uint8_t *tmpArea; 00334 if ( lgth>0 && binArea ) 00335 { 00336 tmpArea = new uint8_t[lgth]; 00337 memcpy(tmpArea,binArea,lgth); 00338 } 00339 else 00340 { 00341 tmpArea = 0; 00342 } 00343 if ( !SetEntryBinArea(tmpArea,lgth,dataEntry) ) 00344 { 00345 if ( tmpArea ) 00346 { 00347 delete[] tmpArea; 00348 } 00349 } 00350 return dataEntry; 00351 }
|
|
Modifies the value of a given Doc Entry (Dicom Element) when it exists. Creates it with the given value when unexistant.
Definition at line 216 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DocEntrySet::AddEntry(), GDCM_NAME_SPACE::RefCounter::Delete(), GDCM_NAME_SPACE::GDCM_VRUNKNOWN, gdcmWarningMacro, GDCM_NAME_SPACE::DictSet::GetDefaultPubDict(), GDCM_NAME_SPACE::Global::GetDicts(), GDCM_NAME_SPACE::DocEntrySet::GetDocEntry(), GDCM_NAME_SPACE::Dict::GetEntry(), GDCM_NAME_SPACE::DocEntry::GetKey(), GDCM_NAME_SPACE::DictEntry::GetVR(), GDCM_NAME_SPACE::DocEntry::GetVR(), GDCM_NAME_SPACE::DocEntrySet::NewDataEntry(), GDCM_NAME_SPACE::RefCounter::Register(), GDCM_NAME_SPACE::DocEntrySet::RemoveEntry(), and GDCM_NAME_SPACE::DocEntrySet::SetEntryString(). Referenced by GDCM_NAME_SPACE::FileHelper::InsertEntryString(), GDCM_NAME_SPACE::FileHelper::Write(), and Write(). 00219 { 00220 DataEntry *dataEntry = 0; 00221 DocEntry *currentEntry = GetDocEntry( group, elem ); 00222 VRKey localVR = vr; 00223 if (currentEntry) 00224 { 00225 dataEntry = dynamic_cast<DataEntry *>(currentEntry); 00226 00227 // Verify the VR 00228 if ( dataEntry ) 00229 if ( dataEntry->GetVR()!=vr ) 00230 dataEntry = NULL; 00231 00232 // if currentEntry doesn't correspond to the requested dataEntry 00233 if ( !dataEntry) 00234 { 00235 if ( !RemoveEntry(currentEntry) ) 00236 { 00237 gdcmWarningMacro( "Removal of previous DocEntry failed."); 00238 return NULL; 00239 } 00240 } 00241 } 00242 00243 else // the 'currentEntry' was not found 00244 { 00245 if ( vr == GDCM_VRUNKNOWN ) // user didn't specify a VR. 00246 // Probabely he trusts the Dicom Dict ! 00247 { 00248 DictEntry *e = 00249 Global::GetDicts()->GetDefaultPubDict()->GetEntry(group, elem); 00250 if ( e ) 00251 { 00252 localVR = e->GetVR(); 00253 e->Register(); // ?? JPRx 00254 } 00255 } 00256 } 00257 00258 // Create a new dataEntry if necessary 00259 if ( !dataEntry ) 00260 { 00261 dataEntry = NewDataEntry( group, elem, localVR ); 00262 00263 if ( !AddEntry(dataEntry) ) 00264 { 00265 gdcmWarningMacro("AddEntry " << dataEntry->GetKey() 00266 << " failed although this is a creation."); 00267 dataEntry->Delete(); 00268 return NULL; 00269 } 00270 dataEntry->Delete(); // ?!? JPRx 00271 } 00272 00273 // Set the dataEntry value 00274 SetEntryString(value, dataEntry); // The std::string value 00275 return dataEntry; 00276 }
|
|
Creates a new gdcm::SeqEntry and adds it to the current DocEntrySet. (remove any existing entry with same group,elem).
Definition at line 361 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DocEntrySet::AddEntry(), GDCM_NAME_SPACE::RefCounter::Delete(), gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDocEntry(), GDCM_NAME_SPACE::DocEntrySet::NewSeqEntry(), and GDCM_NAME_SPACE::DocEntrySet::RemoveEntry(). Referenced by GDCM_NAME_SPACE::FileHelper::InsertSeqEntry(). 00362 { 00363 SeqEntry *seqEntry = 0; 00364 DocEntry *currentEntry = GetDocEntry( group, elem ); 00365 00366 // Verify the currentEntry 00367 if ( currentEntry ) 00368 { 00369 seqEntry = dynamic_cast<SeqEntry *>(currentEntry); 00370 00371 // Verify the VR 00372 if ( seqEntry ) 00373 seqEntry = NULL; 00374 00375 // if currentEntry doesn't correspond to the requested seqEntry 00376 if ( !seqEntry ) 00377 { 00378 if (!RemoveEntry(currentEntry)) 00379 { 00380 gdcmWarningMacro( "Removal of previous DocEntry failed for (" 00381 <<std::hex << group << "|" << elem <<")" ); 00382 return NULL; 00383 } 00384 } 00385 } 00386 // Create a new seqEntry if necessary 00387 if ( !seqEntry ) 00388 { 00389 seqEntry = NewSeqEntry(group, elem); 00390 00391 if ( !AddEntry(seqEntry) ) 00392 { 00393 gdcmWarningMacro( "AddEntry failed although this is a creation for (" 00394 <<std::hex << group << "|" << elem <<")" ); 00395 seqEntry->Delete(); 00396 return NULL; 00397 } 00398 seqEntry->Delete(); 00399 } 00400 // Remark : 00401 // SequenceDelimitationItem will be added at the end of the SeqEntry, 00402 // at write time 00403 return seqEntry; 00404 }
|
|
Predicate for dicom version 3 file.
Definition at line 386 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::ElementSet::GetDocEntry(). Referenced by GetYSize(), and GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(). 00387 { 00388 // Checking if Transfer Syntax exists is enough 00389 // Anyway, it's too late check if the 'Preamble' was found ... 00390 // And ... would it be a rich idea to check ? 00391 // (some 'no Preamble' DICOM images exist !) 00392 return GetDocEntry(0x0002, 0x0010) != NULL; 00393 }
|
|
Tells us if the ElementSet contains no entry.
Implements GDCM_NAME_SPACE::DocEntrySet. Definition at line 59 of file gdcmElementSet.h. Referenced by GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), and GDCM_NAME_SPACE::Document::IsParsable(). 00059 { return TagHT.empty(); }
|
|
Check whether this a monochrome picture (gray levels) or not, using "Photometric Interpretation" tag (0x0028,0x0004).
Definition at line 1407 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Util::DicomStringEqual(), GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), and GetNumberOfScalarComponents(). 01408 { 01409 const std::string &PhotometricInterp = GetEntryString( 0x0028, 0x0004 ); 01410 if ( Util::DicomStringEqual(PhotometricInterp, "MONOCHROME1") 01411 || Util::DicomStringEqual(PhotometricInterp, "MONOCHROME2") ) 01412 { 01413 return true; 01414 } 01415 if ( PhotometricInterp == GDCM_UNFOUND ) 01416 { 01417 gdcmWarningMacro( "Photometric Interpretation (0028,0004) supposed to be " 01418 << "mandatory"); 01419 // to deal with old ACR-NEMA images 01420 if (GetNumberOfScalarComponents() == 1) 01421 return true; 01422 } 01423 return false; 01424 }
|
|
Check whether this a MONOCHROME1 picture (high values = dark) or not using "Photometric Interpretation" tag (0x0028,0x0004).
Definition at line 1431 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Util::DicomStringEqual(), GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, and GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). 01432 { 01433 const std::string &PhotometricInterp = GetEntryString( 0x0028, 0x0004 ); 01434 if ( Util::DicomStringEqual(PhotometricInterp, "MONOCHROME1") ) 01435 { 01436 return true; 01437 } 01438 if ( PhotometricInterp == GDCM_UNFOUND ) 01439 { 01440 gdcmWarningMacro( "Photometric Interpretation (0028,0004) : supposed to" 01441 << " be mandatory! "); 01442 } 01443 return false; 01444 }
|
|
Check whether this a "PALETTE COLOR" picture or not by accessing the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).
Definition at line 1451 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmDebugMacro, and GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). 01452 { 01453 std::string PhotometricInterp = GetEntryString( 0x0028, 0x0004 ); 01454 if ( PhotometricInterp == "PALETTE COLOR " ) 01455 { 01456 return true; 01457 } 01458 if ( PhotometricInterp == GDCM_UNFOUND ) 01459 { 01460 gdcmDebugMacro( "Not found : Palette color (0028,0004)"); 01461 } 01462 return false; 01463 }
|
|
Predicate for Papyrus file Dedicated to whomsoever it may concern.
Definition at line 400 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::ElementSet::GetDocEntry(). 00401 { 00402 // check for Papyrus private Sequence 00403 DocEntry *e = GetDocEntry(0x0041, 0x1050); 00404 if ( !e ) 00405 return false; 00406 // check if it's actually a Sequence 00407 if ( !dynamic_cast<SeqEntry*>(e) ) 00408 return false; 00409 return true; 00410 }
|
|
This predicate tells us whether or not the current Document was properly parsed and contains at least *one* Dicom Element (and nothing more, sorry).
Definition at line 354 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::Document::Filetype, gdcmWarningMacro, GDCM_NAME_SPACE::Document::GetFileName(), GDCM_NAME_SPACE::ElementSet::IsEmpty(), and GDCM_NAME_SPACE::Unknown. Referenced by GDCM_NAME_SPACE::Document::IsReadable(). 00355 { 00356 if ( Filetype == Unknown ) 00357 { 00358 gdcmWarningMacro( "Wrong filetype for " << GetFileName()); 00359 return false; 00360 } 00361 00362 if ( IsEmpty() ) 00363 { 00364 gdcmWarningMacro( "No tag in internal hash table."); 00365 return false; 00366 } 00367 00368 return true; 00369 }
|
|
This predicate, based on hopefully reasonable heuristics, decides whether or not the current File was properly parsed and contains the mandatory information for being considered as a well formed and usable Dicom/Acr File.
Reimplemented from GDCM_NAME_SPACE::Document. Definition at line 277 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmWarningMacro, GDCM_NAME_SPACE::ElementSet::GetDocEntry(), GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GrPixel, GDCM_NAME_SPACE::Document::IsReadable(), and NumPixel. Referenced by GDCM_NAME_SPACE::SerieHelper::AddFileName(), GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(), GDCM_NAME_SPACE::SerieHelper::CreateUniqueSeriesIdentifier(), GDCM_NAME_SPACE::FileHelper::FileHelper(), vtkGdcmReader::LoadFileInformation(), and GDCM_NAME_SPACE::FileHelper::Print(). 00278 { 00279 if ( !Document::IsReadable() ) 00280 { 00281 return false; 00282 } 00283 00284 const std::string &res = GetEntryString(0x0028, 0x0005); 00285 if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 ) 00286 { 00287 gdcmWarningMacro("Wrong Image Dimensions" << res); 00288 return false; // Image Dimensions 00289 } 00290 bool b0028_0100 = true; 00291 if ( !GetDocEntry(0x0028, 0x0100) ) 00292 { 00293 gdcmWarningMacro("Bits Allocated (0028|0100) not found"); 00294 //return false; // "Bits Allocated" 00295 b0028_0100 = false; 00296 } 00297 bool b0028_0101 = true; 00298 if ( !GetDocEntry(0x0028, 0x0101) ) 00299 { 00300 gdcmWarningMacro("Bits Stored (0028|0101) not found"); 00301 //return false; // "Bits Stored" 00302 b0028_0101 = false; 00303 } 00304 bool b0028_0102 = true; 00305 if ( !GetDocEntry(0x0028, 0x0102) ) 00306 { 00307 gdcmWarningMacro("Hight Bit (0028|0102) not found"); 00308 //return false; // "High Bit" 00309 b0028_0102 = false; 00310 } 00311 bool b0028_0103 = true; 00312 if ( !GetDocEntry(0x0028, 0x0103) ) 00313 { 00314 gdcmWarningMacro("Pixel Representation (0028|0103) not found"); 00315 //return false; // "Pixel Representation" i.e. 'Sign' ( 0 : unsigned, 1 : signed) 00316 b0028_0103 = false; 00317 } 00318 00319 if ( !b0028_0100 && !b0028_0101 && !b0028_0102 && !b0028_0103) 00320 { 00321 gdcmWarningMacro("Too much mandatory Tags missing !"); 00322 return false; 00323 } 00324 00325 if ( !GetDocEntry(GrPixel, NumPixel) ) 00326 { 00327 gdcmWarningMacro("Pixel Dicom Element " << std::hex << 00328 GrPixel << "|" << NumPixel << "not found"); 00329 return false; // Pixel Dicom Element not found :-( 00330 } 00331 return true; 00332 }
|
|
Check whether the pixels are signed (1) or UNsigned (0) data.
Definition at line 1390 of file gdcmFile.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), and GDCM_NAME_SPACE::DataEntry::GetValue(). Referenced by GDCM_NAME_SPACE::FileHelper::ConvertFixGreyLevels(), GetPixelType(), GDCM_NAME_SPACE::PixelReadConvert::GrabInformationsFromFile(), and GDCM_NAME_SPACE::PixelWriteConvert::SetCompressJPEG2000UserData(). 01391 { 01392 DataEntry *entry = GetDataEntry(0x0028, 0x0103);//"Pixel Representation" 01393 if( !entry ) 01394 { 01395 gdcmWarningMacro( "Pixel Representation (0028,0103) supposed to be " 01396 << "mandatory"); 01397 return false; 01398 } 01399 return entry->GetValue(0) != 0; 01400 }
|
|
Checks whether *all* the DataEntries of the group have all the same type for VR (ImplicitVR or ExplicitVR).
Definition at line 225 of file gdcmElementSet.cxx. References GDCM_NAME_SPACE::ElementSet::TagHT. 00226 { 00227 uint16_t currentGroup; 00228 int codeVR = -1; 00229 int currentCodeVR; 00230 for(TagDocEntryHT::iterator cc = TagHT.begin();cc != TagHT.end(); ++cc) 00231 { 00232 currentGroup = cc->second->GetGroup(); 00233 00234 if ( currentGroup < group ) 00235 continue; 00236 if ( currentGroup > group ) 00237 break; 00238 // currentGroup == group 00239 if (codeVR == -1) 00240 { 00241 if (cc->second->IsImplicitVR() ) 00242 codeVR = 1; 00243 else 00244 codeVR = 2; 00245 continue; 00246 } 00247 else 00248 { 00249 if (cc->second->IsImplicitVR() ) 00250 currentCodeVR = 1; //Implicit 00251 else 00252 currentCodeVR = 2; // Explicit 00253 00254 if ( currentCodeVR == codeVR ) 00255 continue; 00256 else 00257 return -1; // -1 : not coherent 00258 } 00259 } 00260 return codeVR; 00261 }
|
|
Check whether this a "YBR_FULL" color picture or not by accessing the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).
Definition at line 1470 of file gdcmFile.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, gdcmDebugMacro, and GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). 01471 { 01472 std::string PhotometricInterp = GetEntryString( 0x0028, 0x0004 ); 01473 if ( PhotometricInterp == "YBR_FULL" ) 01474 { 01475 return true; 01476 } 01477 if ( PhotometricInterp == GDCM_UNFOUND ) 01478 { 01479 gdcmDebugMacro( "Not found : YBR Full (0028,0004)"); 01480 } 01481 return false; 01482 }
|
|
Loader.
Reimplemented from GDCM_NAME_SPACE::Document. Definition at line 145 of file gdcmFile.cxx. References DoTheLoadingJob(). Referenced by GDCM_NAME_SPACE::SerieHelper::AddFileName(), GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(), GDCM_NAME_SPACE::FileHelper::Load(), and vtkGdcmReader::LoadFileInformation(). 00146 { 00147 if ( ! this->Document::Load( ) ) 00148 return false; 00149 00150 return DoTheLoadingJob( ); 00151 }
|
|
Loads (from disk) the element content when a string is not suitable.
Definition at line 761 of file gdcmDocument.cxx. References gdcmWarningMacro, GDCM_NAME_SPACE::DataEntry::GetBinArea(), GDCM_NAME_SPACE::DocEntry::GetElement(), GDCM_NAME_SPACE::DocEntry::GetGroup(), GDCM_NAME_SPACE::DocEntry::GetLength(), GDCM_NAME_SPACE::DocEntry::GetOffset(), GDCM_NAME_SPACE::Document::OpenFile(), GDCM_NAME_SPACE::DataEntry::SetState(), and GDCM_NAME_SPACE::DataEntry::STATE_UNREAD. 00762 { 00763 if( entry->GetBinArea() ) 00764 return; 00765 00766 bool openFile = !Fp; 00767 if ( openFile ) 00768 OpenFile(); 00769 00770 //size_t o =(size_t)entry->GetOffset(); 00771 Fp->seekg((size_t)entry->GetOffset(), std::ios::beg); // FIXME : for each DataEntry ! 00772 00773 size_t l = entry->GetLength(); 00774 uint8_t *data = new uint8_t[l]; 00775 if ( !data ) 00776 { 00777 gdcmWarningMacro( "Cannot allocate DataEntry content for : " 00778 << std::hex << entry->GetGroup() 00779 << "|" << entry->GetElement() ); 00780 return; 00781 } 00782 00783 // Read the data 00784 Fp->read((char*)data, l); 00785 if ( Fp->fail() || Fp->eof() ) 00786 { 00787 delete[] data; 00788 entry->SetState(DataEntry::STATE_UNREAD); 00789 return; 00790 } 00791 00792 // Swap the data content if necessary 00793 uint32_t i; 00794 unsigned short vrLgth = 00795 Global::GetVR()->GetAtomicElementLength(entry->GetVR()); 00796 00797 // FIXME : trouble expected if we read an ... OW Entry (LUT, etc ..) 00798 // if( entry->GetVR() == "OW" ) 00799 // vrLgth = 1; 00800 00801 switch(vrLgth) 00802 { 00803 case 1: 00804 { 00805 break; 00806 } 00807 case 2: 00808 { 00809 uint16_t *data16 = (uint16_t *)data; 00810 for(i=0;i<l/vrLgth;i++) 00811 data16[i] = SwapShort(data16[i]); 00812 break; 00813 } 00814 case 4: 00815 { 00816 uint32_t *data32 = (uint32_t *)data; 00817 for(i=0;i<l/vrLgth;i++) 00818 data32[i] = SwapLong(data32[i]); 00819 break; 00820 } 00821 case 8: 00822 { 00823 double *data64 = (double *)data; 00824 for(i=0;i<l/vrLgth;i++) 00825 data64[i] = SwapDouble(data64[i]); 00826 break; 00827 } 00828 } 00829 00830 entry->SetBinArea(data); 00831 00832 if ( openFile ) // The file is left in the state (open/close) it was at entrance 00833 CloseFile(); 00834 }
|
|
Loads (from disk) the element content when a string is not suitable.
Definition at line 736 of file gdcmDocument.cxx. References gdcmDebugMacro, gdcmWarningMacro, and GDCM_NAME_SPACE::ElementSet::GetDocEntry(). Referenced by GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), and GDCM_NAME_SPACE::Document::LoadDocEntry(). 00737 { 00738 // Search the corresponding DocEntry 00739 DocEntry *docEntry = GetDocEntry(group, elem); 00740 if ( !docEntry ) 00741 { 00742 gdcmDebugMacro(std::hex << group << "|" << elem 00743 << " doesn't exist" ); 00744 return; 00745 } 00746 DataEntry *dataEntry = dynamic_cast<DataEntry *>(docEntry); 00747 if ( !dataEntry ) 00748 { 00749 gdcmWarningMacro(std::hex << group << "|" << elem 00750 << " is NOT a DataEntry"); 00751 return; 00752 } 00753 LoadEntryBinArea(dataEntry); 00754 }
|
|
Protect the Writer from writing illegal groups.
Reimplemented from GDCM_NAME_SPACE::ElementSet. Definition at line 195 of file gdcmFile.h.
|
|
Definition at line 104 of file gdcmFile.h. Referenced by GDCM_NAME_SPACE::SerieHelper::AddFileName(), GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(), GDCM_NAME_SPACE::FileHelper::FileHelper(), and vtkGdcmReader::LoadFileInformation(). 00104 {return new File();}
|
|
Build a new DataEntry from all the low level arguments.
Definition at line 425 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, and GDCM_NAME_SPACE::DataEntry::New(). Referenced by GDCM_NAME_SPACE::FileHelper::CopyDataEntry(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryBinArea(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), and GDCM_NAME_SPACE::Document::ReadNextDocEntry(). 00427 { 00428 00429 DataEntry *newEntry = DataEntry::New(group, elem, vr); 00430 if (!newEntry) 00431 { 00432 gdcmWarningMacro( "Failed to allocate DataEntry for (" 00433 <<std::hex << group << "|" << elem <<")" ); 00434 return 0; 00435 } 00436 return newEntry; 00437 }
|
|
Build a new SeqEntry from all the low level arguments.
Definition at line 445 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, and GDCM_NAME_SPACE::SeqEntry::New(). Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::DocEntrySet::InsertSeqEntry(), and GDCM_NAME_SPACE::Document::ReadNextDocEntry(). 00446 { 00447 //DictEntry *dictEntry = GetDictEntry(group, elem, "SQ"); 00448 00449 //SeqEntry *newEntry = SeqEntry::New( dictEntry ); 00450 SeqEntry *newEntry = SeqEntry::New( group, elem ); 00451 //dictEntry->Unregister(); // GetDictEntry register it 00452 if (!newEntry) 00453 { 00454 gdcmWarningMacro( "Failed to allocate SeqEntry for (" 00455 <<std::hex << group << "|" << elem <<")" ); 00456 return 0; 00457 } 00458 return newEntry; 00459 }
|
|
Tries to open the file Document::Filename and checks the preamble when existing, or if the file starts with an ACR-NEMA look-like element.
Definition at line 590 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::Document::Filename, and GDCM_NAME_SPACE::Document::HasDCMPreamble. Referenced by GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), GDCM_NAME_SPACE::FileHelper::GetRaw(), and GDCM_NAME_SPACE::Document::LoadEntryBinArea(). 00591 { 00592 HasDCMPreamble = false; 00593 if (Filename.length() == 0) 00594 { 00595 return 0; 00596 } 00597 00598 if ( Fp ) 00599 { 00600 gdcmDebugMacro( "File already open: " << Filename.c_str()); 00601 CloseFile(); 00602 } 00603 00604 Fp = new std::ifstream(Filename.c_str(), std::ios::in | std::ios::binary); 00605 if ( ! *Fp ) 00606 { 00607 // Don't user gdcmErrorMacro : 00608 // a spurious message will appear when you use, for instance 00609 // gdcm::FileHelper *fh = new gdcm::FileHelper( outputFileName ); 00610 // to create outputFileName. 00611 00612 // FIXME : if the upper comment is still usefull 00613 // --> the constructor is not so good ... 00614 00615 gdcmWarningMacro( "Cannot open file: " << Filename.c_str()); 00616 delete Fp; 00617 Fp = 0; 00618 return 0; 00619 //exit(1); // No function is allowed to leave the application instead 00620 // of warning the caller 00621 } 00622 00623 uint16_t zero = 0; 00624 Fp->read((char*)&zero, (size_t)2); 00625 if ( Fp->eof() ) 00626 { 00627 CloseFile(); 00628 return 0; 00629 } 00630 00631 //-- DICOM -- 00632 Fp->seekg(126L, std::ios::cur); // Once per Document 00633 char dicm[4]; // = {' ',' ',' ',' '}; 00634 Fp->read(dicm, (size_t)4); 00635 if ( Fp->eof() ) 00636 { 00637 CloseFile(); 00638 return 0; 00639 } 00640 00641 if ( memcmp(dicm, "DICM", 4) == 0 ) 00642 { 00643 HasDCMPreamble = true; 00644 return Fp; 00645 } 00646 00647 //-- Broken ACR or DICOM (?) with no Preamble; may start with a Shadow Group -- 00648 // FIXME : We cannot be sure the preable is only zeroes.. 00649 // (see ACUSON-24-YBR_FULL-RLE.dcm ) 00650 if ( 00651 zero == 0x0001 || zero == 0x0100 || zero == 0x0002 || zero == 0x0200 || 00652 zero == 0x0003 || zero == 0x0300 || zero == 0x0004 || zero == 0x0400 || 00653 zero == 0x0005 || zero == 0x0500 || zero == 0x0006 || zero == 0x0600 || 00654 zero == 0x0007 || zero == 0x0700 || zero == 0x0008 || zero == 0x0800 || 00655 zero == 0x0028 || 0x2800 // worse : some ACR-NEMA like files 00656 // start 00028 group ?!? 00657 ) 00658 { 00659 std::string msg = Util::Format( 00660 "ACR/DICOM starting by 0x(%04x) at the beginning of the file\n", zero); 00661 // FIXME : is it a Warning message, or a Debug message? 00662 gdcmWarningMacro( msg.c_str() ); 00663 return Fp; 00664 } 00665 00666 // -- Neither ACR/No Preamble Dicom nor DICOMV3 file 00667 CloseFile(); 00668 // Don't user Warning nor Error, not to pollute the output 00669 // while directory recursive parsing ... 00670 gdcmDebugMacro( "Neither ACR/No Preamble Dicom nor DICOMV3 file: " 00671 << Filename.c_str()); 00672 return 0; 00673 }
|
|
Loads the element while preserving the current underlying file position indicator as opposed to LoadDocEntry that modifies it Compares two documents, according to DicomDir rules.
Definition at line 860 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). 00861 { 00862 // Patient Name 00863 std::string s1 = GetEntryString(0x0010,0x0010); 00864 std::string s2 = document.GetEntryString(0x0010,0x0010); 00865 if (s1 < s2) 00866 { 00867 return true; 00868 } 00869 else if ( s1 > s2 ) 00870 { 00871 return false; 00872 } 00873 else 00874 { 00875 // Patient ID 00876 s1 = GetEntryString(0x0010,0x0020); 00877 s2 = document.GetEntryString(0x0010,0x0020); 00878 if ( s1 < s2 ) 00879 { 00880 return true; 00881 } 00882 else if ( s1 > s2 ) 00883 { 00884 return false; 00885 } 00886 else 00887 { 00888 // Study Instance UID 00889 s1 = GetEntryString(0x0020,0x000d); 00890 s2 = document.GetEntryString(0x0020,0x000d); 00891 if ( s1 < s2 ) 00892 { 00893 return true; 00894 } 00895 else if ( s1 > s2 ) 00896 { 00897 return false; 00898 } 00899 else 00900 { 00901 // Serie Instance UID 00902 s1 = GetEntryString(0x0020,0x000e); 00903 s2 = document.GetEntryString(0x0020,0x000e); 00904 if ( s1 < s2 ) 00905 { 00906 return true; 00907 } 00908 else if ( s1 > s2 ) 00909 { 00910 return false; 00911 } 00912 } 00913 } 00914 } 00915 return false; 00916 }
|
|
Prints the Header Entries (Dicom Elements) from the H Table.
Reimplemented from GDCM_NAME_SPACE::Base. Reimplemented in GDCM_NAME_SPACE::DicomDir. Definition at line 277 of file gdcmElementSet.cxx. References GDCM_NAME_SPACE::DataEntry::FLAG_PIXELDATA, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::Base::PrintLevel, GDCM_NAME_SPACE::DataEntry::SetFlag(), and GDCM_NAME_SPACE::ElementSet::TagHT. Referenced by GDCM_NAME_SPACE::FileHelper::Print(). 00278 { 00279 // Let's change the 'warning value' for Pixel Data, 00280 // to avoid human reader to be confused by 'gdcm::NotLoaded'. 00281 DataEntry *pixelElement = GetDataEntry(0x7fe0,0x0010); 00282 if ( pixelElement != 0 ) 00283 { 00284 pixelElement->SetFlag( DataEntry::FLAG_PIXELDATA ); 00285 } 00286 00287 for( TagDocEntryHT::const_iterator i = TagHT.begin(); i != TagHT.end(); ++i) 00288 { 00289 DocEntry *entry = i->second; 00290 00291 entry->SetPrintLevel(PrintLevel); 00292 entry->Print(os); 00293 00294 if ( dynamic_cast<SeqEntry*>(entry) ) 00295 { 00296 // Avoid the newline for a sequence: 00297 continue; 00298 } 00299 os << std::endl; 00300 } 00301 }
|
|
When parsing the Pixel Data of an encapsulated file, read the basic offset table (when present, and BTW dump it).
Definition at line 2297 of file gdcmFile.cxx. References BasicOffsetTableItemValue, GDCM_NAME_SPACE::Document::Fp, gdcmDebugMacro, and ReadTagLength(). Referenced by ComputeJPEGFragmentInfo(), and ComputeRLEInfo(). 02298 { 02300 uint32_t itemLength = ReadTagLength(0xfffe, 0xe000); 02301 02302 // When present, read the basic offset table itself. 02303 // Notes: - since the presence of this basic offset table is optional 02304 // we can't rely on it for the implementation, and we will simply 02305 // trash its content (when present). 02306 // - still, when present, we could add some further checks on the 02307 // lengths, but we won't bother with such fuses for the time being. 02308 if ( itemLength != 0 ) 02309 { 02310 char *charBasicOffsetTableItemValue = new char[itemLength]; 02311 Fp->read(charBasicOffsetTableItemValue, itemLength); 02312 unsigned int nbEntries = itemLength/4; 02313 assert( nbEntries*4 == itemLength); // Make sure this is a multiple 02314 BasicOffsetTableItemValue = new uint32_t[nbEntries]; 02315 02316 for (unsigned int i=0; i < nbEntries; i++ ) 02317 { 02318 BasicOffsetTableItemValue[i] = *((uint32_t*)(&charBasicOffsetTableItemValue[4*i])); 02319 #if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION) 02320 uint32_t val = BasicOffsetTableItemValue[i]; 02321 BasicOffsetTableItemValue[i] 02322 = ( (val<<24) | ((val<<8) & 0x00ff0000) | 02323 ( (val>>8) & 0x0000ff00) | (val>>24) ); 02324 #endif 02325 gdcmDebugMacro( "Read one length for: " << 02326 std::hex << BasicOffsetTableItemValue[i] ); 02327 } 02328 02329 delete[] charBasicOffsetTableItemValue; 02330 } 02331 }
|
|
Reads a supposed to be 16 Bits integer (swaps it depending on processor endianness).
Definition at line 946 of file gdcmDocument.cxx. Referenced by ReadTag(). 00948 { 00949 uint16_t g; 00950 Fp->read ((char*)&g, (size_t)2); 00951 if ( Fp->fail() ) 00952 { 00953 throw FormatError( "Document::ReadInt16()", " file error." ); 00954 } 00955 if ( Fp->eof() ) 00956 { 00957 throw FormatError( "Document::ReadInt16()", "EOF." ); 00958 } 00959 g = SwapShort(g); 00960 return g; 00961 }
|
|
Reads a supposed to be 32 Bits integer (swaps it depending on processor endianness).
Definition at line 980 of file gdcmDocument.cxx. Referenced by ComputeRLEInfo(), GDCM_NAME_SPACE::Document::FindDocEntryLengthOBOrOW(), and ReadTagLength(). 00982 { 00983 uint32_t g; 00984 Fp->read ((char*)&g, (size_t)4); 00985 if ( Fp->fail() ) 00986 { 00987 throw FormatError( "Document::ReadInt32()", " file error." ); 00988 } 00989 if ( Fp->eof() ) 00990 { 00991 throw FormatError( "Document::ReadInt32()", "EOF." ); 00992 } 00993 g = SwapLong(g); 00994 return g; 00995 }
|
|
Assuming the internal file pointer Document::Fp is placed at the beginning of a tag, check whether this tag is (TestGroup, TestElem).
Definition at line 2214 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Document::Fp, gdcmErrorMacro, gdcmWarningMacro, GDCM_NAME_SPACE::Document::ReadInt16(), and GDCM_NAME_SPACE::DictEntry::TranslateToKey(). Referenced by ComputeJPEGFragmentInfo(), and ReadTagLength(). 02215 { 02216 long positionOnEntry = Fp->tellg(); // Only when reading fragments 02217 //long currentPosition = positionOnEntry; // On debugging purposes 02218 02219 // Read the Item Tag group and element, and make 02220 // sure they are what we expected: 02221 uint16_t itemTagGroup; 02222 uint16_t itemTagElem; 02223 try 02224 { 02225 itemTagGroup = ReadInt16(); 02226 itemTagElem = ReadInt16(); 02227 } 02228 catch ( FormatError ) 02229 { 02230 gdcmErrorMacro( "Can not read tag for " 02231 << " We should have found tag (" 02232 << DictEntry::TranslateToKey(testGroup,testElem) << ")" 02233 ) ; 02234 02235 return false; 02236 } 02237 if ( itemTagGroup != testGroup || itemTagElem != testElem ) 02238 { 02239 // in order not to pollute output we don't warn on 'delimitors' 02240 if (itemTagGroup != 0xfffe || testGroup != 0xfffe ) 02241 gdcmWarningMacro( "Wrong Item Tag found:" 02242 << " We should have found tag (" 02243 << DictEntry::TranslateToKey(testGroup,testElem) << ")" << std::endl 02244 << " but instead we encountered tag (" 02245 << DictEntry::TranslateToKey(itemTagGroup,itemTagElem) << ")" 02246 << " at address: " << " 0x(" << std::hex 02247 << (unsigned int)positionOnEntry << std::dec << ")" 02248 ) ; 02249 Fp->seekg(positionOnEntry, std::ios::beg); 02250 02251 return false; 02252 } 02253 return true; 02254 }
|
|
Assuming the internal file pointer Document::Fp is placed at the beginning of a tag (TestGroup, TestElement), read the length associated to the Tag.
Definition at line 2270 of file gdcmFile.cxx. References gdcmDebugMacro, gdcmErrorMacro, GDCM_NAME_SPACE::Document::ReadInt32(), ReadTag(), and GDCM_NAME_SPACE::DictEntry::TranslateToKey(). Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), and ReadEncapsulatedBasicOffsetTable(). 02271 { 02272 02273 if ( !ReadTag(testGroup, testElem) ) 02274 { 02275 // Avoid polutting output 02276 if ( testGroup != 0xfffe ) 02277 gdcmErrorMacro( "ReadTag did not succeed for (" 02278 << DictEntry::TranslateToKey(testGroup,testElem) 02279 << ")..." ); 02280 return 0; 02281 } 02282 02284 02285 // long currentPosition = Fp->tellg(); // save time // JPRx 02286 uint32_t itemLength = ReadInt32(); 02287 gdcmDebugMacro( "Basic Item Length is: " << itemLength 02288 // << " at address: " << std::hex << (unsigned int)currentPosition 02289 ); 02290 return itemLength; 02291 }
|
|
Register the object.
Definition at line 46 of file gdcmRefCounter.h. Referenced by GDCM_NAME_SPACE::SQItem::AddEntry(), GDCM_NAME_SPACE::SeqEntry::AddSQItem(), GDCM_NAME_SPACE::SeqEntry::Copy(), GDCM_NAME_SPACE::DicomDir::Copy(), GDCM_NAME_SPACE::FileHelper::FileHelper(), GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::CommandManager::InSetCommand(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::SeqEntry::SetDelimitationItem(). 00046 { RefCount++; }
|
|
Clear the hash table from given entry AND delete the entry.
Implements GDCM_NAME_SPACE::DocEntrySet. Definition at line 122 of file gdcmElementSet.cxx. References GDCM_NAME_SPACE::DocEntry::GetKey(), GDCM_NAME_SPACE::ElementSet::TagHT, and GDCM_NAME_SPACE::RefCounter::Unregister(). Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::DicomDir::NewMeta(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::DocEntryArchive::Restore(). 00123 { 00124 const TagKey &key = entryToRemove->GetKey(); 00125 if ( TagHT.count(key) == 1 ) 00126 { 00127 TagHT.erase(key); 00128 entryToRemove->Unregister(); 00129 return true; 00130 } 00131 00132 gdcmWarningMacro( "Key not present : " << key); 00133 return false ; 00134 }
|
|
Accesses an existing DataEntry (i.e. a Dicom Element) and modifies its content with the given value.
Definition at line 195 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DataEntry::SetBinArea(), and GDCM_NAME_SPACE::DocEntry::SetLength(). 00196 { 00197 if (entry) 00198 { 00199 entry->SetLength(lgth); 00200 entry->SetBinArea(content); 00201 return true; 00202 } 00203 return false; 00204 }
|
|
Accesses an existing DocEntry (i.e. a Dicom Element) through its (group, element) and modifies its content with the given value.
Definition at line 158 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, and GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(). Referenced by GDCM_NAME_SPACE::DocEntrySet::InsertEntryBinArea(), and GDCM_NAME_SPACE::FileHelper::SetEntryBinArea(). 00160 { 00161 DataEntry *entry = GetDataEntry(group, elem); 00162 if (!entry ) 00163 { 00164 gdcmWarningMacro( "No corresponding DataEntry " << std::hex << group << 00165 "," << elem << " element (try promotion first)."); 00166 return false; 00167 } 00168 00169 return SetEntryBinArea(content,lgth,entry); 00170 }
|
|
Accesses an existing DocEntry (i.e. a Dicom Element) and modifies its content with the given value.
Definition at line 178 of file gdcmDocEntrySet.cxx. References GDCM_NAME_SPACE::DataEntry::SetString(). 00179 { 00180 if (entry) 00181 { 00182 entry->SetString(content); 00183 return true; 00184 } 00185 return false; 00186 }
|
|
Accesses an existing DocEntry (i.e. a Dicom Element) through its (group, element) and modifies its content with the given value.
Definition at line 136 of file gdcmDocEntrySet.cxx. References gdcmWarningMacro, and GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(). Referenced by AnonymizeFile(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), and GDCM_NAME_SPACE::FileHelper::SetEntryString(). 00138 { 00139 DataEntry *entry = GetDataEntry(group, elem); 00140 if (!entry ) 00141 { 00142 gdcmWarningMacro( "No corresponding DataEntry " << std::hex << group << 00143 "," << elem << " element (try promotion first)."); 00144 return false; 00145 } 00146 return SetEntryString(content,entry); 00147 }
|
|
Accessor to Filename.
Reimplemented in GDCM_NAME_SPACE::DicomDir. Definition at line 80 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::SerieHelper::AddFileName(), GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(), GDCM_NAME_SPACE::Document::Document(), vtkGdcmReader::LoadFileInformation(), and GDCM_NAME_SPACE::FileHelper::SetFileName(). 00081 { if (Filename != fileName) 00082 Filename = fileName, IsDocumentModified = true; }
|
|
Definition at line 112 of file gdcmFile.h. 00112 { 00113 FourthDimensionLocation = TagKey(group, elem); }
|
|
Sets the LoadMode as a boolean string. LD_NOSEQ, LD_NOSHADOW, LD_NOSHADOWSEQ ... (nothing more, right now) WARNING : before using NO_SHADOW, be sure *all* your files contain accurate values in the 0x0000 element (if any) of *each* Shadow Group. The parser will fail if the size is wrong !
Definition at line 107 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::SerieHelper::AddFileName(), GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(), vtkGdcmReader::LoadFileInformation(), and GDCM_NAME_SPACE::FileHelper::SetLoadMode(). 00107 { if (LoadMode != mode) 00108 LoadMode=mode, IsDocumentModified = true; }
|
|
during parsing, Header Elements too long are not loaded in memory
Definition at line 2182 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::Document::MaxSizeLoadEntry. Referenced by GDCM_NAME_SPACE::Document::Document(). 02183 { 02184 if ( newSize < 0 ) 02185 { 02186 return; 02187 } 02188 if ((uint32_t)newSize >= (uint32_t)0xffffffff ) 02189 { 02190 MaxSizeLoadEntry = 0xffffffff; 02191 return; 02192 } 02193 MaxSizeLoadEntry = newSize; 02194 }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Set the shadow dictionary used.
Definition at line 341 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::DictSet::GetDict(), GDCM_NAME_SPACE::Global::GetDicts(), and GDCM_NAME_SPACE::Document::RefShaDict. 00342 { 00343 RefShaDict = Global::GetDicts()->GetDict(dictName); 00344 return !RefShaDict; 00345 }
|
|
Set the shadow dictionary used.
Definition at line 331 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::Document::RefShaDict. 00332 { 00333 RefShaDict = dict; 00334 return !RefShaDict; 00335 }
|
|
skips bytes inside the source file
Definition at line 126 of file gdcmDocument.h. Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), GDCM_NAME_SPACE::Document::FindDocEntryLengthOBOrOW(), and GDCM_NAME_SPACE::Document::SkipDocEntry(). 00126 { Fp->seekg((long)nBytes, std::ios::cur);}
|
|
Unregister the object.
Definition at line 50 of file gdcmRefCounter.h. Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), and GDCM_NAME_SPACE::FileHelper::~FileHelper(). 00051 { 00052 //std::cout <<"================Unreg " << typeid(*this).name() << std::endl; 00053 RefCount--; 00054 if(RefCount<=0) 00055 delete this; 00056 }
|
|
Performs some consistency checking on various 'File related' (as opposed to 'DicomDir related') entries then writes in a file all the (Dicom Elements) included the Pixels.
Definition at line 1979 of file gdcmFile.cxx. References GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), GDCM_NAME_SPACE::Util::DicomString(), GDCM_NAME_SPACE::Util::Format(), gdcmDebugMacro, gdcmWarningMacro, GDCM_NAME_SPACE::DocEntrySet::GetDataEntry(), GDCM_NAME_SPACE::DocEntrySet::GetEntryLength(), GrPixel, GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::JPEG, NumPixel, GDCM_NAME_SPACE::DataEntry::SetString(), and GDCM_NAME_SPACE::Document::WriteContent(). Referenced by GDCM_NAME_SPACE::FileHelper::Write(). 01980 { 01981 gdcmDebugMacro(" File::Write "); 01982 std::ofstream *fp = new std::ofstream(fileName.c_str(), 01983 std::ios::out | std::ios::binary); 01984 if (*fp == NULL) 01985 { 01986 gdcmWarningMacro("Failed to open (write) File: " << fileName.c_str()); 01987 return false; 01988 } 01989 01990 // Entry : 0002|0000 = group length -> recalculated 01991 DataEntry *e0000 = GetDataEntry(0x0002,0x0000); 01992 if ( e0000 ) 01993 { 01994 std::ostringstream sLen; 01995 sLen << ComputeGroup0002Length( ); 01996 e0000->SetString(sLen.str()); 01997 } 01998 02000 if( writetype != JPEG ) 02001 { 02002 int i_lgPix = GetEntryLength(GrPixel, NumPixel); 02003 if (i_lgPix != -2) 02004 { 02005 // no (GrPixel, NumPixel) element 02006 std::string s_lgPix = Util::Format("%d", i_lgPix+12); 02007 s_lgPix = Util::DicomString( s_lgPix.c_str() ); 02008 InsertEntryString(s_lgPix,GrPixel, 0x0000, "UL"); 02009 } 02010 } 02011 Document::WriteContent(fp, writetype); 02012 02013 fp->close(); 02014 delete fp; 02015 02016 return true; 02017 }
|
|
Writes the Header Entries (Dicom Elements) from the H Table.
Implements GDCM_NAME_SPACE::DocEntrySet. Definition at line 52 of file gdcmElementSet.cxx. References GDCM_NAME_SPACE::ACR, GDCM_NAME_SPACE::ACR_LIBIDO, GDCM_NAME_SPACE::ElementSet::MayIWrite(), and GDCM_NAME_SPACE::ElementSet::TagHT. Referenced by GDCM_NAME_SPACE::Document::WriteContent(). 00053 { 00054 bool insideMetaElements = false; 00055 bool yetOutsideMetaElements = false; 00056 00057 for (TagDocEntryHT::const_iterator i = TagHT.begin(); 00058 i != TagHT.end(); 00059 ++i) 00060 { 00061 int group = (i->second)->GetGroup(); 00062 00063 if (yetOutsideMetaElements==false && group == 0x0002) 00064 insideMetaElements = true; 00065 00066 if (insideMetaElements == true && group != 0x0002) 00067 { 00068 yetOutsideMetaElements = true; 00069 insideMetaElements = false; 00070 } 00071 00072 // depending on the gdcm::Document type 00073 // (gdcm::File; gdcm::DicomDir, (more to come ?) 00074 // some groups *cannot* be present. 00075 // We hereby protect gdcm for writting stupid things 00076 // if they were found in the original document. 00077 if ( !MayIWrite( group ) ) 00078 continue; 00079 00080 // Skip 'Group Length' element, since it may be wrong. 00081 // except for Group 0x0002 00082 // ( keep it as well for Group 0x0008 of ACR Files, 00083 // since some ACR readers *need* it ) 00084 00085 if ( (i->second)->GetElement() != 0x0000 00086 || 00087 ( (i->second)->GetGroup() == 0x0002 00088 ||( (filetype == ACR || filetype == ACR_LIBIDO ) && (i->second)->GetGroup() == 0x0008 ) ) 00089 ) 00090 { 00091 // There are DocEntries, written recursively 00092 i->second->WriteContent(fp, filetype, insideMetaElements ); 00093 } 00094 } 00095 }
|
|
Writes in a file all the Entries (Dicom Elements).
Definition at line 696 of file gdcmDocument.cxx. References GDCM_NAME_SPACE::ExplicitVR, GDCM_NAME_SPACE::ImplicitVR, GDCM_NAME_SPACE::JPEG, GDCM_NAME_SPACE::JPEG2000, and GDCM_NAME_SPACE::ElementSet::WriteContent(). Referenced by Write(). 00697 { 00698 // Skip if user wants to write an ACR-NEMA file 00699 00700 if ( filetype == ImplicitVR || filetype == ExplicitVR || 00701 filetype == JPEG || filetype == JPEG2000 ) 00702 { 00703 // writing Dicom File Preamble 00704 char filePreamble[128]; 00705 memset(filePreamble, 0, 128); 00706 fp->write(filePreamble, 128); 00707 fp->write("DICM", 4); 00708 } 00709 /* 00710 * \todo rewrite later, if really usefull 00711 * - 'Group Length' element is optional in DICOM 00712 * - but un-updated odd groups lengthes can causes pb 00713 * (xmedcon breaker) 00714 * 00715 * if ( (filetype == ImplicitVR) || (filetype == ExplicitVR) ) 00716 * UpdateGroupLength(false,filetype); 00717 * if ( filetype == ACR) 00718 * UpdateGroupLength(true,ACR); 00719 * 00720 * --> Computing group length for groups with embeded Sequences 00721 * --> was too much tricky / we were [in a hurry / too lazy] 00722 * --> We don't write the element 0x0000 (group length) 00723 */ 00724 00725 ElementSet::WriteContent(fp, filetype, false); // This one is recursive 00726 }
|
|
Definition at line 235 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::CallStartMethod(), GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(), GDCM_NAME_SPACE::DicomDir::DoTheLoadingJob(), and GDCM_NAME_SPACE::DicomDir::Initialize(). |
|
Definition at line 224 of file gdcmFile.h. Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), File(), ReadEncapsulatedBasicOffsetTable(), and ~File(). |
|
to allow any inner method to know current tag Element number
Definition at line 252 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(). |
|
to allow any inner method to know current tag Group number
Definition at line 250 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::FindDocEntryVR(), and GDCM_NAME_SPACE::Document::ReadNextDocEntry(). |
|
Refering underlying filename.
Definition at line 131 of file gdcmDocument.h. Referenced by AnonymizeNoLoad(), GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), and GDCM_NAME_SPACE::Document::OpenFile(). |
|
ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown.
Definition at line 157 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::CheckSwap(), GDCM_NAME_SPACE::Document::Document(), GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), GDCM_NAME_SPACE::Document::FindDocEntryVR(), GDCM_NAME_SPACE::Document::GetFileType(), GDCM_NAME_SPACE::Document::HandleOutOfGroup0002(), GDCM_NAME_SPACE::Document::Initialize(), GDCM_NAME_SPACE::Document::IsParsable(), GDCM_NAME_SPACE::DicomDir::IsReadable(), and GDCM_NAME_SPACE::Document::ReadNextDocEntry(). |
|
allows user to tell gdcm in which DataElement is stored the -unnormalized- 4th Dimension
Definition at line 215 of file gdcmFile.h. Referenced by File(), and GetTSize(). |
|
File Pointer, opened during Document parsing.
Definition at line 154 of file gdcmDocument.h. Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), GDCM_NAME_SPACE::Document::Document(), GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), GDCM_NAME_SPACE::DicomDir::DoTheLoadingJob(), ReadEncapsulatedBasicOffsetTable(), and ReadTag(). |
|
whether we already parsed group 0002 (Meta Elements)
Definition at line 148 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::Document(), GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), GDCM_NAME_SPACE::Document::HandleOutOfGroup0002(), and GDCM_NAME_SPACE::Document::ReadNextDocEntry(). |
|
In some cases (e.g. for some ACR-NEMA images) the header entry for the group of pixels is *not* found at 0x7fe0. In order to make things easier the parser shall store the proper value in GrPixel to provide a unique access facility.
Definition at line 212 of file gdcmFile.h. Referenced by DoTheLoadingJob(), File(), GetPixelAreaLength(), GetPixelOffset(), IsReadable(), and Write(). |
|
whether file has a DCM Preamble
Definition at line 151 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::OpenFile(), and GDCM_NAME_SPACE::Document::ReadNextDocEntry(). |
|
After opening the file, we read HEADER_LENGTH_TO_READ bytes.
Definition at line 160 of file gdcmDocument.h. |
|
Whether the gdcm::Document is already parsed/loaded : False from the creation of the gdcm::Document untill gdcm::Document:Load().
Definition at line 180 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::Document(), and GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(). |
|
Whether the gdcm::Document was modified since the last Load().
Definition at line 183 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::Document(), and GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(). |
|
Store the JPEG fragments info obtained during parsing of pixels.
Definition at line 201 of file gdcmFile.h. Referenced by ComputeJPEGFragmentInfo(), File(), and ~File(). |
|
Bit string integer (each one considered as a boolean) Bit 0 : Skip Sequences, if possible Bit 1 : Skip Shadow Groups if possible Probabely, some more to add.
Definition at line 175 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(), and GDCM_NAME_SPACE::Document::Document(). |
|
Elements whose value is longer than MAX_SIZE_LOAD_ELEMENT_VALUE are NOT loaded.
Definition at line 163 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::Document(). |
|
Size threshold above which an element value will NOT be loaded in memory (to avoid loading the image/volume itself). By default, this upper bound is fixed to 1024 bytes (which might look reasonable when one considers the definition of the various VR contents).
Definition at line 247 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::LoadDocEntry(), and GDCM_NAME_SPACE::Document::SetMaxSizeLoadEntry(). |
|
In some cases (e.g. for some ACR-NEMA images) the Entry Element Number of the 'Pixel Element' is *not* found at 0x0010. In order to make things easier the parser shall store the proper value in NumPixel to provide a unique access facility.
Definition at line 207 of file gdcmFile.h. Referenced by DoTheLoadingJob(), File(), GetPixelAreaLength(), GetPixelOffset(), IsReadable(), and Write(). |
|
To be able to backtrack (Private Sequence, Implicit VR related pb).
Definition at line 128 of file gdcmDocEntrySet.h. Referenced by GDCM_NAME_SPACE::Document::Backtrack(), and GDCM_NAME_SPACE::DocEntrySet::DocEntrySet(). |
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 55 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print(). |
|
value of the ??? for any progress bar
Definition at line 234 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::CallEndMethod(), GDCM_NAME_SPACE::Document::CallStartMethod(), GDCM_NAME_SPACE::DicomDir::CreateDicomDirChainedList(), GDCM_NAME_SPACE::DicomDir::DoTheLoadingJob(), and GDCM_NAME_SPACE::DicomDir::Initialize(). |
|
Public dictionary used to parse this header.
Definition at line 238 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::GetPubDict(), and GDCM_NAME_SPACE::Document::Initialize(). |
|
Optional "shadow dictionary" (private elements) used to parse this header.
Definition at line 241 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::GetShaDict(), GDCM_NAME_SPACE::Document::Initialize(), and GDCM_NAME_SPACE::Document::SetShaDict(). |
|
Store the RLE frames info obtained during parsing of pixels.
Definition at line 199 of file gdcmFile.h. |
|
Swap code gives an information on the byte order of a supposed to be an int32, as it's read on disc (depending on the image Transfer Syntax *and* on the processor endianess) as opposed as it should in memory to be dealt as an int32. For instance :
Definition at line 145 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::CheckSwap(), GDCM_NAME_SPACE::Document::Document(), GDCM_NAME_SPACE::Document::SwapDouble(), GDCM_NAME_SPACE::Document::SwapLong(), GDCM_NAME_SPACE::Document::SwapShort(), and GDCM_NAME_SPACE::Document::SwitchByteSwapCode(). |
|
User supplied list of elements to Anonymize.
Definition at line 166 of file gdcmDocument.h. Referenced by AddAnonymizeElement(), AnonymizeFile(), and AnonymizeNoLoad(). |
|
User supplied list of elements to force Load.
Definition at line 169 of file gdcmDocument.h. Referenced by GDCM_NAME_SPACE::Document::AddForceLoadElement(). |