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
45struct nifti_1_header;
46struct nifti_2_header;
47
48//----------------------------------------------------------------------------
49class VTKIOIMAGE_EXPORT vtkNIFTIImageHeader : public vtkObject
50{
51public:
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
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
385
390
392
396 void SetHeader(const nifti_1_header *hdr);
398 void SetHeader(const nifti_2_header *hdr);
401
402protected:
405
406 char Magic[12];
407 vtkTypeInt64 VoxOffset;
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;
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
444private:
445 vtkNIFTIImageHeader(const vtkNIFTIImageHeader&) VTK_DELETE_FUNCTION;
446 void operator=(const vtkNIFTIImageHeader&) VTK_DELETE_FUNCTION;
447};
448
449#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.
IntentCodeEnum
NIFTI intent codes.
UnitsXYZTEnum
NIFTI unit codes.
void GetHeader(nifti_1_header *hdr)
int GetDataType()
Get the data type.
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.
int GetBitPix()
Get the number of bits per pixel.
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...
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.
void SetHeader(const nifti_2_header *hdr)
SliceCodeEnum
NIFTI slice codes.
XFormCodeEnum
NIFTI transform codes.
double GetPixDim(int i)
Get the sample spacing in the nth dimension.
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)
void SetAuxFile(const char *auxfile)
Get an auxilliary file, e.g.
vtkTypeInt64 GetSliceStart()
vtkTypeInt64 GetSliceEnd()
void PrintSelf(ostream &os, vtkIndent indent) override
Print information about this object.
void DeepCopy(vtkNIFTIImageHeader *o)
Make a copy of the header.
DataTypeEnum
NIFTI data types.
HeaderSizeEnum
NIFTI header sizes.
void SetStringValue(char *x, const char *y, size_t n)
abstract base class for most VTK objects
Definition: vtkObject.h:60
@ name
Definition: vtkX3D.h:219
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...
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.