]> Creatis software - gdcm.git/blob - src/gdcmDictEntry.h
* src/*.[h|cxx] : coding style
[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  * the gdcmDictEntry in an element contained by the gdcmDict.
11  * It contains :
12  *  - the key referenced by the DICOM norm or the constructor (for private keys)
13  *  - the corresponding name in english (it's equivalent to a label)
14  *  - the owner group
15  *  - etc.
16  */
17 class GDCM_EXPORT gdcmDictEntry {
18 public:
19    gdcmDictEntry(guint16 group, 
20                  guint16 element,
21                  std::string vr     = "Unknown",
22                  std::string fourth = "Unknown",
23                  std::string name   = "Unknown");
24         
25    static TagKey TranslateToKey(guint16 group, guint16 element);
26    void SetVR(std::string);
27
28    /**
29     * \ingroup     gdcmDictEntry
30     * \brief       tells if the V(alue) R(epresentation) is known (?!)
31     *              
32     * @return 
33     */
34    inline bool gdcmDictEntry::IsVRUnknown() {
35            if ( vr == "Unknown" )
36                    return true;
37            return false;
38    }
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 gdcmDictEntry::GetGroup(void)  {
46     return group; 
47    }
48   
49    /**
50     * \ingroup gdcmDictEntry
51     * \brief   returns the Dicom Element Number of the current gdcmDictEntry
52     * return the Dicom Element Number
53     */
54    inline guint16 gdcmDictEntry::GetElement(void)  {
55     return element; 
56    }
57  
58    /**
59     * \ingroup gdcmDictEntry
60     * \brief   returns the Dicom Value Representation of the current gdcmDictEntry
61     * return the Dicom Value Representation
62     */
63    inline std::string gdcmDictEntry::GetVR(void)  {
64     return vr; 
65    }
66  
67    /**
68     * \ingroup gdcmDictEntry
69     * \brief   sets the key of the current gdcmDictEntry
70     * @param k New key to be set.
71     */
72    inline void gdcmDictEntry::SetKey(std::string k)  {
73     key = k; 
74    }
75  
76    /**
77     * \ingroup gdcmDictEntry
78     * \brief   returns the Fourth field of the current gdcmDictEntry
79     * \warning NOT part of the Dicom Standard
80     * \        May be REMOVED an any time
81     * \        NEVER use it
82     * return the Fourth field
83     */
84    inline std::string gdcmDictEntry::GetFourth(void)  {
85     return fourth; 
86    } 
87
88    /**
89     * \ingroup gdcmDictEntry
90     * \brief   returns the Dicom Name of the current gdcmDictEntry
91     * \        e.g. "Patient Name" for Dicom Tag (0x0010, 0x0010) 
92     * return the Dicom Name
93     */
94    inline std::string gdcmDictEntry::GetName(void)  {
95     return name; 
96    } 
97  
98    /**
99     * \ingroup gdcmDictEntry
100     * \brief   Gets the key of the current gdcmDictEntry
101     * @return the key .
102     */
103    inline std::string gdcmDictEntry::GetKey(void)  {
104     return key; 
105    }
106
107 private:
108    // FIXME : were are the group and element used except from building up
109    //         a TagKey. If the answer is nowhere then there is no need
110    //         to store the group and element independently.
111    guint16 group;       // e.g. 0x0010
112    guint16 element;     // e.g. 0x0103
113    std::string  vr;     // Value Representation i.e. some clue about the nature
114                         // of the data represented e.g. "FD" short for
115                         // "Floating Point Double"
116         // CLEANME: find the official dicom name for this field !
117    std::string  fourth; // Fourth field containing some semantics.
118                         //(Group Name abbr.)
119    std::string  name;   // e.g. "Patient_Name"
120    TagKey  key;         // Redundant with (group, element) but we add it
121                         // on efficiency purposes.
122
123         // DCMTK has many fields for handling a DictEntry (see below). What are the
124         // relevant ones for gdcmlib ?
125         //      struct DBI_SimpleEntry {
126         //         Uint16 upperGroup;
127         //         Uint16 upperElement;
128         //         DcmEVR evr;
129         //         const char* tagName;
130         //         int vmMin;
131         //         int vmMax;
132         //         const char* standardVersion;
133         //         DcmDictRangeRestriction groupRestriction;
134         //         DcmDictRangeRestriction elementRestriction;
135         //       };
136 };
137
138 //-----------------------------------------------------------------------------
139 #endif