Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gdcm::File Class Reference

DICOM elements and their corresponding values (and additionaly the corresponding DICOM dictionary entry) of the header of a DICOM file. More...

#include <gdcmFile.h>

Inheritance diagram for gdcm::File:

Inheritance graph
[legend]
Collaboration diagram for gdcm::File:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::list< DicomElementListElements

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.
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.
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.
bool GetImageOrientationPatient (float iop[6])
 gets the info from 0020,0037 : Image Orientation Patient or from 0020 0035 : Image Orientation (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:
  • 8U unsigned 8 bit,
  • 8S signed 8 bit,
  • 16U unsigned 16 bit,
  • 16S signed 16 bit,
  • 32U unsigned 32 bit,
  • 32S signed 32 bit,
  • FD floating double 64 bits (Not kosher DICOM, but so usefull!).

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
float GetRescaleIntercept ()
 gets the info from 0028,1052 : Rescale Intercept
float 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 ...).
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
  • the (vtk) user is supposed to know how deal with LUTs -.

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).
RLEFramesInfoGetRLEInfo ()
 returns the RLE info
JPEGFragmentsInfoGetJPEGInfo ()
 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.
DictGetPubDict ()
 Get the public dictionary used.
DictGetShaDict ()
 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.
bool CloseFile ()
 closes the file
void WriteContent (std::ofstream *fp, FileType type)
 Writes in a file all the Entries (Dicom Elements).
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 LoadDocEntrySafe (DocEntry *entry)
 Loads the element while preserving the current underlying file position indicator as opposed to LoadDocEntry that modifies it.
void AddForceLoadElement (uint16_t group, uint16_t elem)
 Adds a new element we want to load anyway.
bool operator< (Document &document)
 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
DocEntryGetFirstEntry ()
 Get the first entry while visiting *the* 'zero level' DocEntrySet (DocEntries out of any Sequence).
DocEntryGetNextEntry ()
 Get the next entry while visiting *the* 'zero level' DocEntrySet (DocEntries out of any Sequence).
DocEntryGetDocEntry (uint16_t group, uint16_t elem)
 retrieves a Dicom Element using (group, element)
bool IsEmpty ()
 Tells us if the ElementSet contains no entry.
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..
DataEntryGetDataEntry (uint16_t group, uint16_t elem)
 Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type DataEntry.
SeqEntryGetSeqEntry (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 it's (group, element) and modifies it's content with the given value.
bool SetEntryString (std::string const &content, DataEntry *entry)
 Accesses an existing DocEntry (i.e. a Dicom Element) and modifies it's 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 it's (group, element) and modifies it's 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 it's content with the given value.
DataEntryInsertEntryString (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. Create it with the given value when unexistant.
DataEntryInsertEntryBinArea (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.
SeqEntryInsertSeqEntry (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.
DataEntryNewDataEntry (uint16_t group, uint16_t elem, VRKey const &vr=GDCM_VRUNKNOWN)
 Build a new DataEntry from all the low level arguments. Check for existence of dictionary entry, and build a default one when absent.
SeqEntryNewSeqEntry (uint16_t group, uint16_t elem)
 Build a new SeqEntry from all the low level arguments. Check for existence of dictionary entry, and build a default one when absent.
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 FileNew ()

Protected Member Functions

 File ()
 Constructor used when we want to generate dicom files from scratch.
 ~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)
 skips bytes inside the source file
int ComputeGroup0002Length ()
 Re-computes the length of the Dicom group 0002.
DictEntryGetDictEntry (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.
DictEntryGetDictEntry (uint16_t group, uint16_t elem, VRKey const &vr)
 Searches [both] the public [and the shadow dictionary (when they exist)] for the presence of the DictEntry with given group and element, and create a new virtual DictEntry if necessary.

Protected Attributes

RLEFramesInfoRLEInfo
 Store the RLE frames info obtained during parsing of pixels.
JPEGFragmentsInfoJPEGInfo
 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.
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 :
  • a 'Little Endian' image, read with a little endian processor will have a SwapCode= 1234 (the order is OK; nothing to do)
  • a 'Little Endian' image, read with a big endian procesor will have a SwapCode= 4321 (the order is wrong; int32 an int16 must be swapped) note : values 2143, 4321, 3412 remain for the ACR-NEMA time, and the well known 'Bad Big Endian' and 'Bad Little Endian' codes.

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
DictRefPubDict
 Public dictionary used to parse this header.
DictRefShaDict
 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
DocEntryPreviousDocEntry
 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

Detailed Description

DICOM elements and their corresponding values (and additionaly the corresponding DICOM dictionary entry) of the header of a DICOM file.

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.

Note:
The various entries of the explicit value representation (VR) shall be managed within a dictionary which is shared by all File instances.

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.


Member Typedef Documentation

typedef std::list<DicomElement> gdcm::Document::ListElements [inherited]
 

Definition at line 47 of file gdcmDocument.h.


Constructor & Destructor Documentation

gdcm::File::File  )  [protected]
 

Constructor used when we want to generate dicom files from scratch.

Definition at line 113 of file gdcmFile.cxx.

References BasicOffsetTableItemValue, GrPixel, JPEGInfo, NumPixel, and RLEInfo.

00113           :
00114    Document()
00115 {
00116    RLEInfo  = new RLEFramesInfo;
00117    JPEGInfo = new JPEGFragmentsInfo;
00118    GrPixel  = 0x7fe0;  // to avoid further troubles
00119    NumPixel = 0x0010;
00120    BasicOffsetTableItemValue = 0;
00121 }

gdcm::File::~File  )  [protected]
 

Canonical destructor.

Definition at line 127 of file gdcmFile.cxx.

References BasicOffsetTableItemValue, JPEGInfo, and RLEInfo.

00128 {
00129    if ( RLEInfo )
00130       delete RLEInfo;
00131    if ( JPEGInfo )
00132       delete JPEGInfo;
00133    delete[] BasicOffsetTableItemValue;
00134 }


Member Function Documentation

void gdcm::File::AddAnonymizeElement uint16_t  group,
uint16_t  elem,
std::string const &  value
 

Adds the characteristics of a new element we want to anonymize.

Parameters:
group Group number of the target tag.
elem Element number of the target tag.
value new value (string) to substitute with

Definition at line 1315 of file gdcmFile.cxx.

References gdcm::DicomElement::Elem, gdcm::DicomElement::Group, gdcm::Document::UserAnonymizeList, and gdcm::DicomElement::Value.

01317 { 
01318    DicomElement el;
01319    el.Group = group;
01320    el.Elem  = elem;
01321    el.Value = value;
01322    UserAnonymizeList.push_back(el); 
01323 }

bool gdcm::ElementSet::AddEntry DocEntry newEntry  )  [virtual, inherited]
 

add a new Dicom Element pointer to the H Table

Parameters:
newEntry entry to add

Implements gdcm::DocEntrySet.

Definition at line 78 of file gdcmElementSet.cxx.

References gdcmWarningMacro, gdcm::DocEntry::GetKey(), gdcm::RefCounter::Register(), and gdcm::ElementSet::TagHT.

Referenced by DoTheLoadingJob(), gdcm::DocEntryArchive::Push(), and gdcm::DocEntryArchive::Restore().

00079 {
00080    const TagKey &key = newEntry->GetKey();
00081 
00082    if ( TagHT.count(key) == 1 )
00083    {
00084       gdcmWarningMacro( "Key already present: " << key );
00085       return false;
00086    }
00087    else
00088    {
00089       TagHT.insert(TagDocEntryHT::value_type(newEntry->GetKey(), newEntry));
00090       newEntry->Register();
00091       return true;
00092    }
00093 }

void gdcm::Document::AddForceLoadElement uint16_t  group,
uint16_t  elem
[inherited]
 

Adds a new element we want to load anyway.

Parameters:
group Group number of the target tag.
elem Element number of the target tag.

Definition at line 279 of file gdcmDocument.cxx.

References gdcm::DicomElement::Elem, gdcm::DicomElement::Group, and gdcm::Document::UserForceLoadList.

00280 { 
00281    DicomElement el;
00282    el.Group = group;
00283    el.Elem  = elem;
00284    UserForceLoadList.push_back(el); 
00285 }

bool gdcm::File::AnonymizeFile  ) 
 

anonymize a File (remove Patient's personal info passed with AddAnonymizeElement()

Note:
You cannot Anonymize a DataEntry (to be fixed)

Definition at line 1374 of file gdcmFile.cxx.

References gdcm::GDCM_UNFOUND, gdcmWarningMacro, gdcm::ElementSet::GetDocEntry(), gdcm::DocEntrySet::GetEntryString(), gdcm::DocEntrySet::SetEntryString(), and gdcm::Document::UserAnonymizeList.

01375 {
01376    // If Anonymisation list is empty, let's perform some basic anonymization
01377    if ( UserAnonymizeList.begin() == UserAnonymizeList.end() )
01378    {
01379       // If exist, replace by spaces
01380       SetEntryString("  ",0x0010, 0x2154); // Telephone   
01381       SetEntryString("  ",0x0010, 0x1040); // Adress
01382       SetEntryString("  ",0x0010, 0x0020); // Patient ID
01383 
01384       DocEntry *patientNameHE = GetDocEntry (0x0010, 0x0010);
01385   
01386       if ( patientNameHE ) // we replace it by Study Instance UID (why not ?)
01387       {
01388          std::string studyInstanceUID =  GetEntryString (0x0020, 0x000d);
01389          if ( studyInstanceUID != GDCM_UNFOUND )
01390          {
01391             SetEntryString(studyInstanceUID, 0x0010, 0x0010);
01392          }
01393          else
01394          {
01395             SetEntryString("anonymized", 0x0010, 0x0010);
01396          }
01397       }
01398    }
01399    else
01400    {
01401       gdcm::DocEntry *d;
01402       for (ListElements::iterator it = UserAnonymizeList.begin();  
01403                                   it != UserAnonymizeList.end();
01404                                 ++it)
01405       {  
01406          d = GetDocEntry( (*it).Group, (*it).Elem);
01407 
01408          if ( d == NULL)
01409             continue;
01410 
01411          if ( dynamic_cast<SeqEntry *>(d) )
01412          {
01413             gdcmWarningMacro( "You cannot 'Anonymize' a SeqEntry ");
01414             continue;
01415          }
01416 
01417          if ( dynamic_cast<DataEntry *>(d) )
01418          {
01419             gdcmWarningMacro( "To 'Anonymize' a DataEntry, better use AnonymizeNoLoad (FIXME) ");
01420             continue;
01421          }
01422          else
01423             SetEntryString ((*it).Value, (*it).Group, (*it).Elem);
01424       }
01425 }
01426 
01427   // In order to make definitively impossible any further identification
01428   // remove or replace all the stuff that contains a Date
01429 
01430 //0008 0012 DA ID Instance Creation Date
01431 //0008 0020 DA ID Study Date
01432 //0008 0021 DA ID Series Date
01433 //0008 0022 DA ID Acquisition Date
01434 //0008 0023 DA ID Content Date
01435 //0008 0024 DA ID Overlay Date
01436 //0008 0025 DA ID Curve Date
01437 //0008 002a DT ID Acquisition Datetime
01438 //0018 9074 DT ACQ Frame Acquisition Datetime
01439 //0018 9151 DT ACQ Frame Reference Datetime
01440 //0018 a002 DT ACQ Contribution Date Time
01441 //0020 3403 SH REL Modified Image Date (RET)
01442 //0032 0032 DA SDY Study Verified Date
01443 //0032 0034 DA SDY Study Read Date
01444 //0032 1000 DA SDY Scheduled Study Start Date
01445 //0032 1010 DA SDY Scheduled Study Stop Date
01446 //0032 1040 DA SDY Study Arrival Date
01447 //0032 1050 DA SDY Study Completion Date
01448 //0038 001a DA VIS Scheduled Admission Date
01449 //0038 001c DA VIS Scheduled Discharge Date
01450 //0038 0020 DA VIS Admitting Date
01451 //0038 0030 DA VIS Discharge Date
01452 //0040 0002 DA PRC Scheduled Procedure Step Start Date
01453 //0040 0004 DA PRC Scheduled Procedure Step End Date
01454 //0040 0244 DA PRC Performed Procedure Step Start Date
01455 //0040 0250 DA PRC Performed Procedure Step End Date
01456 //0040 2004 DA PRC Issue Date of Imaging Service Request
01457 //0040 4005 DT PRC Scheduled Procedure Step Start Date and Time
01458 //0040 4011 DT PRC Expected Completion Date and Time
01459 //0040 a030 DT PRC Verification Date Time
01460 //0040 a032 DT PRC Observation Date Time
01461 //0040 a120 DT PRC DateTime
01462 //0040 a121 DA PRC Date
01463 //0040 a13a DT PRC Referenced Datetime
01464 //0070 0082 DA ??? Presentation Creation Date
01465 //0100 0420 DT ??? SOP Autorization Date and Time
01466 //0400 0105 DT ??? Digital Signature DateTime
01467 //2100 0040 DA PJ Creation Date
01468 //3006 0008 DA SSET Structure Set Date
01469 //3008 0024 DA ??? Treatment Control Point Date
01470 //3008 0054 DA ??? First Treatment Date
01471 //3008 0056 DA ??? Most Recent Treatment Date
01472 //3008 0162 DA ??? Safe Position Exit Date
01473 //3008 0166 DA ??? Safe Position Return Date
01474 //3008 0250 DA ??? Treatment Date
01475 //300a 0006 DA RT RT Plan Date
01476 //300a 022c DA RT Air Kerma Rate Reference Date
01477 //300e 0004 DA RT Review Date
01478 
01479    return true;
01480 }

void gdcm::File::AnonymizeNoLoad  ) 
 

Overwrites in the file the values of the DicomElements held in the list.

Definition at line 1329 of file gdcmFile.cxx.

References gdcm::Document::Filename, gdcmWarningMacro, gdcm::ElementSet::GetDocEntry(), and gdcm::Document::UserAnonymizeList.

01330 {
01331    std::fstream *fp = new std::fstream(Filename.c_str(), 
01332                               std::ios::in | std::ios::out | std::ios::binary); 
01333    gdcm::DocEntry *d;
01334    uint32_t offset;
01335    uint32_t lgth;
01336    uint32_t valLgth = 0;
01337    std::string *spaces;
01338    for (ListElements::iterator it = UserAnonymizeList.begin();  
01339                                it != UserAnonymizeList.end();
01340                              ++it)
01341    { 
01342       d = GetDocEntry( (*it).Group, (*it).Elem);
01343 
01344       if ( d == NULL)
01345          continue;
01346 
01347       if ( dynamic_cast<SeqEntry *>(d) )
01348       {
01349          gdcmWarningMacro( "You cannot 'Anonymize' a SeqEntry ");
01350          continue;
01351       }
01352 
01353       offset = d->GetOffset();
01354       lgth =   d->GetLength();
01355       if (valLgth < lgth)
01356       {
01357          spaces = new std::string( lgth-valLgth, ' ');
01358          (*it).Value = (*it).Value + *spaces;
01359          delete spaces;
01360       }
01361       fp->seekp( offset, std::ios::beg );
01362       fp->write( (*it).Value.c_str(), lgth );
01363      
01364    }
01365    fp->close();
01366    delete fp;
01367 }

void gdcm::Document::CallEndMethod  )  [protected, virtual, inherited]
 

CallEndMethod.

Definition at line 1007 of file gdcmDocument.cxx.

References gdcm::CMD_ENDPROGRESS, gdcm::CommandManager::ExecuteCommand(), and gdcm::Document::Progress.

Referenced by gdcm::DicomDir::CreateDicomDirChainedList().

01008 {
01009    Progress = 1.0f;
01010    CommandManager::ExecuteCommand(this,CMD_ENDPROGRESS);
01011 }

void gdcm::Document::CallProgressMethod  )  [protected, virtual, inherited]
 

CallProgressMethod.

Definition at line 999 of file gdcmDocument.cxx.

References gdcm::CMD_PROGRESS, and gdcm::CommandManager::ExecuteCommand().

Referenced by gdcm::DicomDir::CreateDicomDirChainedList().

01000 {
01001    CommandManager::ExecuteCommand(this,CMD_PROGRESS);
01002 }

void gdcm::Document::CallStartMethod  )  [protected, virtual, inherited]
 

CallStartMethod.

Definition at line 989 of file gdcmDocument.cxx.

References gdcm::Document::Abort, gdcm::CMD_STARTPROGRESS, gdcm::CommandManager::ExecuteCommand(), and gdcm::Document::Progress.

Referenced by gdcm::DicomDir::CreateDicomDirChainedList().

00990 {
00991    Progress = 0.0f;
00992    Abort    = false;
00993    CommandManager::ExecuteCommand(this,CMD_STARTPROGRESS);
00994 }

bool gdcm::DocEntrySet::CheckIfEntryExist uint16_t  group,
uint16_t  elem
[virtual, inherited]
 

Checks if a given Dicom Element exists within the DocEntrySet.

Parameters:
group Group number of the searched Dicom Element
elem Element number of the searched Dicom Element
Returns:
true is found

Definition at line 392 of file gdcmDocEntrySet.cxx.

References gdcm::DocEntrySet::GetDocEntry().

00393 {
00394    return GetDocEntry(group,elem)!=NULL;
00395 }

void gdcm::File::ClearAnonymizeList  )  [inline]
 

Clears the list of elements to be anonymized.

Definition at line 170 of file gdcmFile.h.

00170 { UserAnonymizeList.clear(); }      

void gdcm::ElementSet::ClearEntry  )  [virtual, inherited]
 

delete all entries in the ElementSet

Implements gdcm::DocEntrySet.

Definition at line 116 of file gdcmElementSet.cxx.

References gdcm::ElementSet::TagHT.

Referenced by gdcm::ElementSet::Copy(), gdcm::DicomDir::CreateDicomDir(), gdcm::Document::DoTheLoadingDocumentJob(), gdcm::DicomDir::SetElements(), and gdcm::ElementSet::~ElementSet().

00117 {
00118    for(TagDocEntryHT::iterator cc = TagHT.begin();cc != TagHT.end(); ++cc)
00119    {
00120       if ( cc->second )
00121       {
00122          cc->second->Unregister();
00123       }
00124    }
00125    TagHT.clear();
00126 }

bool gdcm::Document::CloseFile  )  [inherited]
 

closes the file

Returns:
TRUE if the close was successfull

Definition at line 647 of file gdcmDocument.cxx.

References gdcm::Document::Fp.

Referenced by gdcm::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), gdcm::FileHelper::GetRaw(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::OpenFile(), and gdcm::Document::~Document().

00648 {
00649    if ( Fp )
00650    {
00651       Fp->close();
00652       delete Fp;
00653       Fp = 0;
00654    }
00655    return true;
00656 }

int gdcm::Document::ComputeGroup0002Length  )  [protected, inherited]
 

Re-computes the length of the Dicom group 0002.

Definition at line 945 of file gdcmDocument.cxx.

References gdcm::DocEntry::GetElement(), gdcm::ElementSet::GetFirstEntry(), gdcm::DocEntry::GetGroup(), gdcm::DocEntry::GetLength(), gdcm::ElementSet::GetNextEntry(), and gdcm::DocEntry::GetVR().

