VTK  9.0.1
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 
91  void PrintSelf(ostream& os, vtkIndent indent) override;
92 
96  void SetFileName(const char* name) override;
97 
101  const char* GetFileExtensions() override { return ".mnc"; }
102 
106  const char* GetDescriptiveName() override { return "MINC"; }
107 
111  int CanReadFile(const char* name) override;
112 
119 
121 
126  virtual double GetRescaleSlope();
127  virtual double GetRescaleIntercept();
129 
131 
136  vtkSetMacro(RescaleRealValues, vtkTypeBool);
137  vtkBooleanMacro(RescaleRealValues, vtkTypeBool);
138  vtkGetMacro(RescaleRealValues, vtkTypeBool);
140 
142 
148  virtual double* GetDataRange() VTK_SIZEHINT(2);
149  virtual void GetDataRange(double range[2])
150  {
151  double* r = this->GetDataRange();
152  range[0] = r[0];
153  range[1] = r[1];
154  }
156 
160  virtual int GetNumberOfTimeSteps();
161 
163 
166  vtkSetMacro(TimeStep, int);
167  vtkGetMacro(TimeStep, int);
169 
175 
176 protected:
179 
182 
183  double ValidRange[2];
184  double ImageRange[2];
185  double DataRange[2];
186 
188  int TimeStep;
190  double RescaleSlope;
194 
196 
197  virtual int OpenNetCDFFile(const char* filename, int& ncid);
198  virtual int CloseNetCDFFile(int ncid);
199  virtual int IndexFromDimensionName(const char* dimName);
200  virtual int ReadMINCFileAttributes();
202  static int ConvertMINCTypeToVTKType(int minctype, int mincsigned);
203 
204  void ExecuteInformation() override;
206 
207 private:
208  vtkMINCImageReader(const vtkMINCImageReader&) = delete;
209  void operator=(const vtkMINCImageReader&) = delete;
210 };
211 
212 #endif
vtkMINCImageReader::ExecuteDataWithInformation
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
vtkMINCImageReader::GetFileExtensions
const char * GetFileExtensions() override
Get the extension for this file format.
Definition: vtkMINCImageReader.h:101
vtkMINCImageReader::RescaleIntercept
double RescaleIntercept
Definition: vtkMINCImageReader.h:191
vtkMINCImageReader::ImageAttributes
vtkMINCImageAttributes * ImageAttributes
Definition: vtkMINCImageReader.h:193
vtkMINCImageReader::GetRescaleSlope
virtual double GetRescaleSlope()
Get the slope and intercept for rescaling the scalar values to real data values.
vtkMINCImageReader::GetImageAttributes
virtual vtkMINCImageAttributes * GetImageAttributes()
Get the image attributes, which contain patient information and other useful metadata.
vtkMINCImageReader::GetDirectionCosines
virtual vtkMatrix4x4 * GetDirectionCosines()
Get a matrix that describes the orientation of the data.
vtkMINCImageReader::NumberOfTimeSteps
int NumberOfTimeSteps
Definition: vtkMINCImageReader.h:187
vtkMINCImageReader::IndexFromDimensionName
virtual int IndexFromDimensionName(const char *dimName)
vtkMINCImageReader::~vtkMINCImageReader
~vtkMINCImageReader() override
vtkX3D::range
@ range
Definition: vtkX3D.h:244
vtkMINCImageReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMINCImageReader::SetFileName
void SetFileName(const char *name) override
Set the file name.
vtkMINCImageReader::GetDescriptiveName
const char * GetDescriptiveName() override
Get the name of this file format.
Definition: vtkMINCImageReader.h:106
vtkMINCImageReader::CloseNetCDFFile
virtual int CloseNetCDFFile(int ncid)
vtkMINCImageReader::DirectionCosines
vtkMatrix4x4 * DirectionCosines
Definition: vtkMINCImageReader.h:189
vtkMINCImageReader::OpenNetCDFFile
virtual int OpenNetCDFFile(const char *filename, int &ncid)
vtkMINCImageReader
A reader for MINC files.
Definition: vtkMINCImageReader.h:86
vtkMINCImageReader::RescaleSlope
double RescaleSlope
Definition: vtkMINCImageReader.h:190
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkMINCImageReader::GetNumberOfTimeSteps
virtual int GetNumberOfTimeSteps()
Get the number of time steps in the file.
vtkMINCImageReader::FileNameHasChanged
int FileNameHasChanged
Definition: vtkMINCImageReader.h:195
vtkMINCImageReader::FindRangeAndRescaleValues
virtual void FindRangeAndRescaleValues()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
vtkMINCImageReader::ConvertMINCTypeToVTKType
static int ConvertMINCTypeToVTKType(int minctype, int mincsigned)
vtkMINCImageReader::GetRescaleIntercept
virtual double GetRescaleIntercept()
vtkMINCImageReader::CanReadFile
int CanReadFile(const char *name) override
Test whether the specified file can be read.
vtkImageReader2
Superclass of binary file readers.
Definition: vtkImageReader2.h:53
vtkMINCImageReader::TimeStep
int TimeStep
Definition: vtkMINCImageReader.h:188
vtkMINCImageReader::GetDataRange
virtual double * GetDataRange()
Get the scalar range of the output from the information in the file header.
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:65
vtkMINCImageReader::New
static vtkMINCImageReader * New()
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:36
vtkMINCImageReader::RescaleRealValues
vtkTypeBool RescaleRealValues
Definition: vtkMINCImageReader.h:192
vtkMINCImageReader::MINCImageType
int MINCImageType
Definition: vtkMINCImageReader.h:180
vtkMINCImageReader::vtkMINCImageReader
vtkMINCImageReader()
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:37
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:36
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:60
vtkMINCImageReader::ExecuteInformation
void ExecuteInformation() override
vtkMINCImageReader::MINCImageTypeSigned
int MINCImageTypeSigned
Definition: vtkMINCImageReader.h:181
vtkMINCImageAttributes
A container for a MINC image header.
Definition: vtkMINCImageAttributes.h:84
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkMINCImageReader::ReadMINCFileAttributes
virtual int ReadMINCFileAttributes()
vtkImageReader2.h