-// the | (pipe symbol) acts as a separator). Refer to
-// gdcmDictEntry::TranslateToKey for this conversion function.
-typedef string TagKey;
-
-class GDCM_EXPORT gdcmDictEntry {
-private:
- guint16 group; // e.g. 0x0010
- guint16 element; // e.g. 0x0010
- string vr; // Value Representation i.e. some clue about the nature
- // of the data represented e.g. "FD" short for
- // "Floating Point Double"
- // CLEAN ME: find the official dicom name for this field !
- string fourth; // Fourth field containing some semantics.
- string name; // e.g. "Patient_Name"
- TagKey key; // This is redundant zith (group, element) but we add
- // on efficiency purposes.
- // DCMTK has many fields for handling a DictEntry (see below). What are the
- // relevant ones for gdcmlib ?
- // struct DBI_SimpleEntry {
- // Uint16 group;
- // Uint16 element;
- // Uint16 upperGroup;
- // Uint16 upperElement;
- // DcmEVR evr;
- // const char* tagName;
- // int vmMin;
- // int vmMax;
- // const char* standardVersion;
- // DcmDictRangeRestriction groupRestriction;
- // DcmDictRangeRestriction elementRestriction;
- // };
-public:
- //CLEANME gdcmDictEntry();
- gdcmDictEntry(guint16 group, guint16 element,
- string vr, string fourth, string name);
- static TagKey TranslateToKey(guint16 group, guint16 element);
- guint16 GetGroup(void) { return group;};
- guint16 GetElement(void){return element;};
- string GetVR(void) {return vr; };
- void SetVR(string in){vr = in; };
- string GetFourth(void) {return fourth;};
- string GetName(void) {return name;};
- string GetKey(void) {return key;};
-};
-
-typedef map<TagKey, gdcmDictEntry*> TagHT;
-
-// A single DICOM dictionary i.e. a container for a collection of dictionary
-// 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 GDCM_EXPORT gdcmDict {
- string name;
- string filename;
- TagHT entries;
-public:
- gdcmDict(const char* FileName); // Read Dict from disk
- // TODO Swig int AppendEntry(gdcmDictEntry* NewEntry);
- gdcmDictEntry * GetTag(guint32 group, guint32 element);
- void Print(ostream&);
-};
-
-// Container for managing a set of loaded dictionaries. Sharing dictionaries
-// should avoid :
-// * reloading an allready loaded dictionary.
-// * having many in memory representations of the same dictionary.
-typedef string DictKey;
-typedef map<DictKey, gdcmDict*> DictSetHT;
-class GDCM_EXPORT gdcmDictSet {
-private:
- string DictPath; // Directory path to dictionaries
- DictSetHT dicts;
- int AppendDict(gdcmDict* NewDict);
- int LoadDictFromFile(string filename, DictKey);
- void SetDictPath(void);
-public:
- gdcmDictSet(void); // loads THE DICOM v3 dictionary
- // TODO Swig int LoadDictFromFile(string filename);
-///// QUESTION: the following function might not be thread safe !? Maybe
-///// we need some mutex here, to avoid concurent creation of
-///// the same dictionary !?!?!
- // TODO Swig int LoadDictFromName(string filename);
- // TODO Swig int LoadAllDictFromDirectory(string DirectoryName);
- // TODO Swig string* GetAllDictNames();
- int LoadDicomV3Dict(void);
- void Print(ostream&);
- gdcmDict* GetDict(DictKey DictName);
- gdcmDict* GetDefaultPublicDict(void);
-};
-
-// The dicom header of a Dicom file contains a set of such ELement VALUES
-// (when successfuly parsed against a given Dicom dictionary)
-class GDCM_EXPORT ElValue {
-private:
- gdcmDictEntry *entry;
- guint32 LgrElem;
- // Might prove of some interest (see _ID_DCM_ELEM)
- // int Swap;
-public:
- string value; // used to be char * valeurElem
- size_t Offset; // Offset from the begining of file for direct user access
- ElValue(gdcmDictEntry*);
- void SetVR(string);
- string GetVR(void);
- void SetLength(guint32 l){LgrElem = l; };
- void SetValue(string val){ value = val; };
- void SetOffset(size_t of){ Offset = of; };
- string GetValue(void) { return value; };
- guint32 GetLength(void) { return LgrElem; };
- size_t GetOffset(void) { return Offset; };
- guint16 GetGroup(void) { return entry->GetGroup(); };
- guint16 GetElement(void) { return entry->GetElement(); };
- string GetKey(void) { return entry->GetKey(); };
- string GetName(void) { return entry->GetName();};
-};