X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2Fgdcm.h;h=f0b4b91aa624982f0a34f3439a692348f3783a0b;hb=8afb2999a90aefbce7662c43fe19dad237d49331;hp=c84f9c00ec36534a23b86c8a615977d8601deb17;hpb=0e907c927c8511d4c57eb72912821ac18226ef85;p=gdcm.git diff --git a/src/gdcm.h b/src/gdcm.h index c84f9c00..f0b4b91a 100644 --- a/src/gdcm.h +++ b/src/gdcm.h @@ -28,15 +28,19 @@ // 3/ Make sure we can setup some default size value, // which should be around 4500 entries which is the // average dictionary size (said JPR) + +#define g_malloc malloc +#define g_free free + #ifdef __GNUC__ #include #define guint16 uint16_t #define guint32 uint32_t -#define g_malloc malloc -#define g_free free #endif -#ifdef _MSC_VER -#include +#ifdef _MSC_VER +typedef unsigned short guint16; +typedef unsigned int guint32; + #endif #ifdef _MSC_VER @@ -186,7 +190,7 @@ typedef map TagElValueHT; typedef map TagElValueNameHT; // Container for a set of succefully parsed ElValues. class GDCM_EXPORT ElValSet { - // We need both accesses with a TagKey and the Dicentry.Name + // We need both accesses with a TagKey and the Dictentry.Name TagElValueHT tagHt; TagElValueNameHT NameHt; public: @@ -220,14 +224,17 @@ class GDCM_EXPORT gdcmHeader { //BadLittleEndian, //BigEndian, //BadBigEndian}; + void SkipBytes(guint32); private: - // All instances share the same value representation dictionary + // All instances share the same Value Representation dictionary static VRHT *dicom_vr; + // Dictionaries of data elements: static gdcmDictSet* Dicts; // Global dictionary container gdcmDict* RefPubDict; // Public Dictionary gdcmDict* RefShaDict; // Shadow Dictionary (optional) - ElValSet PubElVals; // Element Values parsed with Public Dictionary - ElValSet ShaElVals; // Element Values parsed with Shadow Dictionary + // Parsed element values: + ElValSet PubElVals; // parsed with Public Dictionary + ElValSet ShaElVals; // parsed with Shadow Dictionary // In order to inspect/navigate through the file string filename; FILE * fp; @@ -237,7 +244,13 @@ private: // outside of the elements: guint16 grPixel; guint16 numPixel; + // Swap code (little, big, big-bad endian): this code is not fixed + // during parsing. int sw; + // Only the elements whose size are below this bound shall be loaded. + // By default, this upper bound is limited to 1024 (which looks reasonable + // when one considers the definition of the various VR contents). + guint32 MaxSizeLoadElementValue; guint16 ReadInt16(void); guint32 ReadInt32(void); @@ -246,6 +259,7 @@ private: void Initialise(void); void CheckSwap(void); void FindLength(ElValue *); + guint32 FindLengthOB(void); void FindVR(ElValue *); void LoadElementValue(ElValue *); void LoadElementValueSafe(ElValue *); @@ -255,7 +269,8 @@ private: void FixFoundLength(ElValue*, guint32); bool IsAnInteger(ElValue *); bool IsBigEndianTransferSyntax(void); - ElValue * ReadNextElement(void); + void SetMaxSizeLoadElementValue(long); + ElValue * ReadNextElement(void); gdcmDictEntry * IsInDicts(guint32, guint32); size_t GetPixelOffset(void); protected: