vtk-dicom  0.8.17
vtkNIFTIWriter.h
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkNIFTIWriter.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 =========================================================================*/
33 #ifndef vtkNIFTIWriter_h
34 #define vtkNIFTIWriter_h
35 
36 #include "vtkImageWriter.h"
37 #include "vtkDICOMModule.h" // For export macro
38 #include "vtkDICOMConfig.h" // For configuration details
39 
40 // Declare VTK classes within VTK's optional namespace
41 #if defined(VTK_ABI_NAMESPACE_BEGIN)
42 VTK_ABI_NAMESPACE_BEGIN
43 #endif
44 
45 class vtkMatrix4x4;
46 
47 #if defined(VTK_ABI_NAMESPACE_BEGIN)
48 VTK_ABI_NAMESPACE_END
49 #endif
50 
51 class vtkNIFTIHeader;
52 
53 class VTKDICOM_EXPORT vtkNIFTIWriter : public vtkImageWriter
54 {
55 public:
56 
58  enum EndianEnum {
59  BigEndian = 0,
60  LittleEndian = 1
61  };
62 
64  static vtkNIFTIWriter *New();
66 
68  void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
69 
71 
77  vtkSetMacro(NIFTIVersion, int);
78  vtkGetMacro(NIFTIVersion, int);
80 
82  vtkSetStringMacro(Description);
84  vtkGetStringMacro(Description);
86 
88 
94  vtkGetMacro(TimeDimension, int);
95  vtkSetMacro(TimeDimension, int);
96  vtkGetMacro(TimeSpacing, double);
97  vtkSetMacro(TimeSpacing, double);
99 
101 
109  vtkSetMacro(RescaleSlope, double);
110  vtkGetMacro(RescaleSlope, double);
111  vtkSetMacro(RescaleIntercept, double);
112  vtkGetMacro(RescaleIntercept, double);
114 
116 
123  vtkGetMacro(PlanarRGB, bool);
124  vtkSetMacro(PlanarRGB, bool);
125  vtkBooleanMacro(PlanarRGB, bool);
127 
129 
134  vtkSetMacro(QFac, double);
135  vtkGetMacro(QFac, double);
137 
139 
146  void SetQFormMatrix(vtkMatrix4x4 *);
147  vtkMatrix4x4 *GetQFormMatrix() { return this->QFormMatrix; }
149 
151 
158  void SetSFormMatrix(vtkMatrix4x4 *);
159  vtkMatrix4x4 *GetSFormMatrix() { return this->SFormMatrix; }
161 
163 
171  vtkNIFTIHeader *GetNIFTIHeader();
173 
175 
184  vtkSetMacro(DataByteOrder, EndianEnum);
185  void SetDataByteOrderToBigEndian() {
186  this->SetDataByteOrder(BigEndian); }
187  void SetDataByteOrderToLittleEndian() {
188  this->SetDataByteOrder(LittleEndian); }
189  vtkGetMacro(DataByteOrder, EndianEnum);
191 
192 protected:
193  vtkNIFTIWriter();
194  ~vtkNIFTIWriter() VTK_DICOM_OVERRIDE;
195 
197  int GenerateHeader(vtkInformation *info, bool singleFile);
198 
200  int RequestData(vtkInformation *request,
201  vtkInformationVector** inputVector,
202  vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
203 
205 
210  static char *ReplaceExtension(
211  const char *fname, const char *ext1, const char *ext2);
212 
214  int TimeDimension;
215  double TimeSpacing;
216 
218  double RescaleIntercept;
219  double RescaleSlope;
220 
222  double QFac;
223 
225  vtkMatrix4x4 *QFormMatrix;
226  vtkMatrix4x4 *SFormMatrix;
227 
229  char *Description;
230 
232  vtkNIFTIHeader *NIFTIHeader;
233  vtkNIFTIHeader *OwnHeader;
234  int NIFTIVersion;
235 
237  bool PlanarRGB;
238 
240  EndianEnum DataByteOrder;
241 
242 private:
243 #ifdef VTK_DICOM_DELETE
244  vtkNIFTIWriter(const vtkNIFTIWriter&) VTK_DICOM_DELETE;
245  void operator=(const vtkNIFTIWriter&) VTK_DICOM_DELETE;
246 #else
247  vtkNIFTIWriter(const vtkNIFTIWriter&) = delete;
248  void operator=(const vtkNIFTIWriter&) = delete;
249 #endif
250 };
251 
252 #endif // vtkNIFTIWriter_h
Writes images to files.
Definition: vtkImageWriter.h:33
Store NIfTI header information.
Definition: vtkNIFTIHeader.h:48
Write NIfTI-1 and NIfTI-2 medical image files.
Definition: vtkNIFTIWriter.h:54
void SetSFormMatrix(vtkMatrix4x4 *)
Set a matrix for the "sform" transformation stored in the file.
void PrintSelf(ostream &os, vtkIndent indent) VTK_DICOM_OVERRIDE
Print information about this object.
void SetNIFTIHeader(vtkNIFTIHeader *hdr)
Set the NIFTI header information to use when writing the file.
EndianEnum
Endianness of output file.
Definition: vtkNIFTIWriter.h:58
void SetQFormMatrix(vtkMatrix4x4 *)
Set the "qform" orientation and offset for the image data.
static vtkNIFTIWriter * New()
Static method for construction.