// exporter des images lisibles par les consoles cliniques
// et pas seulement importables dans e-film.
-
#ifdef __GNUC__
#include <stdint.h>
#define guint16 uint16_t
#define GDCM_EXPORT
#endif
-
//
// ---------------------------------------------------- gdcmDictEntry
//
// fabrique une ligne de Dictionnaire Dicom à partir des parametres en entrée
- gdcmDictEntry(guint16 group, guint16 element,
+ gdcmDictEntry(guint16 group,
+ guint16 element,
string vr = "Unknown",
string fourth = "Unknown",
string name = "Unknown");
static TagKey TranslateToKey(guint16 group, guint16 element);
- guint16 GetGroup(void) { return group;};
+ guint16 GetGroup(void) { return group; };
guint16 GetElement(void){return element;};
- string GetVR(void) {return vr; };
+ string GetVR(void) {return vr; };
void SetVR(string);
+ void SetKey(string k){ key = k; }
bool IsVrUnknown(void);
string GetFourth(void) {return fourth;};
- string GetName(void) {return name;};
- string GetKey(void) {return key;};
+ string GetName(void) {return name; };
+ string GetKey(void) {return key; };
};
//
// combined with all software versions...
typedef map<TagKey, gdcmDictEntry*> TagHT;
- // Table de Hachage (group,Elem) --> pointeur vers une ligne du Dictionnaire Dicom
-
-typedef map<TagKey, gdcmDictEntry*> TagHT;
+ // Table de Hachage : (group,Elem) --> pointeur vers une ligne du Dictionnaire Dicom
class GDCM_EXPORT gdcmDict {
string name;
// rempli le Dictionnaire Dicom à partir d'un fichier texte
gdcmDict(const char* FileName); // Read Dict from disk
- // QUESTION :
- // Ca doit ajouter une nouvelle entrée 'a la fin', ou 'a sa place' ?
- //
- // TODO Swig int AppendEntry(gdcmDictEntry* NewEntry);
+ int AddNewEntry (gdcmDictEntry* NewEntry);
+ int ReplaceEntry(gdcmDictEntry* NewEntry);
+ int RemoveEntry (TagKey k);
+ int RemoveEntry (guint16 group, guint16 element);
// renvoie une ligne de Dictionnaire Dicom à partir de (numGroup, numElement)
gdcmDictEntry * GetTag(guint32 group, guint32 element);
+
void Print(ostream&);
TagHT & GetEntries(void) { return entries; }
};
//
// 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&);
public:
string value; // used to be char * valeurElem
size_t Offset; // Offset from the begining of file for direct user access
+
ElValue(gdcmDictEntry*);
void SetDictEntry(gdcmDictEntry *NewEntry) { entry = NewEntry; };
-
bool IsVrUnknown(void) { return entry->IsVrUnknown(); };
- void SetLength(guint32 l){ LgrElem = l; };
- void SetValue(string val){ value = val; };
- void SetOffset(size_t of){ Offset = of; };
void SetImplicitVr(void) { ImplicitVr = true; };
bool IsImplicitVr(void) { return ImplicitVr; };
- void SetVR(string);
- string GetVR(void);
- string GetValue(void) { return value; };
- guint32 GetLength(void) { return LgrElem; };
- size_t GetOffset(void) { return Offset; };
- guint16 GetGroup(void) { return entry->GetGroup(); };
+
+ guint16 GetGroup(void) { return entry->GetGroup(); };
guint16 GetElement(void) { return entry->GetElement(); };
string GetKey(void) { return entry->GetKey(); };
string GetName(void) { return entry->GetName(); };
+
+ string GetVR(void) { return entry->GetVR(); };
+ void SetVR(string v) { entry->SetVR(v); };
+
+ // Question :
+ // Un champ privé, accessible en consultation et en modif (sans restriction)
+ // interet par rapport à un champ public ?
+ // --> pouvoir en changer la définition sans toucher à l'API
+
+ void SetLength(guint32 l){ LgrElem = l; };
+ guint32 GetLength(void) { return LgrElem; };
+
+ void SetValue(string val){ value = val; };
+ string GetValue(void) { return value; };
+
+ void SetOffset(size_t of){ Offset = of; };
+ size_t GetOffset(void) { return Offset; };
+
};
void Add(ElValue*);
void Print(ostream &);
void PrintByName(ostream &);
+ int Write(FILE *fp);
ElValue* GetElementByNumber(guint32 group, guint32 element);
ElValue* GetElementByName (string);
string GetElValueByNumber(guint32 group, guint32 element);
string GetElValueByName (string);
- TagElValueHT & GetTagHt(void);
+
+ TagElValueHT & GetTagHt(void);
int SetElValueByNumber(string content, guint32 group, guint32 element);
int SetElValueByName(string content, string TagName);
// (Swig limitations for as Has_a dependency between gdcmFile and gdcmHeader)
-typedef string VRKey; // Ne devrait-elle pas etre utilisee dans la definition de VRHT ?
+typedef string VRKey;
typedef string VRAtr;
-typedef map<TagKey, VRAtr> VRHT; // Value Representation Hash Table
- // Cette Table de Hachage ne devrait servir qu'a determiner
- // si deux caractères correspondent à une VR existante ?
+typedef map<VRKey, VRAtr> VRHT; // Value Representation Hash Table
+
class GDCM_EXPORT gdcmHeader {
void SkipBytes(guint32);
private:
static VRHT *dicom_vr;
// Dictionaries of data elements:
-
- // Question :
- // Pourquoi mettre un pointeur statique vers le container des dictionnaires
- // (qui est une H-table de pointeurs vers des dictionnaires)
- // en plus des pointeurs vers chacun des dictionnaires ?
- // Ces derniers n'auraient-ils pas suffit ?
- //
+
static gdcmDictSet* Dicts; // global dictionary container
gdcmDict* RefPubDict; // public dictionary
gdcmDict* RefShaDict; // shadow dictionary (optional)
ElValSet ShaElVals; // parsed with Shadow Dictionary
string filename; // refering underlying file
FILE * fp;
- // The tag Image Location ((0028,0200) containing the address of
- // the pixels) is not allways present. Then we store this information
-
+ // The tag Image Location (0028,0200) - containing the address of
+ // the pixels - is not allways present. Then we store this information
+ // il etait facultatif en ACR-NEMA, il n'existe plus en DICOM 3
// FIXME
// Question :
// 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
+ // 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<string> * GetPubTagNames(void);
int SetPubElValByName(string content, string TagName);
int SetPubElValByNumber(string content, guint16 group, guint16 element);
- // TODO Swig int SetShaElValByName(string content, string ShadowTagName);
- // TODO Swig int SetShaElValByNumber(string content, guint16 group, guint16 element);
+ int SetShaElValByName(string content, string ShadowTagName);
+ int SetShaElValByNumber(string content, guint16 group, guint16 element);
+ ElValSet GetPubElVals() { return(PubElVals); }
};
//
// ---------------------------------------------------- gdcmFile
//
// un fichier EST_UNE entete, ou A_UNE entete ?
-//
-//
+//
+// On dit 'EST_UNE' ...
////////////////////////////////////////////////////////////////////////////
// In addition to Dicom header exploration, this class is designed
// for accessing the image/volume content. One can also use it to
// write Dicom files.
-////// QUESTION: this looks still like an open question wether the
+////// QUESTION: this looks still like an open question whether the
////// relationship between a gdcmFile and gdcmHeader is of
////// type IS_A or HAS_A !
int PutImageDataHere(void* destination, size_t MaxSize );
+ // Question :
+ //
+ // GetImageData et PutImageDataHere
+ // Get et Put pour 2 fonctions qui font presque la meme chose :-(
+ //
+
// Allocates ExpectedSize bytes of memory at this->Data and copies the
// pointed data to it.
+
+ // Question :
+ // Pourquoi dupliquer les pixels, alors qu'on les a deja en mémoire,
+ // et que Data (dans le gdcmHeader) est un pointeur ?
+
// TODO Swig int SetImageData(void * Data, size_t ExpectedSize);
+
// Push to disk.
// A NE PAS OUBLIER : que fait-on en cas de Transfert Syntax (dans l'entete)
// incohérente avec l'ordre des octets en mémoire
// Ecrit sur disque les pixels d'UNE image
// Aucun test n'est fait sur l'"Endiannerie" du processeur.
- // C'est à l'utilisateur d'appeler son Reader correctement
+ // Ca sera à l'utilisateur d'appeler son Reader correctement
int WriteRawData (string nomFichier);
+ int WriteDcm (string nomFichier);
};
//