VTK
vtkMINCImageReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMINCImageReader.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 =========================================================================*/
73 #ifndef __vtkMINCImageReader_h
74 #define __vtkMINCImageReader_h
75 
76 #include "vtkImageReader2.h"
77 
78 class vtkStringArray;
79 class vtkIdTypeArray;
80 class vtkDoubleArray;
81 class vtkMatrix4x4;
82 
83 // A special class that holds the attributes
85 
87 {
88 public:
90 
91  static vtkMINCImageReader *New();
92  virtual void PrintSelf(ostream& os, vtkIndent indent);
93 
95  virtual void SetFileName(const char *name);
96 
98 
99  virtual const char* GetFileExtensions() {
100  return ".mnc"; }
102 
104 
105  virtual const char* GetDescriptiveName() {
106  return "MINC"; }
108 
110  virtual int CanReadFile(const char* name);
111 
115  virtual vtkMatrix4x4 *GetDirectionCosines();
116 
118 
121  virtual double GetRescaleSlope();
122  virtual double GetRescaleIntercept();
124 
126 
129  vtkSetMacro(RescaleRealValues, int);
130  vtkBooleanMacro(RescaleRealValues, int);
131  vtkGetMacro(RescaleRealValues, int);
133 
135 
139  virtual double *GetDataRange();
140  virtual void GetDataRange(double range[2]) {
141  double *r = this->GetDataRange();
142  range[0] = r[0]; range[1] = r[1]; };
144 
146  virtual int GetNumberOfTimeSteps();
147 
149 
150  vtkSetMacro(TimeStep, int);
151  vtkGetMacro(TimeStep, int);
153 
156  virtual vtkMINCImageAttributes *GetImageAttributes();
157 
158 protected:
161 
164 
165  double ValidRange[2];
166  double ImageRange[2];
167  double DataRange[2];
168 
170  int TimeStep;
172  double RescaleSlope;
176 
178 
179  virtual int OpenNetCDFFile(const char *filename, int& ncid);
180  virtual int CloseNetCDFFile(int ncid);
181  virtual int IndexFromDimensionName(const char *dimName);
182  virtual int ReadMINCFileAttributes();
183  virtual void FindRangeAndRescaleValues();
184  static int ConvertMINCTypeToVTKType(int minctype, int mincsigned);
185 
186  virtual void ExecuteInformation();
187  virtual void ExecuteData(vtkDataObject *out);
188 
189 private:
190  vtkMINCImageReader(const vtkMINCImageReader&); // Not implemented
191  void operator=(const vtkMINCImageReader&); // Not implemented
192 
193 };
194 
195 #endif