VTK  9.3.1
vtkNIFTIImageHeader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
27 #ifndef vtkNIFTIImageHeader_h
28 #define vtkNIFTIImageHeader_h
29 
30 #include "vtkIOImageModule.h" // For export macro
31 #include "vtkObject.h"
32 
33 struct nifti_1_header;
34 struct nifti_2_header;
35 
36 VTK_ABI_NAMESPACE_BEGIN
37 //----------------------------------------------------------------------------
38 class VTKIOIMAGE_EXPORT vtkNIFTIImageHeader : public vtkObject
39 {
40 public:
45  {
46  IntentNone = 0,
47  IntentCorrel = 2,
48  IntentTTest = 3,
49  IntentFTest = 4,
50  IntentZScore = 5,
51  IntentChiSQ = 6,
52  IntentBeta = 7,
53  IntentBinom = 8,
54  IntentGamma = 9,
55  IntentPoisson = 10,
56  IntentNormal = 11,
57  IntentFTestNonc = 12,
58  IntentChiSQNonc = 13,
59  IntentLogistic = 14,
60  IntentLaplace = 15,
61  IntentUniform = 16,
62  IntentTTestNonc = 17,
63  IntentWeibull = 18,
64  IntentChi = 19,
65  IntentInvGauss = 20,
66  IntentExtVal = 21,
67  IntentPVal = 22,
68  IntentLogPVal = 23,
69  IntentLog10PVal = 24,
70  IntentEstimate = 1001,
71  IntentLabel = 1002,
72  IntentNeuroName = 1003,
73  IntentGenMatrix = 1004,
74  IntentSymMatrix = 1005,
75  IntentDispVect = 1006,
76  IntentVector = 1007,
77  IntentPointSet = 1008,
78  IntentTriangle = 1009,
79  IntentQuaternion = 1010,
80  IntentDimless = 1011,
81  IntentTimeSeries = 2001,
82  IntentNodeIndex = 2002,
83  IntentRGBVector = 2003,
84  IntentRGBAVector = 2004,
85  IntentShape = 2005
86  };
87 
92  {
93  XFormUnkown = 0,
94  XFormScannerAnat = 1,
95  XFormAlignedAnat = 2,
96  XFormTalairach = 3,
97  XFormMNI152 = 4
98  };
99 
104  {
105  SliceUnknown = 0,
106  SliceSeqInc = 1,
107  SliceSeqDec = 2,
108  SliceAltInc = 3,
109  SliceAltDec = 4,
110  SliceAltInc2 = 5,
111  SliceAltDec2 = 6
112  };
113 
118  {
119  UnitsUnknown = 0,
120  UnitsMeter = 1,
121  UnitsMM = 2,
122  UnitsMicron = 3,
123  UnitsSpace = 7,
124  UnitsSec = 8,
125  UnitsMSec = 16,
126  UnitsUSec = 24,
127  UnitsHz = 32,
128  UnitsPPM = 40,
129  UnitsRads = 48,
130  UnitsTime = 56
131  };
132 
140  {
141  TypeUInt8 = 2,
142  TypeInt16 = 4,
143  TypeInt32 = 8,
144  TypeFloat32 = 16,
145  TypeComplex64 = 32,
146  TypeFloat64 = 64,
147  TypeRGB24 = 128,
148  TypeInt8 = 256,
149  TypeUInt16 = 512,
150  TypeUInt32 = 768,
151  TypeInt64 = 1024,
152  TypeUInt64 = 1280,
153  TypeFloat128 = 1536,
154  TypeComplex128 = 1792,
155  TypeComplex256 = 2048,
156  TypeRGBA32 = 2304
157  };
158 
163  {
164  NIFTI1HeaderSize = 348,
165  NIFTI2HeaderSize = 540
166  };
167 
169 
172  static vtkNIFTIImageHeader* New();
175 
179  void PrintSelf(ostream& os, vtkIndent indent) override;
180 
184  const char* GetMagic() { return this->Magic; }
185 
189  vtkTypeInt64 GetVoxOffset() { return this->VoxOffset; }
190 
194  int GetDataType() { return this->DataType; }
195 
199  int GetBitPix() { return this->BitPix; }
200 
205  vtkTypeInt64 GetDim(int i) { return (i < 0 || i > 7 ? 0 : this->Dim[i]); }
206 
212  double GetPixDim(int i) { return (i < 0 || i > 7 ? 0.0 : this->PixDim[i]); }
213 
215 
219  vtkSetMacro(IntentCode, int);
220  int GetIntentCode() { return this->IntentCode; }
222 
226  void SetIntentName(const char* name);
227  const char* GetIntentName() { return this->IntentName; }
228 
230 
234  vtkSetMacro(IntentP1, double);
235  double GetIntentP1() { return this->IntentP1; }
236  vtkSetMacro(IntentP2, double);
237  double GetIntentP2() { return this->IntentP2; }
238  vtkSetMacro(IntentP3, double);
239  double GetIntentP3() { return this->IntentP3; }
241 
243 
247  vtkSetMacro(SclSlope, double);
248  double GetSclSlope() { return this->SclSlope; }
249  vtkSetMacro(SclInter, double);
250  double GetSclInter() { return this->SclInter; }
252 
254 
258  vtkSetMacro(CalMin, double);
259  double GetCalMin() { return this->CalMin; }
260  vtkSetMacro(CalMax, double);
261  double GetCalMax() { return this->CalMax; }
263 
265 
268  vtkSetMacro(SliceDuration, double);
269  double GetSliceDuration() { return this->SliceDuration; }
270  vtkSetMacro(TOffset, double);
271  double GetTOffset() { return this->TOffset; }
273 
275 
278  vtkSetMacro(SliceStart, vtkTypeInt64);
279  vtkTypeInt64 GetSliceStart() { return this->SliceStart; }
280  vtkSetMacro(SliceEnd, vtkTypeInt64);
281  vtkTypeInt64 GetSliceEnd() { return this->SliceEnd; }
283 
285 
288  vtkSetMacro(SliceCode, int);
289  int GetSliceCode() { return this->SliceCode; }
291 
293 
296  vtkSetMacro(XYZTUnits, int);
297  int GetXYZTUnits() { return this->XYZTUnits; }
299 
301 
306  vtkSetMacro(DimInfo, int);
307  int GetDimInfo() { return this->DimInfo; }
309 
317  void SetDescrip(const char* descrip);
318  const char* GetDescrip() { return this->Descrip; }
319 
326  void SetAuxFile(VTK_FILEPATH const char* auxfile);
327  VTK_FILEPATH const char* GetAuxFile() { return this->AuxFile; }
328 
330 
333  vtkSetMacro(QFormCode, int);
334  int GetQFormCode() { return this->QFormCode; }
335  vtkSetMacro(SFormCode, int);
336  int GetSFormCode() { return this->SFormCode; }
338 
340 
345  vtkSetMacro(QuaternB, double);
346  double GetQuaternB() { return this->QuaternB; }
347  vtkSetMacro(QuaternC, double);
348  double GetQuaternC() { return this->QuaternC; }
349  vtkSetMacro(QuaternD, double);
350  double GetQuaternD() { return this->QuaternD; }
351  vtkSetMacro(QOffsetX, double);
352  double GetQOffsetX() { return this->QOffsetX; }
353  vtkSetMacro(QOffsetY, double);
354  double GetQOffsetY() { return this->QOffsetY; }
355  vtkSetMacro(QOffsetZ, double);
356  double GetQOffsetZ() { return this->QOffsetZ; }
358 
360 
365  vtkSetVector4Macro(SRowX, double);
366  vtkGetVector4Macro(SRowX, double);
367  vtkSetVector4Macro(SRowY, double);
368  vtkGetVector4Macro(SRowY, double);
369  vtkSetVector4Macro(SRowZ, double);
370  vtkGetVector4Macro(SRowZ, double);
372 
376  void Initialize();
377 
381  void DeepCopy(vtkNIFTIImageHeader* o);
382 
384 
388  void SetHeader(const nifti_1_header* hdr);
389  void GetHeader(nifti_1_header* hdr);
390  void SetHeader(const nifti_2_header* hdr);
391  void GetHeader(nifti_2_header* hdr);
393 
394 protected:
396  ~vtkNIFTIImageHeader() override;
397 
398  char Magic[12];
399  vtkTypeInt64 VoxOffset;
400  int DataType;
401  int BitPix;
402  vtkTypeInt64 Dim[8];
403  double PixDim[8];
405  char IntentName[18];
406  double IntentP1;
407  double IntentP2;
408  double IntentP3;
409  double SclSlope;
410  double SclInter;
411  double CalMin;
412  double CalMax;
414  double TOffset;
415  vtkTypeInt64 SliceStart;
416  vtkTypeInt64 SliceEnd;
419  int DimInfo;
420  char Descrip[82];
421  char AuxFile[26];
424  double QuaternB;
425  double QuaternC;
426  double QuaternD;
427  double QOffsetX;
428  double QOffsetY;
429  double QOffsetZ;
430  double SRowX[4];
431  double SRowY[4];
432  double SRowZ[4];
433 
434  void SetStringValue(char* x, const char* y, size_t n);
435 
436 private:
437  vtkNIFTIImageHeader(const vtkNIFTIImageHeader&) = delete;
438  void operator=(const vtkNIFTIImageHeader&) = delete;
439 };
440 
441 VTK_ABI_NAMESPACE_END
442 #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:51
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:28
XFormCodeEnum
NIFTI transform codes.
SliceCodeEnum
NIFTI slice codes.
VTK_FILEPATH const char * GetAuxFile()
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.
HeaderSizeEnum
NIFTI header sizes.
double GetPixDim(int i)
Get the sample spacing in the nth dimension.
#define VTK_FILEPATH
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.