VTK  9.1.0
vtkMINCImageWriter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkMINCImageWriter.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=========================================================================*/
15/*=========================================================================
16
17Copyright (c) 2006 Atamai, Inc.
18
19Use, modification and redistribution of the software, in source or
20binary forms, are permitted provided that the following terms and
21conditions are met:
22
231) Redistribution of the source code, in verbatim or modified
24 form, must retain the above copyright notice, this license,
25 the following disclaimer, and any notices that refer to this
26 license and/or the following disclaimer.
27
282) Redistribution in binary form must include the above copyright
29 notice, a copy of this license and the following disclaimer
30 in the documentation or with other materials provided with the
31 distribution.
32
333) Modified copies of the source code must be clearly marked as such,
34 and must not be misrepresented as verbatim copies of the source code.
35
36THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS"
37WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
38THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY
40MODIFY AND/OR REDISTRIBUTE THE SOFTWARE UNDER THE TERMS OF THIS LICENSE
41BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
42(INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BECOMING INACCURATE
43OR LOSS OF PROFIT OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF
44THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE
45POSSIBILITY OF SUCH DAMAGES.
46
47=========================================================================*/
68#ifndef vtkMINCImageWriter_h
69#define vtkMINCImageWriter_h
70
71#include "vtkIOMINCModule.h" // For export macro
72#include "vtkImageWriter.h"
73
74class vtkStringArray;
75class vtkIdTypeArray;
76class vtkDoubleArray;
77class vtkMatrix4x4;
78
79// A special class that holds the attributes
81
82class VTKIOMINC_EXPORT vtkMINCImageWriter : public vtkImageWriter
83{
84public:
86
88 void PrintSelf(ostream& os, vtkIndent indent) override;
89
93 virtual const char* GetFileExtensions() { return ".mnc"; }
94
98 virtual const char* GetDescriptiveName() { return "MINC"; }
99
103 void SetFileName(VTK_FILEPATH const char* name) override;
104
111 void Write() override;
112
114
125 virtual void SetDirectionCosines(vtkMatrix4x4* matrix);
126 vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
128
130
135 vtkSetMacro(RescaleSlope, double);
136 vtkGetMacro(RescaleSlope, double);
137 vtkSetMacro(RescaleIntercept, double);
138 vtkGetMacro(RescaleIntercept, double);
140
142
147 virtual vtkMINCImageAttributes* GetImageAttributes() { return this->ImageAttributes; }
149
151
155 vtkSetMacro(StrictValidation, vtkTypeBool);
156 vtkBooleanMacro(StrictValidation, vtkTypeBool);
157 vtkGetMacro(StrictValidation, vtkTypeBool);
159
161
165 vtkSetStringMacro(HistoryAddition);
166 vtkGetStringMacro(HistoryAddition);
168
169protected:
172
176
181 int DataUpdateExtent[6];
182
184 double FileValidRange[2];
187
189
191
193
194 int Permutation[3];
195 int Flip[3];
196
199
201
202 virtual int OpenNetCDFFile(const char* filename, int& ncid);
203 virtual int CloseNetCDFFile(int ncid);
204
205 virtual int IndexFromDimensionName(const char* dimName);
206 virtual void ComputePermutationFromOrientation(int permutation[3], int flip[3]);
207 virtual int CreateMINCDimensions(vtkImageData* input, int timeStep, int* dimids);
208 virtual int CreateMINCVariables(vtkImageData* input, int timeStep, int* dimids);
209 virtual int WriteMINCFileAttributes(vtkImageData* input, int timeStep);
210 virtual int WriteMINCData(vtkImageData* input, int frameNumber, int wholeExt[6], int upExt[6]);
211 virtual void FindRescale(double& rescaleSlope, double& rescaleIntercept);
212 virtual void FindMINCValidRange(double range[2]);
213
215
217 vtkInformationVector* outputVector) override;
218
220 vtkInformationVector* outputVector) override;
221
223 vtkInformationVector* outputVector) override;
224
225private:
226 vtkMINCImageWriter(const vtkMINCImageWriter&) = delete;
227 void operator=(const vtkMINCImageWriter&) = delete;
228};
229
230#endif
dynamic, self-adjusting array of double
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
Writes images to files.
a simple class to control print indentation
Definition: vtkIndent.h:113
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)
virtual void ComputePermutationFromOrientation(int permutation[3], int flip[3])
virtual const char * GetFileExtensions()
Get the extension for this file format.
void Write() override
Write the data.
virtual int OpenNetCDFFile(const char *filename, int &ncid)
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 * GetDescriptiveName()
Get the name of 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.
static vtkMINCImageWriter * New()
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.
virtual vtkMINCImageAttributes * GetImageAttributes()
Set the image attributes, which contain patient information and other useful metadata.
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:145
a vtkAbstractArray subclass for strings
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ range
Definition: vtkX3D.h:244
@ name
Definition: vtkX3D.h:225
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_FILEPATH