VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/IO/Image/vtkNIFTIImageHeader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkNIFTIImageHeader.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00038 #ifndef vtkNIFTIImageHeader_h
00039 #define vtkNIFTIImageHeader_h
00040 
00041 #include "vtkIOImageModule.h" // For export macro
00042 #include "vtkObject.h"
00043 
00044 struct nifti_1_header;
00045 struct nifti_2_header;
00046 
00047 //----------------------------------------------------------------------------
00048 class VTKIOIMAGE_EXPORT vtkNIFTIImageHeader : public vtkObject
00049 {
00050 public:
00051 
00053 
00054   enum IntentCodeEnum {
00055     IntentNone = 0,
00056     IntentCorrel = 2,
00057     IntentTTest = 3,
00058     IntentFTest = 4,
00059     IntentZScore = 5,
00060     IntentChiSQ = 6,
00061     IntentBeta = 7,
00062     IntentBinom = 8,
00063     IntentGamma = 9,
00064     IntentPoisson = 10,
00065     IntentNormal = 11,
00066     IntentFTestNonc = 12,
00067     IntentChiSQNonc = 13,
00068     IntentLogistic = 14,
00069     IntentLaplace = 15,
00070     IntentUniform = 16,
00071     IntentTTestNonc = 17,
00072     IntentWeibull = 18,
00073     IntentChi = 19,
00074     IntentInvGauss = 20,
00075     IntentExtVal = 21,
00076     IntentPVal = 22,
00077     IntentLogPVal = 23,
00078     IntentLog10PVal = 24,
00079     IntentEstimate = 1001,
00080     IntentLabel = 1002,
00081     IntentNeuroName = 1003,
00082     IntentGenMatrix = 1004,
00083     IntentSymMatrix = 1005,
00084     IntentDispVect = 1006,
00085     IntentVector = 1007,
00086     IntentPointSet = 1008,
00087     IntentTriangle = 1009,
00088     IntentQuaternion = 1010,
00089     IntentDimless = 1011,
00090     IntentTimeSeries = 2001,
00091     IntentNodeIndex = 2002,
00092     IntentRGBVector = 2003,
00093     IntentRGBAVector = 2004,
00094     IntentShape = 2005
00095   };
00097 
00099 
00100   enum XFormCodeEnum {
00101     XFormUnkown = 0,
00102     XFormScannerAnat = 1,
00103     XFormAlignedAnat = 2,
00104     XFormTalairach = 3,
00105     XFormMNI152 = 4
00106   };
00108 
00110 
00111   enum SliceCodeEnum {
00112     SliceUnknown = 0,
00113     SliceSeqInc = 1,
00114     SliceSeqDec = 2,
00115     SliceAltInc = 3,
00116     SliceAltDec = 4,
00117     SliceAltInc2 = 5,
00118     SliceAltDec2 = 6
00119   };
00121 
00123 
00124   enum UnitsXYZTEnum {
00125     UnitsUnknown = 0,
00126     UnitsMeter = 1,
00127     UnitsMM = 2,
00128     UnitsMicron = 3,
00129     UnitsSpace = 7,
00130     UnitsSec = 8,
00131     UnitsMSec = 16,
00132     UnitsUSec = 24,
00133     UnitsHz = 32,
00134     UnitsPPM = 40,
00135     UnitsRads = 48,
00136     UnitsTime = 56
00137   };
00139 
00141 
00145   enum DataTypeEnum {
00146     TypeUInt8 = 2,
00147     TypeInt16 = 4,
00148     TypeInt32 = 8,
00149     TypeFloat32 = 16,
00150     TypeComplex64 = 32,
00151     TypeFloat64 = 64,
00152     TypeRGB24 = 128,
00153     TypeInt8 = 256,
00154     TypeUInt16 = 512,
00155     TypeUInt32 = 768,
00156     TypeInt64 = 1024,
00157     TypeUInt64 = 1280,
00158     TypeFloat128 = 1536,
00159     TypeComplex128 = 1792,
00160     TypeComplex256 = 2048,
00161     TypeRGBA32 = 2304
00162   };
00164 
00166 
00167   enum HeaderSizeEnum {
00168     NIFTI1HeaderSize = 348,
00169     NIFTI2HeaderSize = 540
00170   };
00172 
00174 
00175   static vtkNIFTIImageHeader *New();
00176   vtkTypeMacro(vtkNIFTIImageHeader, vtkObject);
00178 
00180   virtual void PrintSelf(ostream& os, vtkIndent indent);
00181 
00183   const char *GetMagic() { return this->Magic; }
00184 
00186   vtkTypeInt64 GetVoxOffset() { return this->VoxOffset; }
00187 
00189   int GetDataType() { return this->DataType; }
00190 
00192   int GetBitPix() { return this->BitPix; }
00193 
00195 
00197   vtkTypeInt64 GetDim(int i) {
00198     return (i < 0 || i > 7 ? 0 : this->Dim[i]); }
00200 
00202 
00205   double GetPixDim(int i) {
00206     return (i < 0 || i > 7 ? 0.0 : this->PixDim[i]); }
00208 
00210 
00212   vtkSetMacro(IntentCode, int);
00213   int GetIntentCode() { return this->IntentCode; }
00215 
00217 
00218   void SetIntentName(const char *name);
00219   const char *GetIntentName() { return this->IntentName; }
00221 
00223 
00225   vtkSetMacro(IntentP1, double);
00226   double GetIntentP1() { return this->IntentP1; }
00227   vtkSetMacro(IntentP2, double);
00228   double GetIntentP2() { return this->IntentP2; }
00229   vtkSetMacro(IntentP3, double);
00230   double GetIntentP3() { return this->IntentP3; }
00232 
00234 
00236   vtkSetMacro(SclSlope, double);
00237   double GetSclSlope() { return this->SclSlope; }
00238   vtkSetMacro(SclInter, double);
00239   double GetSclInter() { return this->SclInter; }
00241 
00243 
00245   vtkSetMacro(CalMin, double);
00246   double GetCalMin() { return this->CalMin; }
00247   vtkSetMacro(CalMax, double);
00248   double GetCalMax() { return this->CalMax; }
00250 
00252 
00253   vtkSetMacro(SliceDuration, double);
00254   double GetSliceDuration() { return this->SliceDuration; }
00255   vtkSetMacro(TOffset, double);
00256   double GetTOffset() { return this->TOffset; }
00258 
00260 
00261   vtkSetMacro(SliceStart, vtkTypeInt64);
00262   vtkTypeInt64 GetSliceStart() { return this->SliceStart; }
00263   vtkSetMacro(SliceEnd, vtkTypeInt64);
00264   vtkTypeInt64 GetSliceEnd() { return this->SliceEnd; }
00266 
00268 
00269   vtkSetMacro(SliceCode, int);
00270   int GetSliceCode() { return this->SliceCode; }
00272 
00274 
00275   vtkSetMacro(XYZTUnits, int);
00276   int GetXYZTUnits() { return this->XYZTUnits; }
00278 
00280 
00283   vtkSetMacro(DimInfo, int);
00284   int GetDimInfo() { return this->DimInfo; }
00286 
00288 
00293   void SetDescrip(const char *descrip);
00294   const char *GetDescrip() { return this->Descrip; }
00296 
00298 
00302   void SetAuxFile(const char *auxfile);
00303   const char *GetAuxFile() { return this->AuxFile; }
00305 
00307 
00308   vtkSetMacro(QFormCode, int);
00309   int GetQFormCode() { return this->QFormCode; }
00310   vtkSetMacro(SFormCode, int);
00311   int GetSFormCode() { return this->SFormCode; }
00313 
00315 
00318   vtkSetMacro(QuaternB, double);
00319   double GetQuaternB() { return this->QuaternB; }
00320   vtkSetMacro(QuaternC, double);
00321   double GetQuaternC() { return this->QuaternC; }
00322   vtkSetMacro(QuaternD, double);
00323   double GetQuaternD() { return this->QuaternD; }
00324   vtkSetMacro(QOffsetX, double);
00325   double GetQOffsetX() { return this->QOffsetX; }
00326   vtkSetMacro(QOffsetY, double);
00327   double GetQOffsetY() { return this->QOffsetY; }
00328   vtkSetMacro(QOffsetZ, double);
00329   double GetQOffsetZ() { return this->QOffsetZ; }
00331 
00333 
00336   vtkSetVector4Macro(SRowX, double);
00337   vtkGetVector4Macro(SRowX, double);
00338   vtkSetVector4Macro(SRowY, double);
00339   vtkGetVector4Macro(SRowY, double);
00340   vtkSetVector4Macro(SRowZ, double);
00341   vtkGetVector4Macro(SRowZ, double);
00343 
00345   void Initialize();
00346 
00348   void DeepCopy(vtkNIFTIImageHeader *o);
00349 
00351 
00353   void SetHeader(const nifti_1_header *hdr);
00354   void GetHeader(nifti_1_header *hdr);
00355   void SetHeader(const nifti_2_header *hdr);
00356   void GetHeader(nifti_2_header *hdr);
00358 
00359 protected:
00360   vtkNIFTIImageHeader();
00361   ~vtkNIFTIImageHeader();
00362 
00363   char Magic[12];
00364   vtkTypeInt64 VoxOffset;
00365   int DataType;
00366   int BitPix;
00367   vtkTypeInt64 Dim[8];
00368   double PixDim[8];
00369   int IntentCode;
00370   char IntentName[18];
00371   double IntentP1;
00372   double IntentP2;
00373   double IntentP3;
00374   double SclSlope;
00375   double SclInter;
00376   double CalMin;
00377   double CalMax;
00378   double SliceDuration;
00379   double TOffset;
00380   vtkTypeInt64 SliceStart;
00381   vtkTypeInt64 SliceEnd;
00382   int SliceCode;
00383   int XYZTUnits;
00384   int DimInfo;
00385   char Descrip[82];
00386   char AuxFile[26];
00387   int QFormCode;
00388   int SFormCode;
00389   double QuaternB;
00390   double QuaternC;
00391   double QuaternD;
00392   double QOffsetX;
00393   double QOffsetY;
00394   double QOffsetZ;
00395   double SRowX[4];
00396   double SRowY[4];
00397   double SRowZ[4];
00398 
00399   void SetStringValue(char *x, const char *y, size_t n);
00400 
00401 private:
00402   vtkNIFTIImageHeader(const vtkNIFTIImageHeader&);  // Not implemented.
00403   void operator=(const vtkNIFTIImageHeader&);  // Not implemented.
00404 };
00405 
00406 #endif // vtkNIFTIImageHeader_h