vil_dicom_header.h
Go to the documentation of this file.
1 #ifndef vil_dicom_header_h_
2 #define vil_dicom_header_h_
3 //:
4 // \file
5 // \brief DICOM Header reader and writer.
6 // \author Chris Wolstenholme - Manchester
7 // Modified by Ian Scott to work with vil loader.
8 
9 #include <ostream>
10 #include <string>
11 #include <vector>
12 #ifdef _MSC_VER
13 # include <vcl_msvc_warnings.h>
14 #endif
15 #include <vxl_config.h>
16 #include <vil/vil_stream.h>
17 
18 //: DICOM types
19 // Defines the type of the dicom file being loaded. A
20 // dicom file can be a Part10 file a non-Part10 file or an unknown
21 // file type (possibly not dicom)
22 
24 {
25  VIL_DICOM_HEADER_DTUNKNOWN=0, /*!< Value for unknown dicom types */
26  VIL_DICOM_HEADER_DTPART10, /*!< Value for Part10 dicom files */
27  VIL_DICOM_HEADER_DTNON_PART10 /*!< Value for non Part10 dicom files */
28 };
29 
30 //: Endian types
32 {
33  VIL_DICOM_HEADER_DEUNKNOWN=0, /*!< If the endian is unknown */
34  VIL_DICOM_HEADER_DELITTLEENDIAN, /*!< Value for little endian */
35  VIL_DICOM_HEADER_DEBIGENDIAN /*!< Value for big endian */
36 };
37 
38 //: Encapsulated image types
40 {
41  VIL_DICOM_HEADER_DITUNKNOWN=0, /*!< Value for unknown (or non-encapsulated) file types */
42  VIL_DICOM_HEADER_DITJPEGBASE, /*!< Value for encapsulated jpeg baseline files */
43  VIL_DICOM_HEADER_DITJPEGEXTLOSSY, /*!< Value for encapsulated jpeg, extended lossy files */
44  VIL_DICOM_HEADER_DITJPEGSPECNH, /*!< Value for encapsulated jpeg, spectral selection non-hierarchical files */
45  VIL_DICOM_HEADER_DITJPEGFULLNH, /*!< Value for encapsulated jpeg, full progression non-hierarchical files */
46  VIL_DICOM_HEADER_DITJPEGLOSSLNH, /*!< Value for encapsulated jpeg, lossless non-hierarchical files */
47  VIL_DICOM_HEADER_DITJPEGEXTHIER, /*!< Value for encapsulated jpeg, extended hierarchical files */
48  VIL_DICOM_HEADER_DITJPEGSPECHIER, /*!< Value for encapsulated jpeg, spectral selection, hierarchical files */
49  VIL_DICOM_HEADER_DITJPEGFULLHIER, /*!< Value for encapsulated jpeg, full progression, hierarchical files */
50  VIL_DICOM_HEADER_DITJPEGLOSSLHIER, /*!< Value for encapsulated jpeg, lossless, hierarchical files */
51  VIL_DICOM_HEADER_DITJPEGLOSSLDEF, /*!< Value for encapsulated jpeg, default lossless files */
52  VIL_DICOM_HEADER_DITRLE /*!< Value for encapsulated RLE files */
53 };
54 
55 // Max size (number of groups/elements)
56 constexpr unsigned VIL_DICOM_HEADER_MAXHEADERSIZE = 100;
57 
58 // Define the dicom groups
59 const vxl_uint_16 VIL_DICOM_HEADER_COMMANDGROUP =0x0000;
60 const vxl_uint_16 VIL_DICOM_HEADER_METAFILEGROUP =0x0002;
61 const vxl_uint_16 VIL_DICOM_HEADER_BASICDIRGROUP =0x0004;
62 const vxl_uint_16 VIL_DICOM_HEADER_IDENTIFYINGGROUP =0x0008;
63 const vxl_uint_16 VIL_DICOM_HEADER_PATIENTINFOGROUP =0x0010;
64 const vxl_uint_16 VIL_DICOM_HEADER_ACQUISITIONGROUP =0x0018;
65 const vxl_uint_16 VIL_DICOM_HEADER_RELATIONSHIPGROUP =0x0020;
66 const vxl_uint_16 VIL_DICOM_HEADER_IMAGEGROUP =0x0028;
67 const vxl_uint_16 VIL_DICOM_HEADER_STUDYGROUP =0x0032;
68 const vxl_uint_16 VIL_DICOM_HEADER_VISITGROUP =0x0038;
69 const vxl_uint_16 VIL_DICOM_HEADER_WAVEFORMGROUP =0x003a;
70 const vxl_uint_16 VIL_DICOM_HEADER_PROCEDUREGROUP =0x0040;
71 const vxl_uint_16 VIL_DICOM_HEADER_DEVICEGROUP =0x0050;
72 const vxl_uint_16 VIL_DICOM_HEADER_NMIMAGEGROUP =0x0054;
73 const vxl_uint_16 VIL_DICOM_HEADER_MEDIAGROUP =0x0088;
74 const vxl_uint_16 VIL_DICOM_HEADER_BASICFILMSESSIONGROUP =0x2000;
75 const vxl_uint_16 VIL_DICOM_HEADER_BASICFILMBOXGROUP =0x2010;
76 const vxl_uint_16 VIL_DICOM_HEADER_BASICIMAGEBOXGROUP =0x2020;
77 const vxl_uint_16 VIL_DICOM_HEADER_BASICANNOTATIONBOXGROUP =0x2030;
79 const vxl_uint_16 VIL_DICOM_HEADER_PRINTJOBGROUP =0x2100;
80 const vxl_uint_16 VIL_DICOM_HEADER_PRINTERGROUP =0x2110;
81 const vxl_uint_16 VIL_DICOM_HEADER_TEXTGROUP =0x4000;
82 const vxl_uint_16 VIL_DICOM_HEADER_RESULTSGROUP =0x4008;
83 const vxl_uint_16 VIL_DICOM_HEADER_CURVEGROUP =0x5000;
84 const vxl_uint_16 VIL_DICOM_HEADER_OVERLAYGROUP =0x6000;
85 const vxl_uint_16 VIL_DICOM_HEADER_PIXELGROUP =0x7fe0;
86 const vxl_uint_16 VIL_DICOM_HEADER_PADGROUP =0xfffc;
87 const vxl_uint_16 VIL_DICOM_HEADER_DELIMITERGROUP =0xfffe;
88 
89 const vxl_uint_16 VIL_DICOM_HEADER_NSPHILIPSGROUP =0x2005;
90 
91 // Useful elements of the Meta File group
92 const vxl_uint_16 VIL_DICOM_HEADER_MFGROUPLENGTH =0x0000;
93 const vxl_uint_16 VIL_DICOM_HEADER_MFTRANSFERSYNTAX =0x0010;
94 
95 // Useful elements of the Identifying group
96 const vxl_uint_16 VIL_DICOM_HEADER_IDGROUPLENGTH =0x0000; // UL
97 const vxl_uint_16 VIL_DICOM_HEADER_IDLENGTHTOEND =0x0001; // RET
98 const vxl_uint_16 VIL_DICOM_HEADER_IDSPECIFICCHARACTER =0x0005; // CS
99 const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGETYPE =0x0008; // CS
100 const vxl_uint_16 VIL_DICOM_HEADER_IDSOPCLASSID =0x0016; // UI
101 const vxl_uint_16 VIL_DICOM_HEADER_IDSOPINSTANCEID =0x0018; // UI
102 const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYDATE =0x0020; // DA
103 const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESDATE =0x0021; // DA
104 const vxl_uint_16 VIL_DICOM_HEADER_IDACQUISITIONDATE =0x0022; // DA
105 const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGEDATE =0x0023; // DA
106 const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYTIME =0x0030; // TM
107 const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESTIME =0x0031; // TM
108 const vxl_uint_16 VIL_DICOM_HEADER_IDACQUISITIONTIME =0x0032; // TM
109 const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGETIME =0x0033; // TM
110 const vxl_uint_16 VIL_DICOM_HEADER_IDACCESSIONNUMBER =0x0050; // SH
111 const vxl_uint_16 VIL_DICOM_HEADER_IDMODALITY =0x0060; // CS
112 const vxl_uint_16 VIL_DICOM_HEADER_IDMANUFACTURER =0x0070; // LO
113 const vxl_uint_16 VIL_DICOM_HEADER_IDINSTITUTIONNAME =0x0080; // LO
114 const vxl_uint_16 VIL_DICOM_HEADER_IDINSTITUTIONADDRESS =0x0081; // ST
115 const vxl_uint_16 VIL_DICOM_HEADER_IDREFERRINGPHYSICIAN =0x0090; // PN
116 const vxl_uint_16 VIL_DICOM_HEADER_IDSTATIONNAME =0x1010; // SH
117 const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYDESCRIPTION =0x1030; // LO
118 const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESDESCRIPTION =0x103E; // LO
119 const vxl_uint_16 VIL_DICOM_HEADER_IDATTENDINGPHYSICIAN =0x1050; // PN
120 const vxl_uint_16 VIL_DICOM_HEADER_IDOPERATORNAME =0x1070; // PN
121 const vxl_uint_16 VIL_DICOM_HEADER_IDMANUFACTURERMODEL =0x1090; // LO
122 
123 // Useful elements from the Patient Info group
124 const vxl_uint_16 VIL_DICOM_HEADER_PIGROUPLENGTH =0x0000; // UL
125 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTNAME =0x0010; // PN
126 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTID =0x0020; // LO
127 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTBIRTHDATE =0x0030; // DA
128 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTSEX =0x0040; // CS
129 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTAGE =0x1010; // AS
130 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTWEIGHT =0x1030; // DS
131 const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTHISTORY =0x21B0; // LT
132 
133 // Useful elements from the Acquisition group
134 const vxl_uint_16 VIL_DICOM_HEADER_AQSCANNINGSEQUENCE =0x0020; // CS
135 const vxl_uint_16 VIL_DICOM_HEADER_AQSEQUENCEVARIANT =0x0021; // CS
136 const vxl_uint_16 VIL_DICOM_HEADER_AQSCANOPTIONS =0x0022; // CS
137 const vxl_uint_16 VIL_DICOM_HEADER_AQMRACQUISITIONTYPE =0x0023; // CS
138 const vxl_uint_16 VIL_DICOM_HEADER_AQSEQUENCENAME =0x0024; // SH
139 const vxl_uint_16 VIL_DICOM_HEADER_AQANGIOFLAG =0x0025; // CS
140 const vxl_uint_16 VIL_DICOM_HEADER_AQSLICETHICKNESS =0x0050; // DS
141 const vxl_uint_16 VIL_DICOM_HEADER_AQREPETITIONTIME =0x0080; // DS
142 const vxl_uint_16 VIL_DICOM_HEADER_AQECHOTIME =0x0081; // DS
143 const vxl_uint_16 VIL_DICOM_HEADER_AQINVERSIONTIME =0x0082; // DS
144 const vxl_uint_16 VIL_DICOM_HEADER_AQNUMBEROFAVERAGES =0x0083; // DS
145 const vxl_uint_16 VIL_DICOM_HEADER_AQECHONUMBERS =0x0086; // IS
146 const vxl_uint_16 VIL_DICOM_HEADER_AQMAGNETICFIELDSTRENGTH =0x0087; // DS
147 const vxl_uint_16 VIL_DICOM_HEADER_AQSLICESPACING =0x0088; // DS
148 const vxl_uint_16 VIL_DICOM_HEADER_AQECHOTRAINLENGTH =0x0091; // IS
149 const vxl_uint_16 VIL_DICOM_HEADER_AQPIXELBANDWIDTH =0x0095; // DS
150 const vxl_uint_16 VIL_DICOM_HEADER_AQSOFTWAREVERSION =0x1020; // LO
151 const vxl_uint_16 VIL_DICOM_HEADER_AQPROTOCOLNAME =0x1030; // LO
152 const vxl_uint_16 VIL_DICOM_HEADER_AQTRIGGERTIME =0x1060; // DS
153 const vxl_uint_16 VIL_DICOM_HEADER_AQHEARTRATE =0x1088; // IS
154 const vxl_uint_16 VIL_DICOM_HEADER_AQCARDIACNUMBEROFIMAGES =0x1090; // IS
155 const vxl_uint_16 VIL_DICOM_HEADER_AQTRIGGERWINDOW =0x1094; // IS
156 const vxl_uint_16 VIL_DICOM_HEADER_AQRECONTRUCTIONDIAMETER =0x1100; // DS
157 const vxl_uint_16 VIL_DICOM_HEADER_AQIMAGERPIXELSPACING =0x1164; // DS
158 const vxl_uint_16 VIL_DICOM_HEADER_AQRECEIVINGCOIL =0x1250; // SH
159 const vxl_uint_16 VIL_DICOM_HEADER_AQPHASEENCODINGDIRECTION =0x1312; // CS
160 const vxl_uint_16 VIL_DICOM_HEADER_AQFLIPANGLE =0x1314; // DS
161 const vxl_uint_16 VIL_DICOM_HEADER_AQSAR =0x1316; // DS
162 const vxl_uint_16 VIL_DICOM_HEADER_AQPATIENTPOSITION =0x5100; // CS
163 
164 // Useful elements from the Relationship group
165 const vxl_uint_16 VIL_DICOM_HEADER_RSSTUDYINSTANCEUID =0x000D; // UI
166 const vxl_uint_16 VIL_DICOM_HEADER_RSSERIESINSTANCEUID =0x000E; // UI
167 const vxl_uint_16 VIL_DICOM_HEADER_RSSTUDYID =0x0010; // SH
168 const vxl_uint_16 VIL_DICOM_HEADER_RSSERIESNUMBER =0x0011; // IS
169 const vxl_uint_16 VIL_DICOM_HEADER_RSAQUISITIONNUMBER =0x0012; // IS
170 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGENUMBER =0x0013; // IS
171 const vxl_uint_16 VIL_DICOM_HEADER_RSPATIENTORIENTATION =0x0020; // CS
172 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGEPOSITION =0x0032; // DS
173 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGEORIENTATION =0x0037; // DS
174 const vxl_uint_16 VIL_DICOM_HEADER_RSFRAMEOFREFERENCEUID =0x0052; // UI
175 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGESINACQUISITION =0x1002; // IS
176 const vxl_uint_16 VIL_DICOM_HEADER_RSPOSITIONREFERENCE =0x1040; // LO
177 const vxl_uint_16 VIL_DICOM_HEADER_RSSLICELOCATION =0x1041; // DS
178 const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGECOMMENTS =0x4000; // LT
179 
180 // Useful elements from the Image group
181 const vxl_uint_16 VIL_DICOM_HEADER_IMSAMPLESPERPIXEL =0x0002; // US
182 const vxl_uint_16 VIL_DICOM_HEADER_IMPHOTOMETRICINTERP =0x0004; // CS
183 const vxl_uint_16 VIL_DICOM_HEADER_IMROWS =0x0010; // US
184 const vxl_uint_16 VIL_DICOM_HEADER_IMCOLUMNS =0x0011; // US
185 const vxl_uint_16 VIL_DICOM_HEADER_IMPLANES =0x0012; // US
186 const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELSPACING =0x0030; // DS
187 const vxl_uint_16 VIL_DICOM_HEADER_IMBITSALLOCATED =0x0100; // US
188 const vxl_uint_16 VIL_DICOM_HEADER_IMBITSSTORED =0x0101; // US
189 const vxl_uint_16 VIL_DICOM_HEADER_IMHIGHBIT =0x0102; // US
190 const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELREPRESENTATION =0x0103; // US
191 const vxl_uint_16 VIL_DICOM_HEADER_IMSMALLIMPIXELVALUE =0x0106; // US
192 const vxl_uint_16 VIL_DICOM_HEADER_IMLARGEIMPIXELVALUE =0x0107; // US
193 const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELPADDINGVALUE =0x0120; // US
194 const vxl_uint_16 VIL_DICOM_HEADER_IMWINDOWCENTER =0x1050; // DS
195 const vxl_uint_16 VIL_DICOM_HEADER_IMWINDOWWIDTH =0x1051; // DS
196 const vxl_uint_16 VIL_DICOM_HEADER_IMRESCALEINTERCEPT =0x1052; // DS
197 const vxl_uint_16 VIL_DICOM_HEADER_IMRESCALESLOPE =0x1053; // DS
198 
199 // Useful elements from the Pixel group
200 const vxl_uint_16 VIL_DICOM_HEADER_PXGROUPLENGTH =0x0000; // UL
201 const vxl_uint_16 VIL_DICOM_HEADER_PXPIXELDATA =0x0010; // OW
202 
203 // Tags needed in the Delimiter group
204 const vxl_uint_16 VIL_DICOM_HEADER_DLITEM =0xe000;
205 const vxl_uint_16 VIL_DICOM_HEADER_DLITEMDELIMITATIONITEM =0xe00d;
206 const vxl_uint_16 VIL_DICOM_HEADER_DLSEQDELIMITATIONITEM =0xe0dd;
207 
208 // Tags needed in the Procedure group
209 const vxl_uint_16 VIL_DICOM_HEADER_PRREALWORLDVALUEINTERCEPT=0x9224; // FD
210 const vxl_uint_16 VIL_DICOM_HEADER_PRREALWORLDVALUESLOPE =0x9225; // FD
211 const vxl_uint_16 VIL_DICOM_HEADER_EXPOSEDAREA =0x0303; // US
212 
213 // Tags from non-standard Philips group
214 const vxl_uint_16 VIL_DICOM_HEADER_NSPHILIPSPRIVATEINTERCEPT=0x100d; // DS
215 const vxl_uint_16 VIL_DICOM_HEADER_NSPHILIPSPRIVATESLOPE =0x100e; // DS
216 
217 // Defines for the Value Representations for Part10 meta header
218 const char * const VIL_DICOM_HEADER_APPLICATIONENTRY ="AE";
219 const char * const VIL_DICOM_HEADER_AGESTRING ="AS";
220 const char * const VIL_DICOM_HEADER_ATTRIBUTETAG ="AT";
221 const char * const VIL_DICOM_HEADER_CODESTRING ="CS";
222 const char * const VIL_DICOM_HEADER_DATE ="DA";
223 const char * const VIL_DICOM_HEADER_DECIMALSTRING ="DS";
224 const char * const VIL_DICOM_HEADER_DATETIME ="DT";
225 const char * const VIL_DICOM_HEADER_FLOATINGPOINTDOUBLE ="FD";
226 const char * const VIL_DICOM_HEADER_FLOATINGPOINTSINGLE ="FL";
227 const char * const VIL_DICOM_HEADER_INTEGERSTRING ="IS";
228 const char * const VIL_DICOM_HEADER_LONGSTRING ="LO";
229 const char * const VIL_DICOM_HEADER_LONGTEXT ="LT";
230 const char * const VIL_DICOM_HEADER_OTHERBYTE ="OB";
231 const char * const VIL_DICOM_HEADER_OTHERWORD ="OW";
232 const char * const VIL_DICOM_HEADER_PERSONNAME ="PN";
233 const char * const VIL_DICOM_HEADER_SHORTSTRING ="SH";
234 const char * const VIL_DICOM_HEADER_SIGNEDLONG ="SL";
235 const char * const VIL_DICOM_HEADER_SEQUENCE ="SQ";
236 const char * const VIL_DICOM_HEADER_SIGNEDSHORT ="SS";
237 const char * const VIL_DICOM_HEADER_SHORTTEXT ="ST";
238 const char * const VIL_DICOM_HEADER_TIME ="TM";
239 const char * const VIL_DICOM_HEADER_UNIQUEIDENTIFIER ="UI";
240 const char * const VIL_DICOM_HEADER_UNSIGNEDLONG ="UL";
241 const char * const VIL_DICOM_HEADER_UNKNOWN ="UN";
242 const char * const VIL_DICOM_HEADER_UNSIGNEDSHORT ="US";
243 const char * const VIL_DICOM_HEADER_UNLIMITEDTEXT ="UT";
244 
245 // Enumerations of all VR types
247 {
274 };
275 
276 // maps VR types to C++ types
277 template <int T /* enum vil_dicom_header_vr_type */>
279 {
280  typedef std::string type; // preferred C++ type for this VR (specialised below)
281 };
282 
283 #define vr_macro( VR, CPPT ) \
284  template <> struct vil_dicom_header_type_of<VR> { typedef CPPT type; }
285 
286 vr_macro( vil_dicom_header_AE, std::string );
287 vr_macro( vil_dicom_header_AS, std::string );
288 vr_macro( vil_dicom_header_AT, std::string );
289 vr_macro( vil_dicom_header_CS, std::string );
291 vr_macro( vil_dicom_header_DS, float );
292 vr_macro( vil_dicom_header_FD, double );
293 vr_macro( vil_dicom_header_FL, float );
295 vr_macro( vil_dicom_header_LO, std::string );
296 vr_macro( vil_dicom_header_LT, std::string );
297 vr_macro( vil_dicom_header_OB, std::string );
298 vr_macro( vil_dicom_header_OW, std::string );
299 vr_macro( vil_dicom_header_PN, std::string );
300 vr_macro( vil_dicom_header_SH, std::string );
301 vr_macro( vil_dicom_header_SL, vxl_sint_32 );
302 vr_macro( vil_dicom_header_SQ, std::string );
303 vr_macro( vil_dicom_header_SS, vxl_sint_16 );
304 vr_macro( vil_dicom_header_ST, std::string );
305 vr_macro( vil_dicom_header_TM, float );
306 vr_macro( vil_dicom_header_UI, std::string );
307 vr_macro( vil_dicom_header_UL, vxl_uint_32 );
308 vr_macro( vil_dicom_header_UN, std::string );
309 vr_macro( vil_dicom_header_US, vxl_uint_16 );
310 vr_macro( vil_dicom_header_UT, std::string );
311 #undef vr_macro
312 
313 
314 const vxl_uint_32 VIL_DICOM_HEADER_ALLSET = 0xffffffff;
315 
316 // For determining the endian of the file or the transfer type (JPEG or RLE)
317 const char * const VIL_DICOM_HEADER_IMPLICITLITTLE ="1.2.840.10008.1.2";
318 const char * const VIL_DICOM_HEADER_EXPLICITLITTLE ="1.2.840.10008.1.2.1";
319 const char * const VIL_DICOM_HEADER_EXPLICITBIG ="1.2.840.10008.1.2.2";
320 const char * const VIL_DICOM_HEADER_JPEGBASELINE_P1 ="1.2.840.10008.1.2.4.50";
321 const char * const VIL_DICOM_HEADER_JPEGDEFLOSSY_P2_4 ="1.2.840.10008.1.2.4.51";
322 const char * const VIL_DICOM_HEADER_JPEGEXTENDED_P3_5 ="1.2.840.10008.1.2.4.52";
323 const char * const VIL_DICOM_HEADER_JPEGSPECTRAL_P6_8 ="1.2.840.10008.1.2.4.53";
324 const char * const VIL_DICOM_HEADER_JPEGSPECTRAL_P7_9 ="1.2.840.10008.1.2.4.54";
325 const char * const VIL_DICOM_HEADER_JPEGFULLPROG_P10_12 ="1.2.840.10008.1.2.4.55";
326 const char * const VIL_DICOM_HEADER_JPEGFULLPROG_P11_13 ="1.2.840.10008.1.2.4.56";
327 const char * const VIL_DICOM_HEADER_JPEGLOSSLESS_P14 ="1.2.840.10008.1.2.4.57";
328 const char * const VIL_DICOM_HEADER_JPEGLOSSLESS_P15 ="1.2.840.10008.1.2.4.58";
329 const char * const VIL_DICOM_HEADER_JPEGEXTHIER_P16_18 ="1.2.840.10008.1.2.4.59";
330 const char * const VIL_DICOM_HEADER_JPEGEXTHIER_P17_19 ="1.2.840.10008.1.2.4.60";
331 const char * const VIL_DICOM_HEADER_JPEGSPECHIER_P20_22 ="1.2.840.10008.1.2.4.61";
332 const char * const VIL_DICOM_HEADER_JPEGSPECHIER_P21_23 ="1.2.840.10008.1.2.4.62";
333 const char * const VIL_DICOM_HEADER_JPEGFULLHIER_P24_26 ="1.2.840.10008.1.2.4.63";
334 const char * const VIL_DICOM_HEADER_JPEGFULLHIER_P25_27 ="1.2.840.10008.1.2.4.64";
335 const char * const VIL_DICOM_HEADER_JPEGLLESSHIER_P28 ="1.2.840.10008.1.2.4.65";
336 const char * const VIL_DICOM_HEADER_JPEGLLESSHIER_P29 ="1.2.840.10008.1.2.4.66";
337 const char * const VIL_DICOM_HEADER_JPEGLLESSDEF_P14_SV1 ="1.2.840.10008.1.2.4.70";
338 const char * const VIL_DICOM_HEADER_RLELOSSLESS ="1.2.840.10008.1.2.5";
339 
340 //: DICOM information read from the header
341 //
342 // This structure is filled when reading the header information from
343 // a dicom file. Each member relates to a field in the header part
344 // of the file.
345 
347 {
348  // General info fields
349  bool header_valid_; /*< True if the header was read ok, otherwise false */
350  vil_dicom_header_type file_type_; /*< The type of dicom file */
351  vil_dicom_header_endian sys_endian_; /*< The endian of the architecture */
352  vil_dicom_header_endian file_endian_; /*< The endian of the file being read */
353  vil_dicom_header_image_type image_type_; /*< The encapsulated (or not) image type */
354 
355  // Identifying fields
356  vil_dicom_header_type_of<vil_dicom_header_CS>::type image_id_type_; /*< The image type from the dicom header */
357  vil_dicom_header_type_of<vil_dicom_header_UI>::type sop_cl_uid_; /*< The class unique id for the Service/Object Pair */
360  vil_dicom_header_type_of<vil_dicom_header_DA>::type series_date_; /*< The date this series was collected */
367  vil_dicom_header_type_of<vil_dicom_header_SH>::type accession_number_; /*< The accession number for this image */
369  vil_dicom_header_type_of<vil_dicom_header_LO>::type manufacturer_; /*< The name of the scanner manufacturer */
372  vil_dicom_header_type_of<vil_dicom_header_PN>::type ref_phys_name_; /*< The name of the referring physician */
376  vil_dicom_header_type_of<vil_dicom_header_PN>::type att_phys_name_; /*< The name of the attending physician */
378  vil_dicom_header_type_of<vil_dicom_header_LO>::type model_name_; /*< The name of the MR scanner model */
379 
380  // Patient info
388 
389  // Acquisition Info
390  vil_dicom_header_type_of<vil_dicom_header_CS>::type scanning_seq_; /*< A description of the scanning sequence */
391  vil_dicom_header_type_of<vil_dicom_header_CS>::type sequence_var_; /*< A description of the sequence variant */
392  vil_dicom_header_type_of<vil_dicom_header_CS>::type scan_options_; /*< A description of various scan options */
393  vil_dicom_header_type_of<vil_dicom_header_CS>::type mr_acq_type_; /*< The acquisition type for this scan */
395  vil_dicom_header_type_of<vil_dicom_header_CS>::type angio_flag_; /*< The angio flag for this sequence */
405  vil_dicom_header_type_of<vil_dicom_header_LO>::type software_vers_; /*< Versions of the scanner software used */
417  vil_dicom_header_type_of<vil_dicom_header_DS>::type sar_; /*< The specific absorption rate */
418  vil_dicom_header_type_of<vil_dicom_header_CS>::type patient_pos_; /*< The position of the patient in the scanner */
419 
420  // Relationship info
426  vil_dicom_header_type_of<vil_dicom_header_IS>::type image_number_; /*< The number of this image instance */
428  std::vector<vil_dicom_header_type_of<vil_dicom_header_DS>::type> image_pos_; /*< The image position relative to the patient */
429  std::vector<vil_dicom_header_type_of<vil_dicom_header_DS>::type> image_orient_; /*< The image orientation relative to the patient */
431  vil_dicom_header_type_of<vil_dicom_header_IS>::type images_in_acq_; /*< Then number ot images in the acquisition */
432  vil_dicom_header_type_of<vil_dicom_header_LO>::type pos_ref_ind_; /*< The position reference indicator */
435 
436  // Image info
437  vil_dicom_header_type_of<vil_dicom_header_US>::type pix_samps_; /*< The number of samples per pixel */
446  vil_dicom_header_type_of<vil_dicom_header_DS>::type window_centre_; /*< The value of the image window's centre */
447  vil_dicom_header_type_of<vil_dicom_header_DS>::type window_width_; /*< The actual width of the image window */
448 
449  // Info from the tags specifically for reading the image data
455  vil_dicom_header_type_of<vil_dicom_header_US>::type pix_rep_; /*< The pixel representation (+/-) */
458 
459  // Info from procedure group
464 
465  // Non-standard info from Philips scanner
468 
469 };
470 
471 
472 //: Clears a header info struct
473 // \relatesalso vil_dicom_header_info
475 
476 
478 const unsigned short VIL_DICOM_HEADER_UNSPECIFIED_UNSIGNED = (unsigned short) -1;
479 constexpr double VIL_DICOM_HEADER_DEFAULTSIZE = 1.0;
482 const float VIL_DICOM_HEADER_DEFAULTSLOPE = 1.0f;
483 
484 //: A class to read and write the header part of a dicom file
485 //
486 // This class reads and writes the header section of a dicom file,
487 // determining the type and storing the information in a dicom
488 // structure.
490 {
491  public:
492 
495 
496  //: True if it is known DICOM format
497  bool isDicomFormat(vil_stream &);
498 
499  //: Read the dicom header into a header struct
500  // Reads the header section of the dicom file and stores the
501  // result in a header struct, which it returns. When finished,
502  // the file stream should be pointing at the start of the image
503  // data
504  // \param fs The file stream to read - on exit points to the start of the image data
505  // \return A dicom header struct containing the info gained from the header
506  // \sa lastHeader(), headerValid(), last_read_() and info_valid_()
508 
509  //: Method to return the last struct of header info set
510  //
511  // The class holds a dicom header info struct containing the
512  // info from the last dicom file read.
513  // \return A dicom header struct containing the info gained from the last header read
515 
516  //: Method to indicate if the header info held is valid or not
517  //
518  // \return TRUE if the header info is valid, otherwise false
519  bool headerValid(void);
520 
521  //: Return the current system endian
522  //
523  // \return The system endian for the architecture running the application
525 
526  //: Return the endian of the header being read
527  //
528  // \return The endian of the file currently being read.
529  // \sa determineMetaInfo() and file_endian_()
530 
532 
533  //: Return any encapsulated image type
534  //
535  // \return The encapsulated image type of the file currently being read.
537 
538  private:
539 
540  //: Method to determine the file type
541  //
542  // \param fs The file stream for the image to test
543  // \return The dicom file type or unknown
545 
546  //: Method to read the elements from the header
547  //
548  // This method fills the last_read_ header structure with
549  // the necessary fields
550  // \param fs The file stream to read from
551  // \sa readIdentifyingElements(), readPatientElements(),
552  // readAcquisitionElements(), readRelationshipElements(),
553  // readImageElements, readDelimiterElements(),
554  // readHeader() and last_read_()
555  void readHeaderElements(vil_stream &fs);
556 
557  //: Method to read the identifying group's details
558  //
559  // Fills the identifying details in the last_read_ structure
560  // from the file header
561  // \param element The element being read in the identifying
562  // group
563  // \param dblock_size The size of the data block for this
564  // element
565  // \param fs The file stream to read from
566  // \sa readHeaderElements(), readPatientElements(),
567  // readAcquisitionElements(), readRelationshipElements(),
568  // readImageElements(), readDelimiterElements() and last_read_()
569  void readIdentifyingElements(short element, int dblock_size,
570  vil_stream &fs);
571 
572  //: Method to read the patient details
573  //
574  // Fills the patient details in the last_read_ structure from
575  // the file header
576  // \param element The element being read in the patient group
577  // \param dblock_size The size of the data block for this
578  // element
579  // \param fs The file stream to read from
580  // \sa readHeaderElements(), readIdentifyingElements(),
581  // readAcquisitionElements(), readRelationshipElements(),
582  // readImageElements(), readDelimiterElements() and last_read_()
583  void readPatientElements(short element, int dblock_size,
584  vil_stream &fs);
585 
586  //: Method to read the acquisition group's details
587  //
588  // Fills the acquisition details in the last_read_ structure
589  // from the file header
590  // \param element The element being read in the acquisition
591  // group
592  // \param dblock_size The size of the data block for this
593  // element
594  // \param fs The file stream to read from
595  // \sa readHeaderElements(), readIdentifyingElements(),
596  // readPatientElements(), readRelationshipElements(),
597  // readImageElements(), readDelimiterElements() and last_read_()
598  void readAcquisitionElements(short element, int dblock_size,
599  vil_stream &fs);
600 
601  //: Method to read the relationship group's details
602  //
603  // Fills the relationship details in the last_read_ structure
604  // from the file header
605  // \param element The element being read in the relationship
606  // group
607  // \param dblock_size The size of the data block for this
608  // element
609  // \param fs The file stream to read from
610  // \sa readHeaderElements(), readIdentifyingElements(),
611  // readPatientElements(), readAcquisitionElements(),
612  // readImageElements(), readDelimiterElements()
613  // and last_read_()
614  void readRelationshipElements(short element, int dblock_size,
615  vil_stream &fs);
616 
617  //: Method to read the image group's details
618  //
619  // Fills the image details in the last_read_ structure from
620  // the file header
621  // \param element The element being read in the image group
622  // \param dblock_size The size of the data block for this
623  // element
624  // \param fs The file stream to read from
625  // \sa readHeaderElements(), readIdentifyingElements(),
626  // readPatientElements(), readAcquisitionElements(),
627  // readRelationshipElements(), readDelimiterElements()
628  // and last_read_()
629  void readImageElements(short element, int dblock_size,
630  vil_stream &fs);
631 
632  //: Method to read the delimiter group's details
633  //
634  // Certain field in the delimiter group have no data block, and
635  // so should not be skipped. This method takes the appropriate
636  // action - to skip or not to skip
637  // \param element The element being read in the delimiter group
638  // \param dblock_size The size of the data block for this element
639  // \param fs The file stream to read from
640  // \sa readHeaderElements(), readIdentifyingElements(),
641  // readPatientElements(), readAcquisitionElements(),
642  // readRelationshipElements(), readImageElements()
643  // and last_read_()
644  void readDelimiterElements(short element, int dblock_size,
645  vil_stream &fs);
646 
647  //: Method to read the procedure group's details
648  //
649  // \param element The element being read in the image group
650  // \param dblock_size The size of the data block for this
651  // element
652  // \param fs The file stream to read from
653  // \sa readHeaderElements(), readIdentifyingElements(),
654  // readPatientElements(), readAcquisitionElements(),
655  // readRelationshipElements(), readDelimiterElements()
656  // readProcedureElements()
657  // and last_read_()
658  void readProcedureElements(short element, int dblock_size,
659  vil_stream &fs);
660 
661  //: Method to read the (non-standard, private) Philips group details
662  //
663  // \param element The element being read in the image group
664  // \param dblock_size The size of the data block for this
665  // element
666  // \param fs The file stream to read from
667  // \sa readHeaderElements(), readIdentifyingElements(),
668  // readPatientElements(), readAcquisitionElements(),
669  // readRelationshipElements(), readDelimiterElements()
670  // readProcedureElements(), readNSPhilipsElements()
671  // and last_read_()
672  void readNSPhilipsElements(short element, int dblock_size,
673  vil_stream &fs);
674 
675  //: Method to convert the Value Representation (VR) (if it exists)
676  //
677  // \param data_block Contains the VR or data block size (always
678  // holds the data block size on exit
679  // \param fs The file stream to read from
680  // \sa readHeaderElements()
681  bool convertValueRepresentation(unsigned int &dblock_size,
682  vil_stream &ifs);
683 
684  //: Method to determine whether or not the actual pixel data has been reached
685  //
686  // \param group The current group to test
687  // \param element The element within that group
688  // \return TRUE if it is the pixel data, otherwise false
689  // \sa readHeaderElements()
690  bool pixelDataFound(short group, short element);
691 
692  // Method to clear a header info struct
693  //
694  // \sa last_read_() and info_valid_()
695  void clearInfo(void);
696 
697  //: Work out whether the current architecture is big or little endian
698  //
699  // \return The system endian value calculated
700  // \sa systemEndian() and endian_()
702 
703  //: Initialise all the necessary meta-file stuff
704  //
705  // \return The endian of the file
706  // \sa fileEndian(), file_endian_(), imageType(), and image_type_();
708 
709  //: Method to byte swap an unsigned short int if necessary
710  //
711  // \param short_in The unsigned short to swap
712  // \return The swapped unsigned short
713  // \sa intSwap() and charSwap()
714  vxl_uint_16 shortSwap(vxl_uint_16 short_in);
715 
716  //: Method to byte swap an unsigned int if necessary
717  //
718  // \param int_in The unsigned int to swap
719  // \return The swapped unsigned int
720  // \sa shortSwap() and charSwap()
721  vxl_uint_32 intSwap(vxl_uint_32 int_in);
722 
723  //: Method to swap a number inside a char array
724  //
725  // \param char_in The char array to swap - on exit contains the result
726  // \param val_size The size of the var to swap
727  void charSwap(char *char_in, int val_size);
728 
729  private:
730 
731  //: Holds the info from the last header read
732  //
733  // \sa readHeader(), lastHeader(), headerValid(), clearInfo(),
734  // readHeaderElements() and info_valid_()
736 
737  //: TRUE if the header info is valid (i.e. has been read) otherwise FALSE
738  //
739  // \sa readHeader(), lastHeader(), headerValid(), clearInfo() and last_read_()
741 
742  //: A variable to hold the discovered architecture endian
743  //
744  // \sa calculateEndian() and systemEndian()
746 
747  //: A variable to hold the current header file's endian
748  //
749  // \sa determineMetaInfo() and fileEndian()
751 
752  //: A variable to hole the current encapsulate file type (if any)
753  //
754  // \sa determineMetaInfo() and imageType()
756 };
757 
758 void vil_dicom_header_print(std::ostream &os, const vil_dicom_header_info &s);
759 
760 #endif // vil_dicom_header_h_
vil_dicom_header_type_of< vil_dicom_header_US >::type small_im_pix_val_
const vxl_uint_16 VIL_DICOM_HEADER_NSPHILIPSGROUP
Stream interface for VIL image loaders.
const vxl_uint_16 VIL_DICOM_HEADER_IDMANUFACTURER
vil_dicom_header_type_of< vil_dicom_header_CS >::type phase_enc_dir_
const char *const VIL_DICOM_HEADER_JPEGFULLPROG_P11_13
const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTHISTORY
vil_dicom_header_type
DICOM types.
const vxl_uint_16 VIL_DICOM_HEADER_DLITEMDELIMITATIONITEM
vil_dicom_header_type_of< vil_dicom_header_CS >::type modality_
vil_dicom_header_type_of< vil_dicom_header_IS >::type acquisition_number_
const vxl_uint_16 VIL_DICOM_HEADER_AQPATIENTPOSITION
vil_dicom_header_type_of< vil_dicom_header_IS >::type echo_train_length_
const char *const VIL_DICOM_HEADER_FLOATINGPOINTSINGLE
vil_dicom_header_type_of< vil_dicom_header_CS >::type angio_flag_
const vxl_uint_16 VIL_DICOM_HEADER_PXGROUPLENGTH
vil_dicom_header_type_of< vil_dicom_header_IS >::type echo_numbers_
const char *const VIL_DICOM_HEADER_JPEGSPECTRAL_P6_8
const vxl_uint_16 VIL_DICOM_HEADER_PIXELGROUP
const vxl_uint_16 VIL_DICOM_HEADER_RSPOSITIONREFERENCE
vil_dicom_header_type_of< vil_dicom_header_DS >::type spacing_x_
const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGEDATE
vil_dicom_header_type_of< vil_dicom_header_US >::type exposedarea_y_
const vxl_uint_16 VIL_DICOM_HEADER_PRINTJOBGROUP
const char *const VIL_DICOM_HEADER_EXPLICITLITTLE
const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELPADDINGVALUE
const vxl_uint_16 VIL_DICOM_HEADER_NSPHILIPSPRIVATEINTERCEPT
const vxl_uint_16 VIL_DICOM_HEADER_RSSERIESINSTANCEUID
vil_dicom_header_type_of< vil_dicom_header_US >::type allocated_bits_
vil_dicom_header_type_of< vil_dicom_header_DS >::type sar_
const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGETYPE
const char *const VIL_DICOM_HEADER_APPLICATIONENTRY
const vxl_uint_16 VIL_DICOM_HEADER_IMROWS
const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESDATE
vil_dicom_header_type_of< vil_dicom_header_IS >::type series_number_
const vxl_uint_16 VIL_DICOM_HEADER_OVERLAYGROUP
vil_dicom_header_type_of< vil_dicom_header_SH >::type station_name_
const vxl_uint_16 VIL_DICOM_HEADER_AQECHOTIME
vil_dicom_header_type_of< vil_dicom_header_DS >::type trigger_time_
bool isDicomFormat(vil_stream &)
True if it is known DICOM format.
const vxl_uint_16 VIL_DICOM_HEADER_BASICFILMBOXGROUP
vil_dicom_header_type_of< vil_dicom_header_US >::type size_x_
vil_dicom_header_type_of< vil_dicom_header_IS >::type images_in_acq_
const vxl_uint_16 VIL_DICOM_HEADER_AQSOFTWAREVERSION
vil_dicom_header_type_of< vil_dicom_header_LO >::type manufacturer_
vil_dicom_header_type_of< vil_dicom_header_CS >::type sequence_var_
vil_dicom_header_type_of< vil_dicom_header_AS >::type patient_age_
void readIdentifyingElements(short element, int dblock_size, vil_stream &fs)
Method to read the identifying group's details.
vil_dicom_header_type_of< vil_dicom_header_PN >::type operator_name_
const vxl_uint_16 VIL_DICOM_HEADER_AQRECEIVINGCOIL
vil_dicom_header_endian fileEndian(void)
Return the endian of the header being read.
const vxl_uint_16 VIL_DICOM_HEADER_EXPOSEDAREA
const vxl_uint_16 VIL_DICOM_HEADER_AQTRIGGERTIME
vil_dicom_header_type_of< vil_dicom_header_DS >::type window_centre_
vil_dicom_header_type_of< vil_dicom_header_IS >::type heart_rate_
vil_dicom_header_type_of< vil_dicom_header_LO >::type series_desc_
const char *const VIL_DICOM_HEADER_JPEGLLESSDEF_P14_SV1
vil_dicom_header_type_of< vil_dicom_header_LO >::type institution_name_
const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTBIRTHDATE
const char *const VIL_DICOM_HEADER_LONGTEXT
const vxl_uint_16 VIL_DICOM_HEADER_IDINSTITUTIONADDRESS
constexpr double VIL_DICOM_HEADER_DEFAULTSIZE
const vxl_uint_16 VIL_DICOM_HEADER_CURVEGROUP
const char *const VIL_DICOM_HEADER_FLOATINGPOINTDOUBLE
const vxl_uint_16 VIL_DICOM_HEADER_AQSCANOPTIONS
const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYTIME
const vxl_uint_16 VIL_DICOM_HEADER_PXPIXELDATA
const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESTIME
const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTAGE
void readAcquisitionElements(short element, int dblock_size, vil_stream &fs)
Method to read the acquisition group's details.
vil_dicom_header_type_of< vil_dicom_header_LO >::type patient_id_
void readRelationshipElements(short element, int dblock_size, vil_stream &fs)
Method to read the relationship group's details.
const vxl_uint_16 VIL_DICOM_HEADER_NSPHILIPSPRIVATESLOPE
const vxl_uint_16 VIL_DICOM_HEADER_IDIMAGETIME
const char *const VIL_DICOM_HEADER_JPEGSPECTRAL_P7_9
vil_dicom_header_type_of< vil_dicom_header_DS >::type number_of_averages_
vil_dicom_header_type_of< vil_dicom_header_PN >::type att_phys_name_
const vxl_uint_16 VIL_DICOM_HEADER_IDMODALITY
const vxl_uint_16 VIL_DICOM_HEADER_PRREALWORLDVALUESLOPE
const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELSPACING
vil_dicom_header_type_of< vil_dicom_header_IS >::type card_num_images_
std::vector< vil_dicom_header_type_of< vil_dicom_header_DS >::type > image_orient_
const vxl_uint_16 VIL_DICOM_HEADER_VISITGROUP
vil_dicom_header_type_of< vil_dicom_header_DS >::type flip_angle_
vil_dicom_header_type_of< vil_dicom_header_DS >::type reconst_diameter_
vil_dicom_header_type_of< vil_dicom_header_US >::type size_y_
vil_dicom_header_endian calculateEndian(void)
Work out whether the current architecture is big or little endian.
const char *const VIL_DICOM_HEADER_JPEGFULLHIER_P25_27
const unsigned short VIL_DICOM_HEADER_UNSPECIFIED_UNSIGNED
const char *const VIL_DICOM_HEADER_JPEGLOSSLESS_P14
const float VIL_DICOM_HEADER_DEFAULTINTERCEPT
const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTWEIGHT
const char *const VIL_DICOM_HEADER_JPEGEXTHIER_P17_19
std::vector< vil_dicom_header_type_of< vil_dicom_header_DS >::type > image_pos_
vil_dicom_header_endian determineMetaInfo(vil_stream &fs)
Initialise all the necessary meta-file stuff.
vil_dicom_header_image_type image_type_
const char *const VIL_DICOM_HEADER_JPEGFULLHIER_P24_26
const vxl_uint_16 VIL_DICOM_HEADER_IMPHOTOMETRICINTERP
bool pixelDataFound(short group, short element)
Method to determine whether or not the actual pixel data has been reached.
const vxl_uint_16 VIL_DICOM_HEADER_AQSEQUENCENAME
vil_dicom_header_endian
Endian types.
const vxl_uint_16 VIL_DICOM_HEADER_PROCEDUREGROUP
const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGENUMBER
vil_dicom_header_type_of< vil_dicom_header_DS >::type res_slope_
bool headerValid(void)
Method to indicate if the header info held is valid or not.
const vxl_uint_16 VIL_DICOM_HEADER_AQSEQUENCEVARIANT
vil_dicom_header_type_of< vil_dicom_header_UI >::type sop_cl_uid_
void vil_dicom_header_info_clear(vil_dicom_header_info &info)
Clears a header info struct.
const vxl_uint_16 VIL_DICOM_HEADER_DLITEM
const char *const VIL_DICOM_HEADER_JPEGEXTHIER_P16_18
const char *const VIL_DICOM_HEADER_AGESTRING
const vxl_uint_16 VIL_DICOM_HEADER_AQFLIPANGLE
const vxl_uint_16 VIL_DICOM_HEADER_STUDYGROUP
vil_dicom_header_type_of< vil_dicom_header_FD >::type real_world_value_slope_
bool info_valid_
TRUE if the header info is valid (i.e. has been read) otherwise FALSE.
const vxl_uint_16 VIL_DICOM_HEADER_IDGROUPLENGTH
const char *const VIL_DICOM_HEADER_JPEGLLESSHIER_P28
const char *const VIL_DICOM_HEADER_JPEGLLESSHIER_P29
vil_dicom_header_type_of< vil_dicom_header_CS >::type image_id_type_
vil_dicom_header_type_of< vil_dicom_header_PN >::type patient_name_
vil_dicom_header_type_of< vil_dicom_header_LT >::type patient_hist_
const char *const VIL_DICOM_HEADER_SHORTSTRING
const vxl_uint_16 VIL_DICOM_HEADER_AQMRACQUISITIONTYPE
const vxl_uint_16 VIL_DICOM_HEADER_RELATIONSHIPGROUP
vil_dicom_header_endian file_endian_
vil_dicom_header_endian endian_
A variable to hold the discovered architecture endian.
const vxl_uint_16 VIL_DICOM_HEADER_IMBITSSTORED
vil_dicom_header_type_of< vil_dicom_header_DS >::type imager_spacing_y_
const vxl_uint_16 VIL_DICOM_HEADER_IMLARGEIMPIXELVALUE
const vxl_uint_16 VIL_DICOM_HEADER_AQCARDIACNUMBEROFIMAGES
const vxl_uint_16 VIL_DICOM_HEADER_PRINTERGROUP
vil_dicom_header_type_of< vil_dicom_header_DS >::type inversion_time_
vil_dicom_header_type_of< vil_dicom_header_DA >::type series_date_
vil_dicom_header_endian sys_endian_
const vxl_uint_16 VIL_DICOM_HEADER_RESULTSGROUP
Stream interface for VIL image loaders.
Definition: vil_stream.h:21
const char *const VIL_DICOM_HEADER_CODESTRING
vil_dicom_header_type_of< vil_dicom_header_SH >::type sequence_name_
void readPatientElements(short element, int dblock_size, vil_stream &fs)
Method to read the patient details.
const vxl_uint_16 VIL_DICOM_HEADER_DEVICEGROUP
const vxl_uint_16 VIL_DICOM_HEADER_WAVEFORMGROUP
vil_dicom_header_type_of< vil_dicom_header_DS >::type echo_time_
const vxl_uint_16 VIL_DICOM_HEADER_IDACCESSIONNUMBER
const vxl_uint_16 VIL_DICOM_HEADER_IDLENGTHTOEND
vil_dicom_header_type_of< vil_dicom_header_US >::type pixel_padding_val_
const vxl_uint_16 VIL_DICOM_HEADER_AQNUMBEROFAVERAGES
vil_dicom_header_type_of< vil_dicom_header_DS >::type slice_location_
const char *const VIL_DICOM_HEADER_JPEGLOSSLESS_P15
void readProcedureElements(short element, int dblock_size, vil_stream &fs)
Method to read the procedure group's details.
const float VIL_DICOM_HEADER_DEFAULTSIZE_FLOAT
vil_dicom_header_endian systemEndian(void)
Return the current system endian.
const vxl_uint_16 VIL_DICOM_HEADER_IDACQUISITIONTIME
const vxl_uint_16 VIL_DICOM_HEADER_DELIMITERGROUP
vil_dicom_header_type_of< vil_dicom_header_US >::type high_bit_
const short VIL_DICOM_HEADER_UNSPECIFIED
const vxl_uint_16 VIL_DICOM_HEADER_AQPHASEENCODINGDIRECTION
const vxl_uint_16 VIL_DICOM_HEADER_AQSLICETHICKNESS
const vxl_uint_16 VIL_DICOM_HEADER_ACQUISITIONGROUP
vil_dicom_header_info readHeader(vil_stream &fs)
Read the dicom header into a header struct.
vil_dicom_header_type_of< vil_dicom_header_DA >::type acquisition_date_
const vxl_uint_16 VIL_DICOM_HEADER_AQPIXELBANDWIDTH
DICOM information read from the header.
const vxl_uint_16 VIL_DICOM_HEADER_IMWINDOWCENTER
const vxl_uint_16 VIL_DICOM_HEADER_MFTRANSFERSYNTAX
const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGEPOSITION
const vxl_uint_16 VIL_DICOM_HEADER_IDENTIFYINGGROUP
const char *const VIL_DICOM_HEADER_OTHERBYTE
const vxl_uint_16 VIL_DICOM_HEADER_AQTRIGGERWINDOW
const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTID
const char *const VIL_DICOM_HEADER_JPEGFULLPROG_P10_12
const vxl_uint_16 VIL_DICOM_HEADER_BASICDIRGROUP
vil_dicom_header_type_of< vil_dicom_header_TM >::type image_time_
const vxl_uint_16 VIL_DICOM_HEADER_RSFRAMEOFREFERENCEUID
const vxl_uint_16 VIL_DICOM_HEADER_AQIMAGERPIXELSPACING
const vxl_uint_16 VIL_DICOM_HEADER_BASICFILMSESSIONGROUP
vil_dicom_header_type_of< vil_dicom_header_US >::type size_z_
const vxl_uint_16 VIL_DICOM_HEADER_IDSOPCLASSID
const char *const VIL_DICOM_HEADER_IMPLICITLITTLE
const char *const VIL_DICOM_HEADER_LONGSTRING
vil_dicom_header_type_of< vil_dicom_header_IS >::type image_number_
vil_dicom_header_type_of< vil_dicom_header_CS >::type patient_sex_
const char *const VIL_DICOM_HEADER_UNKNOWN
const char *const VIL_DICOM_HEADER_RLELOSSLESS
const vxl_uint_16 VIL_DICOM_HEADER_IMHIGHBIT
vil_dicom_header_type_of< vil_dicom_header_US >::type large_im_pix_val_
vil_dicom_header_type_of< vil_dicom_header_US >::type pix_samps_
vil_dicom_header_type_of< vil_dicom_header_SH >::type accession_number_
const vxl_uint_16 VIL_DICOM_HEADER_DLSEQDELIMITATIONITEM
vxl_uint_16 shortSwap(vxl_uint_16 short_in)
Method to byte swap an unsigned short int if necessary.
vil_dicom_header_type_of< vil_dicom_header_DA >::type image_date_
const vxl_uint_16 VIL_DICOM_HEADER_IDACQUISITIONDATE
#define vr_macro(VR, CPPT)
vil_dicom_header_type_of< vil_dicom_header_TM >::type study_time_
const float VIL_DICOM_HEADER_DEFAULTSLOPE
vil_dicom_header_type_of< vil_dicom_header_UI >::type ser_ins_uid_
const vxl_uint_16 VIL_DICOM_HEADER_METAFILEGROUP
const vxl_uint_16 VIL_DICOM_HEADER_IDSOPINSTANCEID
const char *const VIL_DICOM_HEADER_SIGNEDSHORT
void readNSPhilipsElements(short element, int dblock_size, vil_stream &fs)
Method to read the (non-standard, private) Philips group details.
const vxl_uint_16 VIL_DICOM_HEADER_RSSERIESNUMBER
vil_dicom_header_type_of< vil_dicom_header_DS >::type pixel_bandwidth_
const vxl_uint_16 VIL_DICOM_HEADER_IMSAMPLESPERPIXEL
vil_dicom_header_type_of< vil_dicom_header_US >::type pix_rep_
vil_dicom_header_type file_type_
const vxl_uint_16 VIL_DICOM_HEADER_AQANGIOFLAG
const vxl_uint_16 VIL_DICOM_HEADER_COMMANDGROUP
void readDelimiterElements(short element, int dblock_size, vil_stream &fs)
Method to read the delimiter group's details.
vil_dicom_header_endian file_endian_
A variable to hold the current header file's endian.
const vxl_uint_16 VIL_DICOM_HEADER_IDSPECIFICCHARACTER
const vxl_uint_16 VIL_DICOM_HEADER_AQHEARTRATE
vil_dicom_header_type_of< vil_dicom_header_DS >::type mag_field_strength_
const vxl_uint_16 VIL_DICOM_HEADER_PIGROUPLENGTH
vil_dicom_header_type_of< vil_dicom_header_DS >::type window_width_
vil_dicom_header_info lastHeader(void)
Method to return the last struct of header info set.
const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYDATE
const vxl_uint_16 VIL_DICOM_HEADER_IDOPERATORNAME
const vxl_uint_16 VIL_DICOM_HEADER_IMCOLUMNS
vxl_uint_32 intSwap(vxl_uint_32 int_in)
Method to byte swap an unsigned int if necessary.
vil_dicom_header_type_of< vil_dicom_header_DS >::type repetition_time_
const vxl_uint_16 VIL_DICOM_HEADER_AQPROTOCOLNAME
vil_dicom_header_type_of< vil_dicom_header_IS >::type trigger_window_
const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGESINACQUISITION
vil_dicom_header_image_type
Encapsulated image types.
const vxl_uint_16 VIL_DICOM_HEADER_IDINSTITUTIONNAME
vil_dicom_header_type_of< vil_dicom_header_PN >::type ref_phys_name_
const vxl_uint_16 VIL_DICOM_HEADER_IDSTUDYDESCRIPTION
const char *const VIL_DICOM_HEADER_UNSIGNEDSHORT
void readImageElements(short element, int dblock_size, vil_stream &fs)
Method to read the image group's details.
const vxl_uint_16 VIL_DICOM_HEADER_RSSTUDYINSTANCEUID
const vxl_uint_32 VIL_DICOM_HEADER_ALLSET
vil_dicom_header_type determineFileType(vil_stream &fs)
Method to determine the file type.
const vxl_uint_16 VIL_DICOM_HEADER_AQSLICESPACING
const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGECOMMENTS
const char *const VIL_DICOM_HEADER_JPEGSPECHIER_P20_22
const vxl_uint_16 VIL_DICOM_HEADER_IMBITSALLOCATED
bool convertValueRepresentation(unsigned int &dblock_size, vil_stream &ifs)
Method to convert the Value Representation (VR) (if it exists).
const vxl_uint_16 VIL_DICOM_HEADER_RSSTUDYID
vil_dicom_header_type_of< vil_dicom_header_SH >::type study_id_
const vxl_uint_16 VIL_DICOM_HEADER_AQSAR
const vxl_uint_16 VIL_DICOM_HEADER_IMWINDOWWIDTH
const vxl_uint_16 VIL_DICOM_HEADER_IMAGEGROUP
vil_dicom_header_type_of< vil_dicom_header_DS >::type philips_private_slope_
vil_dicom_header_type_of< vil_dicom_header_LO >::type study_desc_
const vxl_uint_16 VIL_DICOM_HEADER_IDATTENDINGPHYSICIAN
const vxl_uint_16 VIL_DICOM_HEADER_IDSERIESDESCRIPTION
const vxl_uint_16 VIL_DICOM_HEADER_AQSCANNINGSEQUENCE
const char *const VIL_DICOM_HEADER_UNLIMITEDTEXT
const vxl_uint_16 VIL_DICOM_HEADER_AQRECONTRUCTIONDIAMETER
const vxl_uint_16 VIL_DICOM_HEADER_IMSMALLIMPIXELVALUE
const vxl_uint_16 VIL_DICOM_HEADER_RSIMAGEORIENTATION
vil_dicom_header_type_of< vil_dicom_header_ST >::type institution_addr_
const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTSEX
vil_dicom_header_type_of< vil_dicom_header_LO >::type model_name_
const vxl_uint_16 VIL_DICOM_HEADER_RSAQUISITIONNUMBER
const char *const VIL_DICOM_HEADER_INTEGERSTRING
const vxl_uint_16 VIL_DICOM_HEADER_PRREALWORLDVALUEINTERCEPT
const vxl_uint_16 VIL_DICOM_HEADER_NMIMAGEGROUP
vil_dicom_header_type_of< vil_dicom_header_DS >::type philips_private_intercept_
const vxl_uint_16 VIL_DICOM_HEADER_AQECHOTRAINLENGTH
const char *const VIL_DICOM_HEADER_OTHERWORD
const char *const VIL_DICOM_HEADER_UNIQUEIDENTIFIER
vil_dicom_header_type_of< vil_dicom_header_DS >::type slice_thickness_
vil_dicom_header_type_of< vil_dicom_header_CS >::type mr_acq_type_
vil_dicom_header_type_of< vil_dicom_header_DA >::type patient_dob_
vil_dicom_header_type_of< vil_dicom_header_UI >::type frame_of_ref_
vil_dicom_header_type_of< vil_dicom_header_FD >::type real_world_value_intercept_
const vxl_uint_16 VIL_DICOM_HEADER_AQECHONUMBERS
const vxl_uint_16 VIL_DICOM_HEADER_PIPATIENTNAME
vil_dicom_header_type_of< vil_dicom_header_CS >::type scanning_seq_
const vxl_uint_16 VIL_DICOM_HEADER_IMPLANES
const vxl_uint_16 VIL_DICOM_HEADER_IDREFERRINGPHYSICIAN
const vxl_uint_16 VIL_DICOM_HEADER_IMRESCALESLOPE
const vxl_uint_16 VIL_DICOM_HEADER_IMRESCALEINTERCEPT
vil_dicom_header_image_type imageType(void)
Return any encapsulated image type.
const char *const VIL_DICOM_HEADER_JPEGEXTENDED_P3_5
void readHeaderElements(vil_stream &fs)
Method to read the elements from the header.
const char *const VIL_DICOM_HEADER_DECIMALSTRING
const char *const VIL_DICOM_HEADER_DATE
const char *const VIL_DICOM_HEADER_JPEGSPECHIER_P21_23
const vxl_uint_16 VIL_DICOM_HEADER_IMPIXELREPRESENTATION
const vxl_uint_16 VIL_DICOM_HEADER_MFGROUPLENGTH
const char *const VIL_DICOM_HEADER_JPEGDEFLOSSY_P2_4
const vxl_uint_16 VIL_DICOM_HEADER_AQMAGNETICFIELDSTRENGTH
const char *const VIL_DICOM_HEADER_TIME
vil_dicom_header_type_of< vil_dicom_header_DS >::type res_intercept_
const char *const VIL_DICOM_HEADER_JPEGBASELINE_P1
vil_dicom_header_type_of< vil_dicom_header_UI >::type stud_ins_uid_
vil_dicom_header_type_of< vil_dicom_header_DS >::type spacing_y_
constexpr unsigned VIL_DICOM_HEADER_MAXHEADERSIZE
const char *const VIL_DICOM_HEADER_SHORTTEXT
const vxl_uint_16 VIL_DICOM_HEADER_IDMANUFACTURERMODEL
vil_dicom_header_vr_type
vil_dicom_header_type_of< vil_dicom_header_SH >::type receiving_coil_
vil_dicom_header_type_of< vil_dicom_header_DS >::type spacing_slice_
void vil_dicom_header_print(std::ostream &os, const vil_dicom_header_info &s)
vil_dicom_header_type_of< vil_dicom_header_CS >::type pat_orient_
const vxl_uint_16 VIL_DICOM_HEADER_MEDIAGROUP
vil_dicom_header_type_of< vil_dicom_header_US >::type exposedarea_x_
vil_dicom_header_type_of< vil_dicom_header_UI >::type sop_in_uid_
vil_dicom_header_type_of< vil_dicom_header_CS >::type patient_pos_
const vxl_uint_16 VIL_DICOM_HEADER_TEXTGROUP
vil_dicom_header_type_of< vil_dicom_header_CS >::type scan_options_
const char *const VIL_DICOM_HEADER_DATETIME
const char *const VIL_DICOM_HEADER_ATTRIBUTETAG
vil_dicom_header_type_of< vil_dicom_header_CS >::type photo_interp_
const vxl_uint_16 VIL_DICOM_HEADER_PADGROUP
vil_dicom_header_image_type image_type_
A variable to hole the current encapsulate file type (if any).
const char *const VIL_DICOM_HEADER_SEQUENCE
const vxl_uint_16 VIL_DICOM_HEADER_IDSTATIONNAME
const vxl_uint_16 VIL_DICOM_HEADER_BASICIMAGEOVERLAYBOXGROUP
vil_dicom_header_type_of< vil_dicom_header_LO >::type software_vers_
const char *const VIL_DICOM_HEADER_PERSONNAME
const vxl_uint_16 VIL_DICOM_HEADER_BASICIMAGEBOXGROUP
vil_dicom_header_type_of< vil_dicom_header_LO >::type protocol_name_
A class to read and write the header part of a dicom file.
const char *const VIL_DICOM_HEADER_UNSIGNEDLONG
void charSwap(char *char_in, int val_size)
Method to swap a number inside a char array.
const char *const VIL_DICOM_HEADER_EXPLICITBIG
const vxl_uint_16 VIL_DICOM_HEADER_RSPATIENTORIENTATION
vil_dicom_header_type_of< vil_dicom_header_LT >::type image_comments_
vil_dicom_header_type_of< vil_dicom_header_TM >::type acquisition_time_
const vxl_uint_16 VIL_DICOM_HEADER_BASICANNOTATIONBOXGROUP
const char *const VIL_DICOM_HEADER_SIGNEDLONG
vil_dicom_header_type_of< vil_dicom_header_DS >::type imager_spacing_x_
vil_dicom_header_type_of< vil_dicom_header_TM >::type series_time_
vil_dicom_header_type_of< vil_dicom_header_DA >::type study_date_
const vxl_uint_16 VIL_DICOM_HEADER_AQREPETITIONTIME
const vxl_uint_16 VIL_DICOM_HEADER_PATIENTINFOGROUP
vil_dicom_header_type_of< vil_dicom_header_LO >::type pos_ref_ind_
const vxl_uint_16 VIL_DICOM_HEADER_AQINVERSIONTIME
const vxl_uint_16 VIL_DICOM_HEADER_RSSLICELOCATION
vil_dicom_header_type_of< vil_dicom_header_DS >::type patient_weight_
vil_dicom_header_type_of< vil_dicom_header_US >::type stored_bits_
vil_dicom_header_info last_read_
Holds the info from the last header read.