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 =========================================================================*/
70 #ifndef vtkMINCImageWriter_h
71 #define vtkMINCImageWriter_h
72 
73 #include "vtkIOMINCModule.h" // For export macro
74 #include "vtkImageWriter.h"
75 
76 class vtkStringArray;
77 class vtkIdTypeArray;
78 class vtkDoubleArray;
79 class vtkMatrix4x4;
80 
81 // A special class that holds the attributes
83 
85 {
86 public:
88 
89  static vtkMINCImageWriter *New();
90  virtual void PrintSelf(ostream& os, vtkIndent indent);
91 
93 
94  virtual const char* GetFileExtensions() {
95  return ".mnc"; }
97 
99 
100  virtual const char* GetDescriptiveName() {
101  return "MINC"; }
103 
105  virtual void SetFileName(const char *name);
106 
110  virtual void Write();
111 
113 
121  virtual void SetDirectionCosines(vtkMatrix4x4 *matrix);
122  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
124 
126 
129  vtkSetMacro(RescaleSlope, double);
130  vtkGetMacro(RescaleSlope, double);
131  vtkSetMacro(RescaleIntercept, double);
132  vtkGetMacro(RescaleIntercept, double);
134 
136 
138  virtual void SetImageAttributes(vtkMINCImageAttributes *attributes);
140  return this->ImageAttributes; };
142 
144 
146  vtkSetMacro(StrictValidation, int);
147  vtkBooleanMacro(StrictValidation, int);
148  vtkGetMacro(StrictValidation, int);
150 
152 
154  vtkSetStringMacro(HistoryAddition);
155  vtkGetStringMacro(HistoryAddition);
157 
158 protected:
161 
165 
167  double RescaleSlope;
170  int DataUpdateExtent[6];
171 
173  double FileValidRange[2];
176 
178 
180 
182 
183  int Permutation[3];
184  int Flip[3];
185 
188 
190 
191  virtual int OpenNetCDFFile(const char *filename, int& ncid);
192  virtual int CloseNetCDFFile(int ncid);
193 
194  virtual int IndexFromDimensionName(const char *dimName);
195  virtual void ComputePermutationFromOrientation(int permutation[3],
196  int flip[3]);
197  virtual int CreateMINCDimensions(vtkImageData *input, int timeStep,
198  int *dimids);
199  virtual int CreateMINCVariables(vtkImageData *input, int timeStep,
200  int *dimids);
201  virtual int WriteMINCFileAttributes(vtkImageData *input, int timeStep);
202  virtual int WriteMINCData(vtkImageData *input,
203  int frameNumber,
204  int wholeExt[6],
205  int upExt[6]);
206  virtual void FindRescale(double &rescaleSlope, double &rescaleIntercept);
207  virtual void FindMINCValidRange(double range[2]);
208 
210 
211  virtual int RequestInformation(vtkInformation *request,
212  vtkInformationVector **inputVector,
213  vtkInformationVector *outputVector);
214 
215  virtual int RequestUpdateExtent(vtkInformation *request,
216  vtkInformationVector **inputVector,
217  vtkInformationVector *outputVector);
218 
219  virtual int RequestData(vtkInformation* request,
220  vtkInformationVector** inputVector,
221  vtkInformationVector* outputVector);
222 
223 private:
224  vtkMINCImageWriter(const vtkMINCImageWriter&); // Not implemented
225  void operator=(const vtkMINCImageWriter&); // Not implemented
226 
227 };
228 
229 #endif
vtkMatrix4x4 * DirectionCosines
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
Store vtkAlgorithm input/output information.
vtkStringArray * FileDimensionNames
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
dynamic, self-adjusting array of double
#define VTKIOMINC_EXPORT
A container for a MINC image header.
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkMINCImageAttributes * ImageAttributes
virtual void Write()
Writes images to files.
virtual int FillInputPortInformation(int port, vtkInformation *info)
virtual vtkMINCImageAttributes * GetImageAttributes()
A writer for MINC files.
static vtkImageWriter * New()
virtual void SetFileName(const char *)
void PrintSelf(ostream &os, vtkIndent indent)
virtual const char * GetFileExtensions()
Store zero or more vtkInformation instances.
virtual const char * GetDescriptiveName()