2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
28 #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
29 #define __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
42 //=====================================================================
43 /// Descriptor of an attribute of a node of a Tree (name, dicom group/element)
44 class AttributeDescriptor
48 /// The attribute is hidden (not visible to user)
49 static const unsigned int PRIVATE;
50 /// The attribute enters in unique identifier constitution
51 static const unsigned int IDENTIFIER;
52 /// The attribute enters in label constitution (for printing)
53 static const unsigned int LABEL;
54 /// The attribute can be edited
55 static const unsigned int EDITABLE;
58 /// The attribute is of numeric type
59 static const int NUMBER=1;
60 /// The attribute is of string type
61 static const int STRING=2;
62 /// The attribute's type is unknown
63 static const int UNKNOWN=0;
67 : mKey(""), mName(""), mGroup(0), mElement(0), mFlags(0)
70 /// Ctor with all explicitely
71 AttributeDescriptor(const std::string& key,
72 const std::string& name,
74 unsigned short element,
76 : mKey(key), mName(name), mGroup(group), mElement(element),
81 // Ctor with key, name and flags
82 AttributeDescriptor(const std::string& key,
83 const std::string& name,
84 unsigned int flags = 0);
85 // Ctor with dicom group, elem and flags
86 // The key is built as 'Dgroup_elem'
87 // The user name is retreived from dicom dictionnary
88 AttributeDescriptor(unsigned short group,
89 unsigned short element,
90 unsigned int flags = 0);
91 /// Returns the key of the attribute
92 const std::string& GetKey() const { return mKey; }
93 /// Returns the name of the attribute
94 const std::string& GetName() const { return mName; }
95 /// Returns the DICOM group code of the attribute
96 unsigned short GetGroup() const { return mGroup; }
97 /// Returns the DICOM element code of the attribute
98 unsigned short GetElement() const { return mElement; }
99 /// Returns the flags of the attribute
100 unsigned int GetFlags() const { return mFlags; }
102 /// Extracts group and element from a key of the form "Dgroup_elem"
103 static void GetDicomGroupElementFromKey(const std::string& key,
104 unsigned short& group,
105 unsigned short& elem);
107 /// Replace simple quote by double quotes
108 /// Cut string at NULL chars
109 void CleanName(std::string& str) const;
110 ///Decodes the type of attribute into the existing ones
111 void DecodeType(unsigned int& type) const;
113 /// Determines if Attribute is a date
114 bool isDateEntry() const;
116 /// Determines if Attribute is a time
117 bool isTimeEntry() const;
122 unsigned short mGroup;
123 unsigned short mElement;
126 // EO class AttributeDescriptor
127 //=====================================================================
131 } // EO namespace tree
133 } // EO namespace creaImageIO
139 #endif // #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__