2 //-----------------------------------------------------------------------------
3 #ifndef GDCMHeaderEntry_H
4 #define GDCMHeaderEntry_H
9 #include "gdcmDictEntry.h"
12 //-----------------------------------------------------------------------------
14 * \ingroup gdcmHeaderEntry
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 gdcmHeaderEntry {
20 gdcmHeaderEntry(gdcmDictEntry*);
22 * \ingroup gdcmHeaderEntry
23 * \brief returns the Dicom Group number of the current Dicom Header Entry
26 inline guint16 GetGroup(void) { return entry->GetGroup(); };
28 * \ingroup gdcmHeaderEntry
29 * \brief returns the Dicom Element number of the current Dicom Header Entry
32 inline guint16 GetElement(void) { return entry->GetElement();};
34 * \ingroup gdcmHeaderEntry
35 * \brief returns the 'key' of the current Dicom Header Entry
38 inline std::string GetKey(void) { return entry->GetKey(); };
40 * \ingroup gdcmHeaderEntry
41 * \brief returns the 'Name' '(e.g. "Patient's Name")
42 * found in the Dicom Dictionnary
43 * of the current Dicom Header Entry
46 inline std::string GetName(void) { return entry->GetName(); };
49 * \ingroup gdcmHeaderEntry
50 * \brief returns the 'Value Representation'
51 * (e.g. "PN" : Person Name, "SL" : Signed Long),
52 * found in the Dicom Header or in the Dicom Dictionnary,
53 * of the current Dicom Header Entry
56 inline std::string GetVR(void) { return entry->GetVR(); };
58 * \ingroup gdcmHeaderEntry
59 * \brief returns the 'Value' (e.g. "Dupond Marcel")
60 * converted into a 'string', if it's stored as an integer
62 * of the current Dicom Header Entry
65 inline std::string GetValue(void) { return value; };
67 * \ingroup gdcmHeaderEntry
68 * \brief returns the area value of the current Dicom Header Entry
69 * when it's not string-translatable
73 inline void * GetVoidArea(void) { return voidArea; };
75 * \ingroup gdcmHeaderEntry
76 * \brief returns offset (since the beginning of the file,
77 * including the File Pramble, if any)
78 * of the value of the current Dicom Header Entry
79 * \warning : offset of the *value*, not of the Dicom Header Entry
83 inline size_t GetOffset(void) { return Offset; };
85 * \ingroup gdcmHeaderEntry
86 * \brief returns the actual value length of the current Dicom Header Entry
87 * \warning this value is not *allways* the one stored in the Dicom Header
88 * in case on well knowned buggs
91 inline guint32 GetLength(void) { return UsableLength; };
94 * \ingroup gdcmHeaderEntry
95 * \brief returns the 'read length' of the current Dicom Header Entry
96 * \warning this value is the one stored in the Dicom Header
97 * but not mandatoryly the one thats's used
98 * (in case on SQ, or delimiters, the usable length is set to zero)
101 inline guint32 GetReadLength(void) { return ReadLength;};
104 * \ingroup gdcmHeaderEntry
105 * \brief Sets the 'Value Representation' of the current Dicom Header Entry
107 inline void SetVR(std::string v) { entry->SetVR(v); };
109 * \ingroup gdcmHeaderEntry
110 * \brief Sets both 'Read Length' and 'Usable Length'
111 * of the current Dicom Header Entry
113 inline void SetLength(guint32 l) { ReadLength=UsableLength=l;};
115 // The following 3 members, for internal use only !
118 * \ingroup gdcmHeaderEntry
119 * \brief Sets only 'Read Length' (*not* 'Usable Length')
120 * of the current Dicom Header Entry
122 inline void SetReadLength(guint32 l) { ReadLength = l; };
125 * \ingroup gdcmHeaderEntry
126 * \brief Sets only 'Usable Length' (*not* 'Read Length')
127 * of the current Dicom Header Entry
129 inline void SetUsableLength(guint32 l){ UsableLength = l; };
132 * \ingroup gdcmHeaderEntry
133 * \brief Sets the value (string)
134 * of the current Dicom Header Entry
136 inline void SetValue(std::string val) { value = val; };
139 * \ingroup gdcmHeaderEntry
140 * \brief Sets the value (non string)
141 * of the current Dicom Header Entry
143 inline void SetVoidArea(void * area) { voidArea = area; };
146 * \ingroup gdcmHeaderEntry
147 * \brief Sets the offset of the Dicom Element
148 * \warning : use with caution !
149 * @param of offset to be set
151 inline void gdcmHeaderEntry::SetOffset(size_t of) { Offset = of; };
154 * \ingroup gdcmHeaderEntry
155 * \brief Sets to TRUE the ImplicitVr flag of the current Dicom Element
157 inline void gdcmHeaderEntry::SetImplicitVR(void) { ImplicitVR = true; };
160 * \ingroup gdcmHeaderEntry
161 * \brief tells us if the current Dicom Element was checked as ImplicitVr
162 * @return true if the current Dicom Element was checked as ImplicitVr
164 inline bool gdcmHeaderEntry::IsImplicitVR(void) { return ImplicitVR; };
167 * \ingroup gdcmHeaderEntry
168 * \brief tells us if the VR of the current Dicom Element is Unkonwn
169 * @return true if the VR is unkonwn
171 inline bool gdcmHeaderEntry::IsVRUnknown(void) { return entry->IsVRUnknown(); };
174 * \ingroup gdcmHeaderEntry
175 * \brief Sets the DicEntry of the current Dicom Element
176 * @param NewEntry pointer to the DictEntry
178 inline void gdcmHeaderEntry::SetDictEntry(gdcmDictEntry *NewEntry) {
183 * \ingroup gdcmHeaderEntry
184 * \brief Gets the DicEntry of the current Dicom Element
185 * @return the DicEntry of the current Dicom Element
187 gdcmDictEntry * gdcmHeaderEntry::GetDictEntry(void) { return entry; };
190 * \ingroup gdcmHeaderEntry
191 * \brief Sets the print level for the Dicom Header Elements
192 * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
194 void SetPrintLevel(int level) { printLevel = level; };
195 void Print (std::ostream & os = std::cout);
197 guint32 GetFullLength(void);
200 // FIXME: In fact we should be more specific and use :
201 // friend gdcmHeaderEntry * gdcmHeader::ReadNextElement(void);
203 friend class gdcmHeader;
206 gdcmDictEntry *entry;
207 /// Updated from ReadLength, by FixFoungLentgh()
208 /// for fixing a bug in the header
209 /// or helping the parser going on
210 guint32 UsableLength;
212 /// Length actually read on disk
213 /// (before FixFoundLength)
214 /// ReadLength will be updated only when
215 /// FixFoundLength actually fixes a bug in the header,
216 /// not when it performs a trick to help the Parser
218 /// *for internal* use only
221 /// Even when reading explicit vr files, some
222 /// elements happen to be implicit. Flag them here
223 /// since we can't use the entry->vr without breaking
224 /// the underlying dictionary.
227 /// Header Entry value, stores as a std::string (VR will be used, later, to decode)
230 /// unsecure memory area to hold 'non string' values
231 /// (ie : Lookup Tables, overlays)
233 /// Offset from the begining of file for direct user access
235 /// How many details are to be printed (value : 0,1,2)
239 //-----------------------------------------------------------------------------