]> Creatis software - gdcm.git/commitdiff
Ajout fonctions
authorjpr <jpr>
Thu, 9 Jan 2003 16:52:57 +0000 (16:52 +0000)
committerjpr <jpr>
Thu, 9 Jan 2003 16:52:57 +0000 (16:52 +0000)
int gdcmHeader::SetPubElValByNumber(string content, guint16 group, guint16 element);
int gdcmHeader::SetPubElValByName(string content, string TagName);
int ElValSet::SetElValueByNumber(string content, guint32 group, guint32 element);
int ElValSet::SetElValueByName(string content, string TagName);

src/gdcm.h
src/gdcmElValSet.cxx
src/gdcmHeader.cxx

index 211afebe214a61ee4bbdd90c38012674de9626b3..20e754130838cf96c8a8a59dfcda04d60a356197 100644 (file)
@@ -151,7 +151,7 @@ public:
 // combined with all software versions...
 
 typedef map<TagKey, gdcmDictEntry*> TagHT;
-       // Table de Hachage  (group,Elem) --> ligne du Dictionnaire Dicom
+       // Table de Hachage  (group,Elem) --> pointeur vers une ligne du Dictionnaire Dicom
 
 typedef map<TagKey, gdcmDictEntry*> TagHT;
 
@@ -262,13 +262,13 @@ public:
        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(); };
+       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();};
+       string  GetKey(void)     { return entry->GetKey();     };
+       string  GetName(void)    { return entry->GetName();    };
 };
 
 
@@ -285,10 +285,11 @@ typedef map<string, ElValue*> TagElValueNameHT;
 
 class GDCM_EXPORT ElValSet {
                // We need both accesses with a TagKey and the Dictentry.Name
+
        TagElValueHT tagHt;
        TagElValueNameHT NameHt;
-public:
-       void Add(ElValue*);
+public:        
+       void Add(ElValue*);             
        void Print(ostream &);
        void PrintByName(ostream &);
        ElValue* GetElementByNumber(guint32 group, guint32 element);
@@ -296,6 +297,9 @@ public:
        string   GetElValueByNumber(guint32 group, guint32 element);
        string   GetElValueByName  (string);
        TagElValueHT & GetTagHt(void);
+       
+       int SetElValueByNumber(string content, guint32 group, guint32 element);
+       int SetElValueByName(string content, string TagName);
 };
 
 
@@ -355,6 +359,7 @@ private:
        // Qu'y a-t-il a corriger ?
        //
        // outside of the elements:
+       
        guint16 grPixel;
        guint16 numPixel;
        // Ne faudrait-il pas une indication sur la presence ou non
@@ -472,12 +477,11 @@ public:
        string GetElValRepByName(string TagName);
        string GetElValRepByNumber(guint16 group, guint16 element);
 
-       // TODO Swig int SetPubElValByName(string content, string TagName);
-       // TODO Swig int SetPubElValByNumber(string content, guint16 group, guint16 element);
+       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);
 
-       // TODO Swig int GetSwapCode();
 };
 
 //
@@ -503,6 +507,7 @@ private:
        // Data pointe sur quoi?
        // sur les Pixels lus?
        // --> j'ajoute un champ public : Pixels
+       // (il faudra que l'utilisateur puisse modifier les pixels ?)
        
        void* Data;
        int Parsed;          // weather allready parsed
index 71f76056f3a5ebf3ce2a7aeeed2dff61e3fba39f..1f0760a448f97b47c66e5eadb4acc1024d4f6514 100644 (file)
@@ -63,6 +63,20 @@ string ElValSet::GetElValueByNumber(guint32 group, guint32 element) {
        return tagHt.find(key)->second->GetValue();
 }
 
+int ElValSet::SetElValueByNumber(string content, guint32 group, guint32 element) {
+       TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+       if ( ! tagHt.count(key))
+               return 0;
+       if (tagHt.count(key) > 1) {
+               dbg.Verbose(0, "ElValSet::SetElValueByNumber",
+                           "multiple entries for this key (FIXME) !");
+               return (0); 
+       }
+                                      
+       tagHt[key]->SetValue(content);
+       return(1);              
+}
+
 string ElValSet::GetElValueByName(string TagName) {
        if ( ! NameHt.count(TagName))
                return "gdcm::Unfound";
@@ -72,3 +86,15 @@ string ElValSet::GetElValueByName(string TagName) {
        return NameHt.find(TagName)->second->GetValue();
 }
 
+int ElValSet::SetElValueByName(string content, string TagName) {
+       if ( ! NameHt.count(TagName))
+               return 0;
+       if (NameHt.count(TagName) > 1) {
+               dbg.Verbose(0, "ElValSet::SetElValue",
+                           "multipe entries for this key (FIXME) !");
+               return 0;
+       }
+       NameHt.find(TagName)->second->SetValue(content);
+}
+
+
index e9e31dc43d5350fe827f5b8802a340f9eb1ea923..be4f259aecdd88fbfa28d773774f1b48df182871 100644 (file)
@@ -1084,6 +1084,33 @@ string gdcmHeader::GetElValRepByName(string TagName) {
        return GetShaElValRepByName(TagName);
 }
 
+/**
+ * \ingroup gdcmHeader
+ * \brief   Modifie la valeur d'un ElValue déja existant
+ * \   dans le PubElVals du gdcmHeader,
+ * \   accédé par ses numero de groupe et d'element.
+ */
+int gdcmHeader::SetPubElValByNumber(string content, guint16 group, guint16 element) {
+       //TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+       //PubElVals.tagHt[key]->SetValue(content);
+       
+       return (  PubElVals.SetElValueByNumber (content, group, element) );
+}
+
+
+/**
+ * \ingroup gdcmHeader
+ * \brief   Modifie la valeur d'un ElValue déja existant
+ * \   dans le PubElVals du gdcmHeader,
+ * \   accédé par son nom
+ */
+int gdcmHeader::SetPubElValByName(string content, string TagName) {
+       //TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+       //PubElVals.tagHt[key]->SetValue(content);
+       
+       return (  PubElVals.SetElValueByName (content, TagName) );
+}
+
 /**
  * \ingroup gdcmHeader
  * \brief   Parses the header of the file but does NOT load element values.