VTK  9.3.20240328
vtkMINCImageReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) 2006 Atamai, Inc.
3 // SPDX-License-Identifier: BSD-3-Clause
30 #ifndef vtkMINCImageReader_h
31 #define vtkMINCImageReader_h
32 
33 #include "vtkIOMINCModule.h" // For export macro
34 #include "vtkImageReader2.h"
35 
36 VTK_ABI_NAMESPACE_BEGIN
37 class vtkStringArray;
38 class vtkIdTypeArray;
39 class vtkDoubleArray;
40 class vtkMatrix4x4;
41 
42 // A special class that holds the attributes
44 
45 class VTKIOMINC_EXPORT vtkMINCImageReader : public vtkImageReader2
46 {
47 public:
49 
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
56  void SetFileName(VTK_FILEPATH const char* name) override;
57 
61  const char* GetFileExtensions() override { return ".mnc"; }
62 
66  const char* GetDescriptiveName() override { return "MINC"; }
67 
71  int CanReadFile(VTK_FILEPATH const char* name) override;
72 
79 
81 
86  virtual double GetRescaleSlope();
87  virtual double GetRescaleIntercept();
89 
91 
96  vtkSetMacro(RescaleRealValues, vtkTypeBool);
97  vtkBooleanMacro(RescaleRealValues, vtkTypeBool);
98  vtkGetMacro(RescaleRealValues, vtkTypeBool);
100 
102 
108  virtual double* GetDataRange() VTK_SIZEHINT(2);
109  virtual void GetDataRange(double range[2])
110  {
111  double* r = this->GetDataRange();
112  range[0] = r[0];
113  range[1] = r[1];
114  }
116 
120  virtual int GetNumberOfTimeSteps();
121 
123 
126  vtkSetMacro(TimeStep, int);
127  vtkGetMacro(TimeStep, int);
129 
135 
136 protected:
139 
142 
143  double ValidRange[2];
144  double ImageRange[2];
145  double DataRange[2];
146 
148  int TimeStep;
150  double RescaleSlope;
154 
156 
157  virtual int OpenNetCDFFile(const char* filename, int& ncid);
158  virtual int CloseNetCDFFile(int ncid);
159  virtual int IndexFromDimensionName(const char* dimName);
160  virtual int ReadMINCFileAttributes();
162  static int ConvertMINCTypeToVTKType(int minctype, int mincsigned);
163 
164  void ExecuteInformation() override;
166 
167 private:
168  vtkMINCImageReader(const vtkMINCImageReader&) = delete;
169  void operator=(const vtkMINCImageReader&) = delete;
170 };
171 
172 VTK_ABI_NAMESPACE_END
173 #endif
general representation of visualization data
dynamic, self-adjusting array of double
dynamic, self-adjusting array of vtkIdType
Superclass of binary file readers.
a simple class to control print indentation
Definition: vtkIndent.h:108
Store vtkAlgorithm input/output information.
A container for a MINC image header.
A reader for MINC files.
virtual double GetRescaleIntercept()
Get the slope and intercept for rescaling the scalar values to real data values.
virtual int CloseNetCDFFile(int ncid)
virtual double * GetDataRange()
Get the scalar range of the output from the information in the file header.
void SetFileName(VTK_FILEPATH const char *name) override
Set the file name.
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int IndexFromDimensionName(const char *dimName)
virtual double GetRescaleSlope()
Get the slope and intercept for rescaling the scalar values to real data values.
~vtkMINCImageReader() override
virtual vtkMINCImageAttributes * GetImageAttributes()
Get the image attributes, which contain patient information and other useful metadata.
static int ConvertMINCTypeToVTKType(int minctype, int mincsigned)
const char * GetDescriptiveName() override
Get the name of this file format.
const char * GetFileExtensions() override
Get the extension for this file format.
static vtkMINCImageReader * New()
virtual int OpenNetCDFFile(const char *filename, int &ncid)
vtkMINCImageAttributes * ImageAttributes
void ExecuteInformation() override
virtual int ReadMINCFileAttributes()
virtual vtkMatrix4x4 * GetDirectionCosines()
Get a matrix that describes the orientation of the data.
vtkTypeBool RescaleRealValues
virtual int GetNumberOfTimeSteps()
Get the number of time steps in the file.
virtual void FindRangeAndRescaleValues()
int CanReadFile(VTK_FILEPATH const char *name) override
Test whether the specified file can be read.
vtkMatrix4x4 * DirectionCosines
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:140
a vtkAbstractArray subclass for strings
@ range
Definition: vtkX3D.h:238
@ name
Definition: vtkX3D.h:219
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_FILEPATH
#define VTK_SIZEHINT(...)