VTK  9.3.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
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 
50  static vtkMINCImageReader* New();
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 
78  virtual vtkMatrix4x4* GetDirectionCosines();
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 
134  virtual vtkMINCImageAttributes* GetImageAttributes();
135 
136 protected:
138  ~vtkMINCImageReader() override;
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();
161  virtual void FindRangeAndRescaleValues();
162  static int ConvertMINCTypeToVTKType(int minctype, int mincsigned);
163 
164  void ExecuteInformation() override;
165  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
166 
167 private:
168  vtkMINCImageReader(const vtkMINCImageReader&) = delete;
169  void operator=(const vtkMINCImageReader&) = delete;
170 };
171 
172 VTK_ABI_NAMESPACE_END
173 #endif
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:30
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
vtkMatrix4x4 * DirectionCosines
virtual int CanReadFile(VTK_FILEPATH const char *vtkNotUsed(fname))
Return non zero if the reader can read the given file name.
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 void SetFileName(VTK_FILEPATH 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:54
vtkMINCImageAttributes * ImageAttributes
vtkTypeBool RescaleRealValues