]> Creatis software - gdcm.git/blob - src/gdcmDictEntry.h
Fix mistypings
[gdcm.git] / src / gdcmDictEntry.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDictEntry.h,v $
5   Language:  C++
6   Date:      $Date: 2007/09/17 12:16:02 $
7   Version:   $Revision: 1.47 $
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 "gdcmRefCounter.h"
23 #include "gdcmTagKey.h"
24 #include "gdcmVRKey.h"
25
26 namespace GDCM_NAME_SPACE 
27 {
28 //-----------------------------------------------------------------------------
29 class VRKey;
30 class TagKey;
31 /**
32  * \brief
33  * the DictEntry in an element contained by the Dict.
34  * It contains :
35  *  - the key referenced by the DICOM norm or the constructor (for private keys)
36  *    i.e. the Group number
37  *         the Element number
38  *  - the VR (Value Representation)
39  *  - the VM (Value Multiplicity)
40  *  - the corresponding name in english
41  */
42 class GDCM_EXPORT DictEntry : public RefCounter
43 {
44    gdcmTypeMacro(DictEntry);
45
46 public:
47    static DictEntry *New(uint16_t group, uint16_t elem,
48              VRKey const &vr       = GDCM_VRUNKNOWN,
49              TagName const &vm     = GDCM_UNKNOWN,
50              TagName const &name   = GDCM_UNKNOWN);
51
52 // Print
53    void Print(std::ostream &os = std::cout, std::string const &indent = "");
54
55    /// \brief  Returns the Dicom Group Number
56    /// @return the Dicom Group Number
57    const uint16_t &GetGroup() const { return Tag[0]; }
58
59    /// \brief  Returns the Dicom Element Number
60    /// @return the Dicom Element Number
61    const uint16_t &GetElement() const { return Tag[1]; }   
62
63    /// \brief  Set the Dicom Value Representation 
64    /// \param vr the Dicom Value Representation
65    virtual void SetVR(VRKey const &vr) { VR = vr; }
66    /// \brief  Returns the Dicom Value Representation 
67    /// @return the Dicom Value Representation
68    const VRKey &GetVR() const { return VR; }
69    /// \brief tells if the V(alue) R(epresentation) is known (?!)
70    /// @return 
71    bool IsVRUnknown() const { return VR == GDCM_VRUNKNOWN; }
72
73    const TagKey &GetKey() const { return Tag; }
74
75 // Key creation
76    static TagKey TranslateToKey(uint16_t group, uint16_t elem);
77
78    /// \brief   returns the VM field of the current DictEntry
79    /// @return  The 'Value Multiplicity' field
80    const TagName &GetVM() const { return VM; } 
81    /// \brief  Set the VM field of the current DictEntry
82    /// \param vm the'Value Multiplicity'
83    virtual void SetVM(TagName const &vm) { VM = vm; }
84    /// \brief tells if the V(alue) M(ultiplicity) is known (?!)
85    /// @return 
86    bool IsVMUnknown() const { return VM == GDCM_UNKNOWN; }
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 protected:
94    DictEntry(uint16_t group, uint16_t elem,
95              VRKey const &vr       = GDCM_VRUNKNOWN,
96              TagName const &vm     = GDCM_UNKNOWN,
97              TagName const &name   = GDCM_UNKNOWN);
98
99    ~DictEntry();
100    
101 private:
102    /// Dicom  TagKey. Contains Dicom Group number and Dicom Element number
103    TagKey Tag;
104
105    /// \brief Value Representation i.e. some clue about the nature
106    ///        of the data represented e.g. 
107    ///        - "FD" short for "Floating Point Double"(see VR)
108    ///        - "PN" short for "Person Name"       
109    VRKey VR;
110    
111    /// \brief Value Multiplicity (e.g. "1", "1-n", "2-n", "6")
112    TagName VM; 
113
114    /// \brief English name of the entry (e.g. "Patient's Name")                   
115    TagName Name;      
116 };
117 } // end namespace gdcm
118 //-----------------------------------------------------------------------------
119 #endif