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 HIDDEN;
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 key, name and flags
31 AttributeDescriptor(const std::string& key,
32 const std::string& name,
33 unsigned int flags = 0);
34 // Ctor with dicom group, elem and flags
35 // The key is built as 'Dgroup_elem'
36 // The user name is retreived from dicom dictionnary
37 AttributeDescriptor(unsigned short group,
38 unsigned short element,
39 unsigned int flags = 0);
40 /// Returns the key of the attribute
41 const std::string& GetKey() const { return mKey; }
42 /// Returns the name of the attribute
43 const std::string& GetName() const { return mName; }
44 /// Returns the DICOM group code of the attribute
45 unsigned short GetGroup() const { return mGroup; }
46 /// Returns the DICOM element code of the attribute
47 unsigned short GetElement() const { return mElement; }
48 /// Returns the flags of the attribute
49 unsigned int GetFlags() const { return mFlags; }
51 /// Extracts group and element from a key of the form "Dgroup_elem"
52 static void GetDicomGroupElementFromKey(const std::string& key,
53 unsigned short& group,
54 unsigned short& elem);
56 /// Replace simple quote by double quotes
57 /// Cut string at NULL chars
58 void CleanName(std::string& str) const;
62 unsigned short mGroup;
63 unsigned short mElement;
66 // EO class AttributeDescriptor
67 //=====================================================================
71 } // EO namespace tree
73 } // EO namespace creaImageIO
77 //=====================================================================
78 inline std::ostream& operator<<(std::ostream& s,
79 const creaImageIO::tree::AttributeDescriptor& d)
81 s << "[" << d.key << ":" << d.name << "]";
84 //=====================================================================
88 #endif // #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__