creaImageIO_lib
creaImageIOTreeAttributeDescriptor.h
Go to the documentation of this file.
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # pour la Santé)
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
9 #
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.
16 #
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
21 # liability.
22 #
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 # ------------------------------------------------------------------------
26 */
27 
28 #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
29 #define __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
30 
31 #include <creaImageIOSystem.h>
32 #include <string>
33 //#include <iostream>
34 
35 namespace creaImageIO
36 {
37 
38  namespace tree
39  {
43  //=====================================================================
46  {
47  public:
50  static const unsigned int PRIVATE;
52  static const unsigned int IDENTIFIER;
54  static const unsigned int LABEL;
56  static const unsigned int EDITABLE;
57 
60  static const int NUMBER=1;
62  static const int STRING=2;
64  static const int UNKNOWN=0;
65 
68  : mKey(""), mName(""), mGroup(0), mElement(0), mFlags(0)
69  {
70  }
72  AttributeDescriptor(const std::string& key,
73  const std::string& name,
74  unsigned short group,
75  unsigned short element,
76  unsigned int flags)
77  : mKey(key), mName(name), mGroup(group), mElement(element),
78  mFlags(flags)
79  {
80  }
81 
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);
93  const std::string& GetKey() const { return mKey; }
95  const std::string& GetName() const { return mName; }
97  unsigned short GetGroup() const { return mGroup; }
99  unsigned short GetElement() const { return mElement; }
101  unsigned int GetFlags() const { return mFlags; }
102 
104  static void GetDicomGroupElementFromKey(const std::string& key,
105  unsigned short& group,
106  unsigned short& elem);
110  void CleanName(std::string& str) const;
112  void DecodeType(unsigned int& type) const;
113 
115  bool isDateEntry() const;
116 
118  bool isTimeEntry() const;
119 
120  private:
121  std::string mKey;
122  std::string mName;
123  unsigned short mGroup;
124  unsigned short mElement;
125  unsigned int mFlags;
126  };
127  // EO class AttributeDescriptor
128  //=====================================================================
129 
130 
131 
132  } // EO namespace tree
133 
134 } // EO namespace creaImageIO
135 
136 
137 
138 
139 
140 #endif // #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__