]> Creatis software - gdcm.git/blob - src/gdcmDicomEntry.h
* Fix compilation error for the Python part
[gdcm.git] / src / gdcmDicomEntry.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDicomEntry.h,v $
5   Language:  C++
6   Date:      $Date: 2005/10/21 11:50:04 $
7   Version:   $Revision: 1.4 $
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 GDCMDICOMENTRY_H
20 #define GDCMDICOMENTRY_H
21
22 #include "gdcmCommon.h"
23 #include "gdcmRefCounter.h"
24 #include "gdcmVRKey.h"
25 #include "gdcmTagKey.h"
26
27 namespace gdcm 
28 {
29 //-----------------------------------------------------------------------------
30 /**
31  * \brief
32  * the DicomEntry in an element contained by the Dict.
33  * It contains :
34  *  - the key referenced by the DICOM norm or the constructor (for private keys)
35  *    i.e. the Group number
36  *         the Element number
37  *  - the VR (Value Representation)
38  *  - the VM (Value Multplicity)
39  *  - the corresponding name in english
40  */
41 class GDCM_EXPORT DicomEntry : public RefCounter
42 {
43    gdcmTypeMacro(DicomEntry)
44
45 public:
46 // Print
47    void Print(std::ostream &os = std::cout, std::string const &indent = "");
48
49    /// \brief  Returns the Dicom Group Number
50    /// @return the Dicom Group Number
51    const uint16_t &GetGroup() const { return Tag[0]; }
52
53    /// \brief  Returns the Dicom Element Number
54    /// @return the Dicom Element Number
55    const uint16_t &GetElement() const { return Tag[1]; }
56
57    /// \brief  Set the Dicom Value Representation 
58    /// \param vr the Dicom Value Representation
59    virtual void SetVR(VRKey const &vr) { VR = vr; }
60    /// \brief  Returns the Dicom Value Representation 
61    /// @return the Dicom Value Representation
62    const VRKey &GetVR() const { return VR; }
63    /// \brief tells if the V(alue) R(epresentation) is known (?!)
64    /// @return 
65    bool IsVRUnknown() const { return VR == GDCM_VRUNKNOWN; }
66
67    const TagKey &GetKey() const { return Tag; }
68
69 // Key creation
70    static TagKey TranslateToKey(uint16_t group, uint16_t elem);
71
72 protected:
73    DicomEntry(const uint16_t &group,const uint16_t &elt,
74               const VRKey &vr = GDCM_VRUNKNOWN);
75    ~DicomEntry();
76
77 private:
78    /// Dicom \ref TagKey. Contains DicomGroup number and DicomElement number
79    TagKey Tag;
80
81    /// \brief Value Representation i.e. some clue about the nature
82    ///        of the data represented e.g. 
83    ///        "FD" short for "Floating Point Double"(see \ref VR)
84    ///        "PN" short for "Person Name"       
85    VRKey VR;
86 };
87 } // end namespace gdcm
88 //-----------------------------------------------------------------------------
89 #endif