VTK
vtkGridTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGridTransform.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 =========================================================================*/
31 #ifndef vtkGridTransform_h
32 #define vtkGridTransform_h
33 
34 #include "vtkFiltersHybridModule.h" // For export macro
35 #include "vtkWarpTransform.h"
36 
37 class vtkAlgorithmOutput;
38 class vtkGridTransformConnectionHolder;
39 class vtkImageData;
40 
41 #define VTK_GRID_NEAREST VTK_NEAREST_INTERPOLATION
42 #define VTK_GRID_LINEAR VTK_LINEAR_INTERPOLATION
43 #define VTK_GRID_CUBIC VTK_CUBIC_INTERPOLATION
44 
45 class VTKFILTERSHYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
46 {
47 public:
48  static vtkGridTransform *New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
53 
60  virtual void SetDisplacementGridConnection(vtkAlgorithmOutput*);
61  virtual void SetDisplacementGridData(vtkImageData*);
62  virtual vtkImageData* GetDisplacementGrid();
64 
66 
71  vtkSetMacro(DisplacementScale,double);
72  vtkGetMacro(DisplacementScale,double);
74 
76 
81  vtkSetMacro(DisplacementShift,double);
82  vtkGetMacro(DisplacementShift,double);
84 
86 
91  void SetInterpolationMode(int mode);
92  vtkGetMacro(InterpolationMode,int);
94  { this->SetInterpolationMode(VTK_NEAREST_INTERPOLATION); };
96  { this->SetInterpolationMode(VTK_LINEAR_INTERPOLATION); };
98  { this->SetInterpolationMode(VTK_CUBIC_INTERPOLATION); };
99  const char *GetInterpolationModeAsString();
101 
106 
110  vtkMTimeType GetMTime() override;
111 
112 protected:
114  ~vtkGridTransform() override;
115 
119  void InternalUpdate() override;
120 
124  void InternalDeepCopy(vtkAbstractTransform *transform) override;
125 
127 
130  void ForwardTransformPoint(const float in[3], float out[3]) override;
131  void ForwardTransformPoint(const double in[3], double out[3]) override;
133 
134  void ForwardTransformDerivative(const float in[3], float out[3],
135  float derivative[3][3]) override;
136  void ForwardTransformDerivative(const double in[3], double out[3],
137  double derivative[3][3]) override;
138 
139  void InverseTransformPoint(const float in[3], float out[3]) override;
140  void InverseTransformPoint(const double in[3], double out[3]) override;
141 
142  void InverseTransformDerivative(const float in[3], float out[3],
143  float derivative[3][3]) override;
144  void InverseTransformDerivative(const double in[3], double out[3],
145  double derivative[3][3]) override;
146 
147  void (*InterpolationFunction)(double point[3], double displacement[3],
148  double derivatives[3][3],
149  void *gridPtr, int gridType,
150  int inExt[6], vtkIdType inInc[3]);
151 
155 
156  void *GridPointer;
158  double GridSpacing[3];
159  double GridOrigin[3];
160  int GridExtent[6];
161  vtkIdType GridIncrements[3];
162 
163 private:
164  vtkGridTransform(const vtkGridTransform&) = delete;
165  void operator=(const vtkGridTransform&) = delete;
166 
167  vtkGridTransformConnectionHolder* ConnectionHolder;
168 };
169 
170 //----------------------------------------------------------------------------
172 {
173  switch (this->InterpolationMode)
174  {
175  case VTK_GRID_NEAREST:
176  return "NearestNeighbor";
177  case VTK_GRID_LINEAR:
178  return "Linear";
179  case VTK_GRID_CUBIC:
180  return "Cubic";
181  default:
182  return "";
183  }
184 }
185 
186 #endif
187 
188 
189 
190 
191 
virtual void ForwardTransformPoint(const float in[3], float out[3])=0
If the InverseFlag is set to 0, then a call to InternalTransformPoint results in a call to ForwardTra...
virtual void InverseTransformPoint(const float in[3], float out[3])
If the InverseFlag is set to 1, then a call to InternalTransformPoint results in a call to InverseTra...
vtkMTimeType GetMTime() override
Override GetMTime necessary because of inverse transforms.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
#define VTK_LINEAR_INTERPOLATION
virtual void InverseTransformDerivative(const float in[3], float out[3], float derivative[3][3])
Calculate the inverse transform as well as the derivative of the forward transform (that's correct: t...
virtual void InternalUpdate()
Perform any subclass-specific Update.
virtual vtkAbstractTransform * MakeTransform()=0
Make another transform of the same type.
#define VTK_GRID_LINEAR
int vtkIdType
Definition: vtkType.h:347
#define VTK_CUBIC_INTERPOLATION
Proxy object to connect input/output ports.
void SetInterpolationModeToLinear()
Set interpolation mode for sampling the grid.
virtual void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3])=0
Calculate the forward transform as well as the derivative.
virtual void InternalDeepCopy(vtkAbstractTransform *)
Perform any subclass-specific DeepCopy.
void SetInterpolationModeToNearestNeighbor()
Set interpolation mode for sampling the grid.
const char * GetInterpolationModeAsString()
Set interpolation mode for sampling the grid.
#define VTK_GRID_CUBIC
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
superclass for all geometric transformations
superclass for nonlinear geometric transformations
#define VTK_GRID_NEAREST
void SetInterpolationModeToCubic()
Set interpolation mode for sampling the grid.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_NEAREST_INTERPOLATION
a nonlinear warp transformation