2 //-----------------------------------------------------------------------------
3 #ifndef GDCMHeaderEntry_H
4 #define GDCMHeaderEntry_H
9 #include "gdcmDictEntry.h"
12 //-----------------------------------------------------------------------------
14 * The dicom header of a Dicom file contains a set of such entries
15 * (when successfuly parsed against a given Dicom dictionary)
17 class GDCM_EXPORT gdcmHeaderEntry {
19 gdcmHeaderEntry(gdcmDictEntry*);
21 * \ingroup gdcmHeaderEntry
22 * \brief returns the Dicom Group number of the current Dicom Header Entry
25 inline guint16 GetGroup(void) { return entry->GetGroup(); };
27 * \ingroup gdcmHeaderEntry
28 * \brief returns the Dicom Element number of the current Dicom Header Entry
31 inline guint16 GetElement(void) { return entry->GetElement();};
33 * \ingroup gdcmHeaderEntry
34 * \brief returns the 'key' of the current Dicom Header Entry
37 inline std::string GetKey(void) { return entry->GetKey(); };
39 * \ingroup gdcmHeaderEntry
40 * \brief returns the 'Name' '(e.g. "Patient's Name")
41 * found in the Dicom Dictionnary
42 * of the current Dicom Header Entry
45 inline std::string GetName(void) { return entry->GetName(); };
48 * \ingroup gdcmHeaderEntry
49 * \brief returns the 'Value Representation'
50 * (e.g. "PN" : Person Name, "SL" : Signed Long),
51 * found in the Dicom Header or in the Dicom Dictionnary,
52 * of the current Dicom Header Entry
55 inline std::string GetVR(void) { return entry->GetVR(); };
57 * \ingroup gdcmHeaderEntry
58 * \brief returns the 'Value' (e.g. "Dupond Marcel")
59 * converted into a 'string', if it's stored as an integer
61 * of the current Dicom Header Entry
64 inline std::string GetValue(void) { return value; };
66 * \ingroup gdcmHeaderEntry
67 * \brief returns the area value of the current Dicom Header Entry
68 * when it's not string-translatable
72 inline void * GetVoidArea(void) { return voidArea; };
74 * \ingroup gdcmHeaderEntry
75 * \brief returns offset (since the beginning of the file,
76 * including the File Pramble, if any)
77 * of the value of the current Dicom Header Entry
78 * \warning : offset of the *value*, not of the Dicom Header Entry
82 inline size_t GetOffset(void) { return Offset; };
84 * \ingroup gdcmHeaderEntry
85 * \brief returns the actual value length of the current Dicom Header Entry
86 * \warning this value is not *allways* the one stored in the Dicom Header
87 * in case on well knowned buggs
90 inline guint32 GetLength(void) { return UsableLength; };
93 * \ingroup gdcmHeaderEntry
94 * \brief returns the 'read length' of the current Dicom Header Entry
95 * \warning this value is the one stored in the Dicom Header
96 * but not mandatoryly the one thats's used
97 * (in case on SQ, or delimiters, the usable length is set to zero)
100 inline guint32 GetReadLength(void) { return ReadLength;};
103 * \ingroup gdcmHeaderEntry
104 * \brief Sets the 'Value Representation' of the current Dicom Header Entry
106 inline void SetVR(std::string v) { entry->SetVR(v); };
108 * \ingroup gdcmHeaderEntry
109 * \brief Sets both 'Read Length' and 'Usable Length'
110 * of the current Dicom Header Entry
112 inline void SetLength(guint32 l) { ReadLength=UsableLength=l;};
114 // The following 3 members, for internal use only !
117 * \ingroup gdcmHeaderEntry
118 * \brief Sets only 'Read Length' (*not* 'Usable Length')
119 * of the current Dicom Header Entry
121 inline void SetReadLength(guint32 l) { ReadLength = l; };
123 * \ingroup gdcmHeaderEntry
124 * \brief Sets only 'Usable Length' (*not* 'Read Length')
125 * of the current Dicom Header Entry
127 inline void SetUsableLength(guint32 l){ UsableLength = l; };
130 * \ingroup gdcmHeaderEntry
131 * \brief Sets the value (string)
132 * of the current Dicom Header Entry
134 inline void SetValue(std::string val) { value = val; };
137 * \ingroup gdcmHeaderEntry
138 * \brief Sets the value (non string)
139 * of the current Dicom Header Entry
141 inline void SetVoidArea(void * area) { voidArea = area; };
144 * \ingroup gdcmHeaderEntry
145 * \brief Sets the offset of the Dicom Element
146 * \warning : use with caution !
147 * @param of offset to be set
149 inline void gdcmHeaderEntry::SetOffset(size_t of) { Offset = of; };
152 * \ingroup gdcmHeaderEntry
153 * \brief Sets to TRUE the ImplicitVr flag of the current Dicom Element
155 inline void gdcmHeaderEntry::SetImplicitVR(void) { ImplicitVR = true; };
158 * \ingroup gdcmHeaderEntry
159 * \brief tells us if the current Dicom Element was checked as ImplicitVr
160 * @return true if the current Dicom Element was checked as ImplicitVr
162 inline bool gdcmHeaderEntry::IsImplicitVR(void) { return ImplicitVR; };
165 * \ingroup gdcmHeaderEntry
166 * \brief tells us if the VR of the current Dicom Element is Unkonwn
167 * @return true if the VR is unkonwn
169 inline bool gdcmHeaderEntry::IsVRUnknown(void) { return entry->IsVRUnknown(); };
172 * \ingroup gdcmHeaderEntry
173 * \brief Sets the DicEntry of the current Dicom Element
174 * @param NewEntry pointer to the DictEntry
176 inline void gdcmHeaderEntry::SetDictEntry(gdcmDictEntry *NewEntry) {
181 * \ingroup gdcmHeaderEntry
182 * \brief Gets the DicEntry of the current Dicom Element
183 * @return the DicEntry of the current Dicom Element
185 gdcmDictEntry * gdcmHeaderEntry::GetDictEntry(void) { return entry; };
188 * \ingroup gdcmHeaderEntry
189 * \brief Sets the print level for the Dicom Header Elements
190 * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
192 void SetPrintLevel(int level) { printLevel = level; };
193 void Print (std::ostream & os = std::cout);
196 // FIXME: In fact we should be more specific and use :
197 // friend gdcmHeaderEntry * gdcmHeader::ReadNextElement(void);
199 friend class gdcmHeader;
202 gdcmDictEntry *entry;
203 /// Updated from ReadLength, by FixFoungLentgh()
204 /// for fixing a bug in the header
205 /// or helping the parser going on
206 guint32 UsableLength;
208 /// Length actually read on disk
209 /// (before FixFoundLength)
210 /// ReadLength will be updated only when
211 /// FixFoundLength actually fixes a bug in the header,
212 /// not when it performs a trick to help the Parser
214 /// *for internal* use only
217 /// Even when reading explicit vr files, some
218 /// elements happen to be implicit. Flag them here
219 /// since we can't use the entry->vr without breaking
220 /// the underlying dictionary.
223 /// Header Entry value, stores as a std::string (VR will be used, later, to decode)
226 /// unsecure memory area to hold 'non string' values
227 /// (ie : Lookup Tables, overlays)
229 /// Offset from the begining of file for direct user access
231 /// How many details are to be printed (value : 0,1,2)
235 //-----------------------------------------------------------------------------