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 =========================================================================*/
38 #ifndef vtkNIFTIImageHeader_h
39 #define vtkNIFTIImageHeader_h
40 
41 #include "vtkIOImageModule.h" // For export macro
42 #include "vtkObject.h"
43 
44 struct nifti_1_header;
45 struct nifti_2_header;
46 
47 //----------------------------------------------------------------------------
49 {
50 public:
51 
53 
55  IntentNone = 0,
56  IntentCorrel = 2,
57  IntentTTest = 3,
58  IntentFTest = 4,
59  IntentZScore = 5,
60  IntentChiSQ = 6,
61  IntentBeta = 7,
62  IntentBinom = 8,
63  IntentGamma = 9,
64  IntentPoisson = 10,
65  IntentNormal = 11,
66  IntentFTestNonc = 12,
67  IntentChiSQNonc = 13,
68  IntentLogistic = 14,
69  IntentLaplace = 15,
70  IntentUniform = 16,
71  IntentTTestNonc = 17,
72  IntentWeibull = 18,
73  IntentChi = 19,
74  IntentInvGauss = 20,
75  IntentExtVal = 21,
76  IntentPVal = 22,
77  IntentLogPVal = 23,
78  IntentLog10PVal = 24,
79  IntentEstimate = 1001,
80  IntentLabel = 1002,
81  IntentNeuroName = 1003,
82  IntentGenMatrix = 1004,
83  IntentSymMatrix = 1005,
84  IntentDispVect = 1006,
85  IntentVector = 1007,
86  IntentPointSet = 1008,
87  IntentTriangle = 1009,
88  IntentQuaternion = 1010,
89  IntentDimless = 1011,
90  IntentTimeSeries = 2001,
91  IntentNodeIndex = 2002,
92  IntentRGBVector = 2003,
93  IntentRGBAVector = 2004,
94  IntentShape = 2005
95  };
97 
99 
101  XFormUnkown = 0,
102  XFormScannerAnat = 1,
103  XFormAlignedAnat = 2,
104  XFormTalairach = 3,
105  XFormMNI152 = 4
106  };
108 
110 
112  SliceUnknown = 0,
113  SliceSeqInc = 1,
114  SliceSeqDec = 2,
115  SliceAltInc = 3,
116  SliceAltDec = 4,
117  SliceAltInc2 = 5,
118  SliceAltDec2 = 6
119  };
121 
123 
125  UnitsUnknown = 0,
126  UnitsMeter = 1,
127  UnitsMM = 2,
128  UnitsMicron = 3,
129  UnitsSpace = 7,
130  UnitsSec = 8,
131  UnitsMSec = 16,
132  UnitsUSec = 24,
133  UnitsHz = 32,
134  UnitsPPM = 40,
135  UnitsRads = 48,
136  UnitsTime = 56
137  };
139 
141 
146  TypeUInt8 = 2,
147  TypeInt16 = 4,
148  TypeInt32 = 8,
149  TypeFloat32 = 16,
150  TypeComplex64 = 32,
151  TypeFloat64 = 64,
152  TypeRGB24 = 128,
153  TypeInt8 = 256,
154  TypeUInt16 = 512,
155  TypeUInt32 = 768,
156  TypeInt64 = 1024,
157  TypeUInt64 = 1280,
158  TypeFloat128 = 1536,
159  TypeComplex128 = 1792,
160  TypeComplex256 = 2048,
161  TypeRGBA32 = 2304
162  };
164 
166 
168  NIFTI1HeaderSize = 348,
169  NIFTI2HeaderSize = 540
170  };
172 
174 
175  static vtkNIFTIImageHeader *New();
178 
180  virtual void PrintSelf(ostream& os, vtkIndent indent);
181 
183  const char *GetMagic() { return this->Magic; }
184 
186  vtkTypeInt64 GetVoxOffset() { return this->VoxOffset; }
187 
189  int GetDataType() { return this->DataType; }
190 
192  int GetBitPix() { return this->BitPix; }
193 
195 
197  vtkTypeInt64 GetDim(int i) {
198  return (i < 0 || i > 7 ? 0 : this->Dim[i]); }
200 
202 
205  double GetPixDim(int i) {
206  return (i < 0 || i > 7 ? 0.0 : this->PixDim[i]); }
208 
210 
212  vtkSetMacro(IntentCode, int);
213  int GetIntentCode() { return this->IntentCode; }
215 
217 
218  void SetIntentName(const char *name);
219  const char *GetIntentName() { return this->IntentName; }
221 
223 
225  vtkSetMacro(IntentP1, double);
226  double GetIntentP1() { return this->IntentP1; }
227  vtkSetMacro(IntentP2, double);
228  double GetIntentP2() { return this->IntentP2; }
229  vtkSetMacro(IntentP3, double);
230  double GetIntentP3() { return this->IntentP3; }
232 
234 
236  vtkSetMacro(SclSlope, double);
237  double GetSclSlope() { return this->SclSlope; }
238  vtkSetMacro(SclInter, double);
239  double GetSclInter() { return this->SclInter; }
241 
243 
245  vtkSetMacro(CalMin, double);
246  double GetCalMin() { return this->CalMin; }
247  vtkSetMacro(CalMax, double);
248  double GetCalMax() { return this->CalMax; }
250 
252 
253  vtkSetMacro(SliceDuration, double);
254  double GetSliceDuration() { return this->SliceDuration; }
255  vtkSetMacro(TOffset, double);
256  double GetTOffset() { return this->TOffset; }
258 
260 
261  vtkSetMacro(SliceStart, vtkTypeInt64);
262  vtkTypeInt64 GetSliceStart() { return this->SliceStart; }
263  vtkSetMacro(SliceEnd, vtkTypeInt64);
264  vtkTypeInt64 GetSliceEnd() { return this->SliceEnd; }
266 
268 
269  vtkSetMacro(SliceCode, int);
270  int GetSliceCode() { return this->SliceCode; }
272 
274 
275  vtkSetMacro(XYZTUnits, int);
276  int GetXYZTUnits() { return this->XYZTUnits; }
278 
280 
283  vtkSetMacro(DimInfo, int);
284  int GetDimInfo() { return this->DimInfo; }
286 
288 
293  void SetDescrip(const char *descrip);
294  const char *GetDescrip() { return this->Descrip; }
296 
298 
302  void SetAuxFile(const char *auxfile);
303  const char *GetAuxFile() { return this->AuxFile; }
305 
307 
308  vtkSetMacro(QFormCode, int);
309  int GetQFormCode() { return this->QFormCode; }
310  vtkSetMacro(SFormCode, int);
311  int GetSFormCode() { return this->SFormCode; }
313 
315 
318  vtkSetMacro(QuaternB, double);
319  double GetQuaternB() { return this->QuaternB; }
320  vtkSetMacro(QuaternC, double);
321  double GetQuaternC() { return this->QuaternC; }
322  vtkSetMacro(QuaternD, double);
323  double GetQuaternD() { return this->QuaternD; }
324  vtkSetMacro(QOffsetX, double);
325  double GetQOffsetX() { return this->QOffsetX; }
326  vtkSetMacro(QOffsetY, double);
327  double GetQOffsetY() { return this->QOffsetY; }
328  vtkSetMacro(QOffsetZ, double);
329  double GetQOffsetZ() { return this->QOffsetZ; }
331 
333 
336  vtkSetVector4Macro(SRowX, double);
337  vtkGetVector4Macro(SRowX, double);
338  vtkSetVector4Macro(SRowY, double);
339  vtkGetVector4Macro(SRowY, double);
340  vtkSetVector4Macro(SRowZ, double);
341  vtkGetVector4Macro(SRowZ, double);
343 
345  void Initialize();
346 
348  void DeepCopy(vtkNIFTIImageHeader *o);
349 
351 
353  void SetHeader(const nifti_1_header *hdr);
354  void GetHeader(nifti_1_header *hdr);
355  void SetHeader(const nifti_2_header *hdr);
356  void GetHeader(nifti_2_header *hdr);
358 
359 protected:
362 
363  char Magic[12];
364  vtkTypeInt64 VoxOffset;
365  int DataType;
366  int BitPix;
367  vtkTypeInt64 Dim[8];
368  double PixDim[8];
370  char IntentName[18];
371  double IntentP1;
372  double IntentP2;
373  double IntentP3;
374  double SclSlope;
375  double SclInter;
376  double CalMin;
377  double CalMax;
379  double TOffset;
380  vtkTypeInt64 SliceStart;
381  vtkTypeInt64 SliceEnd;
384  int DimInfo;
385  char Descrip[82];
386  char AuxFile[26];
389  double QuaternB;
390  double QuaternC;
391  double QuaternD;
392  double QOffsetX;
393  double QOffsetY;
394  double QOffsetZ;
395  double SRowX[4];
396  double SRowY[4];
397  double SRowZ[4];
398 
399  void SetStringValue(char *x, const char *y, size_t n);
400 
401 private:
402  vtkNIFTIImageHeader(const vtkNIFTIImageHeader&); // Not implemented.
403  void operator=(const vtkNIFTIImageHeader&); // Not implemented.
404 };
405 
406 #endif // vtkNIFTIImageHeader_h
abstract base class for most VTK objects
Definition: vtkObject.h:61
const char * GetIntentName()
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...
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkTypeInt64 GetVoxOffset()
vtkTypeInt64 GetDim(int i)
vtkTypeInt64 GetSliceEnd()
#define VTKIOIMAGE_EXPORT
static vtkObject * New()
Store NIfTI header information.
vtkTypeInt64 GetSliceStart()