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 
111  double GetQFac() { return this->QFac; }
112 
124  vtkMatrix4x4 *GetQFormMatrix() { return this->QFormMatrix; }
125 
139  vtkMatrix4x4 *GetSFormMatrix() { return this->SFormMatrix; }
140 
142  vtkNIFTIImageHeader *GetNIFTIHeader();
143 
144 protected:
147 
149 
150  virtual int RequestInformation(
151  vtkInformation* request, vtkInformationVector** inputVector,
152  vtkInformationVector* outputVector);
154 
156 
157  virtual int RequestData(
158  vtkInformation* request, vtkInformationVector** inputVector,
159  vtkInformationVector* outputVector);
161 
165  static bool CheckExtension(const char *fname, const char *ext);
166 
168 
174  static char *ReplaceExtension(
175  const char *fname, const char *ext1, const char *ext2);
177 
179  static int CheckNIFTIVersion(const nifti_1_header *hdr);
180 
182  static bool CheckAnalyzeHeader(const nifti_1_header *hdr);
183 
186 
188 
190  double RescaleSlope;
192 
195  double QFac;
196 
198 
202 
204  int Dim[8];
205 
207  double PixDim[8];
208 
211 
212 private:
213  vtkNIFTIImageReader(const vtkNIFTIImageReader&); // Not implemented.
214  void operator=(const vtkNIFTIImageReader&); // Not implemented.
215 };
216 
217 #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)
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
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 vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
#define VTKIOIMAGE_EXPORT
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store NIfTI header information.
vtkMatrix4x4 * SFormMatrix
vtkMatrix4x4 * QFormMatrix
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69