VTK  9.3.20240328
vtkMINCImageWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) 2006 Atamai, Inc.
3 // SPDX-License-Identifier: BSD-3-Clause
27 #ifndef vtkMINCImageWriter_h
28 #define vtkMINCImageWriter_h
29 
30 #include "vtkIOMINCModule.h" // For export macro
31 #include "vtkImageWriter.h"
32 
33 VTK_ABI_NAMESPACE_BEGIN
34 class vtkStringArray;
35 class vtkIdTypeArray;
36 class vtkDoubleArray;
37 class vtkMatrix4x4;
38 
39 // A special class that holds the attributes
41 
42 class VTKIOMINC_EXPORT vtkMINCImageWriter : public vtkImageWriter
43 {
44 public:
46 
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
53  virtual const char* GetFileExtensions() { return ".mnc"; }
54 
58  virtual const char* GetDescriptiveName() { return "MINC"; }
59 
63  void SetFileName(VTK_FILEPATH const char* name) override;
64 
71  void Write() override;
72 
74 
85  virtual void SetDirectionCosines(vtkMatrix4x4* matrix);
86  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
88 
90 
95  vtkSetMacro(RescaleSlope, double);
96  vtkGetMacro(RescaleSlope, double);
97  vtkSetMacro(RescaleIntercept, double);
98  vtkGetMacro(RescaleIntercept, double);
100 
102 
106  virtual void SetImageAttributes(vtkMINCImageAttributes* attributes);
107  virtual vtkMINCImageAttributes* GetImageAttributes() { return this->ImageAttributes; }
109 
111 
115  vtkSetMacro(StrictValidation, vtkTypeBool);
116  vtkBooleanMacro(StrictValidation, vtkTypeBool);
117  vtkGetMacro(StrictValidation, vtkTypeBool);
119 
121 
125  vtkSetStringMacro(HistoryAddition);
126  vtkGetStringMacro(HistoryAddition);
128 
129 protected:
132 
136 
138  double RescaleSlope;
141  int DataUpdateExtent[6];
142 
144  double FileValidRange[2];
147 
149 
151 
153 
154  int Permutation[3];
155  int Flip[3];
156 
159 
161 
162  virtual int OpenNetCDFFile(const char* filename, int& ncid);
163  virtual int CloseNetCDFFile(int ncid);
164 
165  virtual int IndexFromDimensionName(const char* dimName);
166  virtual void ComputePermutationFromOrientation(int permutation[3], int flip[3]);
167  virtual int CreateMINCDimensions(vtkImageData* input, int timeStep, int* dimids);
168  virtual int CreateMINCVariables(vtkImageData* input, int timeStep, int* dimids);
169  virtual int WriteMINCFileAttributes(vtkImageData* input, int timeStep);
170  virtual int WriteMINCData(vtkImageData* input, int frameNumber, int wholeExt[6], int upExt[6]);
171  virtual void FindRescale(double& rescaleSlope, double& rescaleIntercept);
172  virtual void FindMINCValidRange(double range[2]);
173 
175 
177  vtkInformationVector* outputVector) override;
178 
180  vtkInformationVector* outputVector) override;
181 
182  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
183  vtkInformationVector* outputVector) override;
184 
185 private:
186  vtkMINCImageWriter(const vtkMINCImageWriter&) = delete;
187  void operator=(const vtkMINCImageWriter&) = delete;
188 };
189 
190 VTK_ABI_NAMESPACE_END
191 #endif
dynamic, self-adjusting array of double
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
Definition: vtkImageData.h:155
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.
A container for a MINC image header.
A writer for MINC files.
int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Subclasses can reimplement this method to translate the update extent requests from each output port ...
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called in response to a REQUEST_DATA request from the executive.
virtual int IndexFromDimensionName(const char *dimName)
virtual int CloseNetCDFFile(int ncid)
static vtkMINCImageWriter * New()
virtual void ComputePermutationFromOrientation(int permutation[3], int flip[3])
void Write() override
Write the data.
virtual vtkMINCImageAttributes * GetImageAttributes()
Set the image attributes, which contain patient information and other useful metadata.
virtual int OpenNetCDFFile(const char *filename, int &ncid)
virtual const char * GetDescriptiveName()
Get the name of this file format.
virtual void FindMINCValidRange(double range[2])
vtkTypeBool StrictValidation
virtual int CreateMINCDimensions(vtkImageData *input, int timeStep, int *dimids)
virtual int CreateMINCVariables(vtkImageData *input, int timeStep, int *dimids)
virtual const char * GetFileExtensions()
Get the extension for this file format.
vtkStringArray * FileDimensionNames
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
virtual void SetImageAttributes(vtkMINCImageAttributes *attributes)
Set the image attributes, which contain patient information and other useful metadata.
virtual int WriteMINCData(vtkImageData *input, int frameNumber, int wholeExt[6], int upExt[6])
~vtkMINCImageWriter() override
virtual void FindRescale(double &rescaleSlope, double &rescaleIntercept)
int FillInputPortInformation(int port, vtkInformation *info) override
These method should be reimplemented by subclasses that have more than a single input or single outpu...
vtkMatrix4x4 * DirectionCosines
vtkMINCImageAttributes * ImageAttributes
virtual void SetDirectionCosines(vtkMatrix4x4 *matrix)
Set a matrix that describes the orientation of the data.
void SetFileName(VTK_FILEPATH const char *name) override
Set the file name.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int WriteMINCFileAttributes(vtkImageData *input, int timeStep)
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:140
a vtkAbstractArray subclass for strings
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ range
Definition: vtkX3D.h:238
@ name
Definition: vtkX3D.h:219
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_FILEPATH