VTK
|
Read NIfTI-1 and NIfTI-2 medical image files. More...
#include <vtkNIFTIImageReader.h>
Read NIfTI-1 and NIfTI-2 medical image files.
This class reads NIFTI files, either in .nii format or as separate .img and .hdr files. If two files are used, then they can be passed by using SetFileNames() instead of SetFileName(). Files ending in .gz are decompressed on-the-fly while they are being read. Files with complex numbers or vector dimensions will be read as multi-component images. If a NIFTI file has a time dimension, then by default only the first image in the time series will be read, but the TimeAsVector flag can be set to read the time steps as vector components. Files in Analyze 7.5 format are also supported by this reader.
Definition at line 49 of file vtkNIFTIImageReader.h.
Static method for construction.
Reimplemented from vtkImageReader2.
Definition at line 55 of file vtkNIFTIImageReader.h.
vtkNIFTIImageReader::vtkNIFTIImageReader | ( | ) | [protected] |
vtkNIFTIImageReader::~vtkNIFTIImageReader | ( | ) | [protected] |
static vtkNIFTIImageReader* vtkNIFTIImageReader::New | ( | ) | [static] |
Static method for construction.
Reimplemented from vtkImageReader2.
static int vtkNIFTIImageReader::IsTypeOf | ( | const char * | type | ) | [static] |
Static method for construction.
Reimplemented from vtkImageReader2.
virtual int vtkNIFTIImageReader::IsA | ( | const char * | type | ) | [virtual] |
Static method for construction.
Reimplemented from vtkImageReader2.
static vtkNIFTIImageReader* vtkNIFTIImageReader::SafeDownCast | ( | vtkObjectBase * | o | ) | [static] |
Static method for construction.
Reimplemented from vtkImageReader2.
virtual vtkObjectBase* vtkNIFTIImageReader::NewInstanceInternal | ( | ) | const [protected, virtual] |
Static method for construction.
Reimplemented from vtkImageReader2.
Static method for construction.
Reimplemented from vtkImageReader2.
virtual void vtkNIFTIImageReader::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) | [virtual] |
Print information about this object.
Reimplemented from vtkImageReader2.
virtual const char* vtkNIFTIImageReader::GetFileExtensions | ( | ) | [inline, virtual] |
Valid extensions for this file type.
Reimplemented from vtkImageReader2.
Definition at line 63 of file vtkNIFTIImageReader.h.
virtual const char* vtkNIFTIImageReader::GetDescriptiveName | ( | ) | [inline, virtual] |
Return a descriptive name that might be useful in a GUI.
Reimplemented from vtkImageReader2.
Definition at line 69 of file vtkNIFTIImageReader.h.
int vtkNIFTIImageReader::CanReadFile | ( | const char * | filename | ) |
Return true if this reader can read the given file.
virtual bool vtkNIFTIImageReader::GetTimeAsVector | ( | ) | [virtual] |
Read the time dimension as scalar components (default: Off). If this is on, then each time point will be stored as a component in the image data. If the file has both a time dimension and a vector dimension, then the number of components will be the product of these two dimensions, i.e. the components will store a sequence of vectors.
virtual void vtkNIFTIImageReader::SetTimeAsVector | ( | bool | ) | [virtual] |
Read the time dimension as scalar components (default: Off). If this is on, then each time point will be stored as a component in the image data. If the file has both a time dimension and a vector dimension, then the number of components will be the product of these two dimensions, i.e. the components will store a sequence of vectors.
virtual void vtkNIFTIImageReader::TimeAsVectorOn | ( | ) | [virtual] |
Read the time dimension as scalar components (default: Off). If this is on, then each time point will be stored as a component in the image data. If the file has both a time dimension and a vector dimension, then the number of components will be the product of these two dimensions, i.e. the components will store a sequence of vectors.
virtual void vtkNIFTIImageReader::TimeAsVectorOff | ( | ) | [virtual] |
Read the time dimension as scalar components (default: Off). If this is on, then each time point will be stored as a component in the image data. If the file has both a time dimension and a vector dimension, then the number of components will be the product of these two dimensions, i.e. the components will store a sequence of vectors.
int vtkNIFTIImageReader::GetTimeDimension | ( | ) | [inline] |
Get the time dimension that was stored in the NIFTI header.
Definition at line 89 of file vtkNIFTIImageReader.h.
double vtkNIFTIImageReader::GetTimeSpacing | ( | ) | [inline] |
Get the time dimension that was stored in the NIFTI header.
Definition at line 90 of file vtkNIFTIImageReader.h.
double vtkNIFTIImageReader::GetRescaleSlope | ( | ) | [inline] |
Get the slope and intercept for rescaling the scalar values. These values allow calibration of the data to real values. Use the equation v = u*RescaleSlope + RescaleIntercept. This directly returns the values stored in the scl_slope and scl_inter fields in the NIFTI header.
Definition at line 99 of file vtkNIFTIImageReader.h.
double vtkNIFTIImageReader::GetRescaleIntercept | ( | ) | [inline] |
Get the slope and intercept for rescaling the scalar values. These values allow calibration of the data to real values. Use the equation v = u*RescaleSlope + RescaleIntercept. This directly returns the values stored in the scl_slope and scl_inter fields in the NIFTI header.
Definition at line 100 of file vtkNIFTIImageReader.h.
double vtkNIFTIImageReader::GetQFac | ( | ) | [inline] |
QFac gives the slice order in the NIFTI file versus the VTK image. If QFac is -1, then the VTK slice index J is related to the NIFTI slice index j by the equation J = (num_slices - j - 1). VTK requires the slices to be ordered so that the voxel indices (I,J,K) provide a right-handed coordinate system, whereas NIFTI does not. Instead, NIFTI stores a factor called "qfac" in the header to signal when the (i,j,k) indices form a left-handed coordinate system. QFac will only ever have values of +1 or -1.
Definition at line 111 of file vtkNIFTIImageReader.h.
vtkMatrix4x4* vtkNIFTIImageReader::GetQFormMatrix | ( | ) | [inline] |
Get a matrix that gives the "qform" orientation and offset for the data. If no qform matrix was stored in the file, the return value is NULL. This matrix will transform VTK data coordinates into the NIFTI oriented data coordinates, where +X points right, +Y points anterior (toward the front), and +Z points superior (toward the head). The qform matrix will always have a positive determinant. The offset that is stored in the matrix gives the position of the first pixel in the first slice of the VTK image data. Note that if QFac is -1, then the first slice in the VTK image data is the last slice in the NIFTI file, and the Z offset will automatically be adjusted to compensate for this.
Definition at line 124 of file vtkNIFTIImageReader.h.
vtkMatrix4x4* vtkNIFTIImageReader::GetSFormMatrix | ( | ) | [inline] |
Get a matrix that gives the "sform" orientation and offset for the data. If no sform matrix was stored in the file, the return value is NULL. Like the qform matrix, this matrix will transform VTK data coordinates into a NIFTI coordinate system. Unlike the qform matrix, the sform matrix can contain scaling information and can even (rarely) have a negative determinant, i.e. a flip. This matrix is modified slightly as compared to the sform matrix stored in the NIFTI header: the pixdim pixel spacing is factored out. Also, if QFac is -1, then the VTK slices are in reverse order as compared to the NIFTI slices, hence as compared to the sform matrix stored in the header, the third column of this matrix is multiplied by -1 and the Z offset is shifted to compensate for the fact that the last slice has become the first.
Definition at line 139 of file vtkNIFTIImageReader.h.
Get the raw header information from the NIfTI file.
virtual int vtkNIFTIImageReader::RequestInformation | ( | vtkInformation * | request, |
vtkInformationVector ** | inputVector, | ||
vtkInformationVector * | outputVector | ||
) | [protected, virtual] |
Read the header information.
Reimplemented from vtkImageReader2.
virtual int vtkNIFTIImageReader::RequestData | ( | vtkInformation * | request, |
vtkInformationVector ** | inputVector, | ||
vtkInformationVector * | outputVector | ||
) | [protected, virtual] |
Read the voxel data.
Reimplemented from vtkImageAlgorithm.
static bool vtkNIFTIImageReader::CheckExtension | ( | const char * | fname, |
const char * | ext | ||
) | [static, protected] |
Do a case-insensitive check for the given extension. The check will succeed if the filename ends in ".gz", and if the extension matches after removing the ".gz".
static char* vtkNIFTIImageReader::ReplaceExtension | ( | const char * | fname, |
const char * | ext1, | ||
const char * | ext2 | ||
) | [static, protected] |
Make a new filename by replacing extension "ext1" with "ext2". The extensions must include a period, must be three characters long, and must be lower case. This method also verifies that the file exists, and adds or subtracts a ".gz" as necessary If the file exists, a new string is returned that must be deleted by the caller. Otherwise, the return value is NULL.
static int vtkNIFTIImageReader::CheckNIFTIVersion | ( | const nifti_1_header * | hdr | ) | [static, protected] |
Check the version of the header.
static bool vtkNIFTIImageReader::CheckAnalyzeHeader | ( | const nifti_1_header * | hdr | ) | [static, protected] |
Return true if an Analyze 7.5 header was found.
bool vtkNIFTIImageReader::TimeAsVector [protected] |
Read the time dimension as if it was a vector dimension.
Definition at line 185 of file vtkNIFTIImageReader.h.
double vtkNIFTIImageReader::RescaleIntercept [protected] |
Information for rescaling data to quantitative units.
Definition at line 189 of file vtkNIFTIImageReader.h.
double vtkNIFTIImageReader::RescaleSlope [protected] |
Information for rescaling data to quantitative units.
Definition at line 190 of file vtkNIFTIImageReader.h.
double vtkNIFTIImageReader::QFac [protected] |
Is -1 if VTK slice order is opposite to NIFTI slice order, +1 otherwise.
Definition at line 195 of file vtkNIFTIImageReader.h.
vtkMatrix4x4* vtkNIFTIImageReader::QFormMatrix [protected] |
The orientation matrices for the NIFTI file.
Definition at line 199 of file vtkNIFTIImageReader.h.
vtkMatrix4x4* vtkNIFTIImageReader::SFormMatrix [protected] |
The orientation matrices for the NIFTI file.
Definition at line 200 of file vtkNIFTIImageReader.h.
int vtkNIFTIImageReader::Dim[8] [protected] |
The dimensions of the NIFTI file.
Definition at line 204 of file vtkNIFTIImageReader.h.
double vtkNIFTIImageReader::PixDim[8] [protected] |
The spacings in the NIFTI file.
Definition at line 207 of file vtkNIFTIImageReader.h.
vtkNIFTIImageHeader* vtkNIFTIImageReader::NIFTIHeader [protected] |
A copy of the header from the file that was most recently read.
Definition at line 210 of file vtkNIFTIImageReader.h.