VTK  9.3.20240418
vtkNIFTIImageWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
24 #ifndef vtkNIFTIImageWriter_h
25 #define vtkNIFTIImageWriter_h
26 
27 #include "vtkIOImageModule.h" // For export macro
28 #include "vtkImageWriter.h"
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkMatrix4x4;
33 
34 class VTKIOIMAGE_EXPORT vtkNIFTIImageWriter : public vtkImageWriter
35 {
36 public:
38 
44 
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
57  vtkSetMacro(NIFTIVersion, int);
58  vtkGetMacro(NIFTIVersion, int);
60 
62 
66  vtkSetStringMacro(Description);
67  vtkGetStringMacro(Description);
69 
71 
77  vtkGetMacro(TimeDimension, int);
78  vtkSetMacro(TimeDimension, int);
79  vtkGetMacro(TimeSpacing, double);
80  vtkSetMacro(TimeSpacing, double);
82 
84 
92  vtkSetMacro(RescaleSlope, double);
93  vtkGetMacro(RescaleSlope, double);
94  vtkSetMacro(RescaleIntercept, double);
95  vtkGetMacro(RescaleIntercept, double);
97 
99 
106  vtkGetMacro(PlanarRGB, bool);
107  vtkSetMacro(PlanarRGB, bool);
108  vtkBooleanMacro(PlanarRGB, bool);
110 
112 
117  vtkSetMacro(QFac, double);
118  vtkGetMacro(QFac, double);
120 
129  vtkMatrix4x4* GetQFormMatrix() { return this->QFormMatrix; }
130 
139  vtkMatrix4x4* GetSFormMatrix() { return this->SFormMatrix; }
140 
142 
152 
153 protected:
156 
160  int GenerateHeader(vtkInformation* info, bool singleFile);
161 
165  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
166  vtkInformationVector* outputVector) override;
167 
174  static char* ReplaceExtension(const char* filename, const char* ext1, const char* ext2);
175 
177 
181  double TimeSpacing;
183 
185 
189  double RescaleSlope;
191 
195  double QFac;
196 
198 
204 
208  char* Description;
209 
211 
218 
222  bool PlanarRGB;
223 
224 private:
225  vtkNIFTIImageWriter(const vtkNIFTIImageWriter&) = delete;
226  void operator=(const vtkNIFTIImageWriter&) = delete;
227 };
228 
229 VTK_ABI_NAMESPACE_END
230 #endif // vtkNIFTIImageWriter_h
Writes images to files.
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:141
Store NIfTI header information.
Write NIfTI-1 and NIfTI-2 medical image files.
void SetNIFTIHeader(vtkNIFTIImageHeader *hdr)
Set the NIFTI header information to use when writing the file.
vtkMatrix4x4 * GetSFormMatrix()
vtkNIFTIImageHeader * GetNIFTIHeader()
Set the NIFTI header information to use when writing the file.
static vtkNIFTIImageWriter * New()
Static method for construction.
double TimeSpacing
The size and spacing of the Time dimension to use in the file.
vtkMatrix4x4 * GetQFormMatrix()
void PrintSelf(ostream &os, vtkIndent indent) override
Print information about this object.
vtkNIFTIImageHeader * OwnHeader
The header information.
vtkMatrix4x4 * SFormMatrix
The orientation matrices for the NIFTI file.
double QFac
Is -1 if VTK slice order is opposite to NIFTI slice order, +1 otherwise.
bool PlanarRGB
Use planar RGB instead of the default (packed).
static char * ReplaceExtension(const char *filename, const char *ext1, const char *ext2)
Make a new filename by replacing extension "ext1" with "ext2".
double RescaleSlope
Information for rescaling data to quantitative units.
char * Description
A description of how the file was produced.
int TimeDimension
The size and spacing of the Time dimension to use in the file.
void SetQFormMatrix(vtkMatrix4x4 *)
Set the "qform" orientation and offset for the image data.
int GenerateHeader(vtkInformation *info, bool singleFile)
Generate the header information for the file.
~vtkNIFTIImageWriter() override
vtkMatrix4x4 * QFormMatrix
The orientation matrices for the NIFTI file.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
The main execution method, which writes the file.
int NIFTIVersion
The header information.
double RescaleIntercept
Information for rescaling data to quantitative units.
vtkNIFTIImageHeader * NIFTIHeader
The header information.
void SetSFormMatrix(vtkMatrix4x4 *)
Set a matrix for the "sform" transformation stored in the file.
@ info
Definition: vtkX3D.h:376