VTK
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 
17 Copyright (c) 2006 Atamai, Inc.
18 
19 Use, modification and redistribution of the software, in source or
20 binary forms, are permitted provided that the following terms and
21 conditions are met:
22 
23 1) 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 
28 2) 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 
33 3) 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 
36 THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS"
37 WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
38 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY
40 MODIFY AND/OR REDISTRIBUTE THE SOFTWARE UNDER THE TERMS OF THIS LICENSE
41 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
42 (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BECOMING INACCURATE
43 OR LOSS OF PROFIT OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF
44 THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE
45 POSSIBILITY 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 
74 class vtkStringArray;
75 class vtkIdTypeArray;
76 class vtkDoubleArray;
77 class vtkMatrix4x4;
78 
79 // A special class that holds the attributes
81 
82 class VTKIOMINC_EXPORT vtkMINCImageWriter : public vtkImageWriter
83 {
84 public:
86 
87  static vtkMINCImageWriter *New();
88  void PrintSelf(ostream& os, vtkIndent indent) override;
89 
93  virtual const char* GetFileExtensions() {
94  return ".mnc"; }
95 
99  virtual const char* GetDescriptiveName() {
100  return "MINC"; }
101 
105  void SetFileName(const char *name) override;
106 
113  void Write() override;
114 
116 
127  virtual void SetDirectionCosines(vtkMatrix4x4 *matrix);
128  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
130 
132 
137  vtkSetMacro(RescaleSlope, double);
138  vtkGetMacro(RescaleSlope, double);
139  vtkSetMacro(RescaleIntercept, double);
140  vtkGetMacro(RescaleIntercept, double);
142 
144 
148  virtual void SetImageAttributes(vtkMINCImageAttributes *attributes);
150  return this->ImageAttributes; };
152 
154 
158  vtkSetMacro(StrictValidation, vtkTypeBool);
159  vtkBooleanMacro(StrictValidation, vtkTypeBool);
160  vtkGetMacro(StrictValidation, vtkTypeBool);
162 
164 
168  vtkSetStringMacro(HistoryAddition);
169  vtkGetStringMacro(HistoryAddition);
171 
172 protected:
174  ~vtkMINCImageWriter() override;
175 
179 
181  double RescaleSlope;
184  int DataUpdateExtent[6];
185 
187  double FileValidRange[2];
190 
192 
194 
196 
197  int Permutation[3];
198  int Flip[3];
199 
202 
204 
205  virtual int OpenNetCDFFile(const char *filename, int& ncid);
206  virtual int CloseNetCDFFile(int ncid);
207 
208  virtual int IndexFromDimensionName(const char *dimName);
209  virtual void ComputePermutationFromOrientation(int permutation[3],
210  int flip[3]);
211  virtual int CreateMINCDimensions(vtkImageData *input, int timeStep,
212  int *dimids);
213  virtual int CreateMINCVariables(vtkImageData *input, int timeStep,
214  int *dimids);
215  virtual int WriteMINCFileAttributes(vtkImageData *input, int timeStep);
216  virtual int WriteMINCData(vtkImageData *input,
217  int frameNumber,
218  int wholeExt[6],
219  int upExt[6]);
220  virtual void FindRescale(double &rescaleSlope, double &rescaleIntercept);
221  virtual void FindMINCValidRange(double range[2]);
222 
223  int FillInputPortInformation(int port, vtkInformation *info) override;
224 
225  int RequestInformation(vtkInformation *request,
226  vtkInformationVector **inputVector,
227  vtkInformationVector *outputVector) override;
228 
229  int RequestUpdateExtent(vtkInformation *request,
230  vtkInformationVector **inputVector,
231  vtkInformationVector *outputVector) override;
232 
233  int RequestData(vtkInformation* request,
234  vtkInformationVector** inputVector,
235  vtkInformationVector* outputVector) override;
236 
237 private:
238  vtkMINCImageWriter(const vtkMINCImageWriter&) = delete;
239  void operator=(const vtkMINCImageWriter&) = delete;
240 
241 };
242 
243 #endif
vtkMINCImageWriter::MINCFileId
int MINCFileId
Definition: vtkMINCImageWriter.h:201
vtkMINCImageWriter::InternalRescaleIntercept
double InternalRescaleIntercept
Definition: vtkMINCImageWriter.h:189
vtkMINCImageWriter::MINCImageMinMaxDims
int MINCImageMinMaxDims
Definition: vtkMINCImageWriter.h:178
vtkMINCImageWriter::InternalRescaleSlope
double InternalRescaleSlope
Definition: vtkMINCImageWriter.h:188
vtkImageWriter
Writes images to files.
Definition: vtkImageWriter.h:32
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkX3D::range
Definition: vtkX3D.h:238
vtkMINCImageWriter::MINCImageType
int MINCImageType
Definition: vtkMINCImageWriter.h:176
vtkMINCImageWriter::HistoryAddition
char * HistoryAddition
Definition: vtkMINCImageWriter.h:203
vtkMINCImageWriter::RescaleSlope
double RescaleSlope
Definition: vtkMINCImageWriter.h:181
vtkMINCImageWriter::ComputeValidRangeFromScalarRange
int ComputeValidRangeFromScalarRange
Definition: vtkMINCImageWriter.h:191
vtkX3D::port
Definition: vtkX3D.h:447
vtkMINCImageWriter::ImageAttributes
vtkMINCImageAttributes * ImageAttributes
Definition: vtkMINCImageWriter.h:195
vtkMINCImageWriter::FileDimensionNames
vtkStringArray * FileDimensionNames
Definition: vtkMINCImageWriter.h:193
vtkImageAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Subclasses can reimplement this method to translate the update extent requests from each output port ...
vtkImageAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkMINCImageWriter
A writer for MINC files.
Definition: vtkMINCImageWriter.h:82
vtkImageWriter.h
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkMINCImageWriter::GetFileExtensions
virtual const char * GetFileExtensions()
Get the entension for this file format.
Definition: vtkMINCImageWriter.h:93
vtkImageWriter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMINCImageWriter::RescaleIntercept
double RescaleIntercept
Definition: vtkMINCImageWriter.h:182
vtkX3D::name
Definition: vtkX3D.h:219
vtkImageWriter::Write
virtual void Write()
The main interface which triggers the writer to start.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkImageWriter::RequestData
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called in response to a REQUEST_DATA request from the executive.
vtkX3D::info
Definition: vtkX3D.h:376
vtkMINCImageWriter::GetImageAttributes
virtual vtkMINCImageAttributes * GetImageAttributes()
Definition: vtkMINCImageWriter.h:149
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
vtkMINCImageWriter::MismatchedInputs
int MismatchedInputs
Definition: vtkMINCImageWriter.h:200
vtkMINCImageWriter::GetDescriptiveName
virtual const char * GetDescriptiveName()
Get the name of this file format.
Definition: vtkMINCImageWriter.h:99
vtkImageWriter::New
static vtkImageWriter * New()
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:36
vtkImageWriter::SetFileName
virtual void SetFileName(const char *)
Specify file name for the image file.
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:35
vtkMINCImageWriter::MINCImageTypeSigned
int MINCImageTypeSigned
Definition: vtkMINCImageWriter.h:177
vtkMINCImageWriter::StrictValidation
vtkTypeBool StrictValidation
Definition: vtkMINCImageWriter.h:183
vtkMINCImageWriter::FileDataType
int FileDataType
Definition: vtkMINCImageWriter.h:186
vtkImageAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkMINCImageWriter::DirectionCosines
vtkMatrix4x4 * DirectionCosines
Definition: vtkMINCImageWriter.h:180
vtkMINCImageAttributes
A container for a MINC image header.
Definition: vtkMINCImageAttributes.h:83
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69