]> Creatis software - gdcm.git/blob - src/gdcmDictEntry.h
* src/gdcmDictSet.h : set the default output to the os variable
[gdcm.git] / src / gdcmDictEntry.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDictEntry.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/13 16:35:37 $
7   Version:   $Revision: 1.29 $
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  * \ingroup 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  *    i.e. the Group number
35  *         the Element number
36  *  - the VR (Value Representation)
37  *  - the VM (Value Multplicity)
38  *  - the corresponding name in english
39  */
40 class GDCM_EXPORT DictEntry : public Base
41 {
42 public:
43    DictEntry(uint16_t group, 
44              uint16_t element,
45              TagName const &vr     = GDCM_UNKNOWN,
46              TagName const &vm     = GDCM_UNKNOWN,
47              TagName const &name   = GDCM_UNKNOWN);
48
49 // Print
50    void Print(std::ostream &os = std::cout);
51
52 // Key creation
53    static TagKey TranslateToKey(uint16_t group, uint16_t element);
54
55 // Content of DictEntry
56    void SetVR(TagName const &vr);
57    void SetVM(TagName const &vm);
58
59    /// \brief tells if the V(alue) R(epresentation) is known (?!)
60    /// @return 
61    bool IsVRUnknown() { return VR == GDCM_UNKNOWN; }
62
63    /// \brief tells if the V(alue) M(ultiplicity) is known (?!)
64    /// @return 
65    bool IsVMUnknown() { return VM == GDCM_UNKNOWN; }
66
67    /// \brief  Returns the Dicom Group Number of the current DictEntry
68    /// @return the Dicom Group Number
69    uint16_t GetGroup() { return Group; }
70   
71    /// \brief  Returns the Dicom Element Number of the current DictEntry
72    /// @return the Dicom Element Number
73    uint16_t GetElement() { return Element; }
74  
75    /// \brief  Returns the Dicom Value Representation of the current
76    ///         DictEntry
77    /// @return the Dicom Value Representation
78    const TagName &GetVR() const { return VR; }
79  
80    /// \brief   sets the key of the current DictEntry
81    /// @param k New key to be set.
82    void SetKey(TagName const &k)  { Key = k; }
83  
84    /// \brief   returns the VM field of the current DictEntry
85    /// @return  The 'Value Multiplicity' field
86    const TagName &GetVM() const { return VM; } 
87
88    /// \brief  Returns the Dicom Name of the current DictEntry
89    ///         e.g. "Patient Name" for Dicom Tag (0x0010, 0x0010) 
90    /// @return the Dicom Name
91    const TagName &GetName() const { return Name; } 
92  
93    /// \brief  Gets the key of the current DictEntry
94    /// @return the key.
95    const TagName &GetKey() const { return Key; }
96
97 private:
98    /// \todo FIXME 
99    ///        where are the group and element used except from building up
100    ///        a TagKey. If the answer is nowhere then there is no need
101    ///        to store the group and element independently.
102    ///
103    ///        --> EVERYWHERE ! The alternate question would be :
104    ///                         What's TagKey used for ?
105    
106    /// DicomGroup number
107    uint16_t Group;   // e.g. 0x0010
108
109    /// DicomElement number
110    uint16_t Element; // e.g. 0x0103
111
112    /// \brief Value Representation i.e. some clue about the nature
113    ///        of the data represented e.g. "FD" short for
114    ///        "Floating Point Double" (see \ref VR)
115    TagName VR;
116
117    /*
118     *  .
119     *  Formerly 'Group name abbreviations'
120     *  Here is a small dictionary we encountered in "nature":
121     *  - CMD      Command        
122     *  - META     Meta Information 
123     *  - DIR      Directory
124     *  - ID       ???
125     *  - PAT      Patient
126     *  - ACQ      Acquisition
127     *  - REL      Related
128     *  - IMG      Image
129     *  - SDY      Study
130     *  - VIS      Visit 
131     *  - WAV      Waveform
132     *  - PRC      ???
133     *  - DEV      Device
134     *  - NMI      Nuclear Medicine
135     *  - MED      ???
136     *  - BFS      Basic Film Session
137     *  - BFB      Basic Film Box
138     *  - BIB      Basic Image Box
139     *  - BAB
140     *  - IOB
141     *  - PJ
142     *  - PRINTER
143     *  - RT       Radio Therapy
144     *  - DVH   
145     *  - SSET
146     *  - RES      Results
147     *  - CRV      Curve
148     *  - OLY      Overlays
149     *  - PXL      Pixels
150     *  - DL       Delimiters
151     *  .
152     *
153     *  Other usefull abreviations used for Radiographic view associated with
154     *  Patient Position (0018,5100):
155     *  -  AP = Anterior/Posterior 
156     *  -  PA = Posterior/Anterior 
157     *  -  LL = Left Lateral 
158     *  -  RL = Right Lateral 
159     *  - RLD = Right Lateral Decubitus 
160     *  - LLD = Left  Lateral Decubitus 
161     *  - RLO = Right Lateral Oblique 
162     *  - LLO = Left  Lateral Oblique  
163     *  .
164     */
165   /// \brief Value Multiplicity (e.g. "1", "1-n", "6")
166    TagName VM; 
167
168    /// e.g. "Patient's Name"                    
169    TagName Name;      
170
171    /// Redundant with (group, element) but we add it for efficiency purpose.
172    TagKey  Key;
173 };
174 } // end namespace gdcm
175 //-----------------------------------------------------------------------------
176 #endif