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