VTK  9.2.6
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
45struct nifti_1_header;
46struct nifti_2_header;
47
48//----------------------------------------------------------------------------
49class VTKIOIMAGE_EXPORT vtkNIFTIImageHeader : public vtkObject
50{
51public:
56 {
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 {
104 XFormUnkown = 0,
105 XFormScannerAnat = 1,
106 XFormAlignedAnat = 2,
107 XFormTalairach = 3,
108 XFormMNI152 = 4
109 };
110
115 {
116 SliceUnknown = 0,
117 SliceSeqInc = 1,
118 SliceSeqDec = 2,
119 SliceAltInc = 3,
120 SliceAltDec = 4,
121 SliceAltInc2 = 5,
122 SliceAltDec2 = 6
123 };
124
129 {
130 UnitsUnknown = 0,
131 UnitsMeter = 1,
132 UnitsMM = 2,
133 UnitsMicron = 3,
134 UnitsSpace = 7,
135 UnitsSec = 8,
136 UnitsMSec = 16,
137 UnitsUSec = 24,
138 UnitsHz = 32,
139 UnitsPPM = 40,
140 UnitsRads = 48,
141 UnitsTime = 56
142 };
143
151 {
152 TypeUInt8 = 2,
153 TypeInt16 = 4,
154 TypeInt32 = 8,
155 TypeFloat32 = 16,
156 TypeComplex64 = 32,
157 TypeFloat64 = 64,
158 TypeRGB24 = 128,
159 TypeInt8 = 256,
160 TypeUInt16 = 512,
161 TypeUInt32 = 768,
162 TypeInt64 = 1024,
163 TypeUInt64 = 1280,
164 TypeFloat128 = 1536,
165 TypeComplex128 = 1792,
166 TypeComplex256 = 2048,
167 TypeRGBA32 = 2304
168 };
169
174 {
175 NIFTI1HeaderSize = 348,
176 NIFTI2HeaderSize = 540
177 };
178
180
186
190 void PrintSelf(ostream& os, vtkIndent indent) override;
191
195 const char* GetMagic() { return this->Magic; }
196
200 vtkTypeInt64 GetVoxOffset() { return this->VoxOffset; }
201
205 int GetDataType() { return this->DataType; }
206
210 int GetBitPix() { return this->BitPix; }
211
216 vtkTypeInt64 GetDim(int i) { return (i < 0 || i > 7 ? 0 : this->Dim[i]); }
217
223 double GetPixDim(int i) { return (i < 0 || i > 7 ? 0.0 : this->PixDim[i]); }
224
226
230 vtkSetMacro(IntentCode, int);
231 int GetIntentCode() { return this->IntentCode; }
233
237 void SetIntentName(const char* name);
238 const char* GetIntentName() { return this->IntentName; }
239
241
245 vtkSetMacro(IntentP1, double);
246 double GetIntentP1() { return this->IntentP1; }
247 vtkSetMacro(IntentP2, double);
248 double GetIntentP2() { return this->IntentP2; }
249 vtkSetMacro(IntentP3, double);
250 double GetIntentP3() { return this->IntentP3; }
252
254
258 vtkSetMacro(SclSlope, double);
259 double GetSclSlope() { return this->SclSlope; }
260 vtkSetMacro(SclInter, double);
261 double GetSclInter() { return this->SclInter; }
263
265
269 vtkSetMacro(CalMin, double);
270 double GetCalMin() { return this->CalMin; }
271 vtkSetMacro(CalMax, double);
272 double GetCalMax() { return this->CalMax; }
274
276
279 vtkSetMacro(SliceDuration, double);
280 double GetSliceDuration() { return this->SliceDuration; }
281 vtkSetMacro(TOffset, double);
282 double GetTOffset() { return this->TOffset; }
284
286
289 vtkSetMacro(SliceStart, vtkTypeInt64);
290 vtkTypeInt64 GetSliceStart() { return this->SliceStart; }
291 vtkSetMacro(SliceEnd, vtkTypeInt64);
292 vtkTypeInt64 GetSliceEnd() { return this->SliceEnd; }
294
296
299 vtkSetMacro(SliceCode, int);
300 int GetSliceCode() { return this->SliceCode; }
302
304
307 vtkSetMacro(XYZTUnits, int);
308 int GetXYZTUnits() { return this->XYZTUnits; }
310
312
317 vtkSetMacro(DimInfo, int);
318 int GetDimInfo() { return this->DimInfo; }
320
328 void SetDescrip(const char* descrip);
329 const char* GetDescrip() { return this->Descrip; }
330
337 void SetAuxFile(VTK_FILEPATH const char* auxfile);
338 VTK_FILEPATH const char* GetAuxFile() { return this->AuxFile; }
339
341
344 vtkSetMacro(QFormCode, int);
345 int GetQFormCode() { return this->QFormCode; }
346 vtkSetMacro(SFormCode, int);
347 int GetSFormCode() { return this->SFormCode; }
349
351
356 vtkSetMacro(QuaternB, double);
357 double GetQuaternB() { return this->QuaternB; }
358 vtkSetMacro(QuaternC, double);
359 double GetQuaternC() { return this->QuaternC; }
360 vtkSetMacro(QuaternD, double);
361 double GetQuaternD() { return this->QuaternD; }
362 vtkSetMacro(QOffsetX, double);
363 double GetQOffsetX() { return this->QOffsetX; }
364 vtkSetMacro(QOffsetY, double);
365 double GetQOffsetY() { return this->QOffsetY; }
366 vtkSetMacro(QOffsetZ, double);
367 double GetQOffsetZ() { return this->QOffsetZ; }
369
371
376 vtkSetVector4Macro(SRowX, double);
377 vtkGetVector4Macro(SRowX, double);
378 vtkSetVector4Macro(SRowY, double);
379 vtkGetVector4Macro(SRowY, double);
380 vtkSetVector4Macro(SRowZ, double);
381 vtkGetVector4Macro(SRowZ, double);
383
388
393
395
399 void SetHeader(const nifti_1_header* hdr);
401 void SetHeader(const nifti_2_header* hdr);
404
405protected:
408
409 char Magic[12];
410 vtkTypeInt64 VoxOffset;
413 vtkTypeInt64 Dim[8];
414 double PixDim[8];
416 char IntentName[18];
417 double IntentP1;
418 double IntentP2;
419 double IntentP3;
420 double SclSlope;
421 double SclInter;
422 double CalMin;
423 double CalMax;
425 double TOffset;
426 vtkTypeInt64 SliceStart;
427 vtkTypeInt64 SliceEnd;
431 char Descrip[82];
432 char AuxFile[26];
435 double QuaternB;
436 double QuaternC;
437 double QuaternD;
438 double QOffsetX;
439 double QOffsetY;
440 double QOffsetZ;
441 double SRowX[4];
442 double SRowY[4];
443 double SRowZ[4];
444
445 void SetStringValue(char* x, const char* y, size_t n);
446
447private:
449 void operator=(const vtkNIFTIImageHeader&) = delete;
450};
451
452#endif // vtkNIFTIImageHeader_h
a simple class to control print indentation
Definition: vtkIndent.h:40
Store NIfTI header information.
vtkTypeInt64 GetVoxOffset()
Get the offset to the pixel data within the file.
double GetIntentP2()
Get one of the NIFTI intent parameters.
IntentCodeEnum
NIFTI intent codes.
double GetSclInter()
Get the scale and slope to apply to the data in order to get the real-valued data values.
UnitsXYZTEnum
NIFTI unit codes.
void GetHeader(nifti_1_header *hdr)
Set the values from an existing nifti struct, or store the values in an existing nifti struct.
int GetDataType()
Get the data type.
double GetQuaternB()
Get information about the quaternion transformation.
int GetDimInfo()
Get a bitfield with extra information about the dimensions, it states which dimensions are the phase ...
VTK_FILEPATH const char * GetAuxFile()
void SetAuxFile(VTK_FILEPATH const char *auxfile)
Get an auxiliary file, e.g.
int GetIntentCode()
Get the NIFTI intent code.
double GetCalMax()
Get the calibrated range of the data, i.e.
void SetHeader(const nifti_1_header *hdr)
Set the values from an existing nifti struct, or store the values in an existing nifti struct.
void SetIntentName(const char *name)
Get the intent name.
double GetTOffset()
Get the slice_duration and toffset from the header.
int GetQFormCode()
Get the QForm or SForm code.
int GetBitPix()
Get the number of bits per pixel.
int GetSFormCode()
Get the QForm or SForm code.
void Initialize()
Initialize the header to default values.
void SetDescrip(const char *descrip)
Get a null-terminated file descriptor, this usually gives the name of the software that wrote the fil...
double GetSclSlope()
Get the scale and slope to apply to the data in order to get the real-valued data values.
const char * GetMagic()
Get the magic number for the NIFTI file as a null-terminated string.
const char * GetIntentName()
static vtkNIFTIImageHeader * New()
Static method for construction.
~vtkNIFTIImageHeader() override
void SetHeader(const nifti_2_header *hdr)
Set the values from an existing nifti struct, or store the values in an existing nifti struct.
SliceCodeEnum
NIFTI slice codes.
XFormCodeEnum
NIFTI transform codes.
double GetPixDim(int i)
Get the sample spacing in the nth dimension.
int GetXYZTUnits()
Get a bitfield that describes the units for the first 4 dims.
vtkTypeInt64 GetDim(int i)
Get the nth dimension of the data, where GetDim(0) returns the number of dimensions that are defined ...
void GetHeader(nifti_2_header *hdr)
Set the values from an existing nifti struct, or store the values in an existing nifti struct.
double GetQOffsetY()
Get information about the quaternion transformation.
vtkTypeInt64 GetSliceStart()
Get the slice range for the data.
vtkTypeInt64 GetSliceEnd()
Get the slice range for the data.
void PrintSelf(ostream &os, vtkIndent indent) override
Print information about this object.
double GetSliceDuration()
Get the slice_duration and toffset from the header.
double GetIntentP3()
Get one of the NIFTI intent parameters.
double GetQuaternC()
Get information about the quaternion transformation.
void DeepCopy(vtkNIFTIImageHeader *o)
Make a copy of the header.
DataTypeEnum
NIFTI data types.
double GetIntentP1()
Get one of the NIFTI intent parameters.
HeaderSizeEnum
NIFTI header sizes.
double GetQuaternD()
Get information about the quaternion transformation.
double GetCalMin()
Get the calibrated range of the data, i.e.
void SetStringValue(char *x, const char *y, size_t n)
double GetQOffsetX()
Get information about the quaternion transformation.
int GetSliceCode()
Get the slice code for the data.
double GetQOffsetZ()
Get information about the quaternion transformation.
abstract base class for most VTK objects
Definition: vtkObject.h:63
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...
#define VTK_FILEPATH