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