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; };
124 * \ingroup gdcmHeaderEntry
125 * \brief Sets only 'Usable Length' (*not* 'Read Length')
126 * of the current Dicom Header Entry
128 inline void SetUsableLength(guint32 l){ UsableLength = l; };
131 * \ingroup gdcmHeaderEntry
132 * \brief Sets the value (string)
133 * of the current Dicom Header Entry
135 inline void SetValue(std::string val) { value = val; };
138 * \ingroup gdcmHeaderEntry
139 * \brief Sets the value (non string)
140 * of the current Dicom Header Entry
142 inline void SetVoidArea(void * area) { voidArea = area; };
145 * \ingroup gdcmHeaderEntry
146 * \brief Sets the offset of the Dicom Element
147 * \warning : use with caution !
148 * @param of offset to be set
150 inline void gdcmHeaderEntry::SetOffset(size_t of) { Offset = of; };
153 * \ingroup gdcmHeaderEntry
154 * \brief Sets to TRUE the ImplicitVr flag of the current Dicom Element
156 inline void gdcmHeaderEntry::SetImplicitVR(void) { ImplicitVR = true; };
159 * \ingroup gdcmHeaderEntry
160 * \brief tells us if the current Dicom Element was checked as ImplicitVr
161 * @return true if the current Dicom Element was checked as ImplicitVr
163 inline bool gdcmHeaderEntry::IsImplicitVR(void) { return ImplicitVR; };
166 * \ingroup gdcmHeaderEntry
167 * \brief tells us if the VR of the current Dicom Element is Unkonwn
168 * @return true if the VR is unkonwn
170 inline bool gdcmHeaderEntry::IsVRUnknown(void) { return entry->IsVRUnknown(); };
173 * \ingroup gdcmHeaderEntry
174 * \brief Sets the DicEntry of the current Dicom Element
175 * @param NewEntry pointer to the DictEntry
177 inline void gdcmHeaderEntry::SetDictEntry(gdcmDictEntry *NewEntry) {
182 * \ingroup gdcmHeaderEntry
183 * \brief Gets the DicEntry of the current Dicom Element
184 * @return the DicEntry of the current Dicom Element
186 gdcmDictEntry * gdcmHeaderEntry::GetDictEntry(void) { return entry; };
189 * \ingroup gdcmHeaderEntry
190 * \brief Sets the print level for the Dicom Header Elements
191 * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy
193 void SetPrintLevel(int level) { printLevel = level; };
194 void Print (std::ostream & os = std::cout);
197 // FIXME: In fact we should be more specific and use :
198 // friend gdcmHeaderEntry * gdcmHeader::ReadNextElement(void);
200 friend class gdcmHeader;
203 gdcmDictEntry *entry;
204 /// Updated from ReadLength, by FixFoungLentgh()
205 /// for fixing a bug in the header
206 /// or helping the parser going on
207 guint32 UsableLength;
209 /// Length actually read on disk
210 /// (before FixFoundLength)
211 /// ReadLength will be updated only when
212 /// FixFoundLength actually fixes a bug in the header,
213 /// not when it performs a trick to help the Parser
215 /// *for internal* use only
218 /// Even when reading explicit vr files, some
219 /// elements happen to be implicit. Flag them here
220 /// since we can't use the entry->vr without breaking
221 /// the underlying dictionary.
224 /// Header Entry value, stores as a std::string (VR will be used, later, to decode)
227 /// unsecure memory area to hold 'non string' values
228 /// (ie : Lookup Tables, overlays)
230 /// Offset from the begining of file for direct user access
232 /// How many details are to be printed (value : 0,1,2)
236 //-----------------------------------------------------------------------------