]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOTreeAttributeDescriptor.h
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOTreeAttributeDescriptor.h
index cc78838797e437fc2193ec36ad388aeef20a79f9..1a68bfa1f3e69c5593870cb86b5bda647516c8c9 100644 (file)
@@ -16,7 +16,7 @@ namespace creaImageIO
     public:
       /// Flags
       /// The attribute is hidden (not visible to user)
-      static const unsigned int HIDDEN;
+      static const unsigned int PRIVATE;
       /// The attribute enters in unique identifier constitution (KEY)
       static const unsigned int KEY;
       /// The attribute enters in label constitution (for printing)
@@ -27,15 +27,29 @@ namespace creaImageIO
        : mKey(""), mName(""), mGroup(0), mElement(0), mFlags(0)
       {
       }
-      // Ctor with key and flags
-      // If the key is of the form "0020|000E" 
-      // (Two hex short separated by a pipe at 5th position)
-      // it is interpreted as a Dicom Tag 
-      // The user name is retreived from dicom dictionnary
-      // and the group and elem are filled
-      // Else the name is set to the key
+      /// Ctor with all explicitely
       AttributeDescriptor(const std::string& key,
+                         const std::string& name,
+                         unsigned short group,
+                         unsigned short element,
+                         unsigned int flags)
+       : mKey(key), mName(name), mGroup(group), mElement(element), 
+         mFlags(flags)
+      {
+      }
+
+      // Ctor with key, name and flags
+      AttributeDescriptor(const std::string& key,
+                         const std::string& name,
+                         unsigned int flags = 0);
+      // Ctor with dicom group, elem and flags
+      // The key is built as 'Dgroup_elem'
+      // The user name is retreived from dicom dictionnary
+      AttributeDescriptor(unsigned short group,
+                         unsigned short element,
                          unsigned int flags = 0);
+      /// Returns the key of the attribute
+      const std::string& GetKey() const { return mKey; }
       /// Returns the name of the attribute
       const std::string& GetName() const { return mName; }
       /// Returns the DICOM group code of the attribute
@@ -45,6 +59,14 @@ namespace creaImageIO
       /// Returns the flags of the attribute
       unsigned int GetFlags() const { return mFlags; }
     
+      /// Extracts group and element from a key of the form "Dgroup_elem" 
+      static void GetDicomGroupElementFromKey(const std::string& key,
+                                             unsigned short& group,
+                                             unsigned short& elem);
+      /// Cleans the name:
+      /// Replace simple quote by double quotes
+      /// Cut string at NULL chars 
+      void CleanName(std::string& str) const;
     private:
       std::string mKey;
       std::string mName;