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

gdcmHeader Class Reference

#include <gdcmHeader.h>

Inheritance diagram for gdcmHeader:

gdcmParser gdcmHeaderHelper List of all members.

Public Member Functions

 gdcmHeader (bool exception_on_error=false)
 Constructor.

 gdcmHeader (const char *filename, bool exception_on_error=false, bool enable_sequences=false, bool skip_shadow=false)
 Constructor.

virtual ~gdcmHeader ()
 Canonical destructor.

virtual bool IsReadable (void)
 This predicate, based on hopefully reasonable heuristics, decides whether or not the current gdcmParser was properly parsed and contains the mandatory information for being considered as a well formed and usable Dicom/Acr File.

bool IsJPEGBaseLineProcess1TransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEGBaseLineProcess1 one.

bool IsJPEGExtendedProcess2_4TransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEGExtendedProcess2-4 one.

bool IsJPEGExtendedProcess3_5TransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEGExtendeProcess3-5 one.

bool IsJPEGSpectralSelectionProcess6_8TransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEGSpectralSelectionProcess6-8 one.

bool IsRLELossLessTransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a RLE Lossless one.

bool IsJPEGLossless (void)
 Determines if Transfer Syntax was already encountered and if it corresponds to a JPEG Lossless one.

bool IsJPEG2000 (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEG2000 one.

bool IsDicomV3 (void)
 Predicate for dicom version 3 file.

int GetXSize (void)
 Retrieve the number of columns of image.

int GetYSize (void)
 Retrieve the number of lines of image.

int GetZSize (void)
 Retrieve the number of planes of volume or the number of frames of a multiframe.

int GetBitsStored (void)
 Retrieve the number of Bits Stored (actually used) (as opposite to number of Bits Allocated).

int GetBitsAllocated (void)
 Retrieve the number of Bits Allocated (8, 12 -compacted ACR-NEMA files, 16, ...).

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

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

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

std::string GetPixelType (void)
 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!).

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

size_t GetPixelAreaLength (void)
 Recover the pixel area length (in Bytes).

bool HasLUT (void)
 tells us if LUT are used

int GetLUTNbits (void)
 gets the info from 0028,1101 : Lookup Table Desc-Red else 0

unsigned char * GetLUTRGBA (void)
 builts Red/Green/Blue/Alpha LUT from Header when (0028,0004),Photometric Interpretation = [PALETTE COLOR ] and (0028,1101),(0028,1102),(0028,1102) -xxx Palette Color Lookup Table Descriptor - are found and (0028,1201),(0028,1202),(0028,1202) -xxx Palette Color Lookup Table Data - are found

std::string GetTransfertSyntaxName (void)
 gets the info from 0002,0010 : Transfert Syntax and gdcmTS else 1.

virtual std::string GetEntryByNumber (guint16 group, guint16 element)
 Searches within Header Entries (Dicom Elements) parsed with the public and private dictionaries for the element value representation of a given tag.

virtual std::string GetEntryVRByNumber (guint16 group, guint16 element)
 Searches within Header Entries (Dicom Elements) parsed with the public and private dictionaries for the element value representation of a given tag..

virtual std::string GetEntryByName (std::string tagName)
 Searches within Header Entries (Dicom Elements) parsed with the public and private dictionaries for the element value of a given tag.

virtual std::string GetEntryVRByName (std::string tagName)
 Searches within Header Entries (Dicom Elements) parsed with the public and private dictionaries for the element value representation of a given tag.

virtual bool SetEntryByNumber (std::string content, guint16 group, guint16 element)
 Accesses an existing gdcmHeaderEntry (i.e. a Dicom Element) through it's (group, element) and modifies it's content with the given value.

virtual bool SetEntryByName (std::string content, std::string tagName)
 Sets the value (string) of the Header Entry (Dicom Element).

virtual bool SetEntryLengthByNumber (guint32 l, guint16 group, guint16 element)
 Accesses an existing gdcmHeaderEntry (i.e. a Dicom Element) in the PubHeaderEntrySet of this instance through it's (group, element) and modifies it's length with the given value.

virtual void UpdateShaEntries (void)
 Update the entries with the shadow dictionary. Only non even entries are analyzed.

void SetImageDataSize (size_t ExpectedSize)
 Sets the Pixel Area size in the Header --> not-for-rats function.

bool operator< (gdcmHeader &header)
 compares 2 Headers, according to DICOMDIR rules --> not-for-rats function

void SetPrintLevel (int level)
 Sets the print level for the Dicom Header.

virtual void Print (std::ostream &os=std::cout)
virtual void PrintEntry (std::ostream &os=std::cout)
 Prints the Header Entries (Dicom Elements) both from the H Table and the chained list.

virtual void PrintPubDict (std::ostream &os=std::cout)
 Prints The Dict Entries of THE public Dicom Dictionnry.

virtual void PrintShaDict (std::ostream &os=std::cout)
 Prints The Dict Entries of THE shadow Dicom Dictionnry.

std::string GetFileName (void)
gdcmDictGetPubDict (void)
 Get the public dictionary used.

gdcmDictGetShaDict (void)
 Get the shadow dictionary used.

bool SetShaDict (gdcmDict *dict)
 Set the shadow dictionary used.

bool SetShaDict (DictKey dictName)
 Set the shadow dictionary used.

bool IsImplicitVRLittleEndianTransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a ImplicitVRLittleEndian one.

bool IsExplicitVRLittleEndianTransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a ExplicitVRLittleEndian one.

bool IsDeflatedExplicitVRLittleEndianTransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a DeflatedExplicitVRLittleEndian one.

bool IsExplicitVRBigEndianTransferSyntax (void)
 Determines if the Transfer Syntax was already encountered and if it corresponds to a Explicit VR Big Endian one.

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

TagHeaderEntryHTGetEntry (void)
 returns a ref to the Dicom Header H table (multimap) return the Dicom Header H table

ListTagGetListEntry (void)
 returns a ref to the Dicom Header chained list return the Dicom Header chained list

FILE * OpenFile (bool exception_on_error=false) throw (gdcmFileError)
 opens the file

bool CloseFile (void)
 closes the file

virtual bool Write (FILE *, FileType)
bool ReplaceOrCreateByNumber (std::string Value, guint16 Group, guint16 Elem)
 Modifies the value of a given Header Entry (Dicom Element) if it exists; Creates it with the given value if it doesn't.

bool ReplaceOrCreateByNumber (char *Value, guint16 Group, guint16 Elem)
 Modifies the value of a given Header Entry (Dicom Element) if it exists; Creates it with the given value if it doesn't.

bool ReplaceIfExistByNumber (char *Value, guint16 Group, guint16 Elem)
 Set a new value if the invoked element exists Seems to be useless !!!

int GetSwapCode (void)
guint16 GetGrPixel (void)
guint16 GetNumPixel (void)
guint16 SwapShort (guint16)
 Swaps the bytes so they agree with the processor order.

guint32 SwapLong (guint32)
 Swaps back the bytes of 4-byte long integer accordingly to processor order.

guint16 UnswapShort (guint16)
 Unswaps the bytes so they agree with the processor order.

guint32 UnswapLong (guint32)
 Unswaps back the bytes of 4-byte long integer accordingly to processor order.


Protected Member Functions

int write (std::ostream &)
int anonymize (std::ostream &)
bool anonymizeHeader (void)
 anonymize a Header (removes Patient's personal info) (read the code to see which ones ...)

int CheckIfEntryExistByNumber (guint16 Group, guint16 Elem)
 Checks if a given Dicom Element exists within the H table.

virtual size_t GetEntryOffsetByNumber (guint16 Group, guint16 Elem)
 Gets (from Header) the offset of a 'non string' element value (LoadElementValues has already be executed).

virtual void * GetEntryVoidAreaByNumber (guint16 Group, guint16 Elem)
 Gets (from Header) a 'non string' element value (LoadElementValues has already be executed).

virtual void * LoadEntryVoidArea (guint16 Group, guint16 Element)
 Loads (from disk) the element content when a string is not suitable.

virtual bool SetEntryVoidAreaByNumber (void *a, guint16 Group, guint16 Elem)
 Sets a 'non string' value to a given Dicom Element.

gdcmHeaderEntryGetHeaderEntryByNumber (guint16 group, guint16 element)
 retrieves a Dicom Element (the first one) using (group, element)

gdcmHeaderEntryGetHeaderEntryByName (std::string Name)
 Searches within the Header Entries for a Dicom Element of a given tag.

IterHT GetHeaderEntrySameNumber (guint16 group, guint16 element)
 retrieves the Dicom Elements (all of them) using (group, element)

void LoadHeaderEntrySafe (gdcmHeaderEntry *)
 Loads the element while preserving the current underlying file position indicator as opposed to to LoadHeaderEntry that modifies it.

void UpdateGroupLength (bool SkipSequence=false, FileType type=ImplicitVR)
 Re-computes the length of a ACR-NEMA/Dicom group from a DcmHeader.

void WriteEntries (FILE *_fp, FileType type)
 writes on disc according to the requested format (ACR-NEMA, ExplicitVR, ImplicitVR) the image


Protected Attributes

FILE * fp
FileType filetype
TagHeaderEntryHT tagHT
ListTag listEntries
int enableSequences
int printLevel
guint16 GrPixel
guint16 NumPixel
int countGrPixel

Static Protected Attributes

const unsigned int HEADER_LENGTH_TO_READ = 256
const unsigned int MAX_SIZE_LOAD_ELEMENT_VALUE = 4096
const unsigned int MAX_SIZE_PRINT_ELEMENT_VALUE = 64

Constructor & Destructor Documentation

gdcmHeader::gdcmHeader bool  exception_on_error = false  ) 
 

Constructor.

Parameters:
exception_on_error 

Definition at line 68 of file gdcmHeader.cxx.

00068                                               :
00069    gdcmParser(exception_on_error)
00070 {
00071 }

gdcmHeader::gdcmHeader const char *  InFilename,
bool  exception_on_error = false,
bool  enable_sequences = false,
bool  ignore_shadow = false
 

Constructor.

Parameters:
InFilename 
exception_on_error 
enable_sequences = true to allow the header to be parsed *inside* the SeQuences, when they have an actual length
ignore_shadow = true if user wants to skip shadow groups during parsing, to save memory space

Definition at line 26 of file gdcmHeader.cxx.

References GDCM_UNFOUND, gdcmParser::GetEntry(), GetEntryByNumber(), TagKey, and gdcmDictEntry::TranslateToKey().

00029                                           :
00030    gdcmParser(InFilename,exception_on_error,enable_sequences,ignore_shadow)
00031 { 
00032    
00033    // for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010
00034    // We may encounter the 'RETired' (0x0028, 0x0200) tag
00035    // (Image Location") . This Element contains the number of
00036    // the group that contains the pixel data (hence the "Pixel Data"
00037    // is found by indirection through the "Image Location").
00038    // Inside the group pointed by "Image Location" the searched element
00039    // is conventionally the element 0x0010 (when the norm is respected).
00040    // When the "Image Location" is absent we default to group 0x7fe0.
00041    
00042    // This IS the right place for the code
00043  
00044       std::string ImageLocation = GetEntryByNumber(0x0028, 0x0200);
00045       if ( ImageLocation == GDCM_UNFOUND ) { // Image Location
00046          GrPixel = 0x7fe0;                   // default value
00047       } else {
00048          GrPixel = (guint16) atoi( ImageLocation.c_str() );
00049       }   
00050       if (GrPixel == 0xe07f) // sometimes Image Location value doesn't follow 
00051          GrPixel = 0x7fe0;   // the supposed processor endianity. 
00052                              // see gdcmData/cr172241.dcm      
00053       if (GrPixel != 0x7fe0) 
00054          // This is a kludge for old dirty Philips imager.
00055          NumPixel = 0x1010;
00056       else
00057          NumPixel = 0x0010;
00058          
00059       TagKey key = gdcmDictEntry::TranslateToKey(GrPixel, NumPixel);
00060       countGrPixel = GetEntry().count(key);
00061 }

