]> Creatis software - gdcm.git/blob - src/gdcmDictEntry.h
* src/gdcmCommon.h : add the GDCM_UNKNOWN constant. This constant is to
[gdcm.git] / src / gdcmDictEntry.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDictEntry.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/05 15:38:28 $
7   Version:   $Revision: 1.22 $
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.html 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 "gdcmBase.h"
23
24 namespace gdcm 
25 {
26
27 //-----------------------------------------------------------------------------
28 /*
29  * \defgroup DictEntry
30  * \brief
31  * the DictEntry in an element contained by the Dict.
32  * It contains :
33  *  - the key referenced by the DICOM norm or the constructor (for private keys)
34  *  - the corresponding name in english (it's equivalent to a label)
35  *  - the owner group
36  *  - etc.
37  */
38 class GDCM_EXPORT DictEntry : public Base
39 {
40 public:
41    DictEntry(uint16_t group, 
42              uint16_t element,
43              TagName const & vr     = GDCM_UNKNOWN,
44              TagName const & fourth = GDCM_UNKNOWN,
45              TagName const & name   = GDCM_UNKNOWN);
46
47    static TagKey TranslateToKey(uint16_t group, uint16_t element);
48
49    void SetVR(TagName const & vr);
50
51    /// \brief tells if the V(alue) R(epresentation) is known (?!)
52    /// @return 
53    bool IsVRUnknown() { return VR == "??"; }
54
55    /// \brief  Returns the Dicom Group Number of the current DictEntry
56    /// @return the Dicom Group Number
57    uint16_t GetGroup() { return Group; }
58   
59    /// \brief  Returns the Dicom Element Number of the current DictEntry
60    /// @return the Dicom Element Number
61    uint16_t GetElement() { return Element; }
62  
63    /// \brief  Returns the Dicom Value Representation of the current
64    ///         DictEntry
65    /// @return the Dicom Value Representation
66    const TagName & GetVR() const { return VR; }
67  
68    /// \brief   sets the key of the current DictEntry
69    /// @param k New key to be set.
70    void SetKey(TagName const & k)  { Key = k; }
71  
72    /// \brief   returns the Fourth field of the current DictEntry
73    /// \warning NOT part of the Dicom Standard.
74    ///          May be REMOVED an any time. NEVER use it.
75    /// @return  The Fourth field
76    const TagName & GetFourth() const { return Fourth; } 
77
78    /// \brief  Returns the Dicom Name of the current DictEntry
79    ///         e.g. "Patient Name" for Dicom Tag (0x0010, 0x0010) 
80    /// @return the Dicom Name
81    const TagName & GetName() const { return Name; } 
82  
83    /// \brief  Gets the key of the current DictEntry
84    /// @return the key.
85    const TagName & GetKey() const { return Key; }
86
87 private:
88    /// \todo FIXME 
89    ///        where are the group and element used except from building up
90    ///        a TagKey. If the answer is nowhere then there is no need
91    ///        to store the group and element independently.
92    ///
93    ///        --> EVERYWHERE ! The alternate question would be :
94    ///                         What's TagKey used for ?
95    
96    /// DicomGroup number
97    uint16_t Group;   // e.g. 0x0010
98
99    /// DicomElement number
100    uint16_t Element; // e.g. 0x0103
101
102    /// \brief Value Representation i.e. some clue about the nature
103    ///        of the data represented e.g. "FD" short for
104    ///        "Floating Point Double" (see \ref VR)
105    TagName VR;
106
107    /**
108     * \brief AVOID using the following fourth field at all costs.
109     * 
110     *  They are at least two good reasons for NOT using fourth:
111     *  - the main reason is that it is NOT part of the 'official'
112     *    Dicom Dictionnary.
113     *  - a second reason is that it is not defined for all the groups.
114     *  .
115     *  Still it provides some semantics as group name abbreviation that
116     *  can prove of some help when organizing things in an interface.
117     *  For the time being we keep it in gdcm but it migth be removed in
118     *  future releases it proves to be source of confusion.
119     *  Here is a small dictionary we encountered in "nature":
120     *  - CMD      Command        
121     *  - META     Meta Information 
122     *  - DIR      Directory
123     *  - ID       ???
124     *  - PAT      Patient
125     *  - ACQ      Acquisition
126     *  - REL      Related
127     *  - IMG      Image
128     *  - SDY      Study
129     *  - VIS      Visit 
130     *  - WAV      Waveform
131     *  - PRC      ???
132     *  - DEV      Device
133     *  - NMI      Nuclear Medicine
134     *  - MED      ???
135     *  - BFS      Basic Film Session
136     *  - BFB      Basic Film Box
137     *  - BIB      Basic Image Box
138     *  - BAB
139     *  - IOB
140     *  - PJ
141     *  - PRINTER
142     *  - RT       Radio Therapy
143     *  - DVH   
144     *  - SSET
145     *  - RES      Results
146     *  - CRV      Curve
147     *  - OLY      Overlays
148     *  - PXL      Pixels
149     *  - DL       Delimiters
150     *  .
151     *
152     *  Other usefull abreviations used for Radiographic view associated with
153     *  Patient Position (0018,5100):
154     *  -  AP = Anterior/Posterior 
155     *  -  PA = Posterior/Anterior 
156     *  -  LL = Left Lateral 
157     *  -  RL = Right Lateral 
158     *  - RLD = Right Lateral Decubitus 
159     *  - LLD = Left  Lateral Decubitus 
160     *  - RLO = Right Lateral Oblique 
161     *  - LLO = Left  Lateral Oblique  
162     *  .
163     */
164    TagName Fourth; 
165
166    /// e.g. "Patient's Name"                    
167    TagName Name;      
168
169    /// Redundant with (group, element) but we add it for efficiency purpose.
170    TagKey  Key;
171 };
172 } // end namespace gdcm
173 //-----------------------------------------------------------------------------
174 #endif