X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2Fgdcm.h;h=72a513a03fa47113ebd5485876ca15151e4eb256;hb=9324e96afd83331cc182144ac69b2a1aa824538c;hp=80e98048f99f9e3bf15df81cc47e82bf99f14eae;hpb=51b61705e90b352de08519835fa1c63b81bca616;p=gdcm.git diff --git a/src/gdcm.h b/src/gdcm.h index 80e98048..72a513a0 100644 --- a/src/gdcm.h +++ b/src/gdcm.h @@ -16,19 +16,28 @@ // the declaration once you provided the definition of the method... #include -#include // For size_t +#include +#include // For size_t #include -#include - -// The requirement for the hash table (or map) that we shall use: -// 1/ First, next, last (iterators) -// 2/ should be sortable (i.e. sorted by TagKey). This condition -// shall be droped since the Win32/VC++ implementation doesn't look -// a sorted one. Pffff.... -// 3/ Make sure we can setup some default size value, which should be -// around 4500 entries which is the average dictionary size (said JPR) -#include +#include // CLEANME +#include // The requirement for the hash table (or map) that + // we shall use: + // 1/ First, next, last (iterators) + // 2/ should be sortable (i.e. sorted by TagKey). This + // condition shall be droped since the Win32/VC++ + // implementation doesn't look a sorted one. Pffff.... + // 3/ Make sure we can setup some default size value, + // which should be around 4500 entries which is the + // average dictionary size (said JPR) +#ifdef _MSC_VER + using namespace std; // string type lives in the std namespace on VC++ +#endif +#ifdef _MSC_VER +#define GDCM_EXPORT __declspec( dllexport ) +#else +#define GDCM_EXPORT +#endif // Tag based hash tables. // We shall use as keys the strings (as the C++ type) obtained by @@ -40,7 +49,7 @@ // gdcmDictEntry::TranslateToKey for this conversion function. typedef string TagKey; -class gdcmDictEntry { +class GDCM_EXPORT gdcmDictEntry { private: guint16 group; // e.g. 0x0010 guint16 element; // e.g. 0x0010 @@ -70,7 +79,7 @@ private: public: //CLEANME gdcmDictEntry(); gdcmDictEntry(guint16 group, guint16 element, - string vr, string fourth, string vr); + string vr, string fourth, string name); static TagKey TranslateToKey(guint16 group, guint16 element); guint16 GetGroup(void) { return group;}; guint16 GetElement(void){return element;}; @@ -87,12 +96,12 @@ typedef map TagHT; // entries. There should be a single public dictionary (THE dictionary of // the actual DICOM v3) but as many shadow dictionaries as imagers // combined with all software versions... -class gdcmDict { +class GDCM_EXPORT gdcmDict { string name; string filename; TagHT entries; public: - gdcmDict(char *FileName); // Read Dict from disk + gdcmDict(const char* FileName); // Read Dict from disk // TODO Swig int AppendEntry(gdcmDictEntry* NewEntry); gdcmDictEntry * GetTag(guint32 group, guint32 element); void Print(ostream&); @@ -102,15 +111,15 @@ public: // should avoid : // * reloading an allready loaded dictionary. // * having many in memory representations of the same dictionary. -#define PUBDICTNAME "DicomV3Dict" -#define PUBDICTFILENAME "../Dicts/dicomV3.dic" typedef string DictKey; typedef map DictSetHT; -class gdcmDictSet { +class GDCM_EXPORT gdcmDictSet { private: + string DictPath; // Directory path to dictionaries DictSetHT dicts; int AppendDict(gdcmDict* NewDict); - int LoadDictFromFile(char* filename, DictKey); + int LoadDictFromFile(string filename, DictKey); + void SetDictPath(void); public: gdcmDictSet(void); // loads THE DICOM v3 dictionary // TODO Swig int LoadDictFromFile(string filename); @@ -128,7 +137,7 @@ public: // The dicom header of a Dicom file contains a set of such ELement VALUES // (when successfuly parsed against a given Dicom dictionary) -class ElValue { +class GDCM_EXPORT ElValue { private: gdcmDictEntry *entry; guint32 LgrElem; @@ -155,7 +164,7 @@ public: typedef map TagElValueHT; typedef map TagElValueNameHT; // Container for a set of succefully parsed ElValues. -class ElValSet { +class GDCM_EXPORT ElValSet { // We need both accesses with a TagKey and the Dicentry.Name TagElValueHT tagHt; TagElValueNameHT NameHt; @@ -183,7 +192,7 @@ typedef map VRHT; // Value Representation Hash Table // Notes: // * the gdcmHeader::Set*Tag* family members cannot be defined as protected // (Swig limitations for as Has_a dependency between gdcmFile and gdcmHeader) -class gdcmHeader { +class GDCM_EXPORT gdcmHeader { //FIXME sw should be qn EndianType !!! //enum EndianType { //LittleEndian, @@ -191,7 +200,7 @@ class gdcmHeader { //BigEndian, //BadBigEndian}; private: - // All instances share the same valur representation dictionary + // All instances share the same value representation dictionary static VRHT *dicom_vr; static gdcmDictSet* Dicts; // Global dictionary container gdcmDict* RefPubDict; // Public Dictionary @@ -262,7 +271,8 @@ public: // of C/C++ vs Python). // TODO Swig string GetPubElValRepByName(string TagName); // TODO Swig string GetPubElValRepByNumber(guint16 group, guint16 element); - void PrintPubElVal(ostream &); + TagElValueHT & GetPubElVal(void) { return PubElVals.GetTagHt(); }; + void PrintPubElVal(ostream & os = cout); void PrintPubDict(ostream &); // Same thing with the shadow : @@ -293,7 +303,7 @@ public: ////// QUESTION: this looks still like an open question wether the ////// relationship between a gdcmFile and gdcmHeader is of ////// type IS_A or HAS_A ! -class gdcmFile: gdcmHeader +class GDCM_EXPORT gdcmFile: gdcmHeader { private: void* Data;