VTK
vtkNIFTIImageReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkNIFTIImageReader.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 =========================================================================*/
37 #ifndef vtkNIFTIImageReader_h
38 #define vtkNIFTIImageReader_h
39 
40 #include "vtkIOImageModule.h" // For export macro
41 #include "vtkImageReader2.h"
42 
44 class vtkMatrix4x4;
45 
46 struct nifti_1_header;
47 
48 //----------------------------------------------------------------------------
50 {
51 public:
53 
54  static vtkNIFTIImageReader *New();
57 
59  virtual void PrintSelf(ostream& os, vtkIndent indent);
60 
62 
63  virtual const char* GetFileExtensions() {
64  return ".nii .nii.gz .img .img.gz .hdr .hdr.gz"; }
66 
68 
69  virtual const char* GetDescriptiveName() {
70  return "NIfTI"; }
72 
74  int CanReadFile(const char* filename);
75 
77 
82  vtkGetMacro(TimeAsVector, bool);
83  vtkSetMacro(TimeAsVector, bool);
84  vtkBooleanMacro(TimeAsVector, bool);
86 
88 
89  int GetTimeDimension() { return this->Dim[4]; }
90  double GetTimeSpacing() { return this->PixDim[4]; }
92 
94 
99  double GetRescaleSlope() { return this->RescaleSlope; }
100  double GetRescaleIntercept() { return this->RescaleIntercept; }
102 
104 
110  vtkGetMacro(PlanarRGB, bool);
111  vtkSetMacro(PlanarRGB, bool);
112  vtkBooleanMacro(PlanarRGB, bool);
114 
123  double GetQFac() { return this->QFac; }
124 
136  vtkMatrix4x4 *GetQFormMatrix() { return this->QFormMatrix; }
137 
151  vtkMatrix4x4 *GetSFormMatrix() { return this->SFormMatrix; }
152 
154  vtkNIFTIImageHeader *GetNIFTIHeader();
155 
156 protected:
159 
161 
162  virtual int RequestInformation(
163  vtkInformation* request, vtkInformationVector** inputVector,
164  vtkInformationVector* outputVector);
166 
168 
169  virtual int RequestData(
170  vtkInformation* request, vtkInformationVector** inputVector,
171  vtkInformationVector* outputVector);
173 
177  static bool CheckExtension(const char *fname, const char *ext);
178 
180 
186  static char *ReplaceExtension(
187  const char *fname, const char *ext1, const char *ext2);
189 
191  static int CheckNIFTIVersion(const nifti_1_header *hdr);
192 
194  static bool CheckAnalyzeHeader(const nifti_1_header *hdr);
195 
198 
200 
202  double RescaleSlope;
204 
207  double QFac;
208 
210 
214 
216  int Dim[8];
217 
219  double PixDim[8];
220 
223 
225  bool PlanarRGB;
226 
227 private:
228  vtkNIFTIImageReader(const vtkNIFTIImageReader&); // Not implemented.
229  void operator=(const vtkNIFTIImageReader&); // Not implemented.
230 };
231 
232 #endif // vtkNIFTIImageReader_h
virtual const char * GetDescriptiveName()
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
Data structure defining the fields in the nifti1 header. This binary header should be found at the be...
vtkMatrix4x4 * GetQFormMatrix()
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Read NIfTI-1 and NIfTI-2 medical image files.
virtual const char * GetFileExtensions()
virtual int CanReadFile(const char *vtkNotUsed(fname))
a simple class to control print indentation
Definition: vtkIndent.h:38
Superclass of binary file readers.
vtkMatrix4x4 * GetSFormMatrix()
void PrintSelf(ostream &os, vtkIndent indent)
vtkNIFTIImageHeader * NIFTIHeader
Store zero or more vtkInformation instances.
#define VTKIOIMAGE_EXPORT
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store NIfTI header information.
vtkMatrix4x4 * SFormMatrix
vtkMatrix4x4 * QFormMatrix