Referenced by Write().

00946 {
00947    uint16_t gr;
00948    VRKey vr;
00949    
00950    int groupLength = 0;
00951    bool found0002 = false;   
00952   
00953    // for each zero-level Tag in the DCM Header
00954    DocEntry *entry = GetFirstEntry();
00955    while( entry )
00956    {
00957       gr = entry->GetGroup();
00958 
00959       if ( gr == 0x0002 )
00960       {
00961          found0002 = true;
00962 
00963          if ( entry->GetElement() != 0x0000 )
00964          {
00965             vr = entry->GetVR();
00966 
00967             //if ( (vr == "OB")||(vr == "OW")||(vr == "UT")||(vr == "SQ"))
00968             // (no SQ, OW, UT in group 0x0002;)
00969                if ( vr == "OB" ) 
00970                {
00971                   // explicit VR AND (OB, OW, SQ, UT) : 4 more bytes
00972                   groupLength +=  4;
00973                }
00974  
00975             groupLength += 2 + 2 + 4 + entry->GetLength();   
00976          }
00977       }
00978       else if (found0002 )
00979          break;
00980 
00981       entry = GetNextEntry();
00982    }
00983    return groupLength; 
00984 }

void gdcm::File::ComputeJPEGFragmentInfo  )  [private]
 

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 1653 of file gdcmFile.cxx.

References gdcm::JPEGFragmentsInfo::AddFragment(), BasicOffsetTableItemValue, gdcm::Document::Fp, gdcmWarningMacro, gdcm::Document::GetTransferSyntax(), gdcm::Global::GetTS(), JPEGInfo, ReadEncapsulatedBasicOffsetTable(), ReadTag(), ReadTagLength(), gdcm::JPEGFragment::SetLength(), gdcm::JPEGFragment::SetOffset(), and gdcm::Document::SkipBytes().

Referenced by DoTheLoadingJob().

01654 {
01655    // If you need to, look for comments of ComputeRLEInfo().
01656    std::string ts = GetTransferSyntax();
01657    if ( ! Global::GetTS()->IsJPEG(ts) )
01658    {
01659       return;
01660    }
01661 
01662    ReadEncapsulatedBasicOffsetTable();
01663 
01664    // Loop on the fragments[s] and store the parsed information in a
01665    // JPEGInfo.
01666    long fragmentLength;
01667    int i=0;
01668    uint32_t sum = 0;
01669    while ( (fragmentLength = ReadTagLength(0xfffe, 0xe000)) != 0 )
01670    { 
01671       // Since we have read the basic offset table, let's check the value were correct
01672       // or else produce a warning:
01673       // A.4 Transfer syntaxes for encapsulation of encoded pixel data:
01674       // When the Item Value is present, the Basic Offset Table Item Value shall contain
01675       // concatenated 32-bit unsigned integer values that are byte offsets to the first
01676       // byte of the Item Tag of the first fragment for each frame in the Sequence of
01677       // Items. These offsets are measured from the first byte of the first Item Tag
01678       // following the Basic Offset Table item (See Table A.4-2).
01679 
01680       if ( BasicOffsetTableItemValue )
01681         {
01682         // If a BasicOffsetTableItemValue was read
01683         uint32_t individualLength = BasicOffsetTableItemValue[i];
01684         //assert( individualLength == sum ); // Seems like 00191113.dcm is off by one ??
01685         if( individualLength != sum )
01686           {
01687           gdcmWarningMacro( "BasicOffsetTableItemValue differs from the fragment lenght:" <<
01688               individualLength << " != " << sum );
01689           }
01690         sum += fragmentLength + 8;
01691         i++;
01692         }
01693 
01694       long fragmentOffset = Fp->tellg();
01695       // Store the collected info
01696       JPEGFragment *newFragment = new JPEGFragment;
01697       newFragment->SetOffset(fragmentOffset);
01698       newFragment->SetLength(fragmentLength);
01699       JPEGInfo->AddFragment(newFragment);
01700 
01701       SkipBytes(fragmentLength);
01702    }
01703 
01704    // Make sure that  we encounter a 'Sequence Delimiter Item'
01705    // at the end of the item :
01706    if ( !ReadTag(0xfffe, 0xe0dd) )
01707    {
01708       gdcmWarningMacro( "No sequence delimiter item at end of JPEG item sequence");
01709    }
01710 }

void gdcm::File::ComputeRLEInfo  )  [private]
 

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 1541 of file gdcmFile.cxx.

References gdcm::RLEFramesInfo::AddFrame(), BasicOffsetTableItemValue, gdcm::Document::Fp, gdcmWarningMacro, gdcm::Document::GetTransferSyntax(), gdcm::Global::GetTS(), ReadEncapsulatedBasicOffsetTable(), gdcm::Document::ReadInt32(), ReadTag(), ReadTagLength(), RLEInfo, gdcm::RLEFrame::SetLength(), gdcm::RLEFrame::SetNumberOfFragments(), gdcm::RLEFrame::SetOffset(), and gdcm::Document::SkipBytes().

Referenced by DoTheLoadingJob().

01542 {
01543    std::string ts = GetTransferSyntax();
01544    if ( !Global::GetTS()->IsRLELossless(ts) ) 
01545    {
01546       return;
01547    }
01548 
01549    // Encoded pixel data: for the time being we are only concerned with
01550    // Jpeg or RLE Pixel data encodings.
01551    // As stated in PS 3.5-2003, section 8.2 p44:
01552    // "If sent in Encapsulated Format (i.e. other than the Native Format) the
01553    //  value representation OB is used".
01554    // Hence we expect an OB value representation. Concerning OB VR,
01555    // the section PS 3.5-2003, section A.4.c p 58-59, states:
01556    // "For the Value Representations OB and OW, the encoding shall meet the
01557    //   following specifications depending on the Data element tag:"
01558    //   [...snip...]
01559    //    - the first item in the sequence of items before the encoded pixel
01560    //      data stream shall be basic offset table item. The basic offset table
01561    //      item value, however, is not required to be present"
01562    ReadEncapsulatedBasicOffsetTable();
01563 
01564    // Encapsulated RLE Compressed Images (see PS 3.5-2003, Annex G)
01565    // Loop on the individual frame[s] and store the information
01566    // on the RLE fragments in a RLEFramesInfo.
01567    // Note: - when only a single frame is present, this is a
01568    //         classical image.
01569    //       - when more than one frame are present, then we are in 
01570    //         the case of a multi-frame image.
01571    long frameLength;
01572    int i=0;
01573    uint32_t sum = 0;
01574    while ( (frameLength = ReadTagLength(0xfffe, 0xe000)) != 0 )
01575    { 
01576       // Since we have read the basic offset table, let's check the value were correct
01577       // or else produce a warning:
01578       if ( BasicOffsetTableItemValue )
01579         {
01580         // If a BasicOffsetTableItemValue was read
01581         uint32_t individualLength = BasicOffsetTableItemValue[i];
01582         assert( individualLength == sum ); // REMOVE that if this is a problem
01583         if( individualLength != sum )
01584           {
01585           gdcmWarningMacro( "BasicOffsetTableItemValue differs from the fragment lenght" );
01586           }
01587         sum += frameLength + 8;
01588         i++;
01589         }
01590       // Parse the RLE Header and store the corresponding RLE Segment
01591       // Offset Table information on fragments of this current Frame.
01592       // Note that the fragment pixels themselves are not loaded
01593       // (but just skipped).
01594       long frameOffset = Fp->tellg();
01595 
01596       uint32_t nbRleSegments = ReadInt32();
01597       if ( nbRleSegments > 16 )
01598       {
01599          // There should be at most 15 segments (refer to RLEFrame class)
01600          gdcmWarningMacro( "Too many segments.");
01601       }
01602  
01603       uint32_t rleSegmentOffsetTable[16];
01604       for( int k = 1; k <= 15; k++ )
01605       {
01606          rleSegmentOffsetTable[k] = ReadInt32();
01607       }
01608 
01609       // Deduce from both RLE Header and frameLength 
01610       // the fragment length, and again store this info
01611       // in a RLEFramesInfo.
01612       long rleSegmentLength[15];
01613       // skipping (not reading) RLE Segments
01614       if ( nbRleSegments > 1)
01615       {
01616          for(unsigned int k = 1; k <= nbRleSegments-1; k++)
01617          {
01618              rleSegmentLength[k] =  rleSegmentOffsetTable[k+1]
01619                                   - rleSegmentOffsetTable[k];
01620              SkipBytes(rleSegmentLength[k]);
01621           }
01622        }
01623 
01624        rleSegmentLength[nbRleSegments] = frameLength 
01625                                       - rleSegmentOffsetTable[nbRleSegments];
01626        SkipBytes(rleSegmentLength[nbRleSegments]);
01627 
01628        // Store the collected info
01629        RLEFrame *newFrame = new RLEFrame;
01630        newFrame->SetNumberOfFragments(nbRleSegments);
01631        for( unsigned int uk = 1; uk <= nbRleSegments; uk++ )
01632        {
01633           newFrame->SetOffset(uk,frameOffset + rleSegmentOffsetTable[uk]);
01634           newFrame->SetLength(uk,rleSegmentLength[uk]);
01635        }
01636        RLEInfo->AddFrame(newFrame);
01637    }
01638 
01639    // Make sure that  we encounter a 'Sequence Delimiter Item'
01640    // at the end of the item :
01641    if ( !ReadTag(0xfffe, 0xe0dd) )
01642    {
01643       gdcmWarningMacro( "No sequence delimiter item at end of RLE item sequence");
01644    }
01645 }

void gdcm::ElementSet::Copy DocEntrySet set  )  [virtual, inherited]
 

Copies all the attributes from an other DocEntrySet.

Parameters:
set entry to copy from
Remarks:
The contained DocEntries a not copied, only referenced

Reimplemented from gdcm::DocEntrySet.

Reimplemented in gdcm::DicomDir.

Definition at line 178 of file gdcmElementSet.cxx.

References gdcm::ElementSet::ClearEntry(), gdcm::DocEntrySet::Copy(), gdcm::ElementSet::ItTagHT, and gdcm::ElementSet::TagHT.

Referenced by gdcm::DicomDir::Copy().

00179 {
00180    // Remove all previous entries
00181    ClearEntry();
00182 
00183    DocEntrySet::Copy(set);
00184 
00185    ElementSet *eltSet = dynamic_cast<ElementSet *>(set);
00186    if( eltSet )
00187    {
00188       TagHT = eltSet->TagHT;
00189       for(ItTagHT = TagHT.begin();ItTagHT != TagHT.end();++ItTagHT)
00190       {
00191          (ItTagHT->second)->Register();
00192       }
00193    }
00194 }

void gdcm::RefCounter::Delete  )  [inline, inherited]
 

Delete the object.

Remarks:
The object is deleted only if its reference counting is to zero

Definition at line 39 of file gdcmRefCounter.h.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::Document::Backtrack(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::FileHelper::CopyMandatoryEntry(), gdcm::DicomDir::CreateDicomDirChainedList(), DoTheLoadingJob(), gdcm::Dict::DoTheLoadingJob(), gdcm::DicomDirObject::FillObject(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), gdcm::DocEntrySet::InsertSeqEntry(), vtkGdcmReader::LoadFileInformation(), vtkGdcmReader::LoadImageInMemory(), main(), gdcm::DicomDir::NewMeta(), gdcm::DicomDirStudy::NewVisit(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::Document::ReadNextDocEntry(), gdcm::DicomDir::SetElement(), gdcm::FileHelper::SetMandatoryEntry(), gdcm::FileHelper::SetWriteFileTypeToExplicitVR(), gdcm::FileHelper::SetWriteFileTypeToImplicitVR(), gdcm::FileHelper::SetWriteFileTypeToJPEG(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), gdcm::FileHelper::SetWriteToRaw(), gdcm::FileHelper::SetWriteToRGB(), vtkGdcmWriter::WriteDcmFile(), gdcm::DicomDir::~DicomDir(), and gdcm::Global::~Global().

00039 { Unregister(); }

bool gdcm::File::DoTheLoadingJob  )  [private]
 

Does the Loading Job (internal use only).

Returns:
false if file cannot be open or no swap info was found, or no tag was found.

Definition at line 156 of file gdcmFile.cxx.

References gdcm::ElementSet::AddEntry(), gdcm::Document::CloseFile(), ComputeJPEGFragmentInfo(), ComputeRLEInfo(), gdcm::DataEntry::Copy(), gdcm::RefCounter::Delete(), gdcm::Document::Fp, gdcm::GDCM_UNFOUND, gdcm::DataEntry::GetBinArea(), GetBitsAllocated(), gdcm::ElementSet::GetDocEntry(), gdcm::DocEntrySet::GetEntryString(), gdcm::DocEntry::GetOffset(), gdcm::Document::GetTransferSyntax(), gdcm::Global::GetTS(), gdcm::DocEntry::GetVR(), GrPixel, gdcm::DataEntry::IsSelfArea(), gdcm::DataEntry::New(), gdcm::DictEntry::New(), NumPixel, gdcm::Document::OpenFile(), gdcm::ElementSet::RemoveEntry(), gdcm::DataEntry::SetBinArea(), and gdcm::DataEntry::SetSelfArea().

Referenced by Load().

00157 {
00158    // for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010
00159    // We may encounter the 'RETired' (0x0028, 0x0200) tag
00160    // (Image Location") . This entry contains the number of
00161    // the group that contains the pixel data (hence the "Pixel Data"
00162    // is found by indirection through the "Image Location").
00163    // Inside the group pointed by "Image Location" the searched element
00164    // is conventionally the element 0x0010 (when the norm is respected).
00165    // When the "Image Location" is missing we default to group 0x7fe0.
00166    // Note: this IS the right place for the code
00167  
00168    // Image Location
00169    const std::string &imgLocation = GetEntryString(0x0028, 0x0200);
00170    if ( imgLocation == GDCM_UNFOUND )
00171    {
00172       // default value
00173       GrPixel = 0x7fe0;
00174    }
00175    else
00176    {
00177       GrPixel = (uint16_t) atoi( imgLocation.c_str() );
00178    }   
00179 
00180    // sometimes Image Location value doesn't follow
00181    // the supposed processor endianness.
00182    // see gdcmData/cr172241.dcm
00183    if ( GrPixel == 0xe07f )
00184    {
00185       GrPixel = 0x7fe0;
00186    }
00187 
00188    if ( GrPixel != 0x7fe0 )
00189    {
00190       // This is a kludge for old dirty Philips imager.
00191       NumPixel = 0x1010;
00192    }
00193    else
00194    {
00195       NumPixel = 0x0010;
00196    }
00197 
00198    // Now, we know GrPixel and NumPixel.
00199    // Let's create a VirtualDictEntry to allow a further VR modification
00200    // and force VR to match with BitsAllocated.
00201    DocEntry *entry = GetDocEntry(GrPixel, NumPixel); 
00202    if ( entry != 0 )
00203    {
00204       // Compute the RLE or JPEG info
00205       OpenFile();
00206       const std::string &ts = GetTransferSyntax();
00207       Fp->seekg( entry->GetOffset(), std::ios::beg );
00208       if ( Global::GetTS()->IsRLELossless(ts) ) 
00209          ComputeRLEInfo();
00210       else if ( Global::GetTS()->IsJPEG(ts) )
00211          ComputeJPEGFragmentInfo();
00212       CloseFile();
00213 
00214       // Create a new DataEntry to change the DictEntry
00215       // The changed DictEntry will have 
00216       // - a correct PixelVR OB or OW)
00217       // - the name to "Pixel Data"
00218       DataEntry *oldEntry = dynamic_cast<DataEntry *>(entry);
00219       if (oldEntry)
00220       {
00221          VRKey PixelVR;
00222          // 8 bits allocated is a 'O Bytes' , as well as 24 (old ACR-NEMA RGB)
00223          // more than 8 (i.e 12, 16) is a 'O Words'
00224          if ( GetBitsAllocated() == 8 || GetBitsAllocated() == 24 ) 
00225             PixelVR = "OB";
00226          else
00227             PixelVR = "OW";
00228 
00229          // Change only made if usefull
00230          if ( PixelVR != oldEntry->GetVR() )
00231          {
00232             DictEntry* newDict = DictEntry::New(GrPixel,NumPixel,
00233                                                 PixelVR,"1","Pixel Data");
00234 
00235             DataEntry *newEntry = DataEntry::New(newDict);
00236             newDict->Delete();
00237             newEntry->Copy(entry);
00238             newEntry->SetBinArea(oldEntry->GetBinArea(),oldEntry->IsSelfArea());
00239             oldEntry->SetSelfArea(false);
00240 
00241             RemoveEntry(oldEntry);
00242             AddEntry(newEntry);
00243             newEntry->Delete();
00244          }
00245       }
00246    }
00247    return true;
00248 }

gdcm::File::gdcmTypeMacro File   )  [private]
 

int gdcm::File::GetBitsAllocated  ) 
 

Retrieve the number of Bits Allocated (8, 12 -compacted ACR-NEMA files-, 16, 24 -old RGB ACR-NEMA files-,).

Returns:
The encountered Number of Bits Allocated, 0 by default. 0 means the file is NOT USABLE. The caller has to check it !

Definition at line 842 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckWriteIntegrity(), DoTheLoadingJob(), gdcm::PixelReadConvert::GrabInformationsFromFile(), gdcm::FileHelper::SetWriteToRaw(), gdcm::FileHelper::SetWriteToRGB(), userSuppliedMirrorFunction(), and userSuppliedTopDownFunction().

00843 {
00844    DataEntry *entry = GetDataEntry(0x0028,0x0100);
00845    if( !entry )
00846    {
00847       gdcmWarningMacro("BitsAllocated (0028,0100) is supposed to be mandatory");
00848       return 0;
00849    }
00850    return (int)entry->GetValue(0);
00851 }

int gdcm::File::GetBitsStored  ) 
 

Retrieve the number of Bits Stored (actually used) (as opposed to number of Bits Allocated).

Returns:
The encountered number of Bits Stored, 0 by default. 0 means the file is NOT USABLE. The caller has to check it !

Definition at line 825 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by gdcm::FileHelper::CheckMandatoryElements(), and gdcm::PixelReadConvert::GrabInformationsFromFile().

00826 {
00827    DataEntry *entry = GetDataEntry(0x0028,0x0101);
00828    if( !entry )
00829    {
00830       gdcmWarningMacro("BitsStored (0028,0101) is supposed to be mandatory");
00831       return 0;
00832    }
00833    return (int)entry->GetValue(0);
00834 }

DataEntry * gdcm::DocEntrySet::GetDataEntry uint16_t  group,
uint16_t  elem
[inherited]
 

Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type DataEntry.

Parameters:
group Group number of the searched Dicom Element
elem Element number of the searched Dicom Element
Returns:
When present, the corresponding DataEntry.

Definition at line 99 of file gdcmDocEntrySet.cxx.

References gdcm::DocEntrySet::GetDocEntry().

Referenced by gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::Document::DoTheLoadingDocumentJob(), GetBitsAllocated(), GetBitsStored(), gdcm::DocEntrySet::GetEntryBinArea(), GetHighBitPosition(), GetPlanarConfiguration(), GetRescaleIntercept(), GetRescaleSlope(), GetSamplesPerPixel(), GetXOrigin(), GetXSize(), GetXSpacing(), GetYOrigin(), GetYSize(), GetYSpacing(), GetZOrigin(), GetZSize(), GetZSpacing(), IsSignedPixelData(), gdcm::ElementSet::Print(), gdcm::DocEntrySet::SetEntryBinArea(), gdcm::DocEntrySet::SetEntryString(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), userSuppliedLessThanFunction(), gdcm::FileHelper::Write(), Write(), and gdcm::DicomDirMeta::WriteContent().

00100 {
00101    DocEntry *currentEntry = GetDocEntry(group, elem);
00102    if ( !currentEntry )
00103       return NULL;
00104 
00105    return dynamic_cast<DataEntry*>(currentEntry);
00106 }

DictEntry * gdcm::DocEntrySet::GetDictEntry uint16_t  group,
uint16_t  elem,
VRKey const &  vr
[protected, inherited]
 

Searches [both] the public [and the shadow dictionary (when they exist)] for the presence of the DictEntry with given group and element, and create a new virtual DictEntry if necessary.

Parameters:
group group number of the searched DictEntry
elem element number of the searched DictEntry
vr V(alue) R(epresentation) to use, if necessary
Returns:
Corresponding DictEntry when it exists, NULL otherwise.
Remarks:
The returned DictEntry is registered

Definition at line 484 of file gdcmDocEntrySet.cxx.

References gdcm::GDCM_VRUNKNOWN, gdcmWarningMacro, gdcm::DocEntrySet::GetDictEntry(), gdcm::DictEntry::GetVM(), gdcm::DictEntry::GetVR(), gdcm::DictEntry::New(), gdcm::RefCounter::Register(), and gdcm::RefCounter::Unregister().

00486 {
00487    DictEntry *dictEntry = GetDictEntry(group,elem);
00488    DictEntry *goodEntry = dictEntry;
00489    VRKey goodVR = vr;
00490    TagName vm;
00491    if (elem == 0x0000) 
00492       goodVR="UL";
00493 
00494    if ( goodEntry )
00495    {
00496       if ( goodVR != goodEntry->GetVR()
00497         && goodVR != GDCM_VRUNKNOWN )
00498       { 
00499          gdcmWarningMacro("For (" << std::hex << group << "|"
00500             << elem << "), found VR : [" << vr << "]"
00501             << " expected: [" << goodEntry->GetVR() << "]" ) ;
00502         // avoid confusing further validator with "FIXME" VM
00503         // when possible      
00504          vm = dictEntry->GetVM();
00505          goodEntry = NULL;
00506       }
00507       dictEntry->Unregister();
00508    }
00509    else
00510    {
00511       vm = "FIXME";
00512    }
00513    // Create a new virtual DictEntry if necessary
00514    if (!goodEntry)
00515    {
00516       if (dictEntry)
00517       {
00518 
00519          goodEntry = DictEntry::New(group, elem, goodVR, vm,//"FIXME", 
00520                                     dictEntry->GetName() );
00521       }
00522       else
00523       {
00524          goodEntry = DictEntry::New(group, elem, goodVR);
00525       }
00526    }
00527    else
00528    {
00529       goodEntry->Register();
00530    }
00531    return goodEntry;
00532 }

DictEntry * gdcm::DocEntrySet::GetDictEntry uint16_t  group,
uint16_t  elem
[protected, inherited]
 

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.

Parameters:
group Group number of the searched DictEntry
elem Element number of the searched DictEntry
Returns:
Corresponding DictEntry when it exists, NULL otherwise.
Remarks:
The returned DictEntry is registered when existing

Definition at line 457 of file gdcmDocEntrySet.cxx.

References gdcmWarningMacro, gdcm::DictSet::GetDefaultPubDict(), gdcm::Global::GetDicts(), gdcm::Dict::GetEntry(), and gdcm::RefCounter::Register().

Referenced by gdcm::DocEntrySet::GetDictEntry(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), and gdcm::Document::ReadNextDocEntry().

00458 {
00459    DictEntry *found = 0;
00460    Dict *pubDict = Global::GetDicts()->GetDefaultPubDict();
00461    if (!pubDict) 
00462    {
00463       gdcmWarningMacro( "We SHOULD have a default dictionary");
00464    }
00465    else
00466    {
00467       found = pubDict->GetEntry(group, elem);
00468       if( found )
00469          found->Register();
00470    }
00471    return found;
00472 }

DocEntry * gdcm::ElementSet::GetDocEntry uint16_t  group,
uint16_t  elem
[virtual, inherited]
 

retrieves a Dicom Element using (group, element)

Parameters:
group Group number of the searched Dicom Element
elem Element number of the searched Dicom Element
Returns:

Implements gdcm::DocEntrySet.

Definition at line 163 of file gdcmElementSet.cxx.

References gdcm::ElementSet::TagHT, and gdcm::DictEntry::TranslateToKey().

Referenced by AnonymizeFile(), AnonymizeNoLoad(), gdcm::FileHelper::CopyDataEntry(), gdcm::DicomDir::CreateDicomDir(), gdcm::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), gdcm::DicomDir::DoTheLoadingJob(), GetPixelAreaLength(), GetPixelOffset(), gdcm::Document::GetTransferSyntax(), HasLUT(), gdcm::Document::IsDicomV3(), gdcm::Document::IsPapyrus(), IsReadable(), gdcm::Document::LoadEntryBinArea(), gdcm::DocEntryArchive::Push(), and gdcm::DocEntryArchive::Restore().

00164 {
00165    TagKey key = DictEntry::TranslateToKey(group, elem);
00166    TagDocEntryHT::iterator it = TagHT.find(key);
00167 
00168    if ( it!=TagHT.end() )
00169       return it->second;
00170    return NULL;
00171 }

void * gdcm::DocEntrySet::GetEntryBinArea uint16_t  group,
uint16_t  elem
[virtual, inherited]
 

Gets (from Header) a 'non string' element value.

Parameters:
group group number of the Entry
elem element number of the Entry
Returns:
Pointer to the 'non string' area

Definition at line 69 of file gdcmDocEntrySet.cxx.

References gdcm::DataEntry::GetBinArea(), and gdcm::DocEntrySet::GetDataEntry().

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

00070 {
00071    DataEntry *entry = GetDataEntry(group, elem);
00072    if ( entry )
00073       return entry->GetBinArea();
00074    return 0;
00075 }

int gdcm::DocEntrySet::GetEntryLength uint16_t  group,
uint16_t  elem
[virtual, inherited]
 

Searches within the DocEntrySet for the value length of a given tag..

Parameters:
group Group number of the searched tag.
elem Element number of the searched tag.
Returns:
Corresponding element length; -1 if not found

Definition at line 84 of file gdcmDocEntrySet.cxx.

References gdcm::DocEntrySet::GetDocEntry(), and gdcm::DocEntry::GetLength().

Referenced by gdcm::DicomDir::SetElement(), and Write().

00085 {
00086    DocEntry *entry = GetDocEntry(group, elem);
00087    if ( entry )
00088       return entry->GetLength();
00089    return -1;
00090 }

std::string gdcm::DocEntrySet::GetEntryString uint16_t  group,
uint16_t  elem
[virtual, inherited]
 

Get the "std::string representable" value of the Dicom entry.

Parameters:
group Group number of the searched tag.
elem Element number of the searched tag.
Returns:
Corresponding element value when it exists, and the string GDCM_UNFOUND otherwise.

Definition at line 47 of file gdcmDocEntrySet.cxx.

References gdcm::GDCM_NOTLOADED, gdcm::GDCM_UNFOUND, gdcm::GDCM_UNREAD, gdcm::DocEntrySet::GetDocEntry(), gdcm::DataEntry::GetString(), gdcm::DataEntry::IsNotLoaded(), gdcm::DataEntry::IsUnfound(), and gdcm::DataEntry::IsUnread().

Referenced by gdcm::SerieHelper::AddFileName(), AnonymizeFile(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::SerieHelper::CreateUniqueSeriesIdentifier(), gdcm::SerieHelper::CreateUserDefinedFileIdentifier(), gdcm::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), GetImageNumber(), GetImageOrientationPatient(), GetLUTNbits(), GetModality(), GetNumberOfScalarComponents(), GetNumberOfScalarComponentsRaw(), GetPixelSize(), GetPixelType(), gdcm::Document::GetTransferSyntaxName(), gdcm::PixelReadConvert::GrabInformationsFromFile(), IsMonochrome(), IsMonochrome1(), IsPaletteColor(), IsReadable(), IsYBRFull(), gdcm::Document::operator<(), and gdcm::DicomDir::SetElement().

00048 {
00049    DataEntry *entry = dynamic_cast<DataEntry *>(GetDocEntry(group,elem));
00050    if ( entry )
00051    {
00052       if( entry->IsNotLoaded() )
00053          return GDCM_NOTLOADED;
00054       if( entry->IsUnfound() )
00055          return GDCM_UNFOUND;
00056       if( entry->IsUnread() )
00057          return GDCM_UNREAD;
00058       return entry->GetString();
00059    }
00060    return GDCM_UNFOUND;
00061 }

const std::string& gdcm::Document::GetFileName  )  const [inline, inherited]
 

Accessor to Filename.

Definition at line 77 of file gdcmDocument.h.

Referenced by gdcm::DicomDir::DoTheLoadingJob(), gdcm::SerieHelper::FileNameGreaterThan(), gdcm::SerieHelper::FileNameLessThan(), gdcm::Document::IsParsable(), gdcm::DicomDir::IsReadable(), gdcm::Document::Load(), vtkGdcmReader::LoadImageInMemory(), gdcm::DicomDir::ParseDirectory(), gdcm::DicomDir::SetElement(), vtkGdcmReader::TestFileInformation(), and userSuppliedLessThanFunction2().

00077 { return Filename; }

FileType gdcm::Document::GetFileType  )  [inherited]
 

returns the File Type (ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown)

Returns:
the FileType code

Definition at line 392 of file gdcmDocument.cxx.

References gdcm::Document::Filetype.

00393 {
00394    return Filetype;
00395 }

DocEntry * gdcm::ElementSet::GetFirstEntry  )  [virtual, inherited]
 

Get the first entry while visiting *the* 'zero level' DocEntrySet (DocEntries out of any Sequence).

Returns:
The first DocEntry if found, otherwhise NULL

Implements gdcm::DocEntrySet.

Definition at line 133 of file gdcmElementSet.cxx.

References gdcm::ElementSet::ItTagHT, and gdcm::ElementSet::TagHT.

Referenced by gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDir::DoTheLoadingJob(), gdcm::DicomDir::NewMeta(), and gdcm::Validator::SetInput().

00134 {
00135    ItTagHT = TagHT.begin();
00136    if (ItTagHT != TagHT.end())
00137       return  ItTagHT->second;
00138    return NULL;
00139 }

uint16_t gdcm::File::GetGrPixel  )  [inline]
 

Accessor to File::GrPixel.

Definition at line 154 of file gdcmFile.h.

00154 { return GrPixel; }

int gdcm::File::GetHighBitPosition  ) 
 

Retrieve the high bit position.

Warning:
The method defaults to 0 when information is missing. The responsability of checking this value is left to the caller.
Returns:
The high bit position when present. 0 when missing.

Definition at line 859 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by gdcm::FileHelper::CheckMandatoryElements(), and gdcm::PixelReadConvert::GrabInformationsFromFile().

00860 {
00861    DataEntry *entry = GetDataEntry(0x0028,0x0102);
00862    if( !entry )
00863    {
00864       gdcmWarningMacro("HighBitPosition (0028,0102) is supposed to be mandatory");
00865       return 0;
00866    }
00867    return (int)entry->GetValue(0);
00868 }

int gdcm::File::GetImageNumber  ) 
 

gets the info from 0020,0013 : Image Number else 0.

Returns:
image number

Definition at line 318 of file gdcmFile.cxx.

References gdcm::GDCM_UNFOUND, and gdcm::DocEntrySet::GetEntryString().

Referenced by gdcm::SerieHelper::ImageNumberGreaterThan(), and gdcm::SerieHelper::ImageNumberLessThan().

00319 {
00320    //0020 0013 : Image Number
00321    std::string strImNumber = GetEntryString(0x0020,0x0013);
00322    if ( strImNumber != GDCM_UNFOUND )
00323    {
00324       return atoi( strImNumber.c_str() );
00325    }
00326    return 0;   //Hopeless
00327 }

bool gdcm::File::GetImageOrientationPatient float  iop[6]  ) 
 

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)

Parameters:
iop adress of the (6)float array to receive values. (defaulted as 1.,0.,0.,0.,1.,0. if nothing -or inconsistent stuff- is found.
Returns:
true when one of the tag -with consistent values- is found false when nothing or inconsistent stuff - is found

Definition at line 780 of file gdcmFile.cxx.

References gdcm::GDCM_UNFOUND, gdcmWarningMacro, and gdcm::DocEntrySet::GetEntryString().

Referenced by gdcm::Orientation::GetOrientation(), and gdcm::Orientation::GetOrientationType().

00781 {
00782    std::string strImOriPat;
00783    //iop is supposed to be float[6]
00784 
00785    // 0020 0037 DS REL Image Orientation (Patient)
00786    if ( (strImOriPat = GetEntryString(0x0020,0x0037)) != GDCM_UNFOUND )
00787    {
00788       if ( sscanf( strImOriPat.c_str(), "%f \\ %f \\%f \\%f \\%f \\%f ", 
00789           &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 )
00790       {
00791          iop[0] = iop[4] = 1.;
00792          iop[1] = iop[2] = iop[3] = iop[5] = 0.;
00793          gdcmWarningMacro( "Wrong Image Orientation Patient (0020,0037)."
00794                         << " Less than 6 values were found." );
00795          return false;
00796       }
00797       else 
00798          return true;
00799    }
00800    //For ACR-NEMA
00801    // 0020 0035 DS REL Image Orientation (RET)
00802    else if ( (strImOriPat = GetEntryString(0x0020,0x0035)) != GDCM_UNFOUND )
00803    {
00804       if ( sscanf( strImOriPat.c_str(), "%f \\ %f \\%f \\%f \\%f \\%f ", 
00805           &iop[0], &iop[1], &iop[2], &iop[3], &iop[4], &iop[5]) != 6 )
00806       {
00807          iop[0] = iop[4] = 1.;
00808          iop[1] = iop[2] = iop[3] = iop[5] = 0.;
00809          gdcmWarningMacro( "wrong Image Orientation Patient (0020,0035). "
00810                         << "Less than 6 values were found." );
00811          return false;
00812       }
00813       else
00814          return true;
00815    }
00816    return false;
00817 }

JPEGFragmentsInfo* gdcm::File::GetJPEGInfo  )  [inline]
 

Returns the JPEG Fragments info.

Definition at line 164 of file gdcmFile.h.

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

00164 { return JPEGInfo; }

int gdcm::File::GetLUTNbits  ) 
 

gets the info from 0028,1101 : Lookup Table Desc-Red else 0

Returns:
Lookup Table number of Bits , 0 by default when (0028,0004),Photometric Interpretation = [PALETTE COLOR ] @ return bit number of each LUT item

Definition at line 1139 of file gdcmFile.cxx.

References gdcm::GDCM_UNFOUND, gdcm::DocEntrySet::GetEntryString(), and gdcm::Util::Tokenize().

01140 {
01141    std::vector<std::string> tokens;
01142    int lutNbits;
01143 
01144    //Just hope Lookup Table Desc-Red = Lookup Table Desc-Red
01145    //                                = Lookup Table Desc-Blue
01146    // Consistency already checked in GetLUTLength
01147    std::string lutDescription = GetEntryString(0x0028,0x1101);
01148    if ( lutDescription == GDCM_UNFOUND )
01149    {
01150       return 0;
01151    }
01152 
01153    tokens.clear(); // clean any previous value
01154    Util::Tokenize ( lutDescription, tokens, "\\" );
01155    //LutLength=atoi(tokens[0].c_str());
01156    //LutDepth=atoi(tokens[1].c_str());
01157 
01158    lutNbits = atoi( tokens[2].c_str() );
01159    tokens.clear();
01160 
01161    return lutNbits;
01162 }

ModalityType gdcm::File::GetModality  ) 
 

gets the info from 0008,0060 : Modality

Returns:
Modality Type
Todo:
throw error return value ??? specified <> unknown in our database

Definition at line 333 of file gdcmFile.cxx.

References gdcm::AS, gdcm::AU, gdcm::BI, gdcm::CF, gdcm::CP, gdcm::CR, gdcm::CS, gdcm::CT, gdcm::DD, gdcm::DF, gdcm::DG, gdcm::DM, gdcm::DS, gdcm::DX, gdcm::ECG, gdcm::EPS, gdcm::FA, gdcm::FS, gdcm::GDCM_UNFOUND, gdcm::DocEntrySet::GetEntryString(), gdcm::HC, gdcm::HD, gdcm::LP, gdcm::LS, gdcm::MA, gdcm::MR, gdcm::NM, gdcm::OT, gdcm::PT, gdcm::RF, gdcm::RG, gdcm::RTDOSE, gdcm::RTIMAGE, gdcm::RTPLAN, gdcm::RTSTRUCT, gdcm::SM, gdcm::ST, gdcm::TG, gdcm::Unknow, gdcm::US, gdcm::VF, gdcm::XA, and gdcm::XC.

00334 {
00335    // 0008 0060 : Modality
00336    std::string strModality = GetEntryString(0x0008,0x0060);
00337    if ( strModality != GDCM_UNFOUND )
00338    {
00339            if ( strModality.find("AU")  < strModality.length()) return AU;
00340       else if ( strModality.find("AS")  < strModality.length()) return AS;
00341       else if ( strModality.find("BI")  < strModality.length()) return BI;
00342       else if ( strModality.find("CF")  < strModality.length()) return CF;
00343       else if ( strModality.find("CP")  < strModality.length()) return CP;
00344       else if ( strModality.find("CR")  < strModality.length()) return CR;
00345       else if ( strModality.find("CT")  < strModality.length()) return CT;
00346       else if ( strModality.find("CS")  < strModality.length()) return CS;
00347       else if ( strModality.find("DD")  < strModality.length()) return DD;
00348       else if ( strModality.find("DF")  < strModality.length()) return DF;
00349       else if ( strModality.find("DG")  < strModality.length()) return DG;
00350       else if ( strModality.find("DM")  < strModality.length()) return DM;
00351       else if ( strModality.find("DS")  < strModality.length()) return DS;
00352       else if ( strModality.find("DX")  < strModality.length()) return DX;
00353       else if ( strModality.find("ECG") < strModality.length()) return ECG;
00354       else if ( strModality.find("EPS") < strModality.length()) return EPS;
00355       else if ( strModality.find("FA")  < strModality.length()) return FA;
00356       else if ( strModality.find("FS")  < strModality.length()) return FS;
00357       else if ( strModality.find("HC")  < strModality.length()) return HC;
00358       else if ( strModality.find("HD")  < strModality.length()) return HD;
00359       else if ( strModality.find("LP")  < strModality.length()) return LP;
00360       else if ( strModality.find("LS")  < strModality.length()) return LS;
00361       else if ( strModality.find("MA")  < strModality.length()) return MA;
00362       else if ( strModality.find("MR")  < strModality.length()) return MR;
00363       else if ( strModality.find("NM")  < strModality.length()) return NM;
00364       else if ( strModality.find("OT")  < strModality.length()) return OT;
00365       else if ( strModality.find("PT")  < strModality.length()) return PT;
00366       else if ( strModality.find("RF")  < strModality.length()) return RF;
00367       else if ( strModality.find("RG")  < strModality.length()) return RG;
00368       else if ( strModality.find("RTDOSE")   
00369                                         < strModality.length()) return RTDOSE;
00370       else if ( strModality.find("RTIMAGE")  
00371                                         < strModality.length()) return RTIMAGE;
00372       else if ( strModality.find("RTPLAN")
00373                                         < strModality.length()) return RTPLAN;
00374       else if ( strModality.find("RTSTRUCT") 
00375                                         < strModality.length()) return RTSTRUCT;
00376       else if ( strModality.find("SM")  < strModality.length()) return SM;
00377       else if ( strModality.find("ST")  < strModality.length()) return ST;
00378       else if ( strModality.find("TG")  < strModality.length()) return TG;
00379       else if ( strModality.find("US")  < strModality.length()) return US;
00380       else if ( strModality.find("VF")  < strModality.length()) return VF;
00381       else if ( strModality.find("XA")  < strModality.length()) return XA;
00382       else if ( strModality.find("XC")  < strModality.length()) return XC;
00383 
00384       else
00385       {
00388          return Unknow;
00389       }
00390    }
00391    return Unknow;
00392 }

DocEntry * gdcm::ElementSet::GetNextEntry  )  [virtual, inherited]
 

Get the next entry while visiting *the* 'zero level' DocEntrySet (DocEntries out of any Sequence).

Note:
: meaningfull only if GetFirstEntry already called
Returns:
The next DocEntry if found, otherwhise NULL

Implements gdcm::DocEntrySet.

Definition at line 147 of file gdcmElementSet.cxx.

References gdcmAssertMacro, gdcm::ElementSet::ItTagHT, and gdcm::ElementSet::TagHT.

Referenced by gdcm::Document::ComputeGroup0002Length(), and gdcm::Validator::SetInput().

00148 {
00149    gdcmAssertMacro (ItTagHT != TagHT.end());
00150 
00151    ++ItTagHT;
00152    if (ItTagHT != TagHT.end())
00153       return  ItTagHT->second;
00154    return NULL;
00155 }

int gdcm::File::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 ...).

Warning:
to be used with GetImagePixels()
Returns:
1 if Gray level, 3 if Color (RGB, YBR, *or PALETTE COLOR*)

Definition at line 1204 of file gdcmFile.cxx.

References gdcm::Util::DicomStringEqual(), gdcm::GDCM_UNFOUND, gdcm::DocEntrySet::GetEntryString(), GetSamplesPerPixel(), and HasLUT().

Referenced by vtkGdcmReader::GetFileInformation(), vtkGdcmReader::LoadImageInMemory(), gdcm::FileHelper::SetWriteToRaw(), gdcm::FileHelper::SetWriteToRGB(), and vtkGdcmReader::TestFileInformation().

01205 {
01206    if ( GetSamplesPerPixel() == 3 )
01207    {
01208       return 3;
01209    }
01210 
01211    // 0028 0100 US IMG Bits Allocated
01212    // (in order no to be messed up by old RGB images)
01213    if ( GetEntryString(0x0028,0x0100) == "24" )
01214    {
01215       return 3;
01216    }
01217 
01218    std::string strPhotometricInterpretation = GetEntryString(0x0028,0x0004);
01219 
01220    if ( ( strPhotometricInterpretation == "PALETTE COLOR ") )
01221    {
01222       if ( HasLUT() )// PALETTE COLOR is NOT enough
01223       {
01224          return 3;
01225       }
01226       else
01227       {
01228          return 1;
01229       }
01230    }
01231 
01232    // beware of trailing space at end of string      
01233    // DICOM tags are never of odd length
01234    if ( strPhotometricInterpretation == GDCM_UNFOUND   || 
01235         Util::DicomStringEqual(strPhotometricInterpretation, "MONOCHROME1") ||
01236         Util::DicomStringEqual(strPhotometricInterpretation, "MONOCHROME2") )
01237    {
01238       return 1;
01239    }
01240    else
01241    {
01242       // we assume that *all* kinds of YBR are dealt with
01243       return 3;
01244    }
01245 }

int gdcm::File::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

  • the (vtk) user is supposed to know how deal with LUTs -.

Warning:
to be used with GetImagePixelsRaw()
Returns:
1 if Gray level, 3 if Color (RGB or YBR - NOT 'PALETTE COLOR' -)

Definition at line 1254 of file gdcmFile.cxx.

References gdcm::DocEntrySet::GetEntryString(), and GetSamplesPerPixel().

Referenced by vtkGdcmReader::GetFileInformation(), vtkGdcmReader::LoadImageInMemory(), and vtkGdcmReader::TestFileInformation().

01255 {
01256    // 0028 0100 US IMG Bits Allocated
01257    // (in order no to be messed up by old RGB images)
01258    if ( File::GetEntryString(0x0028,0x0100) == "24" )
01259    {
01260       return 3;
01261    }
01262 
01263    // we assume that *all* kinds of YBR are dealt with
01264    return GetSamplesPerPixel();
01265 }

uint16_t gdcm::File::GetNumPixel  )  [inline]
 

Accessor to File::NumPixel.

Definition at line 156 of file gdcmFile.h.

00156 { return NumPixel; }

size_t gdcm::File::GetPixelAreaLength  ) 
 

Recover the pixel area length (in Bytes).

Returns:
Pixel Element Length, as stored in the header (NOT the memory space necessary to hold the Pixels -in case of embeded compressed image-) 0 : NOT USABLE file. The caller has to check.

Definition at line 1294 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::ElementSet::GetDocEntry(), gdcm::DocEntry::GetLength(), GrPixel, and NumPixel.

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

01295 {
01296    DocEntry *pxlElement = GetDocEntry(GrPixel, NumPixel);
01297    if ( pxlElement )
01298    {
01299       return pxlElement->GetLength();
01300    }
01301    else
01302    {
01303       gdcmWarningMacro( "Big trouble : Pixel Element ("
01304                       << std::hex << GrPixel<<","<< NumPixel<< ") NOT found" );
01305       return 0;
01306    }
01307 }

size_t gdcm::File::GetPixelOffset  ) 
 

Recover the offset (from the beginning of the file) of *image* pixels (not *icone image* pixels, if any !).

Returns:
Pixel Offset

Definition at line 1272 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::ElementSet::GetDocEntry(), gdcm::DocEntry::GetOffset(), GrPixel, and NumPixel.

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

01273 {
01274    DocEntry *pxlElement = GetDocEntry(GrPixel, NumPixel);
01275    if ( pxlElement )
01276    {
01277       return pxlElement->GetOffset();
01278    }
01279    else
01280    {
01281       gdcmWarningMacro( "Big trouble : Pixel Element ("
01282                       << std::hex << GrPixel<<","<< NumPixel<< ") NOT found" );
01283       return 0;
01284    }
01285 }

int gdcm::File::GetPixelSize  ) 
 

Return the size (in bytes) of a single pixel of data.

Returns:
The size in bytes of a single pixel of data; 0 by default 0 means the file is NOT USABLE; the caller will have to check

Definition at line 908 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetEntryString(), and GetPixelType().

Referenced by vtkGdcmReader::GetFileInformation(), vtkGdcmReader::LoadImageInMemory(), and vtkGdcmReader::TestFileInformation().

00909 {
00910    // 0028 0100 US IMG Bits Allocated
00911    // (in order no to be messed up by old ACR-NEMA RGB images)
00912    assert( !(GetEntryString(0x0028,0x0100) == "24") );
00913 
00914    std::string pixelType = GetPixelType();
00915    if ( pixelType ==  "8U" || pixelType == "8S" )
00916    {
00917       return 1;
00918    }
00919    if ( pixelType == "16U" || pixelType == "16S")
00920    {
00921       return 2;
00922    }
00923    if ( pixelType == "32U" || pixelType == "32S")
00924    {
00925       return 4;
00926    }
00927    if ( pixelType == "FD" )
00928    {
00929       return 8;
00930    }
00931    gdcmWarningMacro( "Unknown pixel type: " << pixelType);
00932    return 0;
00933 }

std::string gdcm::File::GetPixelType  ) 
 

Build the Pixel Type of the image. Possible values are:

  • 8U unsigned 8 bit,
  • 8S signed 8 bit,
  • 16U unsigned 16 bit,
  • 16S signed 16 bit,
  • 32U unsigned 32 bit,
  • 32S signed 32 bit,
  • FD floating double 64 bits (Not kosher DICOM, but so usefull!).

Warning:
12 bit images appear as 16 bit. 24 bit images appear as 8 bit + photochromatic interp ="RGB " + Planar Configuration = 0
Returns:
0S if nothing found. NOT USABLE file. The caller has to check

Definition at line 950 of file gdcmFile.cxx.

References gdcm::GDCM_UNFOUND, gdcmWarningMacro, gdcm::DocEntrySet::GetEntryString(), and IsSignedPixelData().

Referenced by vtkGdcmReader::GetFileInformation(), GetPixelSize(), vtkGdcmReader::LoadFileInformation(), userSuppliedMirrorFunction(), and userSuppliedTopDownFunction().

00951 {
00952    std::string bitsAlloc = GetEntryString(0x0028, 0x0100); // Bits Allocated
00953    if ( bitsAlloc == GDCM_UNFOUND )
00954    {
00955       gdcmWarningMacro( "Bits Allocated (0028,0100) supposed to be mandatory");
00956       bitsAlloc = "16"; // default and arbitrary value, not to polute the output
00957    }
00958 
00959    if ( bitsAlloc == "64" )
00960    {
00961       return "FD";
00962    }
00963    else if ( bitsAlloc == "12" )
00964    {
00965       // It will be unpacked
00966       bitsAlloc = "16";
00967    }
00968    else if ( bitsAlloc == "24" )
00969    {
00970       // (in order no to be messed up by old RGB images)
00971       bitsAlloc = "8";
00972    }
00973 
00974    std::string sign;
00975    if( IsSignedPixelData() )
00976    {
00977       sign = "S";
00978    }
00979    else
00980    {
00981       sign = "U";
00982    }
00983    return bitsAlloc + sign;
00984 }

int gdcm::File::GetPlanarConfiguration  ) 
 

Retrieve the Planar Configuration for RGB images (0 : RGB Pixels , 1 : R Plane + G Plane + B Plane).

Returns:
The encountered Planar Configuration, 0 by default.

Definition at line 893 of file gdcmFile.cxx.

References gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

00894 {
00895    DataEntry *entry = GetDataEntry(0x0028,0x0006);
00896    if( !entry )
00897    {
00898       return 0;
00899    }
00900    return (int)entry->GetValue(0);
00901 }

int gdcm::Base::GetPrintLevel  )  [inline, inherited]
 

Gets the print level for the Dicom Entries.

Definition at line 50 of file gdcmBase.h.

00050 { return PrintLevel; }

Dict * gdcm::Document::GetPubDict  )  [inherited]
 

Get the public dictionary used.

Definition at line 289 of file gdcmDocument.cxx.

References gdcm::Document::RefPubDict.

Referenced by gdcm::DicomDir::SetElement().

00290 {
00291    return RefPubDict;
00292 }

const unsigned long& gdcm::RefCounter::GetRefCount  )  const [inline, inherited]
 

Get the reference counting.

Returns:
Reference count

Definition at line 56 of file gdcmRefCounter.h.

00057    {
00058       return RefCount;
00059    }

float gdcm::File::GetRescaleIntercept  ) 
 

gets the info from 0028,1052 : Rescale Intercept

Returns:
Rescale Intercept. defaulted to 0.0 is not found or empty

Definition at line 1168 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

01169 {
01170    // 0028 1052 DS IMG Rescale Intercept
01171    DataEntry *entry = GetDataEntry(0x0028, 0x1052);
01172    if( !entry )
01173    {
01174       gdcmWarningMacro( "Missing Rescale Intercept (0028,1052)");
01175       return 0.0f;
01176    }
01177    return (float)entry->GetValue(0);
01178 
01179 }

float gdcm::File::GetRescaleSlope  ) 
 

gets the info from 0028,1053 : Rescale Slope

Returns:
Rescale Slope. defaulted to 0.0 is not found or empty

Definition at line 1185 of file gdcmFile.cxx.

References gdcmDebugMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

01186 {
01187    // 0028 1053 DS IMG Rescale Slope
01188    DataEntry *entry = GetDataEntry(0x0028, 0x1053);
01189    if( !entry )
01190    {
01191       gdcmDebugMacro( "Missing Rescale Slope (0028,1053)");
01192       return 1.0f;
01193    }
01194    return (float)entry->GetValue(0);
01195 }

RLEFramesInfo* gdcm::File::GetRLEInfo  )  [inline]
 

returns the RLE info

Definition at line 162 of file gdcmFile.h.

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

00162 { return RLEInfo; }

int gdcm::File::GetSamplesPerPixel  ) 
 

Retrieve the number of Samples Per Pixel (1 : gray level, 3 : RGB/YBR -1 or 3 Planes-).

Returns:
The encountered number of Samples Per Pixel, 1 by default. (we assume Gray level Pixels)

Definition at line 876 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by gdcm::FileHelper::CheckWriteIntegrity(), GetNumberOfScalarComponents(), GetNumberOfScalarComponentsRaw(), gdcm::PixelReadConvert::GrabInformationsFromFile(), userSuppliedMirrorFunction(), and userSuppliedTopDownFunction().

00877 {
00878    DataEntry *entry = GetDataEntry(0x0028,0x0002);
00879    if( !entry )
00880    {
00881       gdcmWarningMacro("SamplesPerPixel (0028,0002) is supposed to be mandatory");
00882       return 1; // Well, it's supposed to be mandatory ...
00883                 // but sometimes it's missing : *we* assume Gray pixels
00884    }
00885    return (int)entry->GetValue(0);
00886 }

SeqEntry * gdcm::DocEntrySet::GetSeqEntry uint16_t  group,
uint16_t  elem
[inherited]
 

Same as Document::GetDocEntry except it returns a result only when the corresponding entry is of type SeqEntry.

Parameters:
group Group number of the searched Dicom Element
elem Element number of the searched Dicom Element
Returns:
When present, the corresponding SeqEntry.

Definition at line 115 of file gdcmDocEntrySet.cxx.

References gdcm::DocEntrySet::GetDocEntry().

Referenced by gdcm::Document::DoTheLoadingDocumentJob().

00116 {
00117    DocEntry *currentEntry = GetDocEntry(group, elem);
00118    if ( !currentEntry )
00119       return NULL;
00120       
00121    return dynamic_cast<SeqEntry*>(currentEntry);
00122 }

Dict * gdcm::Document::GetShaDict  )  [inherited]
 

Get the shadow dictionary used.

Definition at line 297 of file gdcmDocument.cxx.

References gdcm::Document::RefShaDict.

00298 {
00299    return RefShaDict;
00300 }

int gdcm::Document::GetSwapCode  )  [inline, inherited]
 

'Swap code' accessor (see SwapCode )

Definition at line 73 of file gdcmDocument.h.

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

00073 { return SwapCode; }

std::string gdcm::Document::GetTransferSyntax  )  [inherited]
 

Accessor to the Transfer Syntax (when present) of the current document (it internally handles reading the value from disk when only parsing occured).

Returns:
The encountered Transfer Syntax of the current document, if DICOM. GDCM_UNKNOWN for ACR-NEMA files (or broken headers ...)

Definition at line 404 of file gdcmDocument.cxx.

References gdcm::GDCM_UNKNOWN, gdcmWarningMacro, gdcm::ElementSet::GetDocEntry(), and gdcm::Document::LoadDocEntrySafe().

Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), DoTheLoadingJob(), gdcm::PixelReadConvert::GrabInformationsFromFile(), and gdcm::Document::HandleOutOfGroup0002().

00405 {
00406    DocEntry *entry = GetDocEntry(0x0002, 0x0010);
00407    if ( !entry )
00408    {
00409       return GDCM_UNKNOWN;
00410    }
00411 
00412    // The entry might be present but not loaded (parsing and loading
00413    // happen at different stages): try loading and proceed with check...
00414    LoadDocEntrySafe(entry);
00415    if (DataEntry *dataEntry = dynamic_cast<DataEntry *>(entry) )
00416    {
00417       std::string transfer = dataEntry->GetString();
00418       // The actual transfer (as read from disk) might be padded. We
00419       // first need to remove the potential padding. We can make the
00420       // weak assumption that padding was not executed with digits...
00421       if  ( transfer.length() == 0 )
00422       {
00423          // for brain damaged headers
00424          gdcmWarningMacro( "Transfer Syntax has length = 0.");
00425          return GDCM_UNKNOWN;
00426       }
00427       while ( !isdigit((unsigned char)transfer[transfer.length()-1]) )
00428       {
00429          transfer.erase(transfer.length()-1, 1);
00430          if  ( transfer.length() == 0 )
00431          {
00432             // for brain damaged headers
00433             gdcmWarningMacro( "Transfer Syntax contains no valid character.");
00434             return GDCM_UNKNOWN;
00435          }
00436       }
00437       return transfer;
00438    }
00439    return GDCM_UNKNOWN;
00440 }

std::string gdcm::Document::GetTransferSyntaxName  )  [inherited]
 

Accesses the info from 0002,0010 : Transfer Syntax and TS.

Returns:
The full Transfer Syntax Name (as opposed to Transfer Syntax UID)

Definition at line 446 of file gdcmDocument.cxx.

References gdcm::GDCM_NOTLOADED, gdcm::GDCM_UNFOUND, gdcmDebugMacro, gdcmErrorMacro, gdcm::DocEntrySet::GetEntryString(), and gdcm::Global::GetTS().

Referenced by gdcm::Document::HandleOutOfGroup0002().

00447 {
00448    // use the TS (TS : Transfer Syntax)
00449    std::string transferSyntax = GetEntryString(0x0002,0x0010);
00450 
00451    if ( (transferSyntax.find(GDCM_NOTLOADED) < transferSyntax.length()) )
00452    {
00453       gdcmErrorMacro( "Transfer Syntax not loaded. " << std::endl
00454                << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE" );
00455       return "Uncompressed ACR-NEMA";
00456    }
00457    if ( transferSyntax == GDCM_UNFOUND )
00458    {
00459       gdcmDebugMacro( "Unfound Transfer Syntax (0002,0010)");
00460       return "Uncompressed ACR-NEMA";
00461    }
00462 
00463    // we do it only when we need it
00464    const TSKey &tsName = Global::GetTS()->GetValue( transferSyntax );
00465 
00466    // Global::GetTS() is a global static you shall never try to delete it!
00467    return tsName;
00468 }

float gdcm::File::GetXOrigin  ) 
 

gets the info from 0020,0032 : Image Position Patient else from 0020,0030 : Image Position (RET) else 0.

Returns:
up-left image corner X position

Definition at line 639 of file gdcmFile.cxx.

References gdcmErrorMacro, gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), gdcm::DataEntry::GetValue(), gdcm::DataEntry::GetValueCount(), and gdcm::DataEntry::IsValueCountValid().

00640 {
00641    DataEntry *entry = GetDataEntry(0x0020,0x0032);
00642    if( !entry )
00643    {
00644       gdcmWarningMacro( "Unfound Image Position Patient (0020,0032)");
00645       entry = GetDataEntry(0x0020,0x0030);
00646       if( !entry )
00647       {
00648          gdcmWarningMacro( "Unfound Image Position (RET) (0020,0030)");
00649          return 0.0f;
00650       }
00651    }
00652 
00653    if( entry->GetValueCount() == 3 )
00654    {
00655       if (!entry->IsValueCountValid() )
00656       {
00657          gdcmErrorMacro( "Invalid Value Count" );
00658       }
00659       return (float)entry->GetValue(0);
00660    }
00661    return 0.0f;
00662 }

int gdcm::File::GetXSize  ) 
 

Retrieve the number of columns of image.

Returns:
The encountered size when found, 0 by default. 0 means the file is NOT USABLE. The caller will have to check

Definition at line 399 of file gdcmFile.cxx.

References gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by gdcm::FileHelper::CheckWriteIntegrity(), vtkGdcmReader::GetFileInformation(), gdcm::PixelReadConvert::GrabInformationsFromFile(), vtkGdcmReader::LoadImageInMemory(), vtkGdcmReader::TestFileInformation(), userSuppliedMirrorFunction(), and userSuppliedTopDownFunction().

00400 {
00401    DataEntry *entry = GetDataEntry(0x0028,0x0011);
00402    if( entry )
00403       return (int)entry->GetValue(0);
00404    return 0;
00405 }

float gdcm::File::GetXSpacing  ) 
 

gets the info from 0018,1164 : ImagerPixelSpacing then 0028,0030 : Pixel Spacing else 1.0

Returns:
X dimension of a pixel

Definition at line 459 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), gdcm::DataEntry::GetValue(), and gdcm::DataEntry::GetValueCount().

Referenced by vtkGdcmReader::GetFileInformation().

00460 {
00461    float xspacing = 1.0;
00462    uint32_t nbValue;
00463 
00464    // To follow David Clunie's advice, we first check ImagerPixelSpacing
00465 
00466    DataEntry *entry = GetDataEntry(0x0018,0x1164);
00467    if( entry )
00468    {
00469       nbValue = entry->GetValueCount();
00470       // Can't use IsValueCountValid because of the complex heuristic.
00471       if( nbValue !=2 )
00472          gdcmWarningMacro("ImagerPixelSpacing (0x0018,0x1164) "
00473          << "has a wrong number of values :" << nbValue);
00474      
00475       if( nbValue >= 3 )
00476          xspacing = (float)entry->GetValue(2);
00477       else if( nbValue >= 2 )
00478          xspacing = (float)entry->GetValue(1);
00479       else
00480          xspacing = (float)entry->GetValue(0);
00481 
00482       if ( xspacing == 0.0 )
00483          xspacing = 1.0;
00484       return xspacing;
00485    }
00486    else
00487    {
00488       gdcmWarningMacro( "Unfound Imager Pixel Spacing (0018,1164)" );
00489    }
00490 
00491    entry = GetDataEntry(0x0028,0x0030);
00492    if( entry )
00493    {
00494       nbValue = entry->GetValueCount();
00495       if( nbValue !=2 )
00496          gdcmWarningMacro("PixelSpacing (0x0018,0x0030) "
00497           << "has a wrong number of values :" << nbValue);      
00498       
00499       if( nbValue >= 3 )
00500          xspacing = (float)entry->GetValue(2);
00501       else if( nbValue >= 2 )
00502          xspacing = (float)entry->GetValue(1);
00503       else
00504          xspacing = (float)entry->GetValue(0);
00505 
00506       if ( xspacing == 0.0 )
00507          xspacing = 1.0;
00508       return xspacing;
00509    }
00510    else
00511    {
00512       gdcmWarningMacro( "Unfound Pixel Spacing (0028,0030)" );
00513    }
00514 
00515    return xspacing;
00516 }

float gdcm::File::GetYOrigin  ) 
 

gets the info from 0020,0032 : Image Position Patient else from 0020,0030 : Image Position (RET) else 0.

Returns:
up-left image corner Y position

Definition at line 670 of file gdcmFile.cxx.

References gdcmErrorMacro, gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), gdcm::DataEntry::GetValue(), gdcm::DataEntry::GetValueCount(), and gdcm::DataEntry::IsValueCountValid().

00671 {
00672    DataEntry *entry = GetDataEntry(0x0020,0x0032);
00673    if( !entry )
00674    {
00675       gdcmWarningMacro( "Unfound Image Position Patient (0020,0032)");
00676       entry = GetDataEntry(0x0020,0x0030);
00677       if( !entry )
00678       {
00679          gdcmWarningMacro( "Unfound Image Position (RET) (0020,0030)");
00680          return 0.0f;
00681       }
00682    }
00683 
00684    if( entry->GetValueCount() == 3 )
00685    {
00686       if (!entry->IsValueCountValid() )
00687       {
00688          gdcmErrorMacro( "Invalid Value Count" );
00689       }
00690       return (float)entry->GetValue(1);
00691    }
00692    return 0.0f;
00693 }

int gdcm::File::GetYSize  ) 
 

Retrieve the number of lines of image.

Warning:
The defaulted value is 1 as opposed to File::GetXSize()
Returns:
The encountered size when found, 1 by default (The ACR-NEMA file contains a Signal, not an Image).

Definition at line 413 of file gdcmFile.cxx.

References gdcm::DocEntrySet::GetDataEntry(), gdcm::DataEntry::GetValue(), and gdcm::Document::IsDicomV3().

Referenced by gdcm::FileHelper::CheckWriteIntegrity(), vtkGdcmReader::GetFileInformation(), gdcm::PixelReadConvert::GrabInformationsFromFile(), vtkGdcmReader::LoadImageInMemory(), vtkGdcmReader::TestFileInformation(), userSuppliedMirrorFunction(), and userSuppliedTopDownFunction().

00414 {
00415    DataEntry *entry = GetDataEntry(0x0028,0x0010);
00416    if( entry )
00417       return (int)entry->GetValue(0);
00418 
00419    if ( IsDicomV3() )
00420    {
00421       return 0;
00422    }
00423 
00424    // The Rows (0028,0010) entry was optional for ACR/NEMA.
00425    // (at least some images didn't have it.)
00426    // It might hence be a signal (1D image). So we default to 1:
00427    return 1;
00428 }

float gdcm::File::GetYSpacing  ) 
 

gets the info from 0018,1164 : ImagerPixelSpacing then from 0028,0030 : Pixel Spacing else 1.0

Returns:
Y dimension of a pixel

Definition at line 524 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by vtkGdcmReader::GetFileInformation().

00525 {
00526    float yspacing = 1.0;
00527    // To follow David Clunie's advice, we first check ImagerPixelSpacing
00528 
00529    DataEntry *entry = GetDataEntry(0x0018,0x1164);
00530    if( entry )
00531    {
00532       yspacing = (float)entry->GetValue(0);
00533 
00534       if ( yspacing == 0.0 )
00535          yspacing = 1.0;
00536       return yspacing;
00537    }
00538    else
00539    {
00540       gdcmWarningMacro( "Unfound Imager Pixel Spacing (0018,1164)" );
00541    }
00542 
00543    entry = GetDataEntry(0x0028,0x0030);
00544    if( entry )
00545    {
00546       yspacing = (float)entry->GetValue(0);
00547 
00548       if ( yspacing == 0.0 )
00549          yspacing = 1.0;
00550       return yspacing;
00551    }
00552    else
00553    {
00554       gdcmWarningMacro( "Unfound Pixel Spacing (0028,0030)" );
00555    }
00556 
00557    return yspacing;
00558 } 

float gdcm::File::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.

Returns:
up-left image corner Z position

Definition at line 703 of file gdcmFile.cxx.

References gdcmErrorMacro, gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), gdcm::DataEntry::GetValue(), gdcm::DataEntry::GetValueCount(), and gdcm::DataEntry::IsValueCountValid().

00704 {
00705    DataEntry *entry = GetDataEntry(0x0020,0x0032);
00706    if( entry )
00707    {
00708       if( entry->GetValueCount() == 3 )
00709       {
00710          if (!entry->IsValueCountValid() )
00711          {
00712             gdcmErrorMacro( "Invalid Value Count" );
00713          }
00714          return (float)entry->GetValue(2);
00715       }
00716       gdcmWarningMacro( "Wrong Image Position Patient (0020,0032)");
00717       return 0.0f;
00718    }
00719 
00720    entry = GetDataEntry(0x0020,0x0030);
00721    if( entry )
00722    {
00723       if( entry->GetValueCount() == 3 )
00724       {
00725          if (!entry->IsValueCountValid() )
00726          {
00727             gdcmErrorMacro( "Invalid Value Count" );
00728          }
00729          return (float)entry->GetValue(2);
00730       }
00731       gdcmWarningMacro( "Wrong Image Position (RET) (0020,0030)");
00732       return 0.0f;
00733    }
00734 
00735    // for *very* old ACR-NEMA images
00736    entry = GetDataEntry(0x0020,0x1041);
00737    if( entry )
00738    {
00739       if( entry->GetValueCount() == 1 )
00740       {
00741          if (!entry->IsValueCountValid() )
00742          {
00743             gdcmErrorMacro( "Invalid Value Count" );
00744          }
00745          return (float)entry->GetValue(0); // VM=1 !
00746       }
00747       gdcmWarningMacro( "Wrong Slice Location (0020,1041)");
00748       return 0.0f;
00749    }
00750 
00751    entry = GetDataEntry(0x0020,0x0050);
00752    if( entry )
00753    {
00754       if( entry->GetValueCount() == 1 )
00755       {
00756          if (!entry->IsValueCountValid() )
00757          {
00758             gdcmErrorMacro( "Invalid Value Count" );
00759          }
00760          return (float)entry->GetValue(0);
00761       }
00762       gdcmWarningMacro( "Wrong Location (0020,0050)");
00763       return 0.0f;
00764    }
00765    return 0.; // Hopeless
00766 }

int gdcm::File::GetZSize  ) 
 

Retrieve the number of planes of volume or the number of frames of a multiframe.

Warning:
When present we consider the "Number of Frames" as the third dimension. When missing we consider the third dimension as being the ACR-NEMA "Planes" tag content.
Returns:
The encountered size when found, 1 by default (single image).

Definition at line 438 of file gdcmFile.cxx.

References gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by gdcm::FileHelper::CheckWriteIntegrity(), vtkGdcmReader::GetFileInformation(), gdcm::PixelReadConvert::GrabInformationsFromFile(), vtkGdcmReader::LoadImageInMemory(), vtkGdcmReader::TestFileInformation(), userSuppliedMirrorFunction(), and userSuppliedTopDownFunction().

00439 {
00440    // Both  DicomV3 and ACR/Nema consider the "Number of Frames"
00441    // as the third dimension.
00442    DataEntry *entry = GetDataEntry(0x0028,0x0008);
00443    if( entry )
00444       return (int)entry->GetValue(0);
00445 
00446    // We then consider the "Planes" entry as the third dimension 
00447    entry = GetDataEntry(0x0028,0x0012);
00448    if( entry )
00449       return (int)entry->GetValue(0);
00450    return 1;
00451 }

float gdcm::File::GetZSpacing  ) 
 

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 !

Returns:
Z dimension of a voxel-to be

Definition at line 574 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by vtkGdcmReader::GetFileInformation().

00575 {
00576 
00577    float zspacing = 1.0f;
00578 
00579    // Spacing Between Slices : distance between the middle of 2 slices
00580    // Slices may be :
00581    //   jointives     (Spacing between Slices = Slice Thickness)
00582    //   overlapping   (Spacing between Slices < Slice Thickness)
00583    //   disjointes    (Spacing between Slices > Slice Thickness)
00584    // Slice Thickness : epaisseur de tissus sur laquelle est acquis le signal
00585    //   It only concerns the MRI guys, not people wanting to visualize volumes
00586    //   If Spacing Between Slices is missing, 
00587    //   we suppose slices joint together
00588    DataEntry *entry = GetDataEntry(0x0018,0x0088);
00589    if( entry )
00590    {
00591       zspacing = (float)entry->GetValue(0);
00592 
00593       if ( zspacing == 0.0 )
00594          zspacing = 1.0;
00595       return zspacing;
00596    }
00597    else
00598       gdcmWarningMacro("Unfound Spacing Between Slices (0018,0088)");
00599 
00600    // if no 'Spacing Between Slices' is found, 
00601    // we assume slices join together
00602    // (no overlapping, no interslice gap)
00603    entry = GetDataEntry(0x0018,0x0050);
00604    if( entry )
00605    {
00606       zspacing = (float)entry->GetValue(0);
00607 
00608       if ( zspacing == 0.0 )
00609          zspacing = 1.0;
00610       return zspacing;
00611    }
00612    else
00613       gdcmWarningMacro("Unfound Slice Thickness (0018,0050)");
00614 
00615    // if no 'Spacing Between Slices' is found, 
00616    // we assume slices join together
00617    // (no overlapping, no interslice gap)
00618    entry = GetDataEntry(0x3004,0x000c);
00619    if( entry )
00620    {
00621       float z1 = (float)entry->GetValue(0);
00622       float z2 = (float)entry->GetValue(1);
00623       zspacing = z2 - z1; // can be negative...
00624 
00625       if ( zspacing == 0.0 )
00626          zspacing = 1.0;
00627       return zspacing;
00628    }
00629 
00630    return zspacing;
00631 }

bool gdcm::File::HasLUT  ) 
 

tells us if LUT are used

Warning:
Right now, 'Segmented xxx Palette Color Lookup Table Data' are NOT considered as LUT, since nobody knows how to deal with them Please warn me if you know sbdy that *does* know ... jprx
Returns:
true if LUT Descriptors and LUT Tables were found

Definition at line 1093 of file gdcmFile.cxx.

References gdcm::ElementSet::GetDocEntry().

Referenced by gdcm::FileHelper::CheckWriteIntegrity(), vtkGdcmReader::GetFileInformation(), gdcm::FileHelper::GetImageData(), GetNumberOfScalarComponents(), gdcm::PixelReadConvert::GrabInformationsFromFile(), vtkGdcmReader::LoadImageInMemory(), gdcm::FileHelper::SetWriteToRaw(), and vtkGdcmReader::TestFileInformation().

01094 {
01095    // Check the presence of the LUT Descriptors, and LUT Tables    
01096    // LutDescriptorRed    
01097    if ( !GetDocEntry(0x0028,0x1101) )
01098    {
01099       return false;
01100    }
01101    // LutDescriptorGreen 
01102    if ( !GetDocEntry(0x0028,0x1102) )
01103    {
01104       return false;
01105    }
01106    // LutDescriptorBlue 
01107    if ( !GetDocEntry(0x0028,0x1103) )
01108    {
01109       return false;
01110    }
01111    // Red Palette Color Lookup Table Data
01112    if ( !GetDocEntry(0x0028,0x1201) )
01113    {
01114       return false;
01115    }
01116    // Green Palette Color Lookup Table Data       
01117    if ( !GetDocEntry(0x0028,0x1202) )
01118    {
01119       return false;
01120    }
01121    // Blue Palette Color Lookup Table Data      
01122    if ( !GetDocEntry(0x0028,0x1203) )
01123    {
01124       return false;
01125    }
01126 
01127    // FIXME : (0x0028,0x3006) : LUT Data (CTX dependent)
01128    //         NOT taken into account, but we don't know how to use it ...   
01129    return true;
01130 }

DataEntry * gdcm::DocEntrySet::InsertEntryBinArea uint8_t *  binArea,
int  lgth,
uint16_t  group,
uint16_t  elem,
VRKey const &  vr = GDCM_VRUNKNOWN
[inherited]
 

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.

Parameters:
binArea (binary) value to be set
lgth length of the Bin Area we want to set
group Group number of the Entry
elem Element number of the Entry
vr V(alue) R(epresentation) of the Entry -if private Entry-
Returns:
pointer to the modified/created Header Entry (NULL when creation failed).

Definition at line 270 of file gdcmDocEntrySet.cxx.

References gdcm::DocEntrySet::AddEntry(), gdcm::RefCounter::Delete(), gdcmWarningMacro, gdcm::DocEntrySet::GetDocEntry(), gdcm::DocEntry::GetVR(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::RemoveEntry(), and gdcm::DocEntrySet::SetEntryBinArea().

Referenced by gdcm::FileHelper::InsertEntryBinArea().

00273 {
00274    DataEntry *dataEntry = 0;
00275    DocEntry *currentEntry = GetDocEntry( group, elem );
00276 
00277    // Verify the currentEntry
00278    if (currentEntry)
00279    {
00280       dataEntry = dynamic_cast<DataEntry *>(currentEntry);
00281 
00282       // Verify the VR
00283       if ( dataEntry )
00284          if ( dataEntry->GetVR()!=vr )
00285             dataEntry = NULL;
00286 
00287       // if currentEntry doesn't correspond to the requested dataEntry
00288       if ( !dataEntry)
00289       {
00290          if ( !RemoveEntry(currentEntry) )
00291          {
00292             gdcmWarningMacro( "Removal of previous DocEntry failed.");
00293             return NULL;
00294          }
00295       }
00296    }
00297 
00298    // Create a new dataEntry if necessary
00299    if ( !dataEntry)
00300    {
00301       dataEntry = NewDataEntry(group, elem, vr);
00302 
00303       if ( !AddEntry(dataEntry) )
00304       {
00305          gdcmWarningMacro( "AddEntry failed although this is a creation.");
00306          dataEntry->Delete();
00307          return NULL;
00308       }
00309       dataEntry->Delete();
00310    }
00311 
00312    // Set the dataEntry value
00313    uint8_t *tmpArea;
00314    if ( lgth>0 && binArea )
00315    {
00316       tmpArea = new uint8_t[lgth];
00317       memcpy(tmpArea,binArea,lgth);
00318    }
00319    else
00320    {
00321       tmpArea = 0;
00322    }
00323    if ( !SetEntryBinArea(tmpArea,lgth,dataEntry) )
00324    {
00325       if ( tmpArea )
00326       {
00327          delete[] tmpArea;
00328       }
00329    }
00330    return dataEntry;
00331 }  

DataEntry * gdcm::DocEntrySet::InsertEntryString std::string const &  value,
uint16_t  group,
uint16_t  elem,
VRKey const &  vr = GDCM_VRUNKNOWN
[inherited]
 

Modifies the value of a given Doc Entry (Dicom Element) when it exists. Create it with the given value when unexistant.

Parameters:
value (string) Value to be set
group Group number of the Entry
elem Element number of the Entry
vr V(alue) R(epresentation) of the Entry -if private Entry-
Returns:
pointer to the modified/created Header Entry (NULL when creation failed).

Definition at line 212 of file gdcmDocEntrySet.cxx.

References gdcm::DocEntrySet::AddEntry(), gdcm::RefCounter::Delete(), gdcmWarningMacro, gdcm::DocEntrySet::GetDocEntry(), gdcm::DocEntry::GetVR(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::RemoveEntry(), and gdcm::DocEntrySet::SetEntryString().

Referenced by gdcm::FileHelper::InsertEntryString(), gdcm::FileHelper::Write(), and Write().

00215 {
00216    DataEntry *dataEntry = 0;
00217    DocEntry *currentEntry = GetDocEntry( group, elem );
00218    
00219    if (currentEntry)
00220    {
00221       dataEntry = dynamic_cast<DataEntry *>(currentEntry);
00222 
00223       // Verify the VR
00224       if ( dataEntry )
00225          if ( dataEntry->GetVR()!=vr )
00226             dataEntry = NULL;
00227 
00228       // if currentEntry doesn't correspond to the requested dataEntry
00229       if ( !dataEntry)
00230       {
00231          if ( !RemoveEntry(currentEntry) )
00232          {
00233             gdcmWarningMacro( "Removal of previous DocEntry failed.");
00234             return NULL;
00235          }
00236       }
00237    }
00238 
00239    // Create a new dataEntry if necessary
00240    if ( !dataEntry )
00241    {
00242       dataEntry = NewDataEntry( group, elem, vr );
00243 
00244       if ( !AddEntry(dataEntry) )
00245       {
00246          gdcmWarningMacro("AddEntry failed although this is a creation.");
00247          dataEntry->Delete();
00248          return NULL;
00249       }
00250       dataEntry->Delete();
00251    }
00252 
00253    // Set the dataEntry value
00254    SetEntryString(value, dataEntry); // The std::string value
00255    return dataEntry;
00256 }

SeqEntry * gdcm::DocEntrySet::InsertSeqEntry uint16_t  group,
uint16_t  elem
[inherited]
 

Creates a new gdcm::SeqEntry and adds it to the current DocEntrySet. (remove any existing entry with same group,elem).

Parameters:
group Group number of the Entry
elem Element number of the Entry
Returns:
pointer to the created SeqEntry (NULL when creation failed).

Definition at line 341 of file gdcmDocEntrySet.cxx.

References gdcm::DocEntrySet::AddEntry(), gdcm::RefCounter::Delete(), gdcmWarningMacro, gdcm::DocEntrySet::GetDocEntry(), gdcm::DocEntrySet::NewSeqEntry(), and gdcm::DocEntrySet::RemoveEntry().

Referenced by gdcm::FileHelper::InsertSeqEntry().

00342 {
00343    SeqEntry *seqEntry = 0;
00344    DocEntry *currentEntry = GetDocEntry( group, elem );
00345 
00346    // Verify the currentEntry
00347    if ( currentEntry )
00348    {
00349       seqEntry = dynamic_cast<SeqEntry *>(currentEntry);
00350 
00351       // Verify the VR
00352       if ( seqEntry )
00353          seqEntry = NULL;
00354 
00355       // if currentEntry doesn't correspond to the requested seqEntry
00356       if ( !seqEntry )
00357       {
00358          if (!RemoveEntry(currentEntry))
00359          {
00360             gdcmWarningMacro( "Removal of previous DocEntry failed for ("
00361                <<std::hex << group << "|" << elem <<")" );
00362             return NULL;
00363          }
00364       }
00365    }
00366    // Create a new seqEntry if necessary
00367    if ( !seqEntry )
00368    {
00369       seqEntry = NewSeqEntry(group, elem);
00370 
00371       if ( !AddEntry(seqEntry) )
00372       {
00373          gdcmWarningMacro( "AddEntry failed although this is a creation for ("
00374             <<std::hex << group << "|" << elem <<")" );
00375          seqEntry->Delete();
00376          return NULL;
00377       }
00378       seqEntry->Delete();
00379    }
00380    // Remark :
00381    // SequenceDelimitationItem will be added at the end of the SeqEntry,
00382    // at write time
00383    return seqEntry;
00384 } 

bool gdcm::Document::IsDicomV3  )  [inherited]
 

Predicate for dicom version 3 file.

Returns:
True when the file is a dicom version 3.

Definition at line 361 of file gdcmDocument.cxx.

References gdcm::ElementSet::GetDocEntry().

Referenced by GetYSize(), and gdcm::PixelReadConvert::GrabInformationsFromFile().

00362 {
00363    // Checking if Transfer Syntax exists is enough
00364    // Anyway, it's too late check if the 'Preamble' was found ...
00365    // And ... would it be a rich idea to check ?
00366    // (some 'no Preamble' DICOM images exist !)
00367    return GetDocEntry(0x0002, 0x0010) != NULL;
00368 }

bool gdcm::ElementSet::IsEmpty  )  [inline, virtual, inherited]
 

Tells us if the ElementSet contains no entry.

Implements gdcm::DocEntrySet.

Definition at line 58 of file gdcmElementSet.h.

Referenced by gdcm::Document::DoTheLoadingDocumentJob(), and gdcm::Document::IsParsable().

00058 { return TagHT.empty(); }

bool gdcm::File::IsMonochrome  ) 
 

Check whether this a monochrome picture (gray levels) or not, using "Photometric Interpretation" tag (0x0028,0x0004).

Returns:
true when "MONOCHROME1" or "MONOCHROME2". False otherwise.

Definition at line 1011 of file gdcmFile.cxx.

References gdcm::Util::DicomStringEqual(), gdcm::GDCM_UNFOUND, gdcmWarningMacro, and gdcm::DocEntrySet::GetEntryString().

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

01012 {
01013    const std::string &PhotometricInterp = GetEntryString( 0x0028, 0x0004 );
01014    if (  Util::DicomStringEqual(PhotometricInterp, "MONOCHROME1")
01015       || Util::DicomStringEqual(PhotometricInterp, "MONOCHROME2") )
01016    {
01017       return true;
01018    }
01019    if ( PhotometricInterp == GDCM_UNFOUND )
01020    {
01021       gdcmWarningMacro( "Photometric Interpretation (0028,0004) supposed to be "
01022                          << "mandatory");
01023    }
01024    return false;
01025 }

bool gdcm::File::IsMonochrome1  ) 
 

Check whether this a MONOCHROME1 picture (high values = dark) or not using "Photometric Interpretation" tag (0x0028,0x0004).

Returns:
true when "MONOCHROME1" . False otherwise.

Definition at line 1032 of file gdcmFile.cxx.

References gdcm::Util::DicomStringEqual(), gdcm::GDCM_UNFOUND, gdcmWarningMacro, and gdcm::DocEntrySet::GetEntryString().

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

01033 {
01034    const std::string &PhotometricInterp = GetEntryString( 0x0028, 0x0004 );
01035    if (  Util::DicomStringEqual(PhotometricInterp, "MONOCHROME1") )
01036    {
01037       return true;
01038    }
01039    if ( PhotometricInterp == GDCM_UNFOUND )
01040    {
01041       gdcmWarningMacro( "Photometric Interpretation (0028,0004) : supposed to"
01042       << " be mandatory! ");
01043    }
01044    return false;
01045 }

bool gdcm::File::IsPaletteColor  ) 
 

Check whether this a "PALETTE COLOR" picture or not by accessing the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).

Returns:
true when "PALETTE COLOR". False otherwise.

Definition at line 1052 of file gdcmFile.cxx.

References gdcm::GDCM_UNFOUND, gdcmDebugMacro, and gdcm::DocEntrySet::GetEntryString().

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

01053 {
01054    std::string PhotometricInterp = GetEntryString( 0x0028, 0x0004 );
01055    if (   PhotometricInterp == "PALETTE COLOR " )
01056    {
01057       return true;
01058    }
01059    if ( PhotometricInterp == GDCM_UNFOUND )
01060    {
01061       gdcmDebugMacro( "Not found : Palette color (0028,0004)");
01062    }
01063    return false;
01064 }

bool gdcm::Document::IsPapyrus  )  [inherited]
 

Predicate for Papyrus file Dedicated to whomsoever it may concern.

Returns:
True when the file is a Papyrus file.

Definition at line 375 of file gdcmDocument.cxx.

References gdcm::ElementSet::GetDocEntry().

00376 {
00377    // check for Papyrus private Sequence
00378    DocEntry *e = GetDocEntry(0x0041, 0x1050);
00379    if ( !e )
00380       return false;
00381    // check if it's actually a Sequence
00382    if ( !dynamic_cast<SeqEntry*>(e) )
00383       return  false;
00384    return true;
00385 }

bool gdcm::Document::IsParsable  )  [inherited]
 

This predicate tells us whether or not the current Document was properly parsed and contains at least *one* Dicom Element (and nothing more, sorry).

Returns:
false when we're 150 % sure it's NOT a Dicom/Acr file, true otherwise.

Definition at line 329 of file gdcmDocument.cxx.

References gdcm::Document::Filetype, gdcmWarningMacro, gdcm::Document::GetFileName(), gdcm::ElementSet::IsEmpty(), and gdcm::Unknown.

Referenced by gdcm::Document::IsReadable().

00330 {
00331    if ( Filetype == Unknown )
00332    {
00333       gdcmWarningMacro( "Wrong filetype for " << GetFileName());
00334       return false;
00335    }
00336 
00337    if ( IsEmpty() )
00338    { 
00339       gdcmWarningMacro( "No tag in internal hash table.");
00340       return false;
00341    }
00342 
00343    return true;
00344 }

bool gdcm::File::IsReadable  )  [virtual]
 

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.

Returns:
true when File is the one of a reasonable Dicom/Acr file, false otherwise.

Reimplemented from gdcm::Document.

Definition at line 257 of file gdcmFile.cxx.

References gdcm::GDCM_UNFOUND, gdcmWarningMacro, gdcm::ElementSet::GetDocEntry(), gdcm::DocEntrySet::GetEntryString(), GrPixel, gdcm::Document::IsReadable(), and NumPixel.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::SerieHelper::CreateUniqueSeriesIdentifier(), gdcm::FileHelper::FileHelper(), vtkGdcmReader::LoadFileInformation(), and gdcm::FileHelper::Print().

00258 {
00259    if ( !Document::IsReadable() )
00260    {
00261       return false;
00262    }
00263 
00264    const std::string &res = GetEntryString(0x0028, 0x0005);
00265    if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 )
00266    {
00267       gdcmWarningMacro("Wrong Image Dimensions" << res);
00268       return false; // Image Dimensions
00269    }
00270    bool b0028_0100 = true;
00271    if ( !GetDocEntry(0x0028, 0x0100) )
00272    {
00273       gdcmWarningMacro("Bits Allocated (0028|0100) not found"); 
00274       //return false; // "Bits Allocated"
00275       b0028_0100 = false;
00276    }
00277    bool b0028_0101 = true;
00278    if ( !GetDocEntry(0x0028, 0x0101) )
00279    {
00280       gdcmWarningMacro("Bits Stored (0028|0101) not found");
00281       //return false; // "Bits Stored"
00282       b0028_0101 = false;
00283    }
00284    bool b0028_0102 = true;
00285    if ( !GetDocEntry(0x0028, 0x0102) )
00286    {
00287       gdcmWarningMacro("Hight Bit (0028|0102) not found"); 
00288       //return false; // "High Bit"
00289       b0028_0102 = false;
00290    }
00291    bool b0028_0103 = true;
00292    if ( !GetDocEntry(0x0028, 0x0103) )
00293    {
00294       gdcmWarningMacro("Pixel Representation (0028|0103) not found");
00295       //return false; // "Pixel Representation" i.e. 'Sign' ( 0 : unsigned, 1 : signed)
00296       b0028_0103 = false;
00297    }
00298 
00299    if ( !b0028_0100 && !b0028_0101 && !b0028_0102 && !b0028_0103)
00300    {
00301       gdcmWarningMacro("Too much mandatory Tags missing !");
00302       return false;
00303    }
00304 
00305    if ( !GetDocEntry(GrPixel, NumPixel) )
00306    {
00307       gdcmWarningMacro("Pixel Dicom Element " << std::hex <<
00308                         GrPixel << "|" << NumPixel << "not found");
00309       return false; // Pixel Dicom Element not found :-(
00310    }
00311    return true;
00312 }

bool gdcm::File::IsSignedPixelData  ) 
 

Check whether the pixels are signed (1) or UNsigned (0) data.

Warning:
The method defaults to false (UNsigned) when tag 0028|0103 is missing. The responsability of checking this value is left to the caller (NO transformation is performed on the pixels to make then >0)
Returns:
True when signed, false when UNsigned

Definition at line 994 of file gdcmFile.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), and gdcm::DataEntry::GetValue().

Referenced by GetPixelType(), and gdcm::PixelReadConvert::GrabInformationsFromFile().

00995 {
00996    DataEntry *entry = GetDataEntry(0x0028, 0x0103);//"Pixel Representation"
00997    if( !entry )
00998    {
00999       gdcmWarningMacro( "Pixel Representation (0028,0103) supposed to be "
01000                       << "mandatory");
01001       return false;
01002    }
01003    return entry->GetValue(0) != 0;
01004 }

bool gdcm::File::IsYBRFull  ) 
 

Check whether this a "YBR_FULL" color picture or not by accessing the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).

Returns:
true when "YBR_FULL". False otherwise.

Definition at line 1071 of file gdcmFile.cxx.

References gdcm::GDCM_UNFOUND, gdcmDebugMacro, and gdcm::DocEntrySet::GetEntryString().

Referenced by gdcm::PixelReadConvert::GrabInformationsFromFile().

01072 {
01073    std::string PhotometricInterp = GetEntryString( 0x0028, 0x0004 );
01074    if (   PhotometricInterp == "YBR_FULL" )
01075    {
01076       return true;
01077    }
01078    if ( PhotometricInterp == GDCM_UNFOUND )
01079    {
01080       gdcmDebugMacro( "Not found : YBR Full (0028,0004)");
01081    }
01082    return false;
01083 }

bool gdcm::File::Load  )  [virtual]
 

Loader.

Returns:
false if file cannot be open or no swap info was found, or no tag was found.

Reimplemented from gdcm::Document.

Definition at line 143 of file gdcmFile.cxx.

References DoTheLoadingJob().

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::FileHelper::Load(), and vtkGdcmReader::LoadFileInformation().

00144 {
00145    if ( ! this->Document::Load( ) )
00146       return false;
00147 
00148     return DoTheLoadingJob( );   
00149 }

void gdcm::Document::LoadDocEntrySafe DocEntry entry  )  [inherited]
 

Loads the element while preserving the current underlying file position indicator as opposed to LoadDocEntry that modifies it.

Parameters:
entry DocEntry whose value will be loaded.

Definition at line 811 of file gdcmDocument.cxx.

References gdcm::Document::Fp, and gdcm::Document::LoadDocEntry().

Referenced by gdcm::Document::GetTransferSyntax().

00812 {
00813    if ( Fp )
00814    {
00815       long PositionOnEntry = Fp->tellg();
00816       LoadDocEntry(entry);
00817       Fp->seekg(PositionOnEntry, std::ios::beg);
00818    }
00819 }

void gdcm::Document::LoadEntryBinArea DataEntry entry  )  [virtual, inherited]
 

Loads (from disk) the element content when a string is not suitable.

Parameters:
entry Entry whose binArea is going to be loaded

Definition at line 730 of file gdcmDocument.cxx.

References gdcm::Document::CloseFile(), gdcm::Document::Fp, gdcmWarningMacro, gdcm::VR::GetAtomicElementLength(), gdcm::DataEntry::GetBinArea(), gdcm::DocEntry::GetElement(), gdcm::DocEntry::GetGroup(), gdcm::DocEntry::GetLength(), gdcm::DocEntry::GetOffset(), gdcm::DocEntry::GetVR(), gdcm::Global::GetVR(), gdcm::Document::OpenFile(), gdcm::DataEntry::SetBinArea(), gdcm::DataEntry::SetState(), gdcm::DataEntry::STATE_UNREAD, gdcm::Document::SwapDouble(), gdcm::Document::SwapLong(), and gdcm::Document::SwapShort().

00731 {
00732    if( entry->GetBinArea() )
00733       return;
00734 
00735    bool openFile = !Fp;
00736    if ( openFile )
00737       OpenFile();
00738 
00739    size_t o =(size_t)entry->GetOffset();
00740    Fp->seekg(o, std::ios::beg);
00741 
00742    size_t l = entry->GetLength();
00743    uint8_t *data = new uint8_t[l];
00744    if ( !data )
00745    {
00746       gdcmWarningMacro(  "Cannot allocate DataEntry content for : "
00747                        << std::hex << entry->GetGroup() 
00748                        << "|" << entry->GetElement() );
00749       return;
00750    }
00751 
00752    // Read the data
00753    Fp->read((char*)data, l);
00754    if ( Fp->fail() || Fp->eof() )
00755    {
00756       delete[] data;
00757       entry->SetState(DataEntry::STATE_UNREAD);
00758       return;
00759    }
00760 
00761    // Swap the data content if necessary
00762    uint32_t i;
00763    unsigned short vrLgth = 
00764                         Global::GetVR()->GetAtomicElementLength(entry->GetVR());
00765 
00766 // FIXME : trouble expected if we read an ... OW Entry (LUT, etc ..)
00767 //   if( entry->GetVR() == "OW" )
00768 //      vrLgth = 1;
00769 
00770    switch(vrLgth)
00771    {
00772       case 1:
00773       {
00774          break;
00775       }     
00776       case 2:
00777       {
00778          uint16_t *data16 = (uint16_t *)data;
00779          for(i=0;i<l/vrLgth;i++)
00780             data16[i] = SwapShort(data16[i]);
00781          break;
00782       }
00783       case 4:
00784       {
00785          uint32_t *data32 = (uint32_t *)data;
00786          for(i=0;i<l/vrLgth;i++)
00787             data32[i] = SwapLong(data32[i]);
00788          break;
00789       }
00790       case 8:
00791       {
00792          double *data64 = (double *)data;
00793          for(i=0;i<l/vrLgth;i++)
00794             data64[i] = SwapDouble(data64[i]);
00795          break;
00796       }
00797    }
00798    
00799    entry->SetBinArea(data);
00800 
00801    if ( openFile )
00802       CloseFile();
00803 }

void gdcm::Document::LoadEntryBinArea uint16_t  group,
uint16_t  elem
[virtual, inherited]
 

Loads (from disk) the element content when a string is not suitable.

Parameters:
group group number of the Entry
elem element number of the Entry

Definition at line 705 of file gdcmDocument.cxx.

References gdcmDebugMacro, gdcmWarningMacro, and gdcm::ElementSet::GetDocEntry().

Referenced by gdcm::Document::DoTheLoadingDocumentJob(), gdcm::PixelReadConvert::GrabInformationsFromFile(), and gdcm::Document::LoadDocEntry().

00706 {
00707    // Search the corresponding DocEntry
00708    DocEntry *docEntry = GetDocEntry(group, elem);
00709    if ( !docEntry )
00710    {
00711       gdcmDebugMacro(std::hex << group << "|" << elem 
00712                        <<  " doesn't exist" );
00713       return;
00714    }
00715    DataEntry *dataEntry = dynamic_cast<DataEntry *>(docEntry);
00716    if ( !dataEntry )
00717    {
00718       gdcmWarningMacro(std::hex << group << "|" << elem 
00719                        <<  " is NOT a DataEntry");
00720       return;
00721    }
00722    LoadEntryBinArea(dataEntry);
00723 }

bool gdcm::File::MayIWrite uint16_t  group  )  [inline, protected]
 

Protect the Writer from writing illegal groups.

Reimplemented from gdcm::ElementSet.

Definition at line 182 of file gdcmFile.h.

00183      { if (group < 8 &&  group !=2 ) return false; else return true; }

static File* gdcm::File::New  )  [inline, static]
 

Definition at line 104 of file gdcmFile.h.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::FileHelper::FileHelper(), and vtkGdcmReader::LoadFileInformation().

00104 {return new File();}

DataEntry * gdcm::DocEntrySet::NewDataEntry uint16_t  group,
uint16_t  elem,
VRKey const &  vr = GDCM_VRUNKNOWN
[inherited]
 

Build a new DataEntry from all the low level arguments. Check for existence of dictionary entry, and build a default one when absent.

Parameters:
group Group number of the new Entry
elem Element number of the new Entry
vr V(alue) R(epresentation) of the new Entry
Remarks:
The user of this method must destroy the DataEntry when unused

Definition at line 406 of file gdcmDocEntrySet.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDictEntry(), gdcm::DataEntry::New(), and gdcm::RefCounter::Unregister().

Referenced by gdcm::FileHelper::CopyDataEntry(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), and gdcm::Document::ReadNextDocEntry().

00408 {
00409    DictEntry *dictEntry = GetDictEntry(group, elem, vr);
00410 
00411    DataEntry *newEntry = DataEntry::New(dictEntry);
00412    dictEntry->Unregister(); // GetDictEntry register it
00413    if (!newEntry) 
00414    {
00415       gdcmWarningMacro( "Failed to allocate DataEntry for ("
00416           <<std::hex << group << "|" << elem <<")" );
00417       return 0;
00418    }
00419    return newEntry;
00420 }

SeqEntry * gdcm::DocEntrySet::NewSeqEntry uint16_t  group,
uint16_t  elem
[inherited]
 

Build a new SeqEntry from all the low level arguments. Check for existence of dictionary entry, and build a default one when absent.

Parameters:
group Group number of the new Entry
elem Element number of the new Entry
Remarks:
The user of this method must destroy the SeqEntry when unused

Definition at line 430 of file gdcmDocEntrySet.cxx.

References gdcmWarningMacro, gdcm::DocEntrySet::GetDictEntry(), gdcm::SeqEntry::New(), and gdcm::RefCounter::Unregister().

Referenced by gdcm::Document::Backtrack(), gdcm::DocEntrySet::InsertSeqEntry(), and gdcm::Document::ReadNextDocEntry().

00431 {
00432    DictEntry *dictEntry = GetDictEntry(group, elem, "SQ");
00433 
00434    SeqEntry *newEntry = SeqEntry::New( dictEntry );
00435    dictEntry->Unregister(); // GetDictEntry register it
00436    if (!newEntry)
00437    {
00438       gdcmWarningMacro( "Failed to allocate SeqEntry for ("
00439          <<std::hex << group << "|" << elem <<")" );
00440       return 0;
00441    }
00442    return newEntry;
00443 }

std::ifstream * gdcm::Document::OpenFile  )  [inherited]
 

Tries to open the file Document::Filename and checks the preamble when existing.

Returns:
The FILE pointer on success.

Definition at line 561 of file gdcmDocument.cxx.

References gdcm::Document::CloseFile(), gdcm::Document::Filename, gdcm::Util::Format(), gdcm::Document::Fp, gdcmDebugMacro, gdcmWarningMacro, and gdcm::Document::HasDCMPreamble.

Referenced by gdcm::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), gdcm::FileHelper::GetRaw(), and gdcm::Document::LoadEntryBinArea().

00562 {
00563    HasDCMPreamble = false;
00564    if (Filename.length() == 0) 
00565    {
00566       return 0;
00567    }
00568 
00569    if ( Fp )
00570    {
00571       gdcmDebugMacro( "File already open: " << Filename.c_str());
00572       CloseFile();
00573    }
00574 
00575    Fp = new std::ifstream(Filename.c_str(), std::ios::in | std::ios::binary);
00576    if ( ! *Fp )
00577    {
00578    // Don't user gdcmErrorMacro :
00579    // a spurious message will appear when you use, for instance 
00580    // gdcm::FileHelper *fh = new gdcm::FileHelper( outputFileName );
00581    // to create outputFileName.
00582    
00583    // FIXME : if the upper comment is still usefull 
00584    //         --> the constructor is not so good ...
00585    
00586       gdcmWarningMacro( "Cannot open file: " << Filename.c_str());
00587       delete Fp;
00588       Fp = 0;
00589       return 0;
00590       //exit(1); // No function is allowed to leave the application instead
00591                  // of warning the caller
00592    }
00593  
00594    uint16_t zero = 0;
00595    Fp->read((char*)&zero, (size_t)2);
00596    if ( Fp->eof() )
00597    {
00598       CloseFile();
00599       return 0;
00600    }
00601  
00602    //-- Broken ACR or DICOM with no Preamble; may start with a Shadow Group --
00603    
00604    // FIXME : We cannot be sure the preable is only zeroes..
00605    //         (see ACUSON-24-YBR_FULL-RLE.dcm )
00606    if ( 
00607        zero == 0x0001 || zero == 0x0100 || zero == 0x0002 || zero == 0x0200 ||
00608        zero == 0x0003 || zero == 0x0300 || zero == 0x0004 || zero == 0x0400 ||
00609        zero == 0x0005 || zero == 0x0500 || zero == 0x0006 || zero == 0x0600 ||
00610        zero == 0x0007 || zero == 0x0700 || zero == 0x0008 || zero == 0x0800 )
00611    {
00612       std::string msg = Util::Format(
00613         "ACR/DICOM starting by 0x(%04x) at the beginning of the file\n", zero);
00614       // FIXME : is it a Warning message, or a Debug message?
00615       gdcmWarningMacro( msg.c_str() );
00616       return Fp;
00617    }
00618  
00619    //-- DICOM --
00620    Fp->seekg(126L, std::ios::cur);
00621    char dicm[4]; // = {' ',' ',' ',' '};
00622    Fp->read(dicm,  (size_t)4);
00623    if ( Fp->eof() )
00624    {
00625       CloseFile();
00626       return 0;
00627    }
00628    if ( memcmp(dicm, "DICM", 4) == 0 )
00629    {
00630       HasDCMPreamble = true;
00631       return Fp;
00632    }
00633 
00634    // -- Neither ACR/No Preamble Dicom nor DICOMV3 file
00635    CloseFile();
00636    // Don't user Warning nor Error, not to polute the output
00637    // while directory recursive parsing ...
00638    gdcmDebugMacro( "Neither ACR/No Preamble Dicom nor DICOMV3 file: "
00639                       << Filename.c_str()); 
00640    return 0;
00641 }

bool gdcm::Document::operator< Document document  )  [inherited]
 

Compares two documents, according to DicomDir rules.

Warning:
Does NOT work with ACR-NEMA files
Todo:
Find a trick to solve the pb (use RET fields ?)
Parameters:
document to compare with current one
Returns:
true if 'smaller'

Definition at line 828 of file gdcmDocument.cxx.

References gdcm::DocEntrySet::GetEntryString().

00829 {
00830    // Patient Name
00831    std::string s1 = GetEntryString(0x0010,0x0010);
00832    std::string s2 = document.GetEntryString(0x0010,0x0010);
00833    if (s1 < s2)
00834    {
00835       return true;
00836    }
00837    else if ( s1 > s2 )
00838    {
00839       return false;
00840    }
00841    else
00842    {
00843       // Patient ID
00844       s1 = GetEntryString(0x0010,0x0020);
00845       s2 = document.GetEntryString(0x0010,0x0020);
00846       if ( s1 < s2 )
00847       {
00848          return true;
00849       }
00850       else if ( s1 > s2 )
00851       {
00852          return false;
00853       }
00854       else
00855       {
00856          // Study Instance UID
00857          s1 = GetEntryString(0x0020,0x000d);
00858          s2 = document.GetEntryString(0x0020,0x000d);
00859          if ( s1 < s2 )
00860          {
00861             return true;
00862          }
00863          else if ( s1 > s2 )
00864          {
00865             return false;
00866          }
00867          else
00868          {
00869             // Serie Instance UID
00870             s1 = GetEntryString(0x0020,0x000e);
00871             s2 = document.GetEntryString(0x0020,0x000e);    
00872             if ( s1 < s2 )
00873             {
00874                return true;
00875             }
00876             else if ( s1 > s2 )
00877             {
00878                return false;
00879             }
00880          }
00881       }
00882    }
00883    return false;
00884 }

void gdcm::ElementSet::Print std::ostream &  os = std::cout,
std::string const &  indent = ""
[virtual, inherited]
 

Prints the Header Entries (Dicom Elements) from the H Table.

Parameters:
os ostream to write to
indent Indentation string to be prepended during printing

Reimplemented from gdcm::Base.

Reimplemented in gdcm::DicomDir.

Definition at line 209 of file gdcmElementSet.cxx.

References gdcm::DataEntry::FLAG_PIXELDATA, gdcm::DocEntrySet::GetDataEntry(), gdcm::DocEntry::Print(), gdcm::Base::PrintLevel, gdcm::DataEntry::SetFlag(), gdcm::Base::SetPrintLevel(), and gdcm::ElementSet::TagHT.

Referenced by gdcm::FileHelper::Print().

00210 {
00211    // Let's change the 'warning value' for Pixel Data,
00212    // to avoid human reader to be confused by 'gdcm::NotLoaded'.   
00213    DataEntry *pixelElement = GetDataEntry(0x7fe0,0x0010);
00214    if ( pixelElement != 0 )
00215    {
00216       pixelElement->SetFlag( DataEntry::FLAG_PIXELDATA );
00217    }
00218 
00219    for( TagDocEntryHT::const_iterator i = TagHT.begin(); i != TagHT.end(); ++i)
00220    {
00221       DocEntry *entry = i->second;
00222 
00223       entry->SetPrintLevel(PrintLevel);
00224       entry->Print(os);   
00225 
00226       if ( dynamic_cast<SeqEntry *>(entry) )
00227       {
00228          // Avoid the newline for a sequence:
00229          continue;
00230       }
00231       os << std::endl;
00232    }
00233 }

void gdcm::File::ReadEncapsulatedBasicOffsetTable  )  [private]
 

When parsing the Pixel Data of an encapsulated file, read the basic offset table (when present, and BTW dump it).

Definition at line 1806 of file gdcmFile.cxx.

References BasicOffsetTableItemValue, gdcm::Document::Fp, gdcmDebugMacro, and ReadTagLength().

Referenced by ComputeJPEGFragmentInfo(), and ComputeRLEInfo().

01807 {
01809    uint32_t itemLength = ReadTagLength(0xfffe, 0xe000);
01810 
01811    // When present, read the basic offset table itself.
01812    // Notes: - since the presence of this basic offset table is optional
01813    //          we can't rely on it for the implementation, and we will simply
01814    //          trash it's content (when present).
01815    //        - still, when present, we could add some further checks on the
01816    //          lengths, but we won't bother with such fuses for the time being.
01817    if ( itemLength != 0 )
01818    {
01819       char *charBasicOffsetTableItemValue = new char[itemLength];
01820       Fp->read(charBasicOffsetTableItemValue, itemLength);
01821       unsigned int nbEntries = itemLength/4;
01822       assert( nbEntries*4 == itemLength); // Make sure this is a multiple
01823       BasicOffsetTableItemValue = new uint32_t[nbEntries];
01824 
01825       for (unsigned int i=0; i < nbEntries; i++ )
01826       {
01827          BasicOffsetTableItemValue[i] = *((uint32_t*)(&charBasicOffsetTableItemValue[4*i]));
01828 #if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION)
01829          uint32_t val = BasicOffsetTableItemValue[i];
01830          BasicOffsetTableItemValue[i] 
01831            = (  (val<<24)               | ((val<<8)  & 0x00ff0000) | 
01832               ( (val>>8)  & 0x0000ff00) |  (val>>24)               );
01833 #endif
01834          gdcmDebugMacro( "Read one length for: " << 
01835                           std::hex << BasicOffsetTableItemValue[i] );
01836       }
01837 
01838       delete[] charBasicOffsetTableItemValue;
01839    }
01840 }

uint16_t gdcm::Document::ReadInt16  )  throw ( FormatError ) [protected, inherited]
 

Reads a supposed to be 16 Bits integer (swaps it depending on processor endianness).

Returns:
read value

Definition at line 893 of file gdcmDocument.cxx.

References gdcm::Document::Fp, and gdcm::Document::SwapShort().

Referenced by gdcm::Document::FindDocEntryLengthOBOrOW(), gdcm::Document::ReadNextDocEntry(), and ReadTag().

00895 {
00896    uint16_t g;
00897    Fp->read ((char*)&g, (size_t)2);
00898    if ( Fp->fail() )
00899    {
00900       throw FormatError( "Document::ReadInt16()", " file error." );
00901    }
00902    if ( Fp->eof() )
00903    {
00904       throw FormatError( "Document::ReadInt16()", "EOF." );
00905    }
00906    g = SwapShort(g); 
00907    return g;
00908 }

uint32_t gdcm::Document::ReadInt32  )  throw ( FormatError ) [protected, inherited]
 

Reads a supposed to be 32 Bits integer (swaps it depending on processor endianness).

Returns:
read value

Definition at line 915 of file gdcmDocument.cxx.

References gdcm::Document::Fp, and gdcm::Document::SwapLong().

Referenced by ComputeRLEInfo(), gdcm::Document::FindDocEntryLengthOBOrOW(), and ReadTagLength().

00917 {
00918    uint32_t g;
00919    Fp->read ((char*)&g, (size_t)4);
00920    if ( Fp->fail() )
00921    {
00922       throw FormatError( "Document::ReadInt32()", " file error." );
00923    }
00924    if ( Fp->eof() )
00925    {
00926       throw FormatError( "Document::ReadInt32()", "EOF." );
00927    }
00928    g = SwapLong(g);
00929    return g;
00930 }

bool gdcm::File::ReadTag uint16_t  testGroup,
uint16_t  testElem
[private]
 

Assuming the internal file pointer Document::Fp is placed at the beginning of a tag, check whether this tag is (TestGroup, TestElem).

Warning:
On success the internal file pointer Document::Fp is modified to point after the tag. On failure (i.e. when the tag wasn't the expected tag (TestGroup, TestElem) the internal file pointer Document::Fp is restored to it's original position.
Parameters:
testGroup The expected group of the tag.
testElem The expected Element of the tag.
Returns:
True on success, false otherwise.

Definition at line 1725 of file gdcmFile.cxx.

References gdcm::Document::Fp, gdcmErrorMacro, gdcmWarningMacro, gdcm::Document::ReadInt16(), and gdcm::DictEntry::TranslateToKey().

Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), and ReadTagLength().

01726 {
01727    long positionOnEntry = Fp->tellg();
01728    long currentPosition = Fp->tellg();          // On debugging purposes
01729 
01730    // Read the Item Tag group and element, and make
01731    // sure they are what we expected:
01732    uint16_t itemTagGroup;
01733    uint16_t itemTagElem;
01734    try
01735    {
01736       itemTagGroup = ReadInt16();
01737       itemTagElem  = ReadInt16();
01738    }
01739    catch ( FormatError )
01740    {
01741       gdcmErrorMacro( "Can not read tag for "
01742        << "   We should have found tag ("
01743        << DictEntry::TranslateToKey(testGroup,testElem) << ")"
01744        ) ;
01745 
01746       return false;
01747    }
01748    if ( itemTagGroup != testGroup || itemTagElem != testElem )
01749    { 
01750        // in order not to pollute output we don't warn on 'delimitors'
01751       if (itemTagGroup != 0xfffe ||  testGroup != 0xfffe )
01752          gdcmWarningMacro( "Wrong Item Tag found:"
01753           << "   We should have found tag ("
01754           << DictEntry::TranslateToKey(testGroup,testElem) << ")" << std::endl
01755           << "   but instead we encountered tag ("
01756           << DictEntry::TranslateToKey(itemTagGroup,itemTagElem) << ")"
01757           << "  at address: " << "  0x(" << std::hex 
01758           << (unsigned int)currentPosition  << std::dec << ")" 
01759           ) ;
01760       Fp->seekg(positionOnEntry, std::ios::beg);
01761 
01762       return false;
01763    }
01764    return true;
01765 }

uint32_t gdcm::File::ReadTagLength uint16_t  testGroup,
uint16_t  testElem
[private]
 

Assuming the internal file pointer Document::Fp is placed at the beginning of a tag (TestGroup, TestElement), read the length associated to the Tag.

Warning:
On success the internal file pointer Document::Fp is modified to point after the tag and it's length. On failure (i.e. when the tag wasn't the expected tag (TestGroup, TestElement) the internal file pointer Document::Fp is restored to it's original position.
Parameters:
testGroup The expected Group of the tag.
testElem The expected Element of the tag.
Returns:
On success returns the length associated to the tag. On failure returns 0.

Definition at line 1781 of file gdcmFile.cxx.

References gdcm::Document::Fp, gdcmDebugMacro, gdcmErrorMacro, gdcm::Document::ReadInt32(), ReadTag(), and gdcm::DictEntry::TranslateToKey().

Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), and ReadEncapsulatedBasicOffsetTable().

01782 {
01783 
01784    if ( !ReadTag(testGroup, testElem) )
01785    {
01786       // Avoid polutting output
01787       if ( testGroup != 0xfffe ) 
01788          gdcmErrorMacro( "ReadTag did not succeed for ("
01789                     << DictEntry::TranslateToKey(testGroup,testElem) 
01790                     << ")..." );
01791       return 0;
01792    }
01793                                                                                 
01795    long currentPosition = Fp->tellg();
01796    uint32_t itemLength  = ReadInt32();
01797    gdcmDebugMacro( "Basic Item Length is: " << itemLength 
01798         << "  at address: " << std::hex << (unsigned int)currentPosition);
01799    return itemLength;
01800 }

void gdcm::RefCounter::Register  )  [inline, inherited]
 

Register the object.

Remarks:
It increments the reference counting

Definition at line 44 of file gdcmRefCounter.h.

Referenced by gdcm::SQItem::AddEntry(), gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::SeqEntry::Copy(), gdcm::DicomDir::Copy(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem().

00044 { RefCount++; }

bool gdcm::ElementSet::RemoveEntry DocEntry entryToRemove  )  [virtual, inherited]
 

Clear the hash table from given entry AND delete the entry.

Parameters:
entryToRemove Entry to remove AND delete.

Implements gdcm::DocEntrySet.

Definition at line 99 of file gdcmElementSet.cxx.

References gdcmWarningMacro, gdcm::DocEntry::GetKey(), gdcm::ElementSet::TagHT, and gdcm::RefCounter::Unregister().

Referenced by gdcm::Document::Backtrack(), DoTheLoadingJob(), gdcm::DicomDir::NewMeta(), gdcm::Document::ParseDES(), gdcm::DocEntryArchive::Push(), and gdcm::DocEntryArchive::Restore().

00100 {
00101    const TagKey &key = entryToRemove->GetKey();
00102    if ( TagHT.count(key) == 1 )
00103    {
00104       TagHT.erase(key);
00105       entryToRemove->Unregister();
00106       return true;
00107    }
00108 
00109    gdcmWarningMacro( "Key not present : " << key);
00110    return false ;
00111 }

bool gdcm::DocEntrySet::SetEntryBinArea uint8_t *  content,
int  lgth,
DataEntry entry
[inherited]
 

Accesses an existing DataEntry (i.e. a Dicom Element) and modifies it's content with the given value.

Parameters:
content new value (void* -> uint8_t*) to substitute with
entry Entry to be modified
lgth new value length

Definition at line 191 of file gdcmDocEntrySet.cxx.

References gdcm::DataEntry::SetBinArea(), and gdcm::DocEntry::SetLength().

00192 {
00193    if (entry)
00194    {
00195       entry->SetLength(lgth);
00196       entry->SetBinArea(content);  
00197       return true;
00198    }
00199    return false;
00200 }

bool gdcm::DocEntrySet::SetEntryBinArea uint8_t *  content,
int  lgth,
uint16_t  group,
uint16_t  elem
[inherited]
 

Accesses an existing DocEntry (i.e. a Dicom Element) through it's (group, element) and modifies it's content with the given value.

Parameters:
content new value (void* -> uint8_t*) to substitute with
lgth new value length
group group number of the Dicom Element to modify
elem element number of the Dicom Element to modify

Definition at line 154 of file gdcmDocEntrySet.cxx.

References gdcmWarningMacro, and gdcm::DocEntrySet::GetDataEntry().

Referenced by gdcm::DocEntrySet::InsertEntryBinArea(), and gdcm::FileHelper::SetEntryBinArea().

00156 {
00157    DataEntry *entry = GetDataEntry(group, elem);
00158    if (!entry )
00159    {
00160       gdcmWarningMacro( "No corresponding DataEntry " << std::hex << group <<
00161                         "," << elem << " element (try promotion first).");
00162       return false;
00163    }
00164 
00165    return SetEntryBinArea(content,lgth,entry);
00166 } 

bool gdcm::DocEntrySet::SetEntryString std::string const &  content,
DataEntry entry
[inherited]
 

Accesses an existing DocEntry (i.e. a Dicom Element) and modifies it's content with the given value.

Parameters:
content new value (string) to substitute with
entry Entry to be modified

Definition at line 174 of file gdcmDocEntrySet.cxx.

References gdcm::DataEntry::SetString().

00175 {
00176    if (entry)
00177    {
00178       entry->SetString(content);
00179       return true;
00180    }
00181    return false;
00182 }

bool gdcm::DocEntrySet::SetEntryString std::string const &  content,
uint16_t  group,
uint16_t  elem
[inherited]
 

Accesses an existing DocEntry (i.e. a Dicom Element) through it's (group, element) and modifies it's content with the given value.

Parameters:
content new value (string) to substitute with
group group number of the Dicom Element to modify
elem element number of the Dicom Element to modify

Definition at line 132 of file gdcmDocEntrySet.cxx.

References gdcmWarningMacro, and gdcm::DocEntrySet::GetDataEntry().

Referenced by AnonymizeFile(), gdcm::Document::DoTheLoadingDocumentJob(), gdcm::DocEntrySet::InsertEntryString(), and gdcm::FileHelper::SetEntryString().

00134 {
00135    DataEntry *entry = GetDataEntry(group, elem);
00136    if (!entry )
00137    {
00138       gdcmWarningMacro( "No corresponding DataEntry " << std::hex << group <<
00139                          "," << elem << " element (try promotion first).");
00140       return false;
00141    }
00142    return SetEntryString(content,entry);
00143 }

virtual void gdcm::Document::SetFileName std::string const &  fileName  )  [inline, virtual, inherited]
 

Accessor to Filename.

Reimplemented in gdcm::DicomDir.

Definition at line 79 of file gdcmDocument.h.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::Document::Document(), vtkGdcmReader::LoadFileInformation(), and gdcm::FileHelper::SetFileName().

00080                    { if (Filename != fileName)
00081                         Filename = fileName, IsDocumentModified = true; }

void gdcm::Document::SetLoadMode int  mode  )  [inline, inherited]
 

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 !

Parameters:
mode Load mode to be used

Definition at line 106 of file gdcmDocument.h.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::DicomDir::CreateDicomDirChainedList(), vtkGdcmReader::LoadFileInformation(), and gdcm::FileHelper::SetLoadMode().

00106                                { if (LoadMode != mode) 
00107                                      LoadMode=mode, IsDocumentModified = true; }

void gdcm::Base::SetPrintLevel int  level  )  [inline, inherited]
 

Sets the print level for the Dicom Header Elements.

Note:
0 for Light Print; 1 for 'medium' Print, 2 for Heavy Print

Definition at line 47 of file gdcmBase.h.

Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print().

00047 { PrintLevel = level; }

bool gdcm::Document::SetShaDict DictKey const &  dictName  )  [inherited]
 

Set the shadow dictionary used.

Parameters:
dictName name of the dictionary to use in shadow

Definition at line 316 of file gdcmDocument.cxx.

References gdcm::DictSet::GetDict(), gdcm::Global::GetDicts(), and gdcm::Document::RefShaDict.

00317 {
00318    RefShaDict = Global::GetDicts()->GetDict(dictName);
00319    return !RefShaDict;
00320 }

bool gdcm::Document::SetShaDict Dict dict  )  [inherited]
 

Set the shadow dictionary used.

Parameters:
dict dictionary to use in shadow

Definition at line 306 of file gdcmDocument.cxx.

References gdcm::Document::RefShaDict.

00307 {
00308    RefShaDict = dict;
00309    return !RefShaDict;
00310 }

void gdcm::Document::SkipBytes uint32_t  nBytes  )  [protected, inherited]
 

skips bytes inside the source file

Returns:

Definition at line 936 of file gdcmDocument.cxx.

References gdcm::Document::Fp.

Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), gdcm::Document::FindDocEntryLengthOBOrOW(), and gdcm::Document::SkipDocEntry().

00937 {
00938    //FIXME don't dump the returned value
00939    Fp->seekg((long)nBytes, std::ios::cur);
00940 }

void gdcm::RefCounter::Unregister  )  [inline, inherited]
 

Unregister the object.

Remarks:
It decrements the reference counting

Definition at line 48 of file gdcmRefCounter.h.

Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DicomDir::Copy(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().

00049    {
00050       RefCount--;
00051       if(RefCount<=0)
00052          delete this;
00053    }

bool gdcm::File::Write std::string  fileName,
FileType  writetype
 

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.

Parameters:
fileName file name to write to
writetype type of the file to be written (ACR, ExplicitVR, ImplicitVR)
Todo:
FIXME : Derma?.dcm does not have it...let's remove it ?!? JPRx

Definition at line 1490 of file gdcmFile.cxx.

References gdcm::Document::ComputeGroup0002Length(), gdcm::Util::DicomString(), gdcm::Util::Format(), gdcmWarningMacro, gdcm::DocEntrySet::GetDataEntry(), gdcm::DocEntrySet::GetEntryLength(), GrPixel, gdcm::DocEntrySet::InsertEntryString(), gdcm::JPEG, NumPixel, gdcm::DataEntry::SetString(), and gdcm::Document::WriteContent().

Referenced by gdcm::FileHelper::Write().

01491 {
01492    std::ofstream *fp = new std::ofstream(fileName.c_str(), 
01493                                          std::ios::out | std::ios::binary);
01494    if (*fp == NULL)
01495    {
01496       gdcmWarningMacro("Failed to open (write) File: " << fileName.c_str());
01497       return false;
01498    }
01499 
01500    // Entry : 0002|0000 = group length -> recalculated
01501    DataEntry *e0000 = GetDataEntry(0x0002,0x0000);
01502    if ( e0000 )
01503    {
01504       std::ostringstream sLen;
01505       sLen << ComputeGroup0002Length( );
01506       e0000->SetString(sLen.str());
01507    }
01508 
01510    if( writetype != JPEG )
01511    {
01512       int i_lgPix = GetEntryLength(GrPixel, NumPixel);
01513       if (i_lgPix != -2)
01514       {
01515          // no (GrPixel, NumPixel) element
01516          std::string s_lgPix = Util::Format("%d", i_lgPix+12);
01517          s_lgPix = Util::DicomString( s_lgPix.c_str() );
01518          InsertEntryString(s_lgPix,GrPixel, 0x0000);   
01519       }
01520    }
01521    Document::WriteContent(fp, writetype);
01522 
01523    fp->close();
01524    delete fp;
01525 
01526    return true;
01527 }

void gdcm::Document::WriteContent std::ofstream *  fp,
FileType  filetype
[virtual, inherited]
 

Writes in a file all the Entries (Dicom Elements).

Parameters:
fp file pointer on an already open file (actually: Output File Stream)
filetype Type of the File to be written (ACR-NEMA, ExplicitVR, ImplicitVR)

Reimplemented from gdcm::ElementSet.

Definition at line 664 of file gdcmDocument.cxx.

References gdcm::ExplicitVR, gdcm::ImplicitVR, gdcm::JPEG, and gdcm::ElementSet::WriteContent().

Referenced by Write().

00665 {
00666    // Skip if user wants to write an ACR-NEMA file
00667 
00668    if ( filetype == ImplicitVR || filetype == ExplicitVR ||
00669         filetype == JPEG )
00670    {
00671       // writing Dicom File Preamble
00672       char filePreamble[128];
00673       memset(filePreamble, 0, 128);
00674       fp->write(filePreamble, 128);
00675       fp->write("DICM", 4);
00676    }
00677 
00678    /*
00679     * \todo rewrite later, if really usefull
00680     *       - 'Group Length' element is optional in DICOM
00681     *       - but un-updated odd groups lengthes can causes pb
00682     *         (xmedcon breaker)
00683     *
00684     * if ( (filetype == ImplicitVR) || (filetype == ExplicitVR) )
00685     *    UpdateGroupLength(false,filetype);
00686     * if ( filetype == ACR)
00687     *    UpdateGroupLength(true,ACR);
00688     *
00689     * --> Computing group length for groups with embeded Sequences
00690     * --> was too much tricky / we were [in a hurry / too lazy]
00691     * --> We don't write the element 0x0000 (group length)
00692     */
00693 
00694    ElementSet::WriteContent(fp, filetype); // This one is recursive
00695 }


Member Data Documentation

bool gdcm::Document::Abort [mutable, protected, inherited]
 

Definition at line 229 of file gdcmDocument.h.

Referenced by gdcm::Document::CallStartMethod(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::DicomDir::DoTheLoadingJob(), and gdcm::DicomDir::Initialize().

uint32_t* gdcm::File::BasicOffsetTableItemValue [private]
 

Definition at line 208 of file gdcmFile.h.

Referenced by ComputeJPEGFragmentInfo(), ComputeRLEInfo(), File(), ReadEncapsulatedBasicOffsetTable(), and ~File().

uint16_t gdcm::Document::CurrentElem [protected, inherited]
 

to allow any inner method to know current tag Element number

Definition at line 246 of file gdcmDocument.h.

Referenced by gdcm::Document::ReadNextDocEntry().

uint16_t gdcm::Document::CurrentGroup [protected, inherited]
 

to allow any inner method to know current tag Group number

Definition at line 244 of file gdcmDocument.h.

Referenced by gdcm::Document::FindDocEntryVR(), and gdcm::Document::ReadNextDocEntry().

std::string gdcm::Document::Filename [protected, inherited]
 

Refering underlying filename.

Definition at line 128 of file gdcmDocument.h.

Referenced by AnonymizeNoLoad(), gdcm::Document::DoTheLoadingDocumentJob(), and gdcm::Document::OpenFile().

FileType gdcm::Document::Filetype [protected, inherited]
 

ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown.

Definition at line 154 of file gdcmDocument.h.

Referenced by gdcm::Document::CheckSwap(), gdcm::Document::Document(), gdcm::Document::DoTheLoadingDocumentJob(), gdcm::Document::FindDocEntryVR(), gdcm::Document::GetFileType(), gdcm::Document::HandleOutOfGroup0002(), gdcm::Document::Initialize(), gdcm::Document::IsParsable(), gdcm::DicomDir::IsReadable(), and gdcm::Document::ReadNextDocEntry().

std::ifstream* gdcm::Document::Fp [protected, inherited]
 

File Pointer, opened during Document parsing.

Definition at line 151 of file gdcmDocument.h.

Referenced by gdcm::Document::Backtrack(), gdcm::Document::CheckSwap(), gdcm::Document::CloseFile(), ComputeJPEGFragmentInfo(), ComputeRLEInfo(), gdcm::Document::Document(), gdcm::Document::DoTheLoadingDocumentJob(), DoTheLoadingJob(), gdcm::DicomDir::DoTheLoadingJob(), gdcm::Document::FindDocEntryLengthOBOrOW(), gdcm::Document::FindDocEntryVR(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadDocEntrySafe(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::OpenFile(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), ReadEncapsulatedBasicOffsetTable(), gdcm::Document::ReadInt16(), gdcm::Document::ReadInt32(), gdcm::Document::ReadNextDocEntry(), ReadTag(), ReadTagLength(), gdcm::Document::SkipBytes(), gdcm::Document::SkipToNextDocEntry(), and gdcm::Document::SwitchByteSwapCode().

bool gdcm::Document::Group0002Parsed [protected, inherited]
 

whether we already parsed group 0002 (Meta Elements)

Definition at line 145 of file gdcmDocument.h.

Referenced by gdcm::Document::Document(), gdcm::Document::DoTheLoadingDocumentJob(), and gdcm::Document::HandleOutOfGroup0002().

uint16_t gdcm::File::GrPixel [protected]
 

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 199 of file gdcmFile.h.

Referenced by DoTheLoadingJob(), File(), GetPixelAreaLength(), GetPixelOffset(), IsReadable(), and Write().

bool gdcm::Document::HasDCMPreamble [protected, inherited]
 

whether file has a DCM Preamble

Definition at line 148 of file gdcmDocument.h.

Referenced by gdcm::Document::OpenFile(), and gdcm::Document::ReadNextDocEntry().

const unsigned int gdcm::Document::HEADER_LENGTH_TO_READ [static, protected, inherited]
 

After opening the file, we read HEADER_LENGTH_TO_READ bytes.

Definition at line 157 of file gdcmDocument.h.

bool gdcm::Document::IsDocumentAlreadyLoaded [protected, inherited]
 

Whether the gdcm::Document is already parsed/loaded : False from the creation of the gdcm::Document untill gdcm::Document:Load().

Definition at line 177 of file gdcmDocument.h.

Referenced by gdcm::Document::Document(), and gdcm::Document::DoTheLoadingDocumentJob().

bool gdcm::Document::IsDocumentModified [protected, inherited]
 

Whether the gdcm::Document was modified since the last Load().

Definition at line 180 of file gdcmDocument.h.

Referenced by gdcm::Document::Document(), and gdcm::Document::DoTheLoadingDocumentJob().

JPEGFragmentsInfo* gdcm::File::JPEGInfo [protected]
 

Store the JPEG fragments info obtained during parsing of pixels.

Definition at line 188 of file gdcmFile.h.

Referenced by ComputeJPEGFragmentInfo(), File(), and ~File().

int gdcm::Document::LoadMode [protected, inherited]
 

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 172 of file gdcmDocument.h.

Referenced by gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::Document::Document(), and gdcm::Document::ParseDES().

const unsigned int gdcm::Document::MAX_SIZE_LOAD_ELEMENT_VALUE = 0xfff [static, protected, inherited]
 

Elements whose value is longer than MAX_SIZE_LOAD_ELEMENT_VALUE are NOT loaded.

Definition at line 160 of file gdcmDocument.h.

Referenced by gdcm::Document::Document().

uint32_t gdcm::Document::MaxSizeLoadEntry [protected, inherited]
 

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 241 of file gdcmDocument.h.

Referenced by gdcm::Document::LoadDocEntry(), and gdcm::Document::SetMaxSizeLoadEntry().

uint16_t gdcm::File::NumPixel [protected]
 

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 194 of file gdcmFile.h.

Referenced by DoTheLoadingJob(), File(), GetPixelAreaLength(), GetPixelOffset(), IsReadable(), and Write().

DocEntry* gdcm::DocEntrySet::PreviousDocEntry [protected, inherited]
 

To be able to backtrack (Private Sequence, Implicit VR related pb).

Definition at line 127 of file gdcmDocEntrySet.h.

Referenced by gdcm::Document::Backtrack(), gdcm::DocEntrySet::DocEntrySet(), and gdcm::Document::ParseDES().

int gdcm::Base::PrintLevel [protected, inherited]
 

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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print().

float gdcm::Document::Progress [protected, inherited]
 

value of the ??? for any progress bar

Definition at line 228 of file gdcmDocument.h.

Referenced by gdcm::Document::CallEndMethod(), gdcm::Document::CallStartMethod(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::DicomDir::DoTheLoadingJob(), and gdcm::DicomDir::Initialize().

Dict* gdcm::Document::RefPubDict [protected, inherited]
 

Public dictionary used to parse this header.

Definition at line 232 of file gdcmDocument.h.

Referenced by gdcm::Document::GetPubDict(), and gdcm::Document::Initialize().

Dict* gdcm::Document::RefShaDict [protected, inherited]
 

Optional "shadow dictionary" (private elements) used to parse this header.

Definition at line 235 of file gdcmDocument.h.

Referenced by gdcm::Document::GetShaDict(), gdcm::Document::Initialize(), and gdcm::Document::SetShaDict().

RLEFramesInfo* gdcm::File::RLEInfo [protected]
 

Store the RLE frames info obtained during parsing of pixels.

Definition at line 186 of file gdcmFile.h.

Referenced by ComputeRLEInfo(), File(), and ~File().

int gdcm::Document::SwapCode [protected, inherited]
 

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 :

  • a 'Little Endian' image, read with a little endian processor will have a SwapCode= 1234 (the order is OK; nothing to do)
  • a 'Little Endian' image, read with a big endian procesor will have a SwapCode= 4321 (the order is wrong; int32 an int16 must be swapped) note : values 2143, 4321, 3412 remain for the ACR-NEMA time, and the well known 'Bad Big Endian' and 'Bad Little Endian' codes.

Definition at line 142 of file gdcmDocument.h.

Referenced by gdcm::Document::CheckSwap(), gdcm::Document::Document(), gdcm::Document::SwapDouble(), gdcm::Document::SwapLong(), gdcm::Document::SwapShort(), and gdcm::Document::SwitchByteSwapCode().

ListElements gdcm::Document::UserAnonymizeList [protected, inherited]
 

User supplied list of elements to Anonymize.

Definition at line 163 of file gdcmDocument.h.

Referenced by AddAnonymizeElement(), AnonymizeFile(), and AnonymizeNoLoad().

ListElements gdcm::Document::UserForceLoadList [protected, inherited]
 

User supplied list of elements to force Load.

Definition at line 166 of file gdcmDocument.h.

Referenced by gdcm::Document::AddForceLoadElement(), and gdcm::Document::DoTheLoadingDocumentJob().


The documentation for this class was generated from the following files:
Generated on Fri Jan 20 10:15:06 2006 for gdcm by  doxygen 1.4.4