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__
31 #include <creaImageIOSystem.h>
43 //=====================================================================
44 /// Descriptor of an attribute of a node of a Tree (name, dicom group/element)
45 class AttributeDescriptor
49 /// The attribute is hidden (not visible to user)
50 static const unsigned int PRIVATE;
51 /// The attribute enters in unique identifier constitution
52 static const unsigned int IDENTIFIER;
53 /// The attribute enters in label constitution (for printing)
54 static const unsigned int LABEL;
55 /// The attribute can be edited
56 static const unsigned int EDITABLE;
59 /// The attribute is of numeric type
60 static const int NUMBER=1;
61 /// The attribute is of string type
62 static const int STRING=2;
63 /// The attribute's type is unknown
64 static const int UNKNOWN=0;
68 : mKey(""), mName(""), mGroup(0), mElement(0), mFlags(0)
71 /// Ctor with all explicitely
72 AttributeDescriptor(const std::string& key,
73 const std::string& name,
75 unsigned short element,
77 : mKey(key), mName(name), mGroup(group), mElement(element),
82 // Ctor with key, name and flags
83 AttributeDescriptor(const std::string& key,
84 const std::string& name,
85 unsigned int flags = 0);
86 // Ctor with dicom group, elem and flags
87 // The key is built as 'Dgroup_elem'
88 // The user name is retreived from dicom dictionnary
89 AttributeDescriptor(unsigned short group,
90 unsigned short element,
91 unsigned int flags = 0);
92 /// Returns the key of the attribute
93 const std::string& GetKey() const { return mKey; }
94 /// Returns the name of the attribute
95 const std::string& GetName() const { return mName; }
96 /// Returns the DICOM group code of the attribute
97 unsigned short GetGroup() const { return mGroup; }
98 /// Returns the DICOM element code of the attribute
99 unsigned short GetElement() const { return mElement; }
100 /// Returns the flags of the attribute
101 unsigned int GetFlags() const { return mFlags; }
103 /// Extracts group and element from a key of the form "Dgroup_elem"
104 static void GetDicomGroupElementFromKey(const std::string& key,
105 unsigned short& group,
106 unsigned short& elem);
108 /// Replace simple quote by double quotes
109 /// Cut string at NULL chars
110 void CleanName(std::string& str) const;
111 ///Decodes the type of attribute into the existing ones
112 void DecodeType(unsigned int& type) const;
114 /// Determines if Attribute is a date
115 bool isDateEntry() const;
117 /// Determines if Attribute is a time
118 bool isTimeEntry() const;
123 unsigned short mGroup;
124 unsigned short mElement;
127 // EO class AttributeDescriptor
128 //=====================================================================
132 } // EO namespace tree
134 } // EO namespace creaImageIO
140 #endif // #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__