X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmParser.h;h=c1af1932e77e76a5a0ff9be7460307cef0d47d09;hb=4a07b1470f68d316f570fef1f07b9f9c77e90ee1;hp=7165817e0a8ebe8822eb1fc4f0cfcf6c1dd0b09d;hpb=2c273fe07b6658479d83c26052ae0d6d41aca195;p=gdcm.git diff --git a/src/gdcmParser.h b/src/gdcmParser.h index 7165817e..c1af1932 100644 --- a/src/gdcmParser.h +++ b/src/gdcmParser.h @@ -29,8 +29,8 @@ typedef std::map GroupHT; //----------------------------------------------------------------------------- /* - * \defgroup gdcmHeader - * \brief + * \defgroup gdcmParser + * \brief used by both gdcmHeader and gdcmDicomDir */ class GDCM_EXPORT gdcmParser { @@ -49,6 +49,7 @@ public: * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy */ void SetPrintLevel(int level) { printLevel = level; }; + virtual void Print (std::ostream &os = std::cout) {PrintEntry(os);}; virtual void PrintEntry (std::ostream &os = std::cout); virtual void PrintPubDict (std::ostream &os = std::cout); virtual void PrintShaDict (std::ostream &os = std::cout); @@ -98,6 +99,9 @@ public: // System access inline int GetSwapCode(void) { return sw; } + guint16 GetGrPixel(void) {return GrPixel;} + guint16 GetNumPixel(void) {return NumPixel;} + guint16 SwapShort(guint16); // needed by gdcmFile guint32 SwapLong(guint32); // needed by gdcmFile guint16 UnswapShort(guint16); // needed by gdcmFile @@ -128,11 +132,10 @@ protected: IterHT GetHeaderEntrySameNumber(guint16 group, guint16 element); // IterHT GetHeaderEntrySameName (std::string Name); - void LoadHeaderEntrySafe(gdcmHeaderEntry *); void UpdateGroupLength(bool SkipSequence = false, FileType type = ImplicitVR); - void WriteEntries(FileType type, FILE *); + void WriteEntries(FILE *_fp,FileType type); // Variables FILE *fp; @@ -140,17 +143,25 @@ protected: static const unsigned int HEADER_LENGTH_TO_READ; static const unsigned int MAX_SIZE_LOAD_ELEMENT_VALUE; + static const unsigned int MAX_SIZE_PRINT_ELEMENT_VALUE; protected: + TagHeaderEntryHT tagHT; // H Table (multimap), to provide fast access + ListTag listEntries; // chained list, to keep the 'spacial' ordering + int enableSequences; int printLevel; - TagHeaderEntryHT tagHT; // H Table (multimap), to provide fast access - ListTag listEntries; // chained list, to keep the 'spacial' ordering - + // For some ACR-NEMA images, it's *not* 7fe0, 0010 ... + guint16 GrPixel; + guint16 NumPixel; + // some files may contain icons; GrPixel,NumPixel appears several times + // Let's remember how many times! + int countGrPixel; + private: // Read - void Parse(bool exception_on_error = false) throw(gdcmFormatError); + bool ParseHeader(bool exception_on_error = false) throw(gdcmFormatError); void LoadHeaderEntries (void); void LoadHeaderEntry (gdcmHeaderEntry *); @@ -173,29 +184,31 @@ private: void SkipBytes(guint32); void Initialise(void); - void CheckSwap(void); + bool CheckSwap(void); void SwitchSwapToBigEndian(void); void SetMaxSizeLoadEntry(long); + void SetMaxSizePrintEntry(long); - // Dict + // DictEntry related utilities gdcmDictEntry *GetDictEntryByName (std::string Name); gdcmDictEntry *GetDictEntryByNumber(guint16, guint16); - + gdcmDictEntry *NewVirtualDictEntry(guint16 group, + guint16 element, + std::string vr = "unkn", + std::string fourth = "unkn", + std::string name = "unkn"); + gdcmDictEntry *NewVirtualDictEntry(gdcmHeaderEntry *); + // HeaderEntry related utilities gdcmHeaderEntry *ReadNextHeaderEntry (void); gdcmHeaderEntry *NewHeaderEntryByNumber(guint16 group, guint16 element); gdcmHeaderEntry *NewHeaderEntryByName (std::string Name); - gdcmDictEntry *NewVirtualDictEntry(guint16 group, - guint16 element, - std::string vr = "Unknown", - std::string fourth = "Unknown", - std::string name = "Unknown"); - gdcmDictEntry *NewVirtualDictEntry(gdcmHeaderEntry *); - // Deprecated (Not used) - gdcmHeaderEntry *NewManualHeaderEntryToPubDict(std::string NewTagName, - std::string VR); + + // Deprecated (Not used) --> commented out + //gdcmHeaderEntry *NewManualHeaderEntryToPubDict(std::string NewTagName, + // std::string VR); guint32 GenerateFreeTagKeyInGroup(guint16 group); // Refering underlying filename. @@ -221,6 +234,11 @@ private: // this upper bound is fixed to 1024 bytes (which might look reasonable // when one considers the definition of the various VR contents). guint32 MaxSizeLoadEntry; + // Size treshold above which an element value will NOT be *printed* in + // order no to polute the screen output. By default, + // this upper bound is fixed to 64 bytes. + guint32 MaxSizePrintEntry; + }; //-----------------------------------------------------------------------------