X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2Fgdcm.h;h=735bd98c326ee678b33756a2d727c4a70bfc3aa7;hb=885580b981648efd2b861bb92873c43d09757f27;hp=c4737561aa279a4ee532a1a00a47a72c4acec373;hpb=add079705405296ac0e1f811afbd0f237371dd52;p=gdcm.git diff --git a/src/gdcm.h b/src/gdcm.h index c4737561..735bd98c 100644 --- a/src/gdcm.h +++ b/src/gdcm.h @@ -17,16 +17,19 @@ // problems appears at loading of _gdcm.[so/dll]). So, simply uncomment // the declaration once you provided the definition of the method... +#ifndef GDCM_H +#define GDCM_H + #include -#ifdef _MSC_VER -using namespace std; // string type lives in the std namespace on VC++ -#endif +using namespace std; #include #include // For size_t #include // FIXME For FILE on GCC only #include #include +#include "gdcmException.h" + // The requirement for the hash table (or map) that // we shall use: @@ -38,8 +41,8 @@ using namespace std; // string type lives in the std namespace on VC++ // which should be around 4500 entries which is the // average dictionary size (said JPR) // - // En fait, je disais que dans LE Directory Dicom (dans son etat 2002) - // il y a 1600 entrees. + // En fait, je disais que dans LE Directory Dicom (dans son etat 2001) + // il y a +/- 1600 entrees. // Une valeur raisonable pour un majorant du nombre d'entrees // dans une entete DICOM d'une image semble semble etre 300 // Si on 'decortique' les elements SQ (ce qui ne semble pas etre fait pour le moment) @@ -167,13 +170,19 @@ typedef map 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); + void LoadDictFromFile(string filename, DictKey); +private: + static string DictPath; // Directory path to dictionaries + static string BuildDictPath(void); + static gdcmDict* DefaultPubDict; public: - gdcmDictSet(void); // loads THE DICOM v3 dictionary + static list * GetPubDictTagNames(void); + static map >* GetPubDictTagNamesByCategory(void); + static gdcmDict* LoadDefaultPubDict(void); + + gdcmDictSet(void); // 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 @@ -182,14 +191,9 @@ public: // TODO Swig int LoadAllDictFromDirectory(string DirectoryName); // TODO Swig string* GetAllDictNames(); // - // Question : ne faudra-t-il pas mettre LE dictionnaire DICOM dans un Directory - // et les eventuels 'dictionnaires prives' dans un autre? - // (pour eviter a un utilisateur mal dégourdi de tout saccager ?) - // - int LoadDicomV3Dict(void); void Print(ostream&); gdcmDict* GetDict(DictKey DictName); - gdcmDict* GetDefaultPublicDict(void); + gdcmDict* GetDefaultPubDict(void); }; /////////////////////////////////////////////////////////////////////////// @@ -258,7 +262,11 @@ public: TagElValueHT & GetTagHt(void); int SetElValueByNumber(string content, guint32 group, guint32 element); - int SetElValueByName(string content, string TagName); + int SetElValueByName (string content, string TagName); + + int SetElValueLengthByNumber(guint32 l, guint32 group, guint32 element); + int SetElValueLengthByName (guint32 l, string TagName); + }; //////////////////////////////////////////////////////////////////////////// @@ -287,7 +295,7 @@ private: static VRHT *dicom_vr; // Dictionaries of data elements: - static gdcmDictSet* Dicts; // global dictionary container + gdcmDictSet* Dicts; // global dictionary container gdcmDict* RefPubDict; // public dictionary gdcmDict* RefShaDict; // shadow dictionary (optional) // Parsed element values: @@ -364,8 +372,10 @@ protected: int anonymize(ostream&); // FIXME : anonymize should be a friend ? public: void LoadElements(void); - virtual void ParseHeader(void); - gdcmHeader(const char* filename); + virtual void ParseHeader(bool exception_on_error = false) + throw(gdcmFormatError); + gdcmHeader(const char *filename, bool exception_on_error = false) + throw(gdcmFileError); virtual ~gdcmHeader(); size_t GetPixelOffset(void); @@ -377,14 +387,7 @@ public: // an additional specific dictionary to access extra information. // TODO Swig int SetShaDict(string filename); - // Retrieve all potentially available tag [tag = (group, element)] names - // from the standard (or public) dictionary. Typical usage : enable the - // user of a GUI based interface to select his favorite fields for sorting - // or selecting. - list * GetPubTagNames(void); - map > * GetPubTagNamesByCategory(void); // Get the element values themselves: - string GetPubElValByName(string TagName); string GetPubElValByNumber(guint16 group, guint16 element); @@ -397,7 +400,7 @@ public: TagElValueHT & GetPubElVal(void) { return PubElVals.GetTagHt(); }; void PrintPubElVal(ostream & os = cout); - void PrintPubDict(ostream &); + void PrintPubDict(ostream & os = cout); // Same thing with the shadow : // TODO Swig string* GetShaTagNames(); @@ -491,11 +494,11 @@ public: // Copies (at most MaxSize bytes) of data to caller's memory space. // Returns an error code on failure (if MaxSize is not big enough) - int PutImageDataHere(void* destination, size_t MaxSize ); + int GetImageDataIntoVector(void* destination, size_t MaxSize ); // Question : // - // GetImageData et PutImageDataHere + // GetImageData et GetImageDataIntoVector // Get et Put pour 2 fonctions qui font presque la meme chose :-( // @@ -518,7 +521,7 @@ public: // Ca sera à l'utilisateur d'appeler son Reader correctement int WriteRawData (string nomFichier); - int WriteDcm (string nomFichier); + int WriteDcm (string nomFichier); }; // @@ -540,3 +543,4 @@ public: //class gdcmMultiFrame : gdcmFile; +#endif // #ifndef GDCM_H