VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkNIFTIImageReader.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 =========================================================================*/ 00037 #ifndef vtkNIFTIImageReader_h 00038 #define vtkNIFTIImageReader_h 00039 00040 #include "vtkIOImageModule.h" // For export macro 00041 #include "vtkImageReader2.h" 00042 00043 class vtkNIFTIImageHeader; 00044 class vtkMatrix4x4; 00045 00046 struct nifti_1_header; 00047 00048 //---------------------------------------------------------------------------- 00049 class VTKIOIMAGE_EXPORT vtkNIFTIImageReader : public vtkImageReader2 00050 { 00051 public: 00053 00054 static vtkNIFTIImageReader *New(); 00055 vtkTypeMacro(vtkNIFTIImageReader, vtkImageReader2); 00057 00059 virtual void PrintSelf(ostream& os, vtkIndent indent); 00060 00062 00063 virtual const char* GetFileExtensions() { 00064 return ".nii .nii.gz .img .img.gz .hdr .hdr.gz"; } 00066 00068 00069 virtual const char* GetDescriptiveName() { 00070 return "NIfTI"; } 00072 00074 int CanReadFile(const char* filename); 00075 00077 00082 vtkGetMacro(TimeAsVector, bool); 00083 vtkSetMacro(TimeAsVector, bool); 00084 vtkBooleanMacro(TimeAsVector, bool); 00086 00088 00089 int GetTimeDimension() { return this->Dim[4]; } 00090 double GetTimeSpacing() { return this->PixDim[4]; } 00092 00094 00099 double GetRescaleSlope() { return this->RescaleSlope; } 00100 double GetRescaleIntercept() { return this->RescaleIntercept; } 00102 00111 double GetQFac() { return this->QFac; } 00112 00124 vtkMatrix4x4 *GetQFormMatrix() { return this->QFormMatrix; } 00125 00139 vtkMatrix4x4 *GetSFormMatrix() { return this->SFormMatrix; } 00140 00142 vtkNIFTIImageHeader *GetNIFTIHeader(); 00143 00144 protected: 00145 vtkNIFTIImageReader(); 00146 ~vtkNIFTIImageReader(); 00147 00149 00150 virtual int RequestInformation( 00151 vtkInformation* request, vtkInformationVector** inputVector, 00152 vtkInformationVector* outputVector); 00154 00156 00157 virtual int RequestData( 00158 vtkInformation* request, vtkInformationVector** inputVector, 00159 vtkInformationVector* outputVector); 00161 00165 static bool CheckExtension(const char *fname, const char *ext); 00166 00168 00174 static char *ReplaceExtension( 00175 const char *fname, const char *ext1, const char *ext2); 00177 00179 static int CheckNIFTIVersion(const nifti_1_header *hdr); 00180 00182 static bool CheckAnalyzeHeader(const nifti_1_header *hdr); 00183 00185 bool TimeAsVector; 00186 00188 00189 double RescaleIntercept; 00190 double RescaleSlope; 00192 00195 double QFac; 00196 00198 00199 vtkMatrix4x4 *QFormMatrix; 00200 vtkMatrix4x4 *SFormMatrix; 00202 00204 int Dim[8]; 00205 00207 double PixDim[8]; 00208 00210 vtkNIFTIImageHeader *NIFTIHeader; 00211 00212 private: 00213 vtkNIFTIImageReader(const vtkNIFTIImageReader&); // Not implemented. 00214 void operator=(const vtkNIFTIImageReader&); // Not implemented. 00215 }; 00216 00217 #endif // vtkNIFTIImageReader_h