2 //-----------------------------------------------------------------------------
9 #include "gdcmDictEntry.h"
12 //-----------------------------------------------------------------------------
14 * \ingroup gdcmDocEntry
15 * \brief The dicom header of a Dicom file contains a set of such entries
16 * (when successfuly parsed against a given Dicom dictionary)
18 class GDCM_EXPORT gdcmDocEntry {
20 gdcmDocEntry(gdcmDictEntry*);
22 /// Returns the Dicom Group number of the current Dicom Header Entry
23 inline guint16 GetGroup(void) { return entry->GetGroup(); };
25 /// Returns the Dicom Element number of the current Dicom Header Entry
26 inline guint16 GetElement(void) { return entry->GetElement();};
28 /// Returns the 'key' of the current Dicom Header Entry
29 inline std::string GetKey(void) { return entry->GetKey(); };
31 /// \brief Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom
32 /// Dictionnary of the current Dicom Header Entry
33 inline std::string GetName(void) { return entry->GetName(); };
35 /// \brief Returns the 'Value Representation' (e.g. "PN" : Person Name,
36 /// "SL" : Signed Long), found in the Dicom Header or in the Dicom
37 /// Dictionnary, of the current Dicom Header Entry
38 inline std::string GetVR(void) { return entry->GetVR(); };
40 /// \brief Returns the 'Value' (e.g. "Dupond Marcel") converted into a
41 /// 'string', if it's stored as an integer in the Dicom Header of the
42 /// current Dicom Header Entry
43 inline std::string GetValue(void) { return value; };
45 /// \brief Returns the area value of the current Dicom Header Entry
46 /// when it's not string-translatable (e.g : a LUT table)
47 inline void * GetVoidArea(void) { return voidArea; };
49 /// \brief Returns offset (since the beginning of the file, including
50 /// the File Pramble, if any) of the value of the current Dicom HeaderEntry
51 /// \warning offset of the *value*, not of the Dicom Header Entry
52 inline size_t GetOffset(void) { return Offset; };
54 /// \brief Returns the actual value length of the current Dicom Header Entry
55 /// \warning this value is not *allways* the one stored in the Dicom Header
56 /// in case of well knowned bugs
57 inline guint32 GetLength(void) { return UsableLength; };
59 /// \brief Returns the 'read length' of the current Dicom Header Entry
60 /// \warning this value is the one stored in the Dicom Header but not
61 /// mandatoryly the one thats's used (in case on SQ, or delimiters,
62 /// the usable length is set to zero)
63 inline guint32 GetReadLength(void) { return ReadLength; };
65 /// Sets the 'Value Representation' of the current Dicom Header Entry
66 inline void SetVR(std::string v) { entry->SetVR(v); };
68 /// \brief Sets both 'Read Length' and 'Usable Length' of the current
69 /// Dicom Header Entry
70 inline void SetLength(guint32 l) { ReadLength=UsableLength=l;};
72 // The following 3 members, for internal use only !
74 /// \brief Sets only 'Read Length' (*not* 'Usable Length') of the current
75 /// Dicom Header Entry
76 inline void SetReadLength(guint32 l) { ReadLength = l; };
78 /// \brief Sets only 'Usable Length' (*not* 'Read Length') of the current
79 /// Dicom Header Entry
80 inline void SetUsableLength(guint32 l) { UsableLength = l; };
82 /// Sets the value (string) of the current Dicom Header Entry
83 inline void SetValue(std::string val) { value = val; };
85 /// Sets the value (non string) of the current Dicom Header Entry
86 inline void SetVoidArea(void * area) { voidArea = area; };
88 /// \brief Sets the offset of the Dicom Element
89 /// \warning use with caution !
90 /// @param of offset to be set
91 inline void gdcmDocEntry::SetOffset(size_t of) { Offset = of; };
93 /// Sets to TRUE the ImplicitVr flag of the current Dicom Element
94 inline void gdcmDocEntry::SetImplicitVR(void) { ImplicitVR = true; };
96 /// \brief Tells us if the current Dicom Element was checked as ImplicitVr
97 /// @return true if the current Dicom Element was checked as ImplicitVr
98 inline bool gdcmDocEntry::IsImplicitVR(void) { return ImplicitVR; };
100 /// \brief Tells us if the VR of the current Dicom Element is Unkonwn
101 /// @return true if the VR is unkonwn
102 inline bool gdcmDocEntry::IsVRUnknown(void)
103 { return entry->IsVRUnknown(); };
105 /// \brief Sets the DicEntry of the current Dicom Element
106 /// @param NewEntry pointer to the DictEntry
107 inline void gdcmDocEntry::SetDictEntry(gdcmDictEntry *NewEntry)
108 { entry = NewEntry; };
110 /// \brief Gets the DicEntry of the current Dicom Element
111 /// @return The DicEntry of the current Dicom Element
112 gdcmDictEntry * gdcmDocEntry::GetDictEntry(void) { return entry; };
114 /// \brief Sets the print level for the Dicom Header Elements
115 /// \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
116 void SetPrintLevel(int level) { printLevel = level; };
118 void Print (std::ostream & os = std::cout);
120 /// Gets the depth level of a Dicom Header Entry embedded in a SeQuence
121 inline int GetSQDepthLevel(void) { return (SQDepthLevel); };
123 guint32 GetFullLength(void);
126 // FIXME: In fact we should be more specific and use :
127 // friend gdcmDocEntry * gdcmHeader::ReadNextElement(void);
128 friend class gdcmHeader;
130 /// Sets the depth level of a Dicom Header Entry embedded in a SeQuence
131 inline void SetSQDepthLevel(int depthLevel) { SQDepthLevel = depthLevel; };
134 gdcmDictEntry *entry;
136 /// \brief Updated from ReadLength, by FixFoungLentgh() for fixing a bug
137 /// in the header or helping the parser going on
138 guint32 UsableLength;
140 /// \brief Length actually read on disk (before FixFoundLength). ReadLength
141 /// will be updated only when FixFoundLength actually fixes a bug in the
142 /// header, not when it performs a trick to help the Parser going on.
145 /// \brief Even when reading explicit vr files, some elements happen to
146 /// be implicit. Flag them here since we can't use the entry->vr without
147 /// breaking the underlying dictionary.
150 /// Offset from the begining of file for direct user access
153 /// How many details are to be printed (value : 0,1,2)
156 /// Gives the depth level of elements inside SeQuences
160 //-----------------------------------------------------------------------------