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