VTK
vtkNIFTIImageHeader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkNIFTIImageHeader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
36 #ifndef vtkNIFTIImageHeader_h
37 #define vtkNIFTIImageHeader_h
38 
39 #include "vtkIOImageModule.h" // For export macro
40 #include "vtkObject.h"
41 
42 struct nifti_1_header;
43 struct nifti_2_header;
44 
45 //----------------------------------------------------------------------------
46 class VTKIOIMAGE_EXPORT vtkNIFTIImageHeader : public vtkObject
47 {
48 public:
49 
54  IntentNone = 0,
55  IntentCorrel = 2,
56  IntentTTest = 3,
57  IntentFTest = 4,
58  IntentZScore = 5,
59  IntentChiSQ = 6,
60  IntentBeta = 7,
61  IntentBinom = 8,
62  IntentGamma = 9,
63  IntentPoisson = 10,
64  IntentNormal = 11,
65  IntentFTestNonc = 12,
66  IntentChiSQNonc = 13,
67  IntentLogistic = 14,
68  IntentLaplace = 15,
69  IntentUniform = 16,
70  IntentTTestNonc = 17,
71  IntentWeibull = 18,
72  IntentChi = 19,
73  IntentInvGauss = 20,
74  IntentExtVal = 21,
75  IntentPVal = 22,
76  IntentLogPVal = 23,
77  IntentLog10PVal = 24,
78  IntentEstimate = 1001,
79  IntentLabel = 1002,
80  IntentNeuroName = 1003,
81  IntentGenMatrix = 1004,
82  IntentSymMatrix = 1005,
83  IntentDispVect = 1006,
84  IntentVector = 1007,
85  IntentPointSet = 1008,
86  IntentTriangle = 1009,
87  IntentQuaternion = 1010,
88  IntentDimless = 1011,
89  IntentTimeSeries = 2001,
90  IntentNodeIndex = 2002,
91  IntentRGBVector = 2003,
92  IntentRGBAVector = 2004,
93  IntentShape = 2005
94  };
95 
100  XFormUnkown = 0,
101  XFormScannerAnat = 1,
102  XFormAlignedAnat = 2,
103  XFormTalairach = 3,
104  XFormMNI152 = 4
105  };
106 
111  SliceUnknown = 0,
112  SliceSeqInc = 1,
113  SliceSeqDec = 2,
114  SliceAltInc = 3,
115  SliceAltDec = 4,
116  SliceAltInc2 = 5,
117  SliceAltDec2 = 6
118  };
119 
124  UnitsUnknown = 0,
125  UnitsMeter = 1,
126  UnitsMM = 2,
127  UnitsMicron = 3,
128  UnitsSpace = 7,
129  UnitsSec = 8,
130  UnitsMSec = 16,
131  UnitsUSec = 24,
132  UnitsHz = 32,
133  UnitsPPM = 40,
134  UnitsRads = 48,
135  UnitsTime = 56
136  };
137 
145  TypeUInt8 = 2,
146  TypeInt16 = 4,
147  TypeInt32 = 8,
148  TypeFloat32 = 16,
149  TypeComplex64 = 32,
150  TypeFloat64 = 64,
151  TypeRGB24 = 128,
152  TypeInt8 = 256,
153  TypeUInt16 = 512,
154  TypeUInt32 = 768,
155  TypeInt64 = 1024,
156  TypeUInt64 = 1280,
157  TypeFloat128 = 1536,
158  TypeComplex128 = 1792,
159  TypeComplex256 = 2048,
160  TypeRGBA32 = 2304
161  };
162 
167  NIFTI1HeaderSize = 348,
168  NIFTI2HeaderSize = 540
169  };
170 
172 
175  static vtkNIFTIImageHeader *New();
178 
182  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
183 
187  const char *GetMagic() { return this->Magic; }
188 
192  vtkTypeInt64 GetVoxOffset() { return this->VoxOffset; }
193 
197  int GetDataType() { return this->DataType; }
198 
202  int GetBitPix() { return this->BitPix; }
203 
208  vtkTypeInt64 GetDim(int i) {
209  return (i < 0 || i > 7 ? 0 : this->Dim[i]); }
210 
216  double GetPixDim(int i) {
217  return (i < 0 || i > 7 ? 0.0 : this->PixDim[i]); }
218 
220 
224  vtkSetMacro(IntentCode, int);
225  int GetIntentCode() { return this->IntentCode; }
227 
231  void SetIntentName(const char *name);
232  const char *GetIntentName() { return this->IntentName; }
233 
235 
239  vtkSetMacro(IntentP1, double);
240  double GetIntentP1() { return this->IntentP1; }
241  vtkSetMacro(IntentP2, double);
242  double GetIntentP2() { return this->IntentP2; }
243  vtkSetMacro(IntentP3, double);
244  double GetIntentP3() { return this->IntentP3; }
246 
248 
252  vtkSetMacro(SclSlope, double);
253  double GetSclSlope() { return this->SclSlope; }
254  vtkSetMacro(SclInter, double);
255  double GetSclInter() { return this->SclInter; }
257 
259 
263  vtkSetMacro(CalMin, double);
264  double GetCalMin() { return this->CalMin; }
265  vtkSetMacro(CalMax, double);
266  double GetCalMax() { return this->CalMax; }
268 
270 
273  vtkSetMacro(SliceDuration, double);
274  double GetSliceDuration() { return this->SliceDuration; }
275  vtkSetMacro(TOffset, double);
276  double GetTOffset() { return this->TOffset; }
278 
280 
283  vtkSetMacro(SliceStart, vtkTypeInt64);
284  vtkTypeInt64 GetSliceStart() { return this->SliceStart; }
285  vtkSetMacro(SliceEnd, vtkTypeInt64);
286  vtkTypeInt64 GetSliceEnd() { return this->SliceEnd; }
288 
290 
293  vtkSetMacro(SliceCode, int);
294  int GetSliceCode() { return this->SliceCode; }
296 
298 
301  vtkSetMacro(XYZTUnits, int);
302  int GetXYZTUnits() { return this->XYZTUnits; }
304 
306 
311  vtkSetMacro(DimInfo, int);
312  int GetDimInfo() { return this->DimInfo; }
314 
322  void SetDescrip(const char *descrip);
323  const char *GetDescrip() { return this->Descrip; }
324 
331  void SetAuxFile(const char *auxfile);
332  const char *GetAuxFile() { return this->AuxFile; }
333 
335 
338  vtkSetMacro(QFormCode, int);
339  int GetQFormCode() { return this->QFormCode; }
340  vtkSetMacro(SFormCode, int);
341  int GetSFormCode() { return this->SFormCode; }
343 
345 
350  vtkSetMacro(QuaternB, double);
351  double GetQuaternB() { return this->QuaternB; }
352  vtkSetMacro(QuaternC, double);
353  double GetQuaternC() { return this->QuaternC; }
354  vtkSetMacro(QuaternD, double);
355  double GetQuaternD() { return this->QuaternD; }
356  vtkSetMacro(QOffsetX, double);
357  double GetQOffsetX() { return this->QOffsetX; }
358  vtkSetMacro(QOffsetY, double);
359  double GetQOffsetY() { return this->QOffsetY; }
360  vtkSetMacro(QOffsetZ, double);
361  double GetQOffsetZ() { return this->QOffsetZ; }
363 
365 
370  vtkSetVector4Macro(SRowX, double);
371  vtkGetVector4Macro(SRowX, double);
372  vtkSetVector4Macro(SRowY, double);
373  vtkGetVector4Macro(SRowY, double);
374  vtkSetVector4Macro(SRowZ, double);
375  vtkGetVector4Macro(SRowZ, double);
377 
381  void Initialize();
382 
386  void DeepCopy(vtkNIFTIImageHeader *o);
387 
389 
393  void SetHeader(const nifti_1_header *hdr);
394  void GetHeader(nifti_1_header *hdr);
395  void SetHeader(const nifti_2_header *hdr);
396  void GetHeader(nifti_2_header *hdr);
398 
399 protected:
401  ~vtkNIFTIImageHeader() VTK_OVERRIDE;
402 
403  char Magic[12];
404  vtkTypeInt64 VoxOffset;
405  int DataType;
406  int BitPix;
407  vtkTypeInt64 Dim[8];
408  double PixDim[8];
410  char IntentName[18];
411  double IntentP1;
412  double IntentP2;
413  double IntentP3;
414  double SclSlope;
415  double SclInter;
416  double CalMin;
417  double CalMax;
419  double TOffset;
420  vtkTypeInt64 SliceStart;
421  vtkTypeInt64 SliceEnd;
424  int DimInfo;
425  char Descrip[82];
426  char AuxFile[26];
429  double QuaternB;
430  double QuaternC;
431  double QuaternD;
432  double QOffsetX;
433  double QOffsetY;
434  double QOffsetZ;
435  double SRowX[4];
436  double SRowY[4];
437  double SRowZ[4];
438 
439  void SetStringValue(char *x, const char *y, size_t n);
440 
441 private:
442  vtkNIFTIImageHeader(const vtkNIFTIImageHeader&) VTK_DELETE_FUNCTION;
443  void operator=(const vtkNIFTIImageHeader&) VTK_DELETE_FUNCTION;
444 };
445 
446 #endif // vtkNIFTIImageHeader_h
IntentCodeEnum
NIFTI intent codes.
double GetQuaternB()
Get information about the quaternion transformation.
double GetSclInter()
Get the scale and slope to apply to the data in order to get the real-valued data values...
abstract base class for most VTK objects
Definition: vtkObject.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetIntentName()
double GetSliceDuration()
Get the slice_duration and toffset from the header.
UnitsXYZTEnum
NIFTI unit codes.
Data structure defining the fields in the nifti1 header. This binary header should be found at the be...
Data structure defining the fields in the nifti2 header. This binary header should be found at the be...
int GetSFormCode()
Get the QForm or SForm code.
double GetQOffsetX()
Get information about the quaternion transformation.
double GetIntentP2()
Get one of the NIFTI intent parameters.
double GetQOffsetY()
Get information about the quaternion transformation.
double GetIntentP1()
Get one of the NIFTI intent parameters.
double GetCalMin()
Get the calibrated range of the data, i.e.
const char * GetMagic()
Get the magic number for the NIFTI file as a null-terminated string.
int GetQFormCode()
Get the QForm or SForm code.
double GetTOffset()
Get the slice_duration and toffset from the header.
a simple class to control print indentation
Definition: vtkIndent.h:33
XFormCodeEnum
NIFTI transform codes.
SliceCodeEnum
NIFTI slice codes.
vtkTypeInt64 GetVoxOffset()
Get the offset to the pixel data within the file.
double GetQuaternC()
Get information about the quaternion transformation.
double GetSclSlope()
Get the scale and slope to apply to the data in order to get the real-valued data values...
int GetDataType()
Get the data type.
int GetBitPix()
Get the number of bits per pixel.
DataTypeEnum
NIFTI data types.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
HeaderSizeEnum
NIFTI header sizes.
double GetPixDim(int i)
Get the sample spacing in the nth dimension.
double GetCalMax()
Get the calibrated range of the data, i.e.
double GetQOffsetZ()
Get information about the quaternion transformation.
int GetDimInfo()
Get a bitfield with extra information about the dimensions, it states which dimensions are the phase ...
vtkTypeInt64 GetDim(int i)
Get the nth dimension of the data, where GetDim(0) returns the number of dimensions that are defined ...
vtkTypeInt64 GetSliceEnd()
Get the slice range for the data.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Store NIfTI header information.
int GetSliceCode()
Get the slice code for the data.
int GetXYZTUnits()
Get a bitfield that describes the units for the first 4 dims.
int GetIntentCode()
Get the NIFTI intent code.
vtkTypeInt64 GetSliceStart()
Get the slice range for the data.
double GetQuaternD()
Get information about the quaternion transformation.
double GetIntentP3()
Get one of the NIFTI intent parameters.