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 "vtkImageWriter.h"
74 
75 class vtkStringArray;
76 class vtkIdTypeArray;
77 class vtkDoubleArray;
78 class vtkMatrix4x4;
79 
80 // A special class that holds the attributes
82 
84 {
85 public:
87 
88  static vtkMINCImageWriter *New();
89  virtual void PrintSelf(ostream& os, vtkIndent indent);
90 
92 
93  virtual const char* GetFileExtensions() {
94  return ".mnc"; }
96 
98 
99  virtual const char* GetDescriptiveName() {
100  return "MINC"; }
102 
104  virtual void SetFileName(const char *name);
105 
109  virtual void Write();
110 
112 
120  virtual void SetDirectionCosines(vtkMatrix4x4 *matrix);
121  vtkGetObjectMacro(DirectionCosines, vtkMatrix4x4);
123 
125 
128  vtkSetMacro(RescaleSlope, double);
129  vtkGetMacro(RescaleSlope, double);
130  vtkSetMacro(RescaleIntercept, double);
131  vtkGetMacro(RescaleIntercept, double);
133 
135 
137  virtual void SetImageAttributes(vtkMINCImageAttributes *attributes);
139  return this->ImageAttributes; };
141 
143 
145  vtkSetMacro(StrictValidation, int);
146  vtkBooleanMacro(StrictValidation, int);
147  vtkGetMacro(StrictValidation, int);
149 
151 
153  vtkSetStringMacro(HistoryAddition);
154  vtkGetStringMacro(HistoryAddition);
156 
157 protected:
159  ~vtkMINCImageWriter();
160 
164 
166  double RescaleSlope;
169  int DataUpdateExtent[6];
170 
172  double FileValidRange[2];
175 
177 
179 
181 
182  int Permutation[3];
183  int Flip[3];
184 
187 
189 
190  virtual int OpenNetCDFFile(const char *filename, int& ncid);
191  virtual int CloseNetCDFFile(int ncid);
192 
193  virtual int IndexFromDimensionName(const char *dimName);
194  virtual void ComputePermutationFromOrientation(int permutation[3],
195  int flip[3]);
196  virtual int CreateMINCDimensions(vtkImageData *input, int timeStep,
197  int *dimids);
198  virtual int CreateMINCVariables(vtkImageData *input, int timeStep,
199  int *dimids);
200  virtual int WriteMINCFileAttributes(vtkImageData *input, int timeStep);
201  virtual int WriteMINCData(vtkImageData *input, int frameNumber);
202  virtual void FindRescale(double &rescaleSlope, double &rescaleIntercept);
203  virtual void FindMINCValidRange(double range[2]);
204 
206 
207  virtual int RequestInformation(vtkInformation *request,
208  vtkInformationVector **inputVector,
209  vtkInformationVector *outputVector);
210 
211  virtual int RequestUpdateExtent(vtkInformation *request,
212  vtkInformationVector **inputVector,
213  vtkInformationVector *outputVector);
214 
215  virtual int RequestData(vtkInformation* request,
216  vtkInformationVector** inputVector,
217  vtkInformationVector* outputVector);
218 
219 private:
220  vtkMINCImageWriter(const vtkMINCImageWriter&); // Not implemented
221  void operator=(const vtkMINCImageWriter&); // Not implemented
222 
223 };
224 
225 #endif