ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkSiemensVisionImageIO.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
33 #ifndef __itkSiemensVisionImageIO_h
34 #define __itkSiemensVisionImageIO_h
35 #include "ITKIOSiemensExport.h"
36 
37 
38 #include "itkIPLCommonImageIO.h"
39 
40 namespace itk
41 {
50 class ITKIOSiemens_EXPORT SiemensVisionImageIO:public IPLCommonImageIO
51 {
52 public:
57 
59  itkNewMacro(Self);
60 
62  itkTypeMacro(SiemensVisionImageIO, Superclass);
63 
64  /*-------- This part of the interfaces deals with reading data. ----- */
65 
72  virtual bool CanReadFile(const char *FileNameToRead) ITK_OVERRIDE;
73 
74  /* * Set the spacing and dimension information for the set filename. */
75  // Implemented in superclass
76  // virtual void ReadImageInformation();
77 
78  /* * Get the type of the pixel. */
79  // Implemented in superclass
80  // virtual const std::type_info& GetPixelType() const;
81 
82  /* * Reads the data from disk into the memory buffer provided. */
83  // Implemented in superclass
84  // virtual void Read(void* buffer);
85 
86  /* * Compute the size (in bytes) of the components of a pixel. For
87  * example, and RGB pixel of unsigned char would have a
88  * component size of 1 byte. */
89  // Implemented in superclass
90  // virtual unsigned int GetComponentSize() const;
91 
92  /*-------- This part of the interfaces deals with writing data. ----- */
93 
94  /* * Determine if the file can be written with this ImageIO implementation.
95  * \param FileNameToWrite The name of the file to test for writing.
96  * \author Hans J. Johnson
97  * \post Sets classes ImageIOBase::m_FileName variable to be FileNameToWrite
98  * \return Returns true if this ImageIO can write the file specified.
99  */
100  // Implemented in superclass
101  // virtual bool CanWriteFile(const char * FileNameToWrite);
102 
103  /* * Set the spacing and dimension information for the set filename. */
104  // Implemented in superclass
105  // virtual void WriteImageInformation();
106 
107  /* * Writes the data to disk from the memory buffer provided. Make sure
108  * that the IORegions has been set properly. */
109  // Implemented in superclass
110  // virtual void Write(const void* buffer);
111 
112 protected:
115  // Implemented in superclass
116  // void PrintSelf(std::ostream& os, Indent indent) const;
117  virtual GEImageHeader * ReadHeader(const char *FileNameToRead) ITK_OVERRIDE;
118 
119 private:
120  typedef enum {
121  HDR_STUDY_YEAR = 0, // Study date year, u_int
122  HDR_STUDY_YEAR_LEN = 4,
123  HDR_STUDY_MONTH = 4, // Study date month, u_int
124  HDR_STUDY_MONTH_LEN = 4,
125  HDR_STUDY_DAY = 8, // Study date day, u_int
126  HDR_STUDY_DAY_LEN = 4,
127  HDR_ACQ_YEAR = 12, // Acquisition date year, u_int
128  HDR_ACQ_YEAR_LEN = 4,
129  HDR_ACQ_MONTH = 16, // Acquisition date month, u_int
130  HDR_ACQ_MONTH_LEN = 4,
131  HDR_ACQ_DAY = 20, // Acquisition date day, u_int
132  HDR_ACQ_DAY_LEN = 4,
133  HDR_IMAGE_YEAR = 24, // Image date year, u_int
134  HDR_IMAGE_YEAR_LEN = 4,
135  HDR_IMAGE_MONTH = 28, // Image date month, u_int
136  HDR_IMAGE_MONTH_LEN = 4,
137  HDR_IMAGE_DAY = 32, // Image date day, u_int
138  HDR_IMAGE_DAY_LEN = 4,
139  HDR_STUDY_HOUR = 36, // Study time hour, u_int
140  HDR_STUDY_HOUR_LEN = 4,
141  HDR_STUDY_MIN = 40, // Study time minute, u_int
142  HDR_STUDY_MIN_LEN = 4,
143  HDR_STUDY_SEC = 44, // Study time second, u_int
144  HDR_STUDY_SEC_LEN = 4,
145  HDR_ACQ_HOUR = 52, // Acquisition time second, u_int
146  HDR_ACQ_HOUR_LEN = 4,
147  HDR_ACQ_MIN = 56, // Acquisition time second, u_int
148  HDR_ACQ_MIN_LEN = 4,
149  HDR_ACQ_SEC = 60, // Acquisition time second, u_int
150  HDR_ACQ_SEC_LEN = 4,
151  HDR_IMAGE_HOUR = 68, // Image Creation time second, u_int
152  HDR_IMAGE_HOUR_LEN = 4,
153  HDR_IMAGE_MIN = 72, // Image Creation time second, u_int
154  HDR_IMAGE_MIN_LEN = 4,
155  HDR_IMAGE_SEC = 76, // Image Creation time second, u_int
156  HDR_IMAGE_SEC_LEN = 4,
157  HDR_MANUFAC = 96, // Scanner Manufacturer, char
158  HDR_MANUFAC_LEN = 7,
159  HDR_INSTUTE_NAME = 105, // Institution Name, char
160  HDR_INSTUTE_NAME_LEN = 25,
161  HDR_ANNOTATION = 186, // Annotation, char
162  HDR_ANNOTATION_LEN = 32,
163  HDR_MODEL_NAME = 281, // Scanner Model Name, char
164  HDR_MODEL_NAME_LEN = 12,
165  HDR_LMOVE_YEAR = 412, // Date of Last Image Move - year, u_int
166  HDR_LMOVE_YEAR_LEN = 4,
167  HDR_LMOVE_MONTH = 416, // Date of Last Image Move - month, u_int
168  HDR_LMOVE_MONTH_LEN = 4,
169  HDR_LMOVE_DAY = 420, // Date of Last Image Move - day, u_int
170  HDR_LMOVE_DAY_LEN = 4,
171  HDR_LMOVE_HOUR = 424, // Date of Last Image Move - hour, u_int
172  HDR_LMOVE_HOUR_LEN = 4,
173  HDR_LMOVE_MIN = 428, // Date of Last Image Move - minute, u_int
174  HDR_LMOVE_MIN_LEN = 4,
175  HDR_LMOVE_SEC = 432, // Date of Last Image Move - second, u_int
176  HDR_LMOVE_SEC_LEN = 4,
177  HDR_PAT_NAME = 768, // Patient Name, char
178  HDR_PAT_NAME_LEN = 25,
179  HDR_PAT_ID = 795, // Patient ID Number, char
180  HDR_PAT_ID_LEN = 12,
181  HDR_DOB_YEAR = 808, // Date of Birth year, u_int
182  HDR_DOB_YEAR_LEN = 4,
183  HDR_DOB_MONTH = 812, // Date of Birth month, u_int
184  HDR_DOB_MONTH_LEN = 4,
185  HDR_DOB_DAY = 816, // Date of Birth day, u_int
186  HDR_DOB_DAY_LEN = 4,
187  HDR_PAT_AGE = 851, // Patient Age, char
188  HDR_PAT_AGE_LEN = 3,
189  HDR_AGE_UNIT = 854, // Patient Age Unit, char
190  HDR_AGE_UNIT_LEN = 1,
191  HDR_REG_YEAR = 1052, // Registration Date year, u_int
192  HDR_REG_YEAR_LEN = 4,
193  HDR_REG_MONTH = 1056, // Registration Date month, u_int
194  HDR_REG_MONTH_LEN = 4,
195  HDR_REG_DAY = 1060, // Registration Date day, u_int
196  HDR_REG_DAY_LEN = 4,
197  HDR_REG_HOUR = 1064, // Registration Time hour, u_int
198  HDR_REG_HOUR_LEN = 4,
199  HDR_REG_MIN = 1068, // Registration Time minute, u_int
200  HDR_REG_MIN_LEN = 4,
201  HDR_REG_SEC = 1072, // Registration Time second, u_int
202  HDR_REG_SEC_LEN = 4,
203  HDR_SLICE_THCK = 1544, // Slice thickness, double
204  HDR_SLICE_THCK_LEN = 8,
205  HDR_TR = 1560, // TR, double
206  HDR_TR_LEN = 8,
207  HDR_TE = 1568, // TE, double
208  HDR_TE_LEN = 8,
209  HDR_FREQ = 1592, // Center Frequency, double
210  HDR_FREQ_LEN = 8,
211  HDR_STATION = 1639, // Station Name, char
212  HDR_STATION_LEN = 5,
213  HDR_CAL_YEAR = 1712, // Calibration Date - year, u_int
214  HDR_CAL_YEAR_LEN = 4,
215  HDR_CAL_MONTH = 1716, // Calibration Date - month, u_int
216  HDR_CAL_MONTH_LEN = 4,
217  HDR_CAL_DAY = 1720, // Calibration Date - day, u_int
218  HDR_CAL_DAY_LEN = 4,
219  HDR_CAL_HOUR = 1724, // Calibration Time - hour, u_int
220  HDR_CAL_HOUR_LEN = 4,
221  HDR_CAL_MIN = 1728, // Calibration Time - minute, u_int
222  HDR_CAL_MIN_LEN = 4,
223  HDR_CAL_SEC = 1732, // Calibration Time - second, u_int
224  HDR_CAL_SEC_LEN = 4,
225  HDR_COIL = 1767, // Receive Coil, char
226  HDR_COIL_LEN = 16,
227  HDR_IMAGE_NUC = 1828, // Imaged Nucleus, char
228  HDR_IMAGE_NUC_LEN = 4,
229  HDR_FLIP_ANGLE = 2112, // Flip Angle, double
230  HDR_FLIP_ANGLE_LEN = 8,
231  HDR_FIELD = 2560, // Field Strength, double
232  HDR_FIELD_LEN = 8,
233  HDR_DISPLAY_SIZE = 2864, // Displayed Matrix Size, u_int
234  HDR_DISPLAY_SIZE_LEN = 4,
235  HDR_SEQPROG_NAME = 2944, // Pulse Sequence Program Name, cha
236  HDR_SEQPROG_NAME_LEN = 65,
237  HDR_WKC_NAME = 3009, // Pulse Sequence Name, char
238  HDR_WKC_NAME_LEN = 65,
239  HDR_AUTHOR = 3074, // Pulse Sequence Author, char
240  HDR_AUTHOR_LEN = 9,
241  HDR_SEQUENCE_TYPE = 3083, // Pulse Sequence Type, char
242  HDR_SEQUENCE_TYPE_LEN = 8,
243  HDR_FOV_ROW = 3744, // Row FOV, double
244  HDR_FOV_ROW_LEN = 8,
245  HDR_FOV_COLUMN = 3752, // Column FOV, double
246  HDR_FOV_COLUMN_LEN = 8,
247  HDR_CENTER_X = 3768, // X Center Point, double
248  HDR_CENTER_X_LEN = 8,
249  HDR_CENTER_Y = 3776, // Y Center Point, double
250  HDR_CENTER_Y_LEN = 8,
251  HDR_CENTER_Z = 3784, // Z Center Point, double
252  HDR_CENTER_Z_LEN = 8,
253  HDR_NORMV_X = 3792, // Nornal Vector X, double
254  HDR_NORMV_X_LEN = 8,
255  HDR_NORMV_Y = 3800, // Nornal Vector Y, double
256  HDR_NORMV_Y_LEN = 8,
257  HDR_NORMV_Z = 3808, // Nornal Vector Z, double
258  HDR_NORMV_Z_LEN = 8,
259  HDR_DIST_ISO = 3816, // Distance from Isocenter, double
260  HDR_DIST_ISO_LEN = 8,
261  HDR_ROWV_X = 3832, // Row vector X, double
262  HDR_ROWV_X_LEN = 8,
263  HDR_ROWV_Y = 3840, // Row vector Y, double
264  HDR_ROWV_Y_LEN = 8,
265  HDR_ROWV_Z = 3848, // Row vector Z, double
266  HDR_ROWV_Z_LEN = 8,
267  HDR_COLMNV_X = 3856, // Column vector X, double
268  HDR_COLMNV_X_LEN = 8,
269  HDR_COLMNV_Y = 3864, // Column vector Y, double
270  HDR_COLMNV_Y_LEN = 8,
271  HDR_COLMNV_Z = 3872, // Column vector Z, double
272  HDR_COLMNV_Z_LEN = 8,
273  HDR_ORNT_SET1X = 3880, // Orientation Set 1 - X, char
274  HDR_ORNT_SET1X_LEN = 3,
275  HDR_ORNT_SET1Y = 3884, // Orientation Set 1 - Y, char
276  HDR_ORNT_SET1Y_LEN = 3,
277  HDR_ORNT_SET1Z = 3888, // Orientation Set 1 - Z, char
278  HDR_ORNT_SET1Z_LEN = 3,
279  HDR_ORNT_SET2X = 3892, // Orientation Set 2 - X, char
280  HDR_ORNT_SET2X_LEN = 3,
281  HDR_ORNT_SET2Y = 3896, // Orientation Set 2 - Y, char
282  HDR_ORNT_SET2Y_LEN = 3,
283  HDR_ORNT_SET2Z = 3900, // Orientation Set 2 - Z, char
284  HDR_ORNT_SET2Z_LEN = 3,
285  HDR_PROTOCOL_NAME = 2944, // Pulse Sequence Name, char
286  HDR_PROTOCOL_NAME_LEN = 64,
287  HDR_PIXELSIZE_ROW = 5000, // Row Pixel Size, double
288  HDR_PIXELSIZE_ROW_LEN = 8,
289  HDR_PIXELSIZE_CLMN = 5008, // Column Pixel Size, double
290  HDR_PIXELSIZE_CLMN_LEN = 8,
291  TEXT_PAT_ID = 5504, // Text Patient ID, char
292  TEXT_PAT_ID_LEN = 12,
293  TEXT_PAT_SEX = 5517, // Text Patient Sex, char
294  TEXT_PAT_SEX_LEN = 1,
295  TEXT_PAT_AGE = 5518, // Text Patient Age, char
296  TEXT_PAT_AGE_LEN = 3,
297  TEXT_AGE_UNIT = 5521, // Text Patient Age Unit (Y=year), char
298  TEXT_AGE_UNIT_LEN = 1,
299  TEXT_PAT_POS = 5529, // Text Patient Position, char
300  TEXT_PAT_POS_LEN = 7,
301  TEXT_IMG_FLAG = 5541, // Text Image Flag (IMAGE=image), char
302  TEXT_IMG_FLAG_LEN = 5,
303  TEXT_IMG_NUMBER = 5546, // Text Image Number, char
304  TEXT_IMG_NUMBER_LEN = 4,
305  TEXT_IMG_DAY = 5559, // Text Date - Day, char
306  TEXT_IMG_DAY_LEN = 2,
307  TEXT_IMG_MONTH = 5562, // Text Date - Month, char
308  TEXT_IMG_MONTH_LEN = 3,
309  TEXT_IMG_YEAR = 5566, // Text Date - Year, char
310  TEXT_IMG_YEAR_LEN = 4,
311  TEXT_IMG_HOUR = 5571, // Text Time - hour, char
312  TEXT_IMG_HOUR_LEN = 2,
313  TEXT_IMG_MIN = 5574, // Text Time - minute, char
314  TEXT_IMG_MIN_LEN = 2,
315  TEXT_ACQ_FLAG = 5577, // Text Acq. Time Flag (TA=time of acq), char
316  TEXT_ACQ_FLAG_LEN = 2,
317  TEXT_ACQ_MIN = 5583, // Text Acq Time - minute, char
318  TEXT_ACQ_MIN_LEN = 2,
319  TEXT_ACQ_SEC = 5586, // Text Acq Time - second, char
320  TEXT_ACQ_SEC_LEN = 2,
321  TEXT_ANNOTATION = 5601, // Text Annotation, char
322  TEXT_ANNOTATION_LEN = 32,
323  TEXT_ORGANIZATION = 5655, // Text Organization, char
324  TEXT_ORGANIZATION_LEN = 25,
325  TEXT_STATION = 5682, // Text Station Name, char
326  TEXT_STATION_LEN = 5,
327  TEXT_ACQ_MTRX_PHASE = 5695, // Acq. Matrix Phase Axis, char
328  TEXT_ACQ_MTRX_PHASE_LEN = 3,
329  TEXT_ACQ_PHASE_DIR = 5698, // Acq. phase direction (h=hor, v=vert), char
330  TEXT_ACQ_PHASE_DIR_LEN = 1,
331  TEXT_ACQ_MTRX_FREQ = 5700, // Acq. matrix Freq Axis, char
332  TEXT_ACQ_MTRX_FREQ_LEN = 3,
333  TEXT_ACQ_MTRX_FREQO = 5703, // Acq freq (o=o " "=blank), char
334  TEXT_ACQ_MTRX_FREQO_LEN = 1,
335  TEXT_ACQ_MTRX_FREQS = 5704, // Acq freq (s=s " "=blank), char
336  TEXT_ACQ_MTRX_FREQS_LEN = 1,
337  TEXT_SEQUENCE = 5706, // Sequence Type, char
338  TEXT_SEQUENCE_LEN = 8,
339  TEXT_FLIP_ANGLE = 5714, // Flip Angle, char
340  TEXT_FLIP_ANGLE_LEN = 3,
341  TEXT_SCAN_FLAG = 5718, // Scan flag ("SCAN"), char */
342  TEXT_SCAN_FLAG_LEN = 4,
343  TEXT_SCANA_NUM = 5723, // Scan Number A, char
344  TEXT_SCANA_NUM_LEN = 3,
345  TEXT_SCANB_NUM = 5726, // Scan Number B, char
346  TEXT_SCANB_NUM_LEN = 3,
347  TEXT_TR_FLAG = 5730, // TR flag ("TR"), char
348  TEXT_TR_FLAG_LEN = 2,
349  TEXT_TR = 5734, // TR, char
350  TEXT_TR_LEN = 7,
351  TEXT_TE_FLAG = 5742, // TE flag ("TE"), char
352  TEXT_TE_FLAG_LEN = 2,
353  TEXT_TE = 5746, // TE, char
354  TEXT_TE_LEN = 5,
355  TEXT_ECHO_NUM = 5752, // Echo number, char
356  TEXT_ECHO_NUM_LEN = 1,
357  TEXT_THCK_FLAG = 5790, // SLice thickness flag ("SL"), char
358  TEXT_THCK_FLAG_LEN = 2,
359  TEXT_SLICE_THCK = 5794, // Slice thickness
360  TEXT_SLICE_THCK_LEN = 7,
361  TEXT_POS_FLAG = 5802, // Slice position flag ("SP"), char
362  TEXT_POS_FLAG_LEN = 2,
363  TEXT_SLICE_POS = 5806, // Slice position, char
364  TEXT_SLICE_POS_LEN = 7,
365  TEXT_ANGLE_FLAG1 = 5814, // Angle flag 1 ("Sag","Cor",or,"Tra"), char
366  TEXT_ANGLE_FLAG1_LEN = 3,
367  TEXT_ANGLE_FLAG2 = 5817, // Angle flag 2 ("<", or ">"), char
368  TEXT_ANGLE_FLAG2_LEN = 1,
369  TEXT_ANGLE_FLAG3 = 5818, // Angle flag 3 ("Sag","Cor",or,"Tra"), char
370  TEXT_ANGLE_FLAG3_LEN = 3,
371  TEXT_ANGLE = 5821, // Angle, char
372  TEXT_ANGLE_LEN = 4,
373  TEXT_FOV_FLAG = 5838, // FOV flag ("FOV"), char
374  TEXT_FOV_FLAG_LEN = 3,
375  TEXT_FOVH = 5842, // Horizontal FOV, char
376  TEXT_FOVH_LEN = 3,
377  TEXT_FOVV = 5846, // Vertical FOV, char
378  TEXT_FOVV_LEN = 3,
379  TEXT_TABLEPOS_FLAG = 5874, // Table Position flag ("TP"), char
380  TEXT_TABLEPOS_FLAG_LEN = 2,
381  TEXT_TABLE_POS = 5878, // Table position
382  TEXT_TABLE_POS_LEN = 7,
383  TEXT_STUDY_FLAG = 5938, // Study flag ("STUDY"), char
384  TEXT_STUDY_FLAG_LEN = 5,
385  TEXT_STUDY_NUM = 5943, // Study number, char
386  TEXT_STUDY_NUM_LEN = 2,
387  TEXT_DOB_DAY = 5956, // Date of Birth - day, char
388  TEXT_DOB_DAY_LEN = 2,
389  TEXT_DOB_MONTH = 5959, // Date of Birth - month, char
390  TEXT_DOB_MONTH_LEN = 3,
391  TEXT_DOB_YEAR = 5963, // Date of Birth - year, char
392  TEXT_DOB_YEAR_LEN = 4,
393  TEXT_STUDY_FLAG2 = 5992, // Study flag 2 ("STU"), char
394  TEXT_STUDY_FLAG2_LEN = 3,
395  TEXT_IMAGE_FLAG2 = 5996, // Image flag 2 ("IMA"), char
396  TEXT_IMAGE_FLAG2_LEN = 3,
397  TEXT_STUDY_NUM2 = 5999, // Study number 2, char
398  TEXT_STUDY_NUM2_LEN = 2,
399  TEXT_IMAGE_NUM2 = 6002, // Image number 2, char
400  TEXT_IMAGE_NUM2_LEN = 2,
401  TEXT_IMAGE_NUM3 = 6013, // Image number 3, char
402  TEXT_IMAGE_NUM3_LEN = 5,
403  TEXT_MODEL_NAME = 6031, // Model Name, char
404  TEXT_MODEL_NAME_LEN = 15,
405  TEXT_PAT_NAME = 6058, // Patient Name, char
406  TEXT_PAT_NAME_LEN = 25,
407  TEXT_START_HOUR = 6085, // Scan start time - hour, char
408  TEXT_START_HOUR_LEN = 2,
409  TEXT_START_MIN = 6088, // Scan start time - minute, char
410  TEXT_START_MIN_LEN = 2,
411  TEXT_START_SEC = 6091, // Scan start time - second, char
412  TEXT_START_SEC_LEN = 2,
413  HDR_TOTAL_LENGTH = 6144 // Total length of Siemens Header
414  } SiemensVisionHeaderInfo;
415  SiemensVisionImageIO(const Self &); //purposely not implemented
416  void operator=(const Self &); //purposely not implemented
417 };
418 } // end namespace itk
419 
420 #endif // __itkSiemensVisionImageIO_h
Light weight base class for most itk classes.
Class that defines how to read SiemensVision file format.
Class that defines how to read GE4 file format.
This file was written as a modification to the itkMetaImageIO as a new method for reading in files fr...
Base class for most ITK classes.
Definition: itkObject.h:57