VTK  9.7.1
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
33 #ifndef vtkMINCImageReader_h
34 #define vtkMINCImageReader_h
35 
36 #include "vtkIOMINCModule.h" // For export macro
37 #include "vtkImageReader2.h"
38 
39 VTK_ABI_NAMESPACE_BEGIN
40 class vtkStringArray;
41 class vtkIdTypeArray;
42 class vtkDoubleArray;
43 class vtkMatrix4x4;
44 
45 // A special class that holds the attributes
47 
48 class VTKIOMINC_EXPORT vtkMINCImageReader : public vtkImageReader2
49 {
50 public:
52 
53  static vtkMINCImageReader* New();
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  void SetFileName(VTK_FILEPATH const char* name) override;
60 
64  const char* GetFileExtensions() override { return ".mnc"; }
65 
69  const char* GetDescriptiveName() override { return "MINC"; }
70 
71  using Superclass::CanReadFile;
75  int CanReadFile(VTK_FILEPATH const char* name) override;
76 
82  virtual vtkMatrix4x4* GetDirectionCosines();
83 
85 
90  virtual double GetRescaleSlope();
91  virtual double GetRescaleIntercept();
93 
95 
100  vtkSetMacro(RescaleRealValues, vtkTypeBool);
101  vtkBooleanMacro(RescaleRealValues, vtkTypeBool);
102  vtkGetMacro(RescaleRealValues, vtkTypeBool);
104 
106 
112  virtual double* GetDataRange() VTK_SIZEHINT(2);
113  virtual void GetDataRange(double range[2])
114  {
115  double* r = this->GetDataRange();
116  range[0] = r[0];
117  range[1] = r[1];
118  }
120 
124  virtual int GetNumberOfTimeSteps();
125 
127 
130  vtkSetMacro(TimeStep, int);
131  vtkGetMacro(TimeStep, int);
133 
138  virtual vtkMINCImageAttributes* GetImageAttributes();
139 
140 protected:
142  ~vtkMINCImageReader() override;
143 
146 
147  double ValidRange[2];
148  double ImageRange[2];
149  double DataRange[2];
150 
152  int TimeStep;
154  double RescaleSlope;
158 
160 
161  virtual int OpenNetCDFFile(const char* filename, int& ncid);
162  virtual int CloseNetCDFFile(int ncid);
163  virtual int IndexFromDimensionName(const char* dimName);
164  virtual int ReadMINCFileAttributes();
165  virtual void FindRangeAndRescaleValues();
166  static int ConvertMINCTypeToVTKType(int minctype, int mincsigned);
167 
168  void ExecuteInformation() override;
169  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
170 
171 private:
172  vtkMINCImageReader(const vtkMINCImageReader&) = delete;
173  void operator=(const vtkMINCImageReader&) = delete;
174 };
175 
176 VTK_ABI_NAMESPACE_END
177 #endif
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
vtkMatrix4x4 * DirectionCosines
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
A reader for MINC files.
dynamic, self-adjusting array of double
void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
int vtkTypeBool
Definition: vtkABI.h:64
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:28
virtual void ExecuteInformation()
#define VTK_SIZEHINT(...)
Superclass of binary file readers.
#define VTK_FILEPATH
virtual int CanReadFile(const char *fname)
Return non zero if the reader can read the given file name.
virtual void SetFileName(const char *)
Specify file name for the image file.
const char * GetFileExtensions() override
Get the extension for this file format.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
general representation of visualization data
Definition: vtkDataObject.h:55
vtkMINCImageAttributes * ImageAttributes
vtkTypeBool RescaleRealValues