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 =========================================================================*/
71 #ifndef vtkMINCImageReader_h
72 #define vtkMINCImageReader_h
73 
74 #include "vtkIOMINCModule.h" // For export macro
75 #include "vtkImageReader2.h"
76 
77 class vtkStringArray;
78 class vtkIdTypeArray;
79 class vtkDoubleArray;
80 class vtkMatrix4x4;
81 
82 // A special class that holds the attributes
84 
85 class VTKIOMINC_EXPORT vtkMINCImageReader : public vtkImageReader2
86 {
87 public:
89 
90  static vtkMINCImageReader *New();
91  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
92 
96  void SetFileName(const char *name) VTK_OVERRIDE;
97 
101  const char* GetFileExtensions() VTK_OVERRIDE {
102  return ".mnc"; }
103 
107  const char* GetDescriptiveName() VTK_OVERRIDE {
108  return "MINC"; }
109 
113  int CanReadFile(const char* name) VTK_OVERRIDE;
114 
120  virtual vtkMatrix4x4 *GetDirectionCosines();
121 
123 
128  virtual double GetRescaleSlope();
129  virtual double GetRescaleIntercept();
131 
133 
138  vtkSetMacro(RescaleRealValues, int);
139  vtkBooleanMacro(RescaleRealValues, int);
140  vtkGetMacro(RescaleRealValues, int);
142 
144 
150  virtual double *GetDataRange();
151  virtual void GetDataRange(double range[2]) {
152  double *r = this->GetDataRange();
153  range[0] = r[0]; range[1] = r[1]; };
155 
159  virtual int GetNumberOfTimeSteps();
160 
162 
165  vtkSetMacro(TimeStep, int);
166  vtkGetMacro(TimeStep, int);
168 
173  virtual vtkMINCImageAttributes *GetImageAttributes();
174 
175 protected:
177  ~vtkMINCImageReader() VTK_OVERRIDE;
178 
179  int MINCImageType;
180  int MINCImageTypeSigned;
181 
182  double ValidRange[2];
183  double ImageRange[2];
184  double DataRange[2];
185 
186  int NumberOfTimeSteps;
187  int TimeStep;
188  vtkMatrix4x4 *DirectionCosines;
189  double RescaleSlope;
190  double RescaleIntercept;
191  int RescaleRealValues;
192  vtkMINCImageAttributes *ImageAttributes;
193 
194  int FileNameHasChanged;
195 
196  virtual int OpenNetCDFFile(const char *filename, int& ncid);
197  virtual int CloseNetCDFFile(int ncid);
198  virtual int IndexFromDimensionName(const char *dimName);
199  virtual int ReadMINCFileAttributes();
200  virtual void FindRangeAndRescaleValues();
201  static int ConvertMINCTypeToVTKType(int minctype, int mincsigned);
202 
203  void ExecuteInformation() VTK_OVERRIDE;
204  void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) VTK_OVERRIDE;
205 
206 private:
207  vtkMINCImageReader(const vtkMINCImageReader&) VTK_DELETE_FUNCTION;
208  void operator=(const vtkMINCImageReader&) VTK_DELETE_FUNCTION;
209 
210 };
211 
212 #endif
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
A reader for MINC files.
dynamic, self-adjusting array of double
virtual int CanReadFile(const char *vtkNotUsed(fname))
Return non zero if the reader can read the given file name.
const char * GetDescriptiveName() override
Get the name of this file format.
A container for a MINC image header.
a simple class to control print indentation
Definition: vtkIndent.h:33
Superclass of binary file readers.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
virtual void SetFileName(const char *)
Specify file name for the image file.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
const char * GetFileExtensions() override
Get the entension for this file format.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void GetDataRange(double range[2])
Get the scalar range of the output from the information in the file header.
general representation of visualization data
Definition: vtkDataObject.h:58