gdcmHeader::~gdcmHeader void   )  [virtual]
 

Canonical destructor.

Definition at line 77 of file gdcmHeader.cxx.

00077                              {
00078 }


Member Function Documentation

int gdcmHeader::anonymize std::ostream &   )  [protected]
 

bool gdcmHeader::anonymizeHeader void   )  [protected]
 

anonymize a Header (removes Patient's personal info) (read the code to see which ones ...)

Parameters:
 

Definition at line 795 of file gdcmHeader.cxx.

References GDCM_UNFOUND, GetEntryByNumber(), gdcmParser::GetHeaderEntryByNumber(), gdcmParser::ReplaceIfExistByNumber(), and gdcmParser::ReplaceOrCreateByNumber().

00795                                  {
00796 
00797   gdcmHeaderEntry *patientNameHE = GetHeaderEntryByNumber (0x0010, 0x0010);
00798  // gdcmHeaderEntry *patientIDHE   = GetHeaderEntryByNumber (0x0010, 0x0020); 
00799     
00800   ReplaceIfExistByNumber ("  ",0x0010, 0x2154); // Telephone   
00801   ReplaceIfExistByNumber ("  ",0x0010, 0x1040); // Adress
00802   ReplaceIfExistByNumber ("  ",0x0010, 0x0020); // Patient ID
00803   
00804   if (patientNameHE) {
00805      std::string StudyInstanceUID =  GetEntryByNumber (0x0020, 0x000d);
00806      if (StudyInstanceUID !=GDCM_UNFOUND)
00807         ReplaceOrCreateByNumber(StudyInstanceUID, 0x0010, 0x0010);
00808      else
00809         ReplaceOrCreateByNumber("anonymised", 0x0010, 0x0010);            
00810   }
00811   
00812   // Just for fun :-(
00813   // (if any) remove or replace 
00814   
00815 //0008 0012 DA ID Instance Creation Date
00816 //0008 0020 DA ID Study Date
00817 //0008 0021 DA ID Series Date
00818 //0008 0022 DA ID Acquisition Date
00819 //0008 0023 DA ID Content Date
00820 //0008 0024 DA ID Overlay Date
00821 //0008 0025 DA ID Curve Date
00822 //0008 002a DT ID Acquisition Datetime
00823 //0018 9074 DT ACQ Frame Acquisition Datetime
00824 //0018 9151 DT ACQ Frame Reference Datetime
00825 //0018 a002 DT ACQ Contribution Date Time
00826 //0020 3403 SH REL Modified Image Date (RET)
00827 //0032 0032 DA SDY Study Verified Date
00828 //0032 0034 DA SDY Study Read Date
00829 //0032 1000 DA SDY Scheduled Study Start Date
00830 //0032 1010 DA SDY Scheduled Study Stop Date
00831 //0032 1040 DA SDY Study Arrival Date
00832 //0032 1050 DA SDY Study Completion Date
00833 //0038 001a DA VIS Scheduled Admission Date
00834 //0038 001c DA VIS Scheduled Discharge Date
00835 //0038 0020 DA VIS Admitting Date
00836 //0038 0030 DA VIS Discharge Date
00837 //0040 0002 DA PRC Scheduled Procedure Step Start Date
00838 //0040 0004 DA PRC Scheduled Procedure Step End Date
00839 //0040 0244 DA PRC Performed Procedure Step Start Date
00840 //0040 0250 DA PRC Performed Procedure Step End Date
00841 //0040 2004 DA PRC Issue Date of Imaging Service Request
00842 //0040 4005 DT PRC Scheduled Procedure Step Start Date and Time
00843 //0040 4011 DT PRC Expected Completion Date and Time
00844 //0040 a030 DT PRC Verification Date Time
00845 //0040 a032 DT PRC Observation Date Time
00846 //0040 a120 DT PRC DateTime
00847 //0040 a121 DA PRC Date
00848 //0040 a13a DT PRC Referenced Datetime
00849 //0070 0082 DA ??? Presentation Creation Date
00850 //0100 0420 DT ??? SOP Autorization Date and Time
00851 //0400 0105 DT ??? Digital Signature DateTime
00852 //2100 0040 DA PJ Creation Date
00853 //3006 0008 DA SSET Structure Set Date
00854 //3008 0024 DA ??? Treatment Control Point Date
00855 //3008 0054 DA ??? First Treatment Date
00856 //3008 0056 DA ??? Most Recent Treatment Date
00857 //3008 0162 DA ??? Safe Position Exit Date
00858 //3008 0166 DA ??? Safe Position Return Date
00859 //3008 0250 DA ??? Treatment Date
00860 //300a 0006 DA RT RT Plan Date
00861 //300a 022c DA RT Air Kerma Rate Reference Date
00862 //300e 0004 DA RT Review Date
00863  return true;  
00864  }

int gdcmParser::CheckIfEntryExistByNumber guint16  group,
guint16  element
[protected, inherited]
 

Checks if a given Dicom Element exists within the H table.

Parameters:
group Group number of the searched Dicom Element
element Element number of the searched Dicom Element
Returns:
number of occurences

Definition at line 509 of file gdcmParser.cxx.

References gdcmParser::tagHT, and gdcmDictEntry::TranslateToKey().

Referenced by gdcmParser::ReplaceOrCreateByNumber().

00509                                                                          {
00510         std::string key = gdcmDictEntry::TranslateToKey(group, element );
00511         return (tagHT.count(key));
00512 }

bool gdcmParser::CloseFile void   )  [inherited]
 

closes the file

Returns:
TRUE if the close was successfull

Definition at line 365 of file gdcmParser.cxx.

References gdcmParser::fp.

Referenced by gdcmParser::gdcmParser(), gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00365                                {
00366   int closed = fclose(fp);
00367   fp = (FILE *)0;
00368   if (! closed)
00369      return false;
00370   return true;
00371 }

int gdcmHeader::GetBitsAllocated void   ) 
 

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

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 336 of file gdcmHeader.cxx.

References GDCM_UNFOUND, and GetEntryByNumber().

Referenced by gdcmFile::gdcm_read_RLE_file(), and gdcmFile::ReadPixelData().

00336                                      {
00337    std::string StrSize = GetEntryByNumber(0x0028,0x0100);
00338    if (StrSize == GDCM_UNFOUND)
00339       return 0; // It's supposed to be mandatory
00340                 // the caller will have to check
00341    return atoi(StrSize.c_str());
00342 }

int gdcmHeader::GetBitsStored void   ) 
 

Retrieve the number of Bits Stored (actually used) (as opposite 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 321 of file gdcmHeader.cxx.

References GDCM_UNFOUND, and GetEntryByNumber().

Referenced by gdcmFile::ReadPixelData().

00321                                   {  
00322    std::string StrSize = GetEntryByNumber(0x0028,0x0101);
00323    if (StrSize == GDCM_UNFOUND)
00324       return 0;  // It's supposed to be mandatory
00325                  // the caller will have to check
00326    return atoi(StrSize.c_str());
00327 }

TagHeaderEntryHT& gdcmParser::GetEntry void   )  [inline, inherited]
 

returns a ref to the Dicom Header H table (multimap) return the Dicom Header H table

Definition at line 80 of file gdcmParser.h.

References TagHeaderEntryHT.

Referenced by gdcmHeader(), and gdcmFile::WriteBase().

00080 { return tagHT; };

virtual std::string gdcmHeader::GetEntryByName std::string  tagName  )  [inline, virtual]
 

Searches within Header Entries (Dicom Elements) parsed with the public and private dictionaries for the element value of a given tag.

Warning:
Don't use any longer : use GetPubEntryByName
Parameters:
tagName name of the searched element.
Returns:
Corresponding element value when it exists, and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.

Reimplemented from gdcmParser.

Definition at line 90 of file gdcmHeader.h.

References gdcmParser::GetEntryByName().

00091       { return(gdcmParser::GetEntryByName(tagName)); }

virtual std::string gdcmHeader::GetEntryByNumber guint16  group,
guint16  element
[inline, virtual]
 

Searches within Header Entries (Dicom Elements) parsed with the public and private dictionaries for the element value representation of a given tag.

Parameters:
group Group of the searched tag.
element Element of the searched tag.
Returns:
Corresponding element value representation when it exists, and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.

Reimplemented from gdcmParser.

Definition at line 85 of file gdcmHeader.h.

References gdcmParser::GetEntryByNumber().

Referenced by anonymizeHeader(), gdcmHeader(), GetBitsAllocated(), GetBitsStored(), gdcmHeaderHelper::GetClassUID(), gdcmFile::GetImageDataIntoVectorRaw(), gdcmHeaderHelper::GetImageNumber(), gdcmHeaderHelper::GetImageOrientationPatient(), gdcmHeaderHelper::GetInstanceUID(), GetLUTNbits(), GetLUTRGBA(), gdcmHeaderHelper::GetModality(), gdcmHeaderHelper::GetNumberOfScalarComponents(), gdcmHeaderHelper::GetNumberOfScalarComponentsRaw(), gdcmHeaderHelper::GetPixelSize(), gdcmHeaderHelper::GetPixelType(), GetPixelType(), GetPlanarConfiguration(), gdcmHeaderHelper::GetRescaleIntercept(), gdcmHeaderHelper::GetRescaleSlope(), GetSamplesPerPixel(), gdcmHeaderHelper::GetSeriesUID(), gdcmHeaderHelper::GetStudyUID(), GetTransfertSyntaxName(), gdcmHeaderHelper::GetXOrigin(), GetXSize(), gdcmHeaderHelper::GetXSpacing(), gdcmHeaderHelper::GetYOrigin(), GetYSize(), gdcmHeaderHelper::GetYSpacing(), gdcmHeaderHelper::GetZOrigin(), GetZSize(), gdcmHeaderHelper::GetZSpacing(), IsReadable(), operator<(), gdcmFile::ParsePixelData(), gdcmFile::ReadPixelData(), gdcmDicomDir::SetElement(), gdcmFile::SetPixelDataSizeFromHeader(), and gdcmFile::WriteBase().

00086       { return(gdcmParser::GetEntryByNumber(group,element)); }

size_t gdcmParser::GetEntryOffsetByNumber guint16  Group,
guint16  Elem
[protected, virtual, inherited]
 

Gets (from Header) the offset of a 'non string' element value (LoadElementValues has already be executed).

Parameters:
Group group of the Entry
Elem element of the Entry
Returns:
File Offset of the Element Value

Definition at line 695 of file gdcmParser.cxx.

References dbg, gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetOffset(), and gdcmDebug::Verbose().

00696 {
00697    gdcmHeaderEntry* Entry = GetHeaderEntryByNumber(Group, Elem);         
00698    if (!Entry) 
00699    {
00700       dbg.Verbose(1, "gdcmParser::GetHeaderEntryByNumber",
00701                       "failed to Locate gdcmHeaderEntry");
00702       return (size_t)0;
00703    }
00704    return Entry->GetOffset();
00705 }

void * gdcmParser::GetEntryVoidAreaByNumber guint16  Group,
guint16  Elem
[protected, virtual, inherited]
 

Gets (from Header) a 'non string' element value (LoadElementValues has already be executed).

Parameters:
Group group of the Entry
Elem element of the Entry
Returns:
Pointer to the 'non string' area

Definition at line 715 of file gdcmParser.cxx.

References dbg, gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetVoidArea(), and gdcmDebug::Verbose().

Referenced by GetLUTRGBA().

00716 {
00717    gdcmHeaderEntry* Entry = GetHeaderEntryByNumber(Group, Elem);         
00718    if (!Entry) 
00719    {
00720       dbg.Verbose(1, "gdcmParser::GetHeaderEntryByNumber",
00721                   "failed to Locate gdcmHeaderEntry");
00722       return (NULL);
00723    }
00724    return Entry->GetVoidArea();
00725 }

virtual std::string gdcmHeader::GetEntryVRByName std::string  tagName  )  [inline, virtual]
 

Searches within Header Entries (Dicom Elements) parsed with the public and private dictionaries for the element value representation of a given tag.

Obtaining the VR (Value Representation) might be needed by caller to convert the string typed content to caller's native type (think of C++ vs Python). The VR is actually of a higher level of semantics than just the native C++ type.

Parameters:
tagName name of the searched element.
Returns:
Corresponding element value representation when it exists, and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.

Reimplemented from gdcmParser.

Definition at line 92 of file gdcmHeader.h.

References gdcmParser::GetEntryVRByName().

00093       { return(gdcmParser::GetEntryVRByName(tagName)); }

virtual std::string gdcmHeader::GetEntryVRByNumber guint16  group,
guint16  element
[inline, virtual]
 

Searches within Header Entries (Dicom Elements) parsed with the public and private dictionaries for the element value representation of a given tag..

Obtaining the VR (Value Representation) might be needed by caller to convert the string typed content to caller's native type (think of C++ vs Python). The VR is actually of a higher level of semantics than just the native C++ type.

Parameters:
group Group of the searched tag.
element Element of the searched tag.
Returns:
Corresponding element value representation when it exists, and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise.

Reimplemented from gdcmParser.

Definition at line 87 of file gdcmHeader.h.

References gdcmParser::GetEntryVRByNumber().

00088       { return(gdcmParser::GetEntryVRByNumber(group,element)); }

std::string gdcmParser::GetFileName void   )  [inline, inherited]
 

Definition at line 58 of file gdcmParser.h.

Referenced by gdcmDicomDir::GetPath(), and gdcmDicomDir::SetElement().

00058 {return filename;}

FileType gdcmParser::GetFileType void   )  [inherited]
 

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

Returns:
the FileType code

Definition at line 315 of file gdcmParser.cxx.

References gdcmParser::filetype, and FileType.

Referenced by gdcmFile::WriteBase().

00315                                      {
00316    return(filetype);
00317 }

guint16 gdcmParser::GetGrPixel void   )  [inline, inherited]
 

Definition at line 102 of file gdcmParser.h.

Referenced by gdcmFile::WriteBase().

00102 {return GrPixel;}

gdcmHeaderEntry * gdcmParser::GetHeaderEntryByName std::string  tagName  )  [protected, inherited]
 

Searches within the Header Entries for a Dicom Element of a given tag.

Parameters:
tagName name of the searched Dicom Element.
Returns:
Corresponding Dicom Element when it exists, and NULL otherwise.

Definition at line 829 of file gdcmParser.cxx.

References gdcmDict::GetDictEntryByName(), gdcmDictEntry::GetElement(), gdcmDictEntry::GetGroup(), gdcmParser::GetHeaderEntryByNumber(), and gdcmParser::RefPubDict.

00829                                                                     {
00830    gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); 
00831    if( dictEntry == NULL)
00832       return NULL;
00833 
00834   return(GetHeaderEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement()));
00835 }

gdcmHeaderEntry * gdcmParser::GetHeaderEntryByNumber guint16  group,
guint16  element
[protected, inherited]
 

retrieves a Dicom Element (the first one) using (group, element)

Warning:
(group, element) IS NOT an identifier inside the Dicom Header if you think it's NOT UNIQUE, check the count number and use iterators to retrieve ALL the Dicoms Elements within a given couple (group, element)
Parameters:
group Group number of the searched Dicom Element
element Element number of the searched Dicom Element
Returns:

Definition at line 848 of file gdcmParser.cxx.

References gdcmParser::tagHT, TagKey, and gdcmDictEntry::TranslateToKey().

Referenced by anonymizeHeader(), gdcmParser::GetEntryOffsetByNumber(), gdcmParser::GetEntryVoidAreaByNumber(), gdcmParser::GetEntryVRByName(), gdcmParser::GetEntryVRByNumber(), gdcmParser::GetHeaderEntryByName(), HasLUT(), gdcmParser::IsDeflatedExplicitVRLittleEndianTransferSyntax(), IsDicomV3(), gdcmParser::IsExplicitVRBigEndianTransferSyntax(), gdcmParser::IsExplicitVRLittleEndianTransferSyntax(), gdcmParser::IsImplicitVRLittleEndianTransferSyntax(), IsJPEG2000(), IsJPEGBaseLineProcess1TransferSyntax(), IsJPEGExtendedProcess2_4TransferSyntax(), IsJPEGExtendedProcess3_5TransferSyntax(), IsJPEGLossless(), IsJPEGSpectralSelectionProcess6_8TransferSyntax(), IsReadable(), IsRLELossLessTransferSyntax(), gdcmParser::LoadEntryVoidArea(), SetImageDataSize(), and gdcmParser::UpdateGroupLength().

00849 {
00850    TagKey key = gdcmDictEntry::TranslateToKey(group, element);
00851    if ( ! tagHT.count(key))
00852       return NULL;
00853    return tagHT.find(key)->second;
00854 }

IterHT gdcmParser::GetHeaderEntrySameNumber guint16  group,
guint16  element
[protected, inherited]
 

retrieves the Dicom Elements (all of them) using (group, element)

Parameters:
group Group number of the searched Dicom Element.
element Element number of the searched Dicom Element.
Returns:
a range (i.e.pair<,>) containing all elements whose key is group|element)

Definition at line 864 of file gdcmParser.cxx.

References IterHT, gdcmParser::tagHT, TagKey, and gdcmDictEntry::TranslateToKey().

Referenced by GetPixelAreaLength(), and GetPixelOffset().

00864                                                                          {
00865    TagKey key = gdcmDictEntry::TranslateToKey(group, element);
00866    return (tagHT.equal_range(key));
00867 }

ListTag& gdcmParser::GetListEntry void   )  [inline, inherited]
 

returns a ref to the Dicom Header chained list return the Dicom Header chained list

Definition at line 87 of file gdcmParser.h.

References ListTag.

Referenced by gdcmDicomDir::CreateDicomDir(), gdcmDicomDir::gdcmDicomDir(), and gdcmParser::LoadHeaderEntries().

00087 { return listEntries; };

int gdcmHeader::GetLUTNbits void   ) 
 

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 538 of file gdcmHeader.cxx.

References GDCM_UNFOUND, GetEntryByNumber(), and Tokenize().

00538                                 {
00539    std::vector<std::string> tokens;
00540    //int LutLength;
00541    //int LutDepth;
00542    int LutNbits;
00543    //Just hope Lookup Table Desc-Red = Lookup Table Desc-Red = Lookup Table Desc-Blue
00544    // Consistency already checked in GetLUTLength
00545    std::string LutDescription = GetEntryByNumber(0x0028,0x1101);
00546    if (LutDescription == GDCM_UNFOUND)
00547       return 0;
00548    tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
00549    Tokenize (LutDescription, tokens, "\\");
00550    //LutLength=atoi(tokens[0].c_str());
00551    //LutDepth=atoi(tokens[1].c_str());
00552    LutNbits=atoi(tokens[2].c_str());
00553    tokens.clear();
00554    return LutNbits;
00555 }

unsigned char * gdcmHeader::GetLUTRGBA void   ) 
 

builts Red/Green/Blue/Alpha LUT from Header when (0028,0004),Photometric Interpretation = [PALETTE COLOR ] and (0028,1101),(0028,1102),(0028,1102) -xxx Palette Color Lookup Table Descriptor - are found and (0028,1201),(0028,1202),(0028,1202) -xxx Palette Color Lookup Table Data - are found

Warning:
does NOT deal with : 0028 1100 Gray Lookup Table Descriptor (Retired) 0028 1221 Segmented Red Palette Color Lookup Table Data 0028 1222 Segmented Green Palette Color Lookup Table Data 0028 1223 Segmented Blue Palette Color Lookup Table Data no known Dicom reader deals with them :-(
Returns:
a RGBA Lookup Table

Definition at line 573 of file gdcmHeader.cxx.

References GDCM_UNFOUND, GetEntryByNumber(), gdcmParser::GetEntryVoidAreaByNumber(), and Tokenize().

Referenced by gdcmFile::GetImageDataIntoVector().

00573                                            {
00574 // Not so easy : see 
00575 // http://www.barre.nom.fr/medical/dicom2/limitations.html#Color%20Lookup%20Tables
00576 
00577 //  if Photometric Interpretation # PALETTE COLOR, no LUT to be done
00578    if (GetEntryByNumber(0x0028,0x0004) != "PALETTE COLOR ") {
00579         return NULL;
00580    }  
00581    int lengthR, debR, nbitsR;
00582    int lengthG, debG, nbitsG;
00583    int lengthB, debB, nbitsB;
00584    
00585 // Get info from Lut Descriptors
00586 // (the 3 LUT descriptors may be different)    
00587    std::string LutDescriptionR = GetEntryByNumber(0x0028,0x1101);
00588    if (LutDescriptionR == GDCM_UNFOUND)
00589       return NULL;
00590    std::string LutDescriptionG = GetEntryByNumber(0x0028,0x1102);
00591    if (LutDescriptionG == GDCM_UNFOUND)
00592       return NULL;   
00593    std::string LutDescriptionB = GetEntryByNumber(0x0028,0x1103);
00594    if (LutDescriptionB == GDCM_UNFOUND)
00595       return NULL;
00596       
00597    std::vector<std::string> tokens;
00598       
00599    tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
00600    Tokenize (LutDescriptionR, tokens, "\\");
00601    lengthR=atoi(tokens[0].c_str()); // Red LUT length in Bytes
00602    debR   =atoi(tokens[1].c_str()); // subscript of the first Lut Value
00603    nbitsR =atoi(tokens[2].c_str()); // Lut item size (in Bits)
00604    tokens.clear();
00605    
00606    tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
00607    Tokenize (LutDescriptionG, tokens, "\\");
00608    lengthG=atoi(tokens[0].c_str()); // Green LUT length in Bytes
00609    debG   =atoi(tokens[1].c_str()); // subscript of the first Lut Value
00610    nbitsG =atoi(tokens[2].c_str()); // Lut item size (in Bits)
00611    tokens.clear();  
00612    
00613    tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
00614    Tokenize (LutDescriptionB, tokens, "\\");
00615    lengthB=atoi(tokens[0].c_str()); // Blue LUT length in Bytes
00616    debB   =atoi(tokens[1].c_str()); // subscript of the first Lut Value
00617    nbitsB =atoi(tokens[2].c_str()); // Lut item size (in Bits)
00618    tokens.clear();
00619  
00620    // Load LUTs into memory, (as they were stored on disk)
00621    unsigned char *lutR = (unsigned char *)
00622                          GetEntryVoidAreaByNumber(0x0028,0x1201);
00623    unsigned char *lutG = (unsigned char *)
00624                          GetEntryVoidAreaByNumber(0x0028,0x1202);
00625    unsigned char *lutB = (unsigned char *)
00626                          GetEntryVoidAreaByNumber(0x0028,0x1203); 
00627    
00628    if (!lutR || !lutG || !lutB ) {
00629         return NULL;
00630    } 
00631    // forge the 4 * 8 Bits Red/Green/Blue/Alpha LUT 
00632    
00633    unsigned char *LUTRGBA = (unsigned char *)calloc(1024,1); // 256 * 4 (R, G, B, Alpha) 
00634    if (!LUTRGBA) {
00635       return NULL;
00636    }
00637    memset(LUTRGBA, 0, 1024);
00638         // Bits Allocated
00639    int nb;
00640    std::string str_nb = GetEntryByNumber(0x0028,0x0100);
00641    if (str_nb == GDCM_UNFOUND ) {
00642       nb = 16;
00643    } else {
00644       nb = atoi(str_nb.c_str() );
00645    }  
00646    int mult;
00647 
00648    if (nbitsR==16 && nb==8) // when LUT item size is different than pixel size
00649       mult=2;               // high byte must be = low byte 
00650    else                     // See PS 3.3-2003 C.11.1.1.2 p 619
00651       mult=1; 
00652  
00653    // if we get a black image, let's just remove the '+1'
00654    // from 'i*mult+1' and check again 
00655    // if it works, we shall have to check the 3 Palettes
00656    // to see which byte is ==0 (first one, or second one)
00657    // and fix the code
00658    // We give up the checking to avoid some (useless ?)overhead 
00659    // (optimistic asumption)
00660    unsigned char *a;      
00661    int i;
00662 
00663    a = LUTRGBA+0;
00664    for(i=0;i<lengthR;i++) {
00665       *a = lutR[i*mult+1]; 
00666       a+=4;       
00667    }        
00668    a = LUTRGBA+1;
00669    for(i=0;i<lengthG;i++) {
00670       *a = lutG[i*mult+1]; 
00671       a+=4;       
00672    }  
00673    a = LUTRGBA+2;
00674    for(i=0;i<lengthB;i++) {
00675       *a = lutB[i*mult+1]; 
00676       a+=4;       
00677    }  
00678    a = LUTRGBA+3;
00679    for(i=0;i<256;i++) {
00680       *a = 1; // Alpha component
00681       a+=4; 
00682    } 
00683    
00684    //How to free the now useless LUTs?
00685    //free(LutR); free(LutB); free(LutG); // Seg Fault when used
00686    return(LUTRGBA);   
00687 } 

guint16 gdcmParser::GetNumPixel void   )  [inline, inherited]
 

Definition at line 103 of file gdcmParser.h.

Referenced by gdcmFile::WriteBase().

00103 {return NumPixel;}

size_t gdcmHeader::GetPixelAreaLength void   ) 
 

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 476 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntrySameNumber(), gdcmHeaderEntry::GetLength(), IterHT, TagKey, and gdcmDictEntry::TranslateToKey().

Referenced by gdcmFile::ReadPixelData().

00476                                           { 
00477           
00478    IterHT it = GetHeaderEntrySameNumber(GrPixel,NumPixel);          
00479    TagKey key = gdcmDictEntry::TranslateToKey(GrPixel,NumPixel);
00480    gdcmHeaderEntry* PixelElement;
00481   
00482   if (countGrPixel==1)  
00483       PixelElement = (it.first)->second;
00484    else
00485       PixelElement = (++it.first)->second;
00486 
00487    if (PixelElement) {
00488       return PixelElement->GetLength();
00489    } else {
00490 /*      std::cout << "Big trouble : Pixel Element ("
00491                 << std::hex << GrPixel<<","<< NumPixel<< ") NOT found"
00492                 << std::endl;*/
00493       return 0;
00494    }
00495 }

size_t gdcmHeader::GetPixelOffset void   ) 
 

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

Returns:
Pixel Offset

Definition at line 440 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntrySameNumber(), gdcmHeaderEntry::GetOffset(), IterHT, TagKey, and gdcmDictEntry::TranslateToKey().

Referenced by gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00440                                       { 
00441    //
00442    // If the element (0x0088,0x0200) 'icone image sequence' is found
00443    // (grPixel,numPixel) is stored twice : the first one for the icon
00444    // the second one for the image ...
00445    // pb : sometimes , (0x0088,0x0200) exists, but doesn't contain *anything*
00446    // see gdcmData/MxTwinLossLess.dcm ...
00447 
00448    //std::string icone = GetEntryByNumber(0x0088,0x0200); //icone image sequence
00449       
00450    IterHT it = GetHeaderEntrySameNumber(GrPixel,NumPixel);          
00451    TagKey key = gdcmDictEntry::TranslateToKey(GrPixel,NumPixel);
00452    gdcmHeaderEntry* PixelElement;
00453    if (countGrPixel == 1)   
00454       PixelElement = (it.first)->second;
00455    else {
00456       PixelElement = (++it.first)->second; // hope there are no more than 2 !
00457    } 
00458    if (PixelElement) {
00459       return PixelElement->GetOffset();
00460    } else {
00461 /*      std::cout << "Big trouble : Pixel Element ("
00462                 << std::hex << GrPixel<<","<< NumPixel<< ") NOT found"
00463                 << std::endl;  */
00464       return 0;
00465    }     
00466 }

int gdcmHeader::GetPixelSize void   ) 
 

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

Reimplemented in gdcmHeaderHelper.

Definition at line 378 of file gdcmHeader.cxx.

References dbg, GetPixelType(), and gdcmDebug::Verbose().

Referenced by gdcmFile::ReadPixelData().

00378                                  {
00379    std::string PixelType = GetPixelType();
00380    if (PixelType == "8U"  || PixelType == "8S")
00381       return 1;
00382    if (PixelType == "16U" || PixelType == "16S")
00383       return 2;
00384    if (PixelType == "32U" || PixelType == "32S")
00385       return 4;
00386    if (PixelType == "FD")
00387       return 8;         
00388    dbg.Verbose(0, "gdcmHeader::GetPixelSize: Unknown pixel type");
00389    return 0;
00390 }

std::string gdcmHeader::GetPixelType void   ) 
 

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
Returns:
0S if nothing found. NOT USABLE file. The caller has to check

Reimplemented in gdcmHeaderHelper.

Definition at line 407 of file gdcmHeader.cxx.

References dbg, GDCM_UNFOUND, GetEntryByNumber(), and gdcmDebug::Verbose().

Referenced by GetPixelSize().

00407                                        { 
00408    std::string BitsAlloc = GetEntryByNumber(0x0028, 0x0100); // Bits Allocated
00409    if (BitsAlloc == GDCM_UNFOUND) {
00410       dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Bits Allocated");
00411       BitsAlloc = std::string("16");
00412    }
00413    if (BitsAlloc == "64")            // )
00414       return ("FD");
00415    if (BitsAlloc == "12")            // It will be unpacked
00416       BitsAlloc = std::string("16");
00417    else if (BitsAlloc == "24")       // (in order no to be messed up
00418       BitsAlloc = std::string("8");  // by old RGB images)
00419      
00420    std::string Signed = GetEntryByNumber(0x0028, 0x0103); // "Pixel Representation"
00421    if (Signed == GDCM_UNFOUND) {
00422       dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Pixel Representation");
00423       BitsAlloc = std::string("0");
00424    }
00425    if (Signed == "0")
00426       Signed = std::string("U");
00427    else
00428       Signed = std::string("S");
00429 
00430    return( BitsAlloc + Signed);
00431 }

int gdcmHeader::GetPlanarConfiguration void   ) 
 

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 365 of file gdcmHeader.cxx.

References GDCM_UNFOUND, and GetEntryByNumber().

Referenced by gdcmFile::GetImageDataIntoVectorRaw().

00365                                            {
00366    std::string StrSize = GetEntryByNumber(0x0028,0x0006);
00367    if (StrSize == GDCM_UNFOUND)
00368       return 0;
00369    return atoi(StrSize.c_str());
00370 }

gdcmDict * gdcmParser::GetPubDict void   )  [inherited]
 

Get the public dictionary used.

Definition at line 185 of file gdcmParser.cxx.

References gdcmParser::RefPubDict.

Referenced by gdcmDicomDir::SetElement().

00185                                      {
00186    return(RefPubDict);
00187 }

int gdcmHeader::GetSamplesPerPixel void   ) 
 

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

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

Definition at line 351 of file gdcmHeader.cxx.

References GDCM_UNFOUND, and GetEntryByNumber().

Referenced by gdcmHeaderHelper::GetNumberOfScalarComponents(), gdcmHeaderHelper::GetNumberOfScalarComponentsRaw(), gdcmFile::ParsePixelData(), gdcmFile::ReadPixelData(), and gdcmFile::SetPixelDataSizeFromHeader().

00351                                        {
00352    std::string StrSize = GetEntryByNumber(0x0028,0x0002);
00353    if (StrSize == GDCM_UNFOUND)
00354       return 1; // Well, it's supposed to be mandatory ...
00355                 // but sometimes it's missing : *we* assume Gray pixels
00356    return atoi(StrSize.c_str());
00357 }

gdcmDict * gdcmParser::GetShaDict void   )  [inherited]
 

Get the shadow dictionary used.

Definition at line 193 of file gdcmParser.cxx.

References gdcmParser::RefShaDict.

00193                                      {
00194    return(RefShaDict);
00195 }

int gdcmParser::GetSwapCode void   )  [inline, inherited]
 

Definition at line 101 of file gdcmParser.h.

Referenced by gdcmFile::gdcm_read_RLE_file(), gdcmFile::GetImageDataIntoVectorRaw(), gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00101 { return sw; }

std::string gdcmHeader::GetTransfertSyntaxName void   ) 
 

gets the info from 0002,0010 : Transfert Syntax and gdcmTS else 1.

Returns:
the full Transfert Syntax Name (as oposite to Transfert Syntax UID)

Definition at line 695 of file gdcmHeader.cxx.

References dbg, GDCM_UNFOUND, GetEntryByNumber(), gdcmGlobal::GetTS(), gdcmTS::GetValue(), and gdcmDebug::Verbose().

00695                                                  { 
00696    // use the gdcmTS (TS : Transfert Syntax)
00697    std::string TransfertSyntax = GetEntryByNumber(0x0002,0x0010);
00698    if (TransfertSyntax == GDCM_UNFOUND) {
00699       dbg.Verbose(0, "gdcmHeader::GetTransfertSyntaxName: unfound Transfert Syntax (0002,0010)");
00700       return "Uncompressed ACR-NEMA";
00701    }
00702    // we do it only when we need it
00703    gdcmTS * ts = gdcmGlobal::GetTS();
00704    std::string tsName=ts->GetValue(TransfertSyntax);
00705    //delete ts; // Seg Fault when deleted ?!
00706    return tsName;
00707 }

int gdcmHeader::GetXSize void   ) 
 

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 264 of file gdcmHeader.cxx.

References GDCM_UNFOUND, and GetEntryByNumber().

Referenced by gdcmFile::gdcm_read_RLE_file(), gdcmFile::GetImageDataIntoVectorRaw(), gdcmFile::ParsePixelData(), gdcmFile::ReadPixelData(), and gdcmFile::SetPixelDataSizeFromHeader().

00264                              {
00265    std::string StrSize;
00266    StrSize = GetEntryByNumber(0x0028,0x0011);
00267    if (StrSize == GDCM_UNFOUND)
00268       return 0;
00269    return atoi(StrSize.c_str());
00270 }

int gdcmHeader::GetYSize void   ) 
 

Retrieve the number of lines of image.

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

Definition at line 279 of file gdcmHeader.cxx.

References GDCM_UNFOUND, GetEntryByNumber(), and IsDicomV3().

Referenced by gdcmFile::gdcm_read_RLE_file(), gdcmFile::GetImageDataIntoVectorRaw(), gdcmFile::ParsePixelData(), gdcmFile::ReadPixelData(), and gdcmFile::SetPixelDataSizeFromHeader().

00279                              {
00280    std::string StrSize = GetEntryByNumber(0x0028,0x0010);
00281    if (StrSize != GDCM_UNFOUND)
00282       return atoi(StrSize.c_str());
00283    if ( IsDicomV3() )
00284       return 0;
00285    else
00286       // The Rows (0028,0010) entry was optional for ACR/NEMA. It might
00287       // hence be a signal (1d image). So we default to 1:
00288       return 1;
00289 }

int gdcmHeader::GetZSize void   ) 
 

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 absent 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 300 of file gdcmHeader.cxx.

References GDCM_UNFOUND, and GetEntryByNumber().

Referenced by gdcmFile::gdcm_read_RLE_file(), gdcmFile::GetImageDataIntoVectorRaw(), and gdcmFile::SetPixelDataSizeFromHeader().

00300                              {
00301    // Both  DicomV3 and ACR/Nema consider the "Number of Frames"
00302    // as the third dimension.
00303    std::string StrSize = GetEntryByNumber(0x0028,0x0008);
00304    if (StrSize != GDCM_UNFOUND)
00305       return atoi(StrSize.c_str());
00306 
00307    // We then consider the "Planes" entry as the third dimension 
00308    StrSize = GetEntryByNumber(0x0028,0x0012);
00309    if (StrSize != GDCM_UNFOUND)
00310       return atoi(StrSize.c_str());
00311    return 1;
00312 }

bool gdcmHeader::HasLUT void   ) 
 

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 506 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber().

Referenced by gdcmFile::GetImageDataIntoVector(), gdcmFile::GetImageDataRaw(), gdcmHeaderHelper::GetNumberOfScalarComponents(), and gdcmFile::SetPixelDataSizeFromHeader().

00506                             {
00507 
00508    // Check the presence of the LUT Descriptors, and LUT Tables    
00509    // LutDescriptorRed    
00510    if ( !GetHeaderEntryByNumber(0x0028,0x1101) )
00511       return false;
00512    // LutDescriptorGreen 
00513    if ( !GetHeaderEntryByNumber(0x0028,0x1102) )
00514       return false;
00515    // LutDescriptorBlue 
00516    if ( !GetHeaderEntryByNumber(0x0028,0x1103) )
00517       return false;   
00518    // Red Palette Color Lookup Table Data
00519    if ( !GetHeaderEntryByNumber(0x0028,0x1201) )
00520       return false; 
00521    // Green Palette Color Lookup Table Data       
00522    if ( !GetHeaderEntryByNumber(0x0028,0x1202) )
00523       return false;
00524    // Blue Palette Color Lookup Table Data      
00525    if ( !GetHeaderEntryByNumber(0x0028,0x1203) )
00526       return false;   
00527    return true;
00528 }

bool gdcmParser::IsDeflatedExplicitVRLittleEndianTransferSyntax void   )  [inherited]
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a DeflatedExplicitVRLittleEndian one.

Returns:
True when DeflatedExplicitVRLittleEndian found. False in all other cases.

Definition at line 279 of file gdcmParser.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), gdcmParser::LoadHeaderEntrySafe(), and UI1_2_840_10008_1_2_1_99.

Referenced by gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00279                                                                     {
00280    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00281    if ( !Element )
00282       return false;
00283    LoadHeaderEntrySafe(Element);
00284 
00285    std::string Transfer = Element->GetValue();
00286    if ( Transfer == UI1_2_840_10008_1_2_1_99 )
00287       return true;
00288    return false;
00289 }

bool gdcmHeader::IsDicomV3 void   ) 
 

Predicate for dicom version 3 file.

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

Definition at line 250 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber().

Referenced by GetYSize(), gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00250                                {
00251    // Checking if Transfert Syntax exists is enough
00252    // Anyway, it's to late check if the 'Preamble' was found ...
00253    // And ... would it be a rich idea to check ?
00254    // (some 'no Preamble' DICOM images exist !)
00255    return (GetHeaderEntryByNumber(0x0002, 0x0010) != NULL);
00256 }

bool gdcmParser::IsExplicitVRBigEndianTransferSyntax void   )  [inherited]
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a Explicit VR Big Endian one.

Returns:
True when big endian found. False in all other cases.

Definition at line 297 of file gdcmParser.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), gdcmParser::LoadHeaderEntrySafe(), and UI1_2_840_10008_1_2_2.

Referenced by gdcmParser::FindHeaderEntryLength(), gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00297                                                          {
00298    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00299    if ( !Element )
00300       return false;
00301    LoadHeaderEntrySafe(Element);
00302 
00303    std::string Transfer = Element->GetValue();
00304    if ( Transfer == UI1_2_840_10008_1_2_2 )  //1.2.2 ??? A verifier !
00305       return true;
00306    return false;
00307 }

bool gdcmParser::IsExplicitVRLittleEndianTransferSyntax void   )  [inherited]
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a ExplicitVRLittleEndian one.

Returns:
True when ExplicitVRLittleEndian found. False in all other cases.

Definition at line 261 of file gdcmParser.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), gdcmParser::LoadHeaderEntrySafe(), and UI1_2_840_10008_1_2_1.

Referenced by gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00261                                                             {
00262    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00263    if ( !Element )
00264       return false;
00265    LoadHeaderEntrySafe(Element);
00266 
00267    std::string Transfer = Element->GetValue();
00268    if ( Transfer == UI1_2_840_10008_1_2_1 )
00269       return true;
00270    return false;
00271 }

bool gdcmParser::IsImplicitVRLittleEndianTransferSyntax void   )  [inherited]
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a ImplicitVRLittleEndian one.

Returns:
True when ImplicitVRLittleEndian found. False in all other cases.

Definition at line 243 of file gdcmParser.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), gdcmParser::LoadHeaderEntrySafe(), and UI1_2_840_10008_1_2.

Referenced by gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00243                                                             {
00244    gdcmHeaderEntry *Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00245    if ( !Element )
00246       return false;
00247    LoadHeaderEntrySafe(Element);
00248 
00249    std::string Transfer = Element->GetValue();
00250    if ( Transfer == UI1_2_840_10008_1_2 )
00251       return true;
00252    return false;
00253 }

bool gdcmHeader::IsJPEG2000 void   ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEG2000 one.

Returns:
True when JPEG2000 (Lossly or LossLess) found. False in all other cases.

Definition at line 232 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), and gdcmParser::LoadHeaderEntrySafe().

Referenced by gdcmFile::ReadPixelData().

00232                                 {
00233    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00234    if ( !Element )
00235       return false;
00236    LoadHeaderEntrySafe(Element);
00237 
00238    std::string Transfer = Element->GetValue();
00239    if (    (Transfer == "1.2.840.10008.1.2.4.90") 
00240         || (Transfer == "1.2.840.10008.1.2.4.91") )
00241       return true;
00242    return false;
00243 }

bool gdcmHeader::IsJPEGBaseLineProcess1TransferSyntax void   ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEGBaseLineProcess1 one.

Returns:
True when JPEGBaseLineProcess1found. False in all other cases.

Definition at line 120 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), and gdcmParser::LoadHeaderEntrySafe().

00120                                                           {
00121    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00122    if ( !Element )
00123       return false;
00124    LoadHeaderEntrySafe(Element);
00125 
00126    std::string Transfer = Element->GetValue();
00127    if ( Transfer == "1.2.840.10008.1.2.4.50" )
00128       return true;
00129    return false;
00130 }

bool gdcmHeader::IsJPEGExtendedProcess2_4TransferSyntax void   ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEGExtendedProcess2-4 one.

Returns:
True when JPEGExtendedProcess2-4 found. False in all other cases.

Definition at line 138 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), and gdcmParser::LoadHeaderEntrySafe().

00138                                                             {
00139    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00140    if ( !Element )
00141       return false;
00142    LoadHeaderEntrySafe(Element);
00143    return ( Element->GetValue() == "1.2.840.10008.1.2.4.51" );
00144 }

bool gdcmHeader::IsJPEGExtendedProcess3_5TransferSyntax void   ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEGExtendeProcess3-5 one.

Returns:
True when JPEGExtendedProcess3-5 found. False in all other cases.

Definition at line 152 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), and gdcmParser::LoadHeaderEntrySafe().

00152                                                             {
00153    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00154    if ( !Element )
00155       return false;
00156    LoadHeaderEntrySafe(Element);
00157 
00158    std::string Transfer = Element->GetValue();
00159    if ( Transfer == "1.2.840.10008.1.2.4.52" )
00160       return true;
00161    return false;
00162 }

bool gdcmHeader::IsJPEGLossless void   ) 
 

Determines if Transfer Syntax was already encountered and if it corresponds to a JPEG Lossless one.

Returns:
True when RLE Lossless found. False in all other cases.

Definition at line 210 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), and gdcmParser::LoadHeaderEntrySafe().

Referenced by gdcmFile::ReadPixelData().

00210                                     {
00211    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00212     // faire qq chose d'intelligent a la place de ça
00213    if ( !Element )
00214       return false;
00215    LoadHeaderEntrySafe(Element);
00216 
00217    const char * Transfert = Element->GetValue().c_str();
00218    if ( memcmp(Transfert+strlen(Transfert)-2 ,"70",2)==0) return true;
00219    if ( memcmp(Transfert+strlen(Transfert)-2 ,"55",2)==0) return true;
00220    if (Element->GetValue() == "1.2.840.10008.1.2.4.57")   return true;
00221 
00222    return false;
00223 }

bool gdcmHeader::IsJPEGSpectralSelectionProcess6_8TransferSyntax void   ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a JPEGSpectralSelectionProcess6-8 one.

Returns:
True when JPEGSpectralSelectionProcess6-8 found. False in all other cases.

Definition at line 171 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), and gdcmParser::LoadHeaderEntrySafe().

00171                                                                      {
00172    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00173    if ( !Element )
00174       return false;
00175    LoadHeaderEntrySafe(Element);
00176 
00177    std::string Transfer = Element->GetValue();
00178    if ( Transfer == "1.2.840.10008.1.2.4.53" )
00179       return true;
00180    return false;
00181 }

bool gdcmHeader::IsReadable void   )  [virtual]
 

This predicate, based on hopefully reasonable heuristics, decides whether or not the current gdcmParser was properly parsed and contains the mandatory information for being considered as a well formed and usable Dicom/Acr File.

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

Reimplemented from gdcmParser.

Definition at line 96 of file gdcmHeader.cxx.

References GDCM_UNFOUND, GetEntryByNumber(), gdcmParser::GetHeaderEntryByNumber(), and gdcmParser::IsReadable().

Referenced by gdcmFile::gdcmFile(), and gdcmDicomDir::NewDicomDir().

00096                                 {
00097    if(!gdcmParser::IsReadable()) {
00098       return(false);
00099    }
00100    std::string res = GetEntryByNumber(0x0028, 0x0005);
00101    if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 ) 
00102       return false; // Image Dimensions
00103    if ( !GetHeaderEntryByNumber(0x0028, 0x0100) )
00104       return false; // "Bits Allocated"
00105    if ( !GetHeaderEntryByNumber(0x0028, 0x0101) )
00106       return false; // "Bits Stored"
00107    if ( !GetHeaderEntryByNumber(0x0028, 0x0102) )
00108       return false; // "High Bit"
00109    if ( !GetHeaderEntryByNumber(0x0028, 0x0103) )
00110       return false; // "Pixel Representation" i.e. 'Sign'
00111    return true;
00112 }

bool gdcmHeader::IsRLELossLessTransferSyntax void   ) 
 

Determines if the Transfer Syntax was already encountered and if it corresponds to a RLE Lossless one.

Returns:
True when RLE Lossless found. False in all other cases.

Definition at line 190 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetValue(), and gdcmParser::LoadHeaderEntrySafe().

Referenced by gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00190                                                  {
00191    gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
00192    if ( !Element )
00193       return false;
00194    LoadHeaderEntrySafe(Element);
00195 
00196    std::string Transfer = Element->GetValue();
00197    if ( Transfer == "1.2.840.10008.1.2.5" ) {
00198       return true;
00199     }
00200    return false;
00201 }

void * gdcmParser::LoadEntryVoidArea guint16  Group,
guint16  Elem
[protected, virtual, inherited]
 

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

Parameters:
Group group of the Entry
Elem element of the Entry

Definition at line 734 of file gdcmParser.cxx.

References gdcmParser::fp, gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetLength(), gdcmHeaderEntry::GetOffset(), and gdcmParser::SetEntryVoidAreaByNumber().

Referenced by gdcmParser::LoadHeaderEntries().

00735 {
00736    gdcmHeaderEntry * Element= GetHeaderEntryByNumber(Group, Elem);
00737    if ( !Element )
00738       return NULL;
00739    size_t o =(size_t)Element->GetOffset();
00740    fseek(fp, o, SEEK_SET);
00741    int l=Element->GetLength();
00742    void * a = malloc(l);
00743    if(!a) 
00744         return NULL;
00745 
00746    SetEntryVoidAreaByNumber(a, Group, Elem);
00747    // TODO check the result 
00748    size_t l2 = fread(a, 1, l ,fp);
00749    if(l != l2) 
00750    {
00751         free(a);
00752         return NULL;
00753    }
00754 
00755    return a;  
00756 }

void gdcmParser::LoadHeaderEntrySafe gdcmHeaderEntry entry  )  [protected, inherited]
 

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

Parameters:
entry Header Entry whose value shall be loaded.
Returns:

Definition at line 877 of file gdcmParser.cxx.

References gdcmParser::fp, and gdcmParser::LoadHeaderEntry().

Referenced by gdcmParser::IsDeflatedExplicitVRLittleEndianTransferSyntax(), gdcmParser::IsExplicitVRBigEndianTransferSyntax(), gdcmParser::IsExplicitVRLittleEndianTransferSyntax(), gdcmParser::IsImplicitVRLittleEndianTransferSyntax(), IsJPEG2000(), IsJPEGBaseLineProcess1TransferSyntax(), IsJPEGExtendedProcess2_4TransferSyntax(), IsJPEGExtendedProcess3_5TransferSyntax(), IsJPEGLossless(), IsJPEGSpectralSelectionProcess6_8TransferSyntax(), and IsRLELossLessTransferSyntax().

00877                                                             {
00878    long PositionOnEntry = ftell(fp);
00879    LoadHeaderEntry(entry);
00880    fseek(fp, PositionOnEntry, SEEK_SET);
00881 }

FILE * gdcmParser::OpenFile bool  exception_on_error = false  )  throw (gdcmFileError) [inherited]
 

opens the file

Parameters:
exception_on_error 
Returns:

Definition at line 325 of file gdcmParser.cxx.

References dbg, and gdcmDebug::Verbose().

Referenced by gdcmParser::gdcmParser(), gdcmFile::ParsePixelData(), and gdcmFile::ReadPixelData().

00327 {
00328   fp=fopen(filename.c_str(),"rb");
00329   if(exception_on_error) 
00330   {
00331     if(!fp)
00332       throw gdcmFileError("gdcmParser::gdcmParser(const char *, bool)");
00333   }
00334 
00335   if ( fp ) 
00336   {
00337      guint16 zero;
00338      fread(&zero,  (size_t)2, (size_t)1, fp);
00339 
00340     //ACR -- or DICOM with no Preamble --
00341     if( zero == 0x0008 || zero == 0x0800 || zero == 0x0002 || zero == 0x0200)
00342        return(fp);
00343 
00344     //DICOM
00345     fseek(fp, 126L, SEEK_CUR);
00346     char dicm[4];
00347     fread(dicm,  (size_t)4, (size_t)1, fp);
00348     if( memcmp(dicm, "DICM", 4) == 0 )
00349        return(fp);
00350 
00351     fclose(fp);
00352     dbg.Verbose(0, "gdcmParser::OpenFile not DICOM/ACR", filename.c_str());
00353   }
00354   else {
00355     dbg.Verbose(0, "gdcmParser::OpenFile cannot open file", filename.c_str());
00356   }
00357   return(NULL);
00358 }

bool gdcmHeader::operator< gdcmHeader header  ) 
 

compares 2 Headers, according to DICOMDIR rules --> not-for-rats function

Warning:
does NOT work with ACR-NEMA files
Todo:
find a trick to solve the pb (use RET fields ?)
Parameters:
header 
Returns:
true if 'smaller'

Definition at line 743 of file gdcmHeader.cxx.

References GetEntryByNumber().

00743                                              {
00744    std::string s1,s2;
00745 
00746    // Patient Name
00747    s1=this->GetEntryByNumber(0x0010,0x0010);
00748    s2=header.GetEntryByNumber(0x0010,0x0010);
00749    if(s1 < s2)
00750            return(true);
00751    else if(s1 > s2)
00752            return(false);
00753    else
00754    {
00755       // Patient ID
00756       s1=this->GetEntryByNumber(0x0010,0x0020);
00757       s2=header.GetEntryByNumber(0x0010,0x0020);
00758       if (s1 < s2)
00759               return(true);
00760       else if (s1 > s2)
00761          return(1);
00762       else
00763       {
00764               // Study Instance UID
00765          s1=this->GetEntryByNumber(0x0020,0x000d);
00766          s2=header.GetEntryByNumber(0x0020,0x000d);
00767          if (s1 < s2)
00768                  return(true);
00769          else if(s1 > s2)
00770                  return(false);
00771          else
00772          {
00773                  // Serie Instance UID          
00774             s1=this->GetEntryByNumber(0x0020,0x000e);
00775             s2=header.GetEntryByNumber(0x0020,0x000e);
00776             if (s1 < s2)
00777                return(true);
00778             else if(s1 > s2)
00779                return(false);
00780          }
00781       }
00782    }
00783    return(false);
00784 }

virtual void gdcmParser::Print std::ostream &  os = std::cout  )  [inline, virtual, inherited]
 

Reimplemented in gdcmDicomDir.

Definition at line 52 of file gdcmParser.h.

00052 {PrintEntry(os);};

void gdcmParser::PrintEntry std::ostream &  os = std::cout  )  [virtual, inherited]
 

Prints the Header Entries (Dicom Elements) both from the H Table and the chained list.

Returns:

Definition at line 148 of file gdcmParser.cxx.

References gdcmParser::listEntries.

00148                                            {
00149    std::ostringstream s;   
00150            
00151    for (ListTag::iterator i = listEntries.begin();  
00152            i != listEntries.end();
00153            ++i)
00154    {
00155            (*i)->SetPrintLevel(printLevel);
00156            (*i)->Print(os);   
00157    } 
00158    os<<s.str();
00159 }

void gdcmParser::PrintPubDict std::ostream &  os = std::cout  )  [virtual, inherited]
 

Prints The Dict Entries of THE public Dicom Dictionnry.

Returns:

Definition at line 166 of file gdcmParser.cxx.

References gdcmDict::Print(), and gdcmParser::RefPubDict.

00166                                              {
00167    RefPubDict->Print(os);
00168 }

void gdcmParser::PrintShaDict std::ostream &  os = std::cout  )  [virtual, inherited]
 

Prints The Dict Entries of THE shadow Dicom Dictionnry.

Returns:

Definition at line 175 of file gdcmParser.cxx.

References gdcmDict::Print(), and gdcmParser::RefShaDict.

00175                                              {
00176    RefShaDict->Print(os);
00177 }

bool gdcmParser::ReplaceIfExistByNumber char *  Value,
guint16  Group,
guint16  Elem
[inherited]
 

Set a new value if the invoked element exists Seems to be useless !!!

Parameters:
Value new element value
Group group of the Entry
Elem element of the Entry
Returns:
boolean

Definition at line 491 of file gdcmParser.cxx.

References gdcmParser::SetEntryByNumber().

Referenced by anonymizeHeader().

00492 {
00493    std::string v = Value;       
00494    SetEntryByNumber(v, Group, Elem);
00495    return true;
00496 } 

bool gdcmParser::ReplaceOrCreateByNumber char *  Value,
guint16  Group,
guint16  Elem
[inherited]
 

Modifies the value of a given Header Entry (Dicom Element) if it exists; Creates it with the given value if it doesn't.

Parameters:
Value passed as a char*
Group group of the Entry
Elem element of the Entry
Returns:
boolean

Definition at line 469 of file gdcmParser.cxx.

References gdcmParser::AddHeaderEntry(), gdcmParser::NewHeaderEntryByNumber(), and gdcmParser::SetEntryByNumber().

00469                                                                                   {
00470    gdcmHeaderEntry* nvHeaderEntry=NewHeaderEntryByNumber(Group, Elem);
00471 
00472    if(!nvHeaderEntry)
00473       return(false);
00474 
00475    AddHeaderEntry(nvHeaderEntry);
00476 
00477    std::string v = Value;       
00478    SetEntryByNumber(v, Group, Elem);
00479    return(true);
00480 }  

bool gdcmParser::ReplaceOrCreateByNumber std::string  Value,
guint16  Group,
guint16  Elem
[inherited]
 

Modifies the value of a given Header Entry (Dicom Element) if it exists; Creates it with the given value if it doesn't.

Parameters:
Value passed as a std::string
Group 
Elem 
Returns:
false only if new element creation fails

Definition at line 446 of file gdcmParser.cxx.

References gdcmParser::AddHeaderEntry(), gdcmParser::CheckIfEntryExistByNumber(), gdcmParser::NewHeaderEntryByNumber(), and gdcmParser::SetEntryByNumber().

Referenced by anonymizeHeader(), and gdcmParser::Write().

00448                                                        {
00449    if (CheckIfEntryExistByNumber(Group, Elem) == 0) {
00450       gdcmHeaderEntry *a =NewHeaderEntryByNumber(Group, Elem);
00451       if (a == NULL) 
00452          return false;
00453       AddHeaderEntry(a);
00454    }   
00455    SetEntryByNumber(Value, Group, Elem);
00456    return(true);
00457 }   

virtual bool gdcmHeader::SetEntryByName std::string  content,
std::string  tagName
[inline, virtual]
 

Sets the value (string) of the Header Entry (Dicom Element).

Parameters:
content string value of the Dicom Element
tagName name of the searched Dicom Element.
Returns:
true when found

Reimplemented from gdcmParser.

Definition at line 97 of file gdcmHeader.h.

References gdcmParser::SetEntryByName().

00098       { return(gdcmParser::SetEntryByName(content,tagName)); }

virtual bool gdcmHeader::SetEntryByNumber std::string  content,
guint16  group,
guint16  element
[inline, virtual]
 

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

Warning:
Don't use any longer : use SetPubEntryByNumber
Parameters:
content new value to substitute with
group group of the Dicom Element to modify
element element of the Dicom Element to modify

Reimplemented from gdcmParser.

Definition at line 95 of file gdcmHeader.h.

References gdcmParser::SetEntryByNumber().

Referenced by gdcmFile::GetImageDataIntoVector(), gdcmFile::GetImageDataIntoVectorRaw(), SetImageDataSize(), and gdcmFile::WriteBase().

00096       { return(gdcmParser::SetEntryByNumber(content,group,element)); }

virtual bool gdcmHeader::SetEntryLengthByNumber guint32  l,
guint16  group,
guint16  element
[inline, virtual]
 

Accesses an existing gdcmHeaderEntry (i.e. a Dicom Element) in the PubHeaderEntrySet of this instance through it's (group, element) and modifies it's length with the given value.

Warning:
Use with extreme caution.
Parameters:
l new length to substitute with
group group of the Entry to modify
element element of the Entry to modify
Returns:
1 on success, 0 otherwise.

Reimplemented from gdcmParser.

Definition at line 100 of file gdcmHeader.h.

References gdcmParser::SetEntryLengthByNumber().

00101       { return(gdcmParser::SetEntryLengthByNumber(l,group,element)); }

bool gdcmParser::SetEntryVoidAreaByNumber void *  area,
guint16  group,
guint16  element
[protected, virtual, inherited]
 

Sets a 'non string' value to a given Dicom Element.

Parameters:
area 
group Group number of the searched Dicom Element
element Element number of the searched Dicom Element
Returns:

Definition at line 766 of file gdcmParser.cxx.

References gdcmParser::tagHT, TagKey, and gdcmDictEntry::TranslateToKey().

Referenced by gdcmParser::LoadEntryVoidArea().

00769 {
00770    TagKey key = gdcmDictEntry::TranslateToKey(group, element);
00771    if ( ! tagHT.count(key))
00772       return false;
00773    ( ((tagHT.equal_range(key)).first)->second )->SetVoidArea(area);      
00774    return true;
00775 }

void gdcmHeader::SetImageDataSize size_t  ImageDataSize  ) 
 

Sets the Pixel Area size in the Header --> not-for-rats function.

Parameters:
ImageDataSize new Pixel Area Size warning : nothing else is checked

Definition at line 716 of file gdcmHeader.cxx.

References gdcmParser::GetHeaderEntryByNumber(), SetEntryByNumber(), and gdcmHeaderEntry::SetLength().

Referenced by gdcmFile::SetImageData().

00716                                                       {
00717    std::string content1;
00718    char car[20];
00719         
00720    // Assumes HeaderEntry (GrPixel, NumPixel) is unique ...   
00721    // TODO deal with multiplicity (see gdcmData/icone.dcm)      
00722    sprintf(car,"%d",ImageDataSize);
00723  
00724    gdcmHeaderEntry *a = GetHeaderEntryByNumber(GrPixel, NumPixel);
00725    a->SetLength(ImageDataSize);
00726                 
00727    ImageDataSize+=8;
00728    sprintf(car,"%d",ImageDataSize);
00729    content1=car;        
00730    SetEntryByNumber(content1, GrPixel, NumPixel);
00731 }

void gdcmParser::SetPrintLevel int  level  )  [inline, inherited]
 

Sets the print level for the Dicom Header.

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

Reimplemented in gdcmDicomDir.

Definition at line 51 of file gdcmParser.h.

00051 { printLevel = level; };

bool gdcmParser::SetShaDict DictKey  dictName  )  [inherited]
 

Set the shadow dictionary used.

Parameters:
dictName name of the dictionary to use in shadow

Definition at line 212 of file gdcmParser.cxx.

References DictKey, gdcmDictSet::GetDict(), gdcmGlobal::GetDicts(), and gdcmParser::RefShaDict.

00212                                            {
00213    RefShaDict=gdcmGlobal::GetDicts()->GetDict(dictName);
00214    return(!RefShaDict);
00215 }

bool gdcmParser::SetShaDict gdcmDict dict  )  [inherited]
 

Set the shadow dictionary used.

Parameters:
dict dictionary to use in shadow

Definition at line 202 of file gdcmParser.cxx.

References gdcmParser::RefShaDict.

00202                                          {
00203    RefShaDict=dict;
00204    return(!RefShaDict);
00205 }

guint32 gdcmParser::SwapLong guint32  a  )  [inherited]
 

Swaps back the bytes of 4-byte long integer accordingly to processor order.

Returns:
The properly swaped 32 bits integer.

Definition at line 1156 of file gdcmParser.cxx.

References dbg, gdcmDebug::Error(), and gdcmParser::sw.

Referenced by gdcmFile::gdcm_read_RLE_file(), gdcmParser::GetHeaderEntryValue(), gdcmFile::ParsePixelData(), gdcmParser::ReadInt32(), gdcmFile::ReadPixelData(), and gdcmParser::UnswapLong().

01156                                       {
01157    switch (sw) {
01158       case    0 :
01159          break;
01160       case 4321 :
01161          a=( ((a<<24) & 0xff000000) | ((a<<8)  & 0x00ff0000) | 
01162              ((a>>8)  & 0x0000ff00) | ((a>>24) & 0x000000ff) );
01163          break;
01164    
01165       case 3412 :
01166          a=( ((a<<16) & 0xffff0000) | ((a>>16) & 0x0000ffff) );
01167          break;
01168    
01169       case 2143 :
01170          a=( ((a<<8) & 0xff00ff00) | ((a>>8) & 0x00ff00ff)  );
01171          break;
01172       default :
01173          dbg.Error(" gdcmParser::SwapLong : unset swap code");
01174          a=0;
01175    }
01176    return(a);
01177 }

guint16 gdcmParser::SwapShort guint16  a  )  [inherited]
 

Swaps the bytes so they agree with the processor order.

Returns:
The properly swaped 16 bits integer.

Definition at line 1194 of file gdcmParser.cxx.

References gdcmParser::sw.

Referenced by gdcmParser::FindHeaderEntryLength(), gdcmFile::gdcm_read_RLE_file(), gdcmParser::GetHeaderEntryValue(), gdcmFile::ParsePixelData(), gdcmParser::ReadInt16(), gdcmFile::ReadPixelData(), and gdcmParser::UnswapShort().

01194                                        {
01195    if ( (sw==4321)  || (sw==2143) )
01196       a =(((a<<8) & 0x0ff00) | ((a>>8)&0x00ff));
01197    return (a);
01198 }

guint32 gdcmParser::UnswapLong guint32  a  )  [inherited]
 

Unswaps back the bytes of 4-byte long integer accordingly to processor order.

Returns:
The properly unswaped 32 bits integer.

Definition at line 1185 of file gdcmParser.cxx.

References gdcmParser::SwapLong().

01185                                         {
01186    return (SwapLong(a));
01187 }

guint16 gdcmParser::UnswapShort guint16  a  )  [inherited]
 

Unswaps the bytes so they agree with the processor order.

Returns:
The properly unswaped 16 bits integer.

Definition at line 1205 of file gdcmParser.cxx.

References gdcmParser::SwapShort().

01205                                          {
01206    return (SwapShort(a));
01207 }

void gdcmParser::UpdateGroupLength bool  SkipSequence = false,
FileType  type = ImplicitVR
[protected, inherited]
 

Re-computes the length of a ACR-NEMA/Dicom group from a DcmHeader.

Warning:
: to be re-written using the chained list instead of the H table.

: DO NOT use (doesn't work any longer because of the multimap)

Todo:
: to be re-written using the chained list instead of the H table
Parameters:
SkipSequence TRUE if we don't want to write Sequences (ACR-NEMA Files)
type Type of the File (ExplicitVR,ImplicitVR, ACR, ...)

Definition at line 892 of file gdcmParser.cxx.

References gdcmParser::AddHeaderEntry(), ExplicitVR, gdcmHeaderEntry::GetElement(), gdcmHeaderEntry::GetGroup(), gdcmParser::GetHeaderEntryByNumber(), gdcmHeaderEntry::GetLength(), gdcmHeaderEntry::GetVR(), GroupHT, GroupKey, gdcmHeaderEntry::SetLength(), gdcmHeaderEntry::SetValue(), gdcmParser::tagHT, and TagKey.

00892                                                                    {
00893    guint16 gr, el;
00894    std::string vr;
00895    
00896    gdcmHeaderEntry *elem;
00897    char trash[10];
00898    std::string str_trash;
00899    
00900    GroupKey key;
00901    GroupHT groupHt;  // to hold the length of each group
00902    TagKey tk;
00903    // remember :
00904    // typedef std::map<GroupKey, int> GroupHT;
00905    
00906    gdcmHeaderEntry *elemZ;
00907   
00908    // for each Tag in the DCM Header
00909    
00910    for (TagHeaderEntryHT::iterator tag2 = tagHT.begin(); 
00911         tag2 != tagHT.end();
00912         ++tag2)
00913    {
00914       elem  = tag2->second;
00915       gr = elem->GetGroup();
00916       el = elem->GetElement();
00917       vr = elem->GetVR(); 
00918                  
00919       sprintf(trash, "%04x", gr);
00920       key = trash;              // generate 'group tag'
00921       
00922       // if the caller decided not to take SEQUENCEs into account 
00923       // e.g : he wants to write an ACR-NEMA File 
00924                 
00925       if (SkipSequence && vr == "SQ") 
00926          continue;
00927       
00928       // Still unsolved problem :
00929       // we cannot find the 'Sequence Delimitation Item'
00930       // since it's at the end of the Hash Table
00931       // (fffe,e0dd) 
00932        
00933       // pas SEQUENCE en ACR-NEMA
00934       // WARNING : 
00935       // --> la descente a l'interieur' des SQ 
00936       // devrait etre faite avec une liste chainee, pas avec une HTable...
00937             
00938       if ( groupHt.count(key) == 0) // we just read the first elem of a given group
00939       { 
00940          if (el == 0x0000) // the first elem is 0x0000
00941          {            
00942             groupHt[key] = 0;         // initialize group length 
00943          } 
00944          else 
00945          {
00946             groupHt[key] = 2 + 2 + 4 + elem->GetLength(); // non 0x0000 first group elem
00947          } 
00948       } 
00949       else // any elem but the first
00950       {   
00951          if (type == ExplicitVR) 
00952          {
00953             if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") ) 
00954             {
00955                groupHt[key] +=  4; // explicit VR AND OB, OW, SQ : 4 more bytes
00956             }
00957          }
00958          groupHt[key] += 2 + 2 + 4 + elem->GetLength(); 
00959       } 
00960    }
00961 
00962    unsigned short int gr_bid;
00963   
00964    for (GroupHT::iterator g = groupHt.begin(); // for each group we found
00965         g != groupHt.end();
00966         ++g)
00967    { 
00968       // FIXME: g++ -Wall -Wstrict-prototypes reports on following line:
00969       //        warning: unsigned int format, different type arg
00970       sscanf(g->first.c_str(),"%x",&gr_bid);
00971       tk = g->first + "|0000";                  // generate the element full tag
00972                      
00973       if ( tagHT.count(tk) == 0) // if element 0x0000 not found
00974       {                 
00975          gdcmDictEntry * tagZ = new gdcmDictEntry(gr_bid, 0x0000, "UL");       
00976          elemZ = new gdcmHeaderEntry(tagZ);
00977          elemZ->SetLength(4);
00978          AddHeaderEntry(elemZ);                         // create it
00979       } 
00980       else 
00981       {
00982          elemZ=GetHeaderEntryByNumber(gr_bid, 0x0000);
00983       }     
00984       sprintf(trash ,"%d",g->second);
00985       str_trash=trash;
00986       elemZ->SetValue(str_trash);
00987    }   
00988 }

virtual void gdcmHeader::UpdateShaEntries void   )  [inline, virtual]
 

Update the entries with the shadow dictionary. Only non even entries are analyzed.

Reimplemented from gdcmParser.

Definition at line 103 of file gdcmHeader.h.

References gdcmParser::UpdateShaEntries().

bool gdcmParser::Write FILE *  fp,
FileType  type
[virtual, inherited]
 

Parameters:
fp file pointer on an already open file
type type of the File to be written (ACR-NEMA, ExplicitVR, ImplicitVR)
Returns:
always "True" ?!

Definition at line 381 of file gdcmParser.cxx.

References ExplicitVR, gdcmParser::ReplaceOrCreateByNumber(), gdcmParser::SetEntryLengthByNumber(), UI1_2_840_10008_1_2, UI1_2_840_10008_1_2_1, and gdcmParser::WriteEntries().

Referenced by gdcmFile::WriteBase().

00381                                               {
00382 // ==============
00383 // TODO The stuff was rewritten using the chained list instead 
00384 //      of the H table
00385 //      so we could remove the GroupHT from the gdcmParser
00386 // To be checked
00387 // =============
00388 
00389    // TODO : move the following lines (and a lot of others, to be written)
00390    // to a future function CheckAndCorrectHeader
00391    
00392         // Question :
00393         // Comment pourrait-on savoir si le DcmHeader vient d'un fichier DicomV3 ou non
00394         // (FileType est un champ de gdcmParser ...)
00395         // WARNING : Si on veut ecrire du DICOM V3 a partir d'un DcmHeader ACR-NEMA
00396         // no way 
00397         // a moins de se livrer a un tres complique ajout des champs manquants.
00398         // faire un CheckAndCorrectHeader (?)  
00399          
00400 
00401    if (type == ImplicitVR) 
00402    {
00403       std::string implicitVRTransfertSyntax = UI1_2_840_10008_1_2;
00404       ReplaceOrCreateByNumber(implicitVRTransfertSyntax,0x0002, 0x0010);
00405       
00406       //FIXME Refer to standards on page 21, chapter 6.2 "Value representation":
00407       //      values with a VR of UI shall be padded with a single trailing null
00408       //      Dans le cas suivant on doit pader manuellement avec un 0
00409       
00410       SetEntryLengthByNumber(18, 0x0002, 0x0010);
00411    } 
00412 
00413    if (type == ExplicitVR) 
00414    {
00415       std::string explicitVRTransfertSyntax = UI1_2_840_10008_1_2_1;
00416       ReplaceOrCreateByNumber(explicitVRTransfertSyntax,0x0002, 0x0010);
00417       
00418       //FIXME Refer to standards on page 21, chapter 6.2 "Value representation":
00419       //      values with a VR of UI shall be padded with a single trailing null
00420       //      Dans le cas suivant on doit pader manuellement avec un 0
00421       
00422       SetEntryLengthByNumber(20, 0x0002, 0x0010);
00423    }
00424 
00425 /* TODO : rewrite later
00426 
00427    if ( (type == ImplicitVR) || (type == ExplicitVR) )
00428       UpdateGroupLength(false,type);
00429    if ( type == ACR)
00430       UpdateGroupLength(true,ACR);
00431 */
00432 
00433    WriteEntries(fp,type);
00434    return(true);
00435  }

int gdcmHeader::write std::ostream &   )  [protected]
 

void gdcmParser::WriteEntries FILE *  _fp,
FileType  type
[protected, inherited]
 

writes on disc according to the requested format (ACR-NEMA, ExplicitVR, ImplicitVR) the image

Warning:
does NOT add the missing elements in the header : it's up to the user doing it ! (function CheckHeaderCoherence to be written)

DON'T try, right now, to write a DICOM image from an ACR Header (meta elements will be missing!)

Parameters:
type type of the File to be written (ACR-NEMA, ExplicitVR, ImplicitVR)
_fp already open file pointer

Definition at line 1003 of file gdcmParser.cxx.

References ACR, gdcmParser::countGrPixel, DICOMDIR, ExplicitVR, gdcmParser::GrPixel, gdcmParser::listEntries, gdcmParser::NumPixel, and Tokenize().

Referenced by gdcmParser::Write(), and gdcmDicomDir::Write().

01004 {
01005    guint16 gr, el;
01006    guint32 lgr;
01007    std::string value;
01008    const char * val;
01009    std::string vr;
01010    guint32 val_uint32;
01011    guint16 val_uint16;
01012    guint16 valZero =0;
01013    void *voidArea;
01014    std::vector<std::string> tokens;
01015    
01016    // TODO : function CheckHeaderCoherence to be written
01017    
01018    //  uses now listEntries to iterate, not TagHt!
01019    //
01020    //        pb : gdcmParser.Add does NOT update listEntries
01021    //       TODO : find a trick (in STL?) to do it, at low cost !
01022 
01023    void *ptr;
01024 
01025    // TODO (?) tester les echecs en ecriture (apres chaque fwrite)
01026    int compte =0;
01027    
01028    for (ListTag::iterator tag2=listEntries.begin();
01029         tag2 != listEntries.end();
01030         ++tag2)
01031    {
01032       // === Deal with the length
01033       //     --------------------
01034       if(((*tag2)->GetLength())%2==1)
01035       {
01036          (*tag2)->SetValue((*tag2)->GetValue()+"\0");
01037          (*tag2)->SetLength((*tag2)->GetLength()+1);
01038       }
01039 
01040       gr    = (*tag2)->GetGroup();
01041       el    = (*tag2)->GetElement();
01042       lgr   = (*tag2)->GetReadLength();
01043       val   = (*tag2)->GetValue().c_str();
01044       vr    = (*tag2)->GetVR();
01045       voidArea = (*tag2)->GetVoidArea();
01046       
01047       if ( type == ACR ) 
01048       { 
01049          if (gr < 0x0008)   continue; // ignore pure DICOM V3 groups
01050          if (gr %2)         continue; // ignore shadow groups
01051          if (vr == "SQ" )   continue; // ignore Sequences
01052                    // TODO : find a trick to *skip* the SeQuences !
01053                    // Not only ignore the SQ element
01054          if (gr == 0xfffe ) continue; // ignore delimiters
01055       } 
01056 
01057       fwrite ( &gr,(size_t)2 ,(size_t)1 ,_fp);  //group
01058       fwrite ( &el,(size_t)2 ,(size_t)1 ,_fp);  //element
01059       
01060       // if ( (type == ExplicitVR) && (gr <= 0x0002) ) // ?!?  < 2  
01061       if ( (type == ExplicitVR) || (type == DICOMDIR) )      
01062       {
01063          // EXPLICIT VR
01064          guint16 z=0, shortLgr;
01065          if (vr == "unkn") 
01066          { // Unknown was 'written'      
01067             shortLgr=lgr;
01068             fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,_fp);
01069             fwrite ( &z,  (size_t)2 ,(size_t)1 ,_fp);
01070          } 
01071          else 
01072          {
01073             if (gr != 0xfffe) 
01074             { // NO value for 'delimiters'
01075                if (vr == "unkn") // Unknown was 'written'
01076                   fwrite(&z,(size_t)2 ,(size_t)1 ,_fp);
01077                else      
01078                   fwrite (vr.c_str(),(size_t)2 ,(size_t)1 ,_fp);
01079             }
01080 
01081             if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") || gr == 0xfffe)
01082             {
01083                if (gr != 0xfffe)
01084                   fwrite ( &z,  (size_t)2 ,(size_t)1 ,_fp);
01085                   fwrite ( &lgr,(size_t)4 ,(size_t)1 ,_fp);
01086             } 
01087             else 
01088             {
01089                shortLgr=lgr;
01090                fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,_fp);
01091             }
01092          }
01093       } 
01094       else // IMPLICIT VR 
01095       { 
01096          fwrite ( &lgr,(size_t)4 ,(size_t)1 ,_fp);
01097       }
01098       
01099       // === Deal with the value
01100       //     -------------------
01101       if (vr == "SQ")  continue; // no "value" to write for the SEQuences
01102       if (gr == 0xfffe)continue;
01103       
01104       if (voidArea != NULL) 
01105       { // there is a 'non string' LUT, overlay, etc
01106          fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,_fp); // Elem value
01107          continue;            
01108       }
01109       
01110       if (vr == "US" || vr == "SS") 
01111       {
01112          tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
01113          Tokenize ((*tag2)->GetValue(), tokens, "\\");
01114          for (unsigned int i=0; i<tokens.size();i++) 
01115          {
01116             val_uint16 = atoi(tokens[i].c_str());
01117             ptr = &val_uint16;
01118             fwrite ( ptr,(size_t)2 ,(size_t)1 ,_fp);
01119          }
01120          tokens.clear();
01121          continue;
01122       }
01123       if (vr == "UL" || vr == "SL") 
01124       {
01125          tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
01126          Tokenize ((*tag2)->GetValue(), tokens, "\\");
01127          for (unsigned int i=0; i<tokens.size();i++) 
01128          {
01129             val_uint32 = atoi(tokens[i].c_str());
01130             ptr = &val_uint32;
01131             fwrite ( ptr,(size_t)4 ,(size_t)1 ,_fp);
01132          }
01133          tokens.clear();
01134          continue;
01135       } 
01136           
01137       // Pixels are never loaded in the element !
01138       // we stop writting when Pixel are processed
01139       // FIX : we loose trailing elements (RAB, right now)           
01140             
01141       if ((gr == GrPixel) && (el == NumPixel) ) {
01142          compte++;
01143          if (compte == countGrPixel) // we passed *all* the GrPixel,NumPixel   
01144             break;
01145       }       
01146       fwrite ( val,(size_t)lgr ,(size_t)1 ,_fp); // Elem value
01147    }
01148 }


Member Data Documentation

int gdcmParser::countGrPixel [protected, inherited]
 

Definition at line 160 of file gdcmParser.h.

Referenced by gdcmParser::WriteEntries().

int gdcmParser::enableSequences [protected, inherited]
 

Definition at line 152 of file gdcmParser.h.

Referenced by gdcmParser::FixHeaderEntryFoundLength(), and gdcmParser::gdcmParser().

FileType gdcmParser::filetype [protected, inherited]
 

Definition at line 142 of file gdcmParser.h.

Referenced by gdcmParser::CheckSwap(), gdcmParser::FindHeaderEntryLength(), gdcmParser::FindHeaderEntryVR(), gdcmParser::GetFileType(), gdcmParser::IsReadable(), and gdcmParser::LoadHeaderEntries().

FILE* gdcmParser::fp [protected, inherited]
 

Definition at line 141 of file gdcmParser.h.

Referenced by gdcmParser::CheckSwap(), gdcmParser::CloseFile(), gdcmParser::FindHeaderEntryLength(), gdcmParser::FindHeaderEntryLengthOB(), gdcmParser::FindHeaderEntryVR(), gdcmParser::IsHeaderEntryAnInteger(), gdcmParser::LoadEntryVoidArea(), gdcmParser::LoadHeaderEntries(), gdcmParser::LoadHeaderEntry(), gdcmParser::LoadHeaderEntrySafe(), gdcmParser::ReadInt16(), gdcmParser::ReadInt32(), gdcmParser::ReadNextHeaderEntry(), and gdcmParser::SkipBytes().

guint16 gdcmParser::GrPixel [protected, inherited]
 

Definition at line 156 of file gdcmParser.h.

Referenced by gdcmParser::FindHeaderEntryLength(), and gdcmParser::WriteEntries().

const unsigned int gdcmParser::HEADER_LENGTH_TO_READ = 256 [static, protected, inherited]
 

Definition at line 69 of file gdcmParser.cxx.

Referenced by gdcmParser::CheckSwap().

ListTag gdcmParser::listEntries [protected, inherited]
 

Definition at line 150 of file gdcmParser.h.

Referenced by gdcmParser::AddHeaderEntry(), gdcmParser::IsReadable(), gdcmParser::PrintEntry(), gdcmParser::UpdateShaEntries(), and gdcmParser::WriteEntries().

const unsigned int gdcmParser::MAX_SIZE_LOAD_ELEMENT_VALUE = 4096 [static, protected, inherited]
 

Definition at line 72 of file gdcmParser.cxx.

Referenced by gdcmParser::gdcmParser().

const unsigned int gdcmParser::MAX_SIZE_PRINT_ELEMENT_VALUE = 64 [static, protected, inherited]
 

Definition at line 76 of file gdcmParser.cxx.

guint16 gdcmParser::NumPixel [protected, inherited]
 

Definition at line 157 of file gdcmParser.h.

Referenced by gdcmParser::FindHeaderEntryLength(), and gdcmParser::WriteEntries().

int gdcmParser::printLevel [protected, inherited]
 

Definition at line 153 of file gdcmParser.h.

TagHeaderEntryHT gdcmParser::tagHT [protected, inherited]
 

Definition at line 149 of file gdcmParser.h.

Referenced by gdcmParser::AddHeaderEntry(), gdcmParser::CheckIfEntryExistByNumber(), gdcmParser::GenerateFreeTagKeyInGroup(), gdcmParser::GetEntryByNumber(), gdcmParser::GetHeaderEntryByNumber(), gdcmParser::GetHeaderEntrySameNumber(), gdcmParser::SetEntryByNumber(), gdcmParser::SetEntryLengthByNumber(), gdcmParser::SetEntryVoidAreaByNumber(), and gdcmParser::UpdateGroupLength().


The documentation for this class was generated from the following files:
Generated on Mon Feb 14 16:13:38 2005 for gdcm by doxygen 1.3.6