]> Creatis software - gdcm.git/blob - src/gdcmDictEntry.h
* src/gdcmUtil.[cxx|h] split in two. Additional file gdcmGlobal.[cxx|h]
[gdcm.git] / src / gdcmDictEntry.h
1 // gdcmDictEntry.h
2 //-----------------------------------------------------------------------------
3 #ifndef GDCMDICTENTRY_H
4 #define GDCMDICTENTRY_H
5
6 #include "gdcmCommon.h"
7
8 //-----------------------------------------------------------------------------
9 /*
10  * \defgroup gdcmDictEntry
11  * \brief
12  * the gdcmDictEntry in an element contained by the gdcmDict.
13  * It contains :
14  *  - the key referenced by the DICOM norm or the constructor (for private keys)
15  *  - the corresponding name in english (it's equivalent to a label)
16  *  - the owner group
17  *  - etc.
18  */
19 class GDCM_EXPORT gdcmDictEntry 
20 {
21 public:
22    gdcmDictEntry(guint16 group, 
23                  guint16 element,
24                  std::string vr     = "Unknown",
25                  std::string fourth = "Unknown",
26                  std::string name   = "Unknown");
27         
28    static TagKey TranslateToKey(guint16 group, guint16 element);
29
30    void SetVR(std::string);
31
32    /**
33     * \ingroup     gdcmDictEntry
34     * \brief       tells if the V(alue) R(epresentation) is known (?!)
35     *              
36     * @return 
37     */
38    inline bool IsVRUnknown() {return vr == "??"; }
39
40    /**
41     * \ingroup gdcmDictEntry
42     * \brief   returns the Dicom Group Number of the current gdcmDictEntry
43     * return the Dicom Group Number
44     */
45    inline guint16 GetGroup(void) { return group; }
46   
47    /**
48     * \ingroup gdcmDictEntry
49     * \brief   returns the Dicom Element Number of the current gdcmDictEntry
50     * return the Dicom Element Number
51     */
52    inline guint16 GetElement(void) { return element; }
53  
54    /**
55     * \ingroup gdcmDictEntry
56     * \brief   returns the Dicom Value Representation of the current gdcmDictEntry
57     * return the Dicom Value Representation
58     */
59    inline std::string GetVR(void) { return vr; }
60  
61    /**
62     * \ingroup gdcmDictEntry
63     * \brief   sets the key of the current gdcmDictEntry
64     * @param k New key to be set.
65     */
66    inline void SetKey(std::string k)  { key = k; }
67  
68    /**
69     * \ingroup gdcmDictEntry
70     * \brief   returns the Fourth field of the current gdcmDictEntry
71     * \warning NOT part of the Dicom Standard
72     * \        May be REMOVED an any time
73     * \        NEVER use it
74     * return the Fourth field
75     */
76    inline std::string GetFourth(void) { return fourth; } 
77
78    /**
79     * \ingroup gdcmDictEntry
80     * \brief   returns the Dicom Name of the current gdcmDictEntry
81     * \        e.g. "Patient Name" for Dicom Tag (0x0010, 0x0010) 
82     * return the Dicom Name
83     */
84    inline std::string GetName(void) { return name; } 
85  
86    /**
87     * \ingroup gdcmDictEntry
88     * \brief   Gets the key of the current gdcmDictEntry
89     * @return the key .
90     */
91    inline std::string GetKey(void) { return key; }
92
93 private:
94    // FIXME : where are the group and element used except from building up
95    //         a TagKey. If the answer is nowhere then there is no need
96    //         to store the group and element independently.
97    //
98    //         --> EVERYWHERE ! The alternate question would be :
99    //                          What's TagKey used for ?
100    
101    /// DicomGroup number
102    guint16 group;   // e.g. 0x0010
103    /// DicomElement number
104    guint16 element; // e.g. 0x0103
105    /**
106     * \ingroup gdcmDictEntry
107     * \brief   Value Representation i.e. some clue about the nature
108     *          of the data represented 
109     *          e.g. "FD" short for "Floating Point Double"
110     */ 
111    std::string vr;
112                                                 
113    /**
114     * \brief AVOID using the following fourth field at all costs.
115     * 
116     *  They are at leat two good reasons for NOT using fourth:
117     *  - the main reason is that it is NOT part of the 'official'
118     *    Dicom Dictionnary.
119     *  - a second reason is that it is not defined for all the groups.
120     *  .
121     *  Still it provides some semantics as group name abbreviation that
122     *  can prove of some help when organizing things in an interface.
123     *  For the time being we keep it in gdcm but it migth be removed in
124     *  future releases it proves to be source of confusion.
125     *  Here is a small dictionary we encountered in "nature":
126     *  - CMD      Command        
127     *  - META     Meta Information 
128     *  - DIR      Directory
129     *  - ID       ???
130     *  - PAT      Patient
131     *  - ACQ      Acquisition
132     *  - REL      Related
133     *  - IMG      Image
134     *  - SDY      Study
135     *  - VIS      Visit 
136     *  - WAV      Waveform
137     *  - PRC      ???
138     *  - DEV      Device
139     *  - NMI      Nuclear Medicine
140     *  - MED      ???
141     *  - BFS      Basic Film Session
142     *  - BFB      Basic Film Box
143     *  - BIB      Basic Image Box
144     *  - BAB
145     *  - IOB
146     *  - PJ
147     *  - PRINTER
148     *  - RT       Radio Therapy
149     *  - DVH   
150     *  - SSET
151     *  - RES      Results
152     *  - CRV      Curve
153     *  - OLY      Overlays
154     *  - PXL      Pixels
155     *  - DL       Delimiters
156     *  .
157     *
158     *  Other usefull abreviations used for Radiographic view associated with
159     *  Patient Position (0018,5100):
160     *  -  AP = Anterior/Posterior 
161     *  -  PA = Posterior/Anterior 
162     *  -  LL = Left Lateral 
163     *  -  RL = Right Lateral 
164     *  - RLD = Right Lateral Decubitus 
165     *  - LLD = Left  Lateral Decubitus 
166     *  - RLO = Right Lateral Oblique 
167     *  - LLO = Left  Lateral Oblique  
168     *  .
169     */
170    std::string fourth; 
171
172    /// e.g. "Patient's Name"                    
173    std::string name;      
174
175    /// Redundant with (group, element) but we add it on efficiency purposes. 
176    TagKey  key;
177                      
178         // DCMTK has many fields for handling a DictEntry (see below). What are the
179         // relevant ones for gdcmlib ?
180         //      struct DBI_SimpleEntry {
181         //         Uint16 upperGroup;
182         //         Uint16 upperElement;
183         //         DcmEVR evr;
184         //         const char* tagName;
185         //         int vmMin;
186         //         int vmMax;
187         //         const char* standardVersion;
188         //         DcmDictRangeRestriction groupRestriction;
189         //         DcmDictRangeRestriction elementRestriction;
190         //       };
191 };
192
193 //-----------------------------------------------------------------------------
194 #endif