1 #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
2 #define __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
12 //=====================================================================
13 /// Descriptor of an attribute of a node of a tree (name, dicom group/element)
14 class AttributeDescriptor
18 /// The attribute is hidden (not visible to user)
19 static const unsigned int PRIVATE;
20 /// The attribute enters in unique identifier constitution (KEY)
21 static const unsigned int KEY;
22 /// The attribute enters in label constitution (for printing)
23 static const unsigned int LABEL;
27 : mKey(""), mName(""), mGroup(0), mElement(0), mFlags(0)
30 /// Ctor with all explicitely
31 AttributeDescriptor(const std::string& key,
32 const std::string& name,
34 unsigned short element,
36 : mKey(key), mName(name), mGroup(group), mElement(element),
41 // Ctor with key, name and flags
42 AttributeDescriptor(const std::string& key,
43 const std::string& name,
44 unsigned int flags = 0);
45 // Ctor with dicom group, elem and flags
46 // The key is built as 'Dgroup_elem'
47 // The user name is retreived from dicom dictionnary
48 AttributeDescriptor(unsigned short group,
49 unsigned short element,
50 unsigned int flags = 0);
51 /// Returns the key of the attribute
52 const std::string& GetKey() const { return mKey; }
53 /// Returns the name of the attribute
54 const std::string& GetName() const { return mName; }
55 /// Returns the DICOM group code of the attribute
56 unsigned short GetGroup() const { return mGroup; }
57 /// Returns the DICOM element code of the attribute
58 unsigned short GetElement() const { return mElement; }
59 /// Returns the flags of the attribute
60 unsigned int GetFlags() const { return mFlags; }
62 /// Extracts group and element from a key of the form "Dgroup_elem"
63 static void GetDicomGroupElementFromKey(const std::string& key,
64 unsigned short& group,
65 unsigned short& elem);
67 /// Replace simple quote by double quotes
68 /// Cut string at NULL chars
69 void CleanName(std::string& str) const;
73 unsigned short mGroup;
74 unsigned short mElement;
77 // EO class AttributeDescriptor
78 //=====================================================================
82 } // EO namespace tree
84 } // EO namespace creaImageIO
88 //=====================================================================
89 inline std::ostream& operator<<(std::ostream& s,
90 const creaImageIO::tree::AttributeDescriptor& d)
92 s << "[" << d.key << ":" << d.name << "]";
95 //=====================================================================
99 #endif // #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__