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 =========================================================================*/
39 #ifndef vtkNIFTIImageHeader_h
40 #define vtkNIFTIImageHeader_h
41 
42 #include "vtkIOImageModule.h" // For export macro
43 #include "vtkObject.h"
44 
45 struct nifti_1_header;
46 struct nifti_2_header;
47 
48 //----------------------------------------------------------------------------
49 class VTKIOIMAGE_EXPORT vtkNIFTIImageHeader : public vtkObject
50 {
51 public:
52 
57  IntentNone = 0,
58  IntentCorrel = 2,
59  IntentTTest = 3,
60  IntentFTest = 4,
61  IntentZScore = 5,
62  IntentChiSQ = 6,
63  IntentBeta = 7,
64  IntentBinom = 8,
65  IntentGamma = 9,
66  IntentPoisson = 10,
67  IntentNormal = 11,
68  IntentFTestNonc = 12,
69  IntentChiSQNonc = 13,
70  IntentLogistic = 14,
71  IntentLaplace = 15,
72  IntentUniform = 16,
73  IntentTTestNonc = 17,
74  IntentWeibull = 18,
75  IntentChi = 19,
76  IntentInvGauss = 20,
77  IntentExtVal = 21,
78  IntentPVal = 22,
79  IntentLogPVal = 23,
80  IntentLog10PVal = 24,
81  IntentEstimate = 1001,
82  IntentLabel = 1002,
83  IntentNeuroName = 1003,
84  IntentGenMatrix = 1004,
85  IntentSymMatrix = 1005,
86  IntentDispVect = 1006,
87  IntentVector = 1007,
88  IntentPointSet = 1008,
89  IntentTriangle = 1009,
90  IntentQuaternion = 1010,
91  IntentDimless = 1011,
92  IntentTimeSeries = 2001,
93  IntentNodeIndex = 2002,
94  IntentRGBVector = 2003,
95  IntentRGBAVector = 2004,
96  IntentShape = 2005
97  };
98 
103  XFormUnkown = 0,
104  XFormScannerAnat = 1,
105  XFormAlignedAnat = 2,
106  XFormTalairach = 3,
107  XFormMNI152 = 4
108  };
109 
114  SliceUnknown = 0,
115  SliceSeqInc = 1,
116  SliceSeqDec = 2,
117  SliceAltInc = 3,
118  SliceAltDec = 4,
119  SliceAltInc2 = 5,
120  SliceAltDec2 = 6
121  };
122 
127  UnitsUnknown = 0,
128  UnitsMeter = 1,
129  UnitsMM = 2,
130  UnitsMicron = 3,
131  UnitsSpace = 7,
132  UnitsSec = 8,
133  UnitsMSec = 16,
134  UnitsUSec = 24,
135  UnitsHz = 32,
136  UnitsPPM = 40,
137  UnitsRads = 48,
138  UnitsTime = 56
139  };
140 
148  TypeUInt8 = 2,
149  TypeInt16 = 4,
150  TypeInt32 = 8,
151  TypeFloat32 = 16,
152  TypeComplex64 = 32,
153  TypeFloat64 = 64,
154  TypeRGB24 = 128,
155  TypeInt8 = 256,
156  TypeUInt16 = 512,
157  TypeUInt32 = 768,
158  TypeInt64 = 1024,
159  TypeUInt64 = 1280,
160  TypeFloat128 = 1536,
161  TypeComplex128 = 1792,
162  TypeComplex256 = 2048,
163  TypeRGBA32 = 2304
164  };
165 
170  NIFTI1HeaderSize = 348,
171  NIFTI2HeaderSize = 540
172  };
173 
175 
178  static vtkNIFTIImageHeader *New();
181 
185  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
186 
190  const char *GetMagic() { return this->Magic; }
191 
195  vtkTypeInt64 GetVoxOffset() { return this->VoxOffset; }
196 
200  int GetDataType() { return this->DataType; }
201 
205  int GetBitPix() { return this->BitPix; }
206 
211  vtkTypeInt64 GetDim(int i) {
212  return (i < 0 || i > 7 ? 0 : this->Dim[i]); }
213 
219  double GetPixDim(int i) {
220  return (i < 0 || i > 7 ? 0.0 : this->PixDim[i]); }
221 
223 
227  vtkSetMacro(IntentCode, int);
228  int GetIntentCode() { return this->IntentCode; }
230 
234  void SetIntentName(const char *name);
235  const char *GetIntentName() { return this->IntentName; }
236 
238 
242  vtkSetMacro(IntentP1, double);
243  double GetIntentP1() { return this->IntentP1; }
244  vtkSetMacro(IntentP2, double);
245  double GetIntentP2() { return this->IntentP2; }
246  vtkSetMacro(IntentP3, double);
247  double GetIntentP3() { return this->IntentP3; }
249 
251 
255  vtkSetMacro(SclSlope, double);
256  double GetSclSlope() { return this->SclSlope; }
257  vtkSetMacro(SclInter, double);
258  double GetSclInter() { return this->SclInter; }
260 
262 
266  vtkSetMacro(CalMin, double);
267  double GetCalMin() { return this->CalMin; }
268  vtkSetMacro(CalMax, double);
269  double GetCalMax() { return this->CalMax; }
271 
273 
276  vtkSetMacro(SliceDuration, double);
277  double GetSliceDuration() { return this->SliceDuration; }
278  vtkSetMacro(TOffset, double);
279  double GetTOffset() { return this->TOffset; }
281 
283 
286  vtkSetMacro(SliceStart, vtkTypeInt64);
287  vtkTypeInt64 GetSliceStart() { return this->SliceStart; }
288  vtkSetMacro(SliceEnd, vtkTypeInt64);
289  vtkTypeInt64 GetSliceEnd() { return this->SliceEnd; }
291 
293 
296  vtkSetMacro(SliceCode, int);
297  int GetSliceCode() { return this->SliceCode; }
299 
301 
304  vtkSetMacro(XYZTUnits, int);
305  int GetXYZTUnits() { return this->XYZTUnits; }
307 
309 
314  vtkSetMacro(DimInfo, int);
315  int GetDimInfo() { return this->DimInfo; }
317 
325  void SetDescrip(const char *descrip);
326  const char *GetDescrip() { return this->Descrip; }
327 
334  void SetAuxFile(const char *auxfile);
335  const char *GetAuxFile() { return this->AuxFile; }
336 
338 
341  vtkSetMacro(QFormCode, int);
342  int GetQFormCode() { return this->QFormCode; }
343  vtkSetMacro(SFormCode, int);
344  int GetSFormCode() { return this->SFormCode; }
346 
348 
353  vtkSetMacro(QuaternB, double);
354  double GetQuaternB() { return this->QuaternB; }
355  vtkSetMacro(QuaternC, double);
356  double GetQuaternC() { return this->QuaternC; }
357  vtkSetMacro(QuaternD, double);
358  double GetQuaternD() { return this->QuaternD; }
359  vtkSetMacro(QOffsetX, double);
360  double GetQOffsetX() { return this->QOffsetX; }
361  vtkSetMacro(QOffsetY, double);
362  double GetQOffsetY() { return this->QOffsetY; }
363  vtkSetMacro(QOffsetZ, double);
364  double GetQOffsetZ() { return this->QOffsetZ; }
366 
368 
373  vtkSetVector4Macro(SRowX, double);
374  vtkGetVector4Macro(SRowX, double);
375  vtkSetVector4Macro(SRowY, double);
376  vtkGetVector4Macro(SRowY, double);
377  vtkSetVector4Macro(SRowZ, double);
378  vtkGetVector4Macro(SRowZ, double);
380 
384  void Initialize();
385 
389  void DeepCopy(vtkNIFTIImageHeader *o);
390 
392 
396  void SetHeader(const nifti_1_header *hdr);
397  void GetHeader(nifti_1_header *hdr);
398  void SetHeader(const nifti_2_header *hdr);
399  void GetHeader(nifti_2_header *hdr);
401 
402 protected:
405 
406  char Magic[12];
407  vtkTypeInt64 VoxOffset;
408  int DataType;
409  int BitPix;
410  vtkTypeInt64 Dim[8];
411  double PixDim[8];
413  char IntentName[18];
414  double IntentP1;
415  double IntentP2;
416  double IntentP3;
417  double SclSlope;
418  double SclInter;
419  double CalMin;
420  double CalMax;
422  double TOffset;
423  vtkTypeInt64 SliceStart;
424  vtkTypeInt64 SliceEnd;
427  int DimInfo;
428  char Descrip[82];
429  char AuxFile[26];
432  double QuaternB;
433  double QuaternC;
434  double QuaternD;
435  double QOffsetX;
436  double QOffsetY;
437  double QOffsetZ;
438  double SRowX[4];
439  double SRowY[4];
440  double SRowZ[4];
441 
442  void SetStringValue(char *x, const char *y, size_t n);
443 
444 private:
445  vtkNIFTIImageHeader(const vtkNIFTIImageHeader&) VTK_DELETE_FUNCTION;
446  void operator=(const vtkNIFTIImageHeader&) VTK_DELETE_FUNCTION;
447 };
448 
449 #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:59
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.
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
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:39
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.