VTK  9.3.0
vtkGridTransform.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
19 #ifndef vtkGridTransform_h
20 #define vtkGridTransform_h
21 
22 #include "vtkFiltersHybridModule.h" // For export macro
23 #include "vtkWarpTransform.h"
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkAlgorithmOutput;
27 class vtkGridTransformConnectionHolder;
28 class vtkImageData;
29 
30 #define VTK_GRID_NEAREST VTK_NEAREST_INTERPOLATION
31 #define VTK_GRID_LINEAR VTK_LINEAR_INTERPOLATION
32 #define VTK_GRID_CUBIC VTK_CUBIC_INTERPOLATION
33 
34 class VTKFILTERSHYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
35 {
36 public:
37  static vtkGridTransform* New();
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
42 
53 
55 
60  vtkSetMacro(DisplacementScale, double);
61  vtkGetMacro(DisplacementScale, double);
63 
65 
70  vtkSetMacro(DisplacementShift, double);
71  vtkGetMacro(DisplacementShift, double);
73 
75 
81  vtkGetMacro(InterpolationMode, int);
83  {
84  this->SetInterpolationMode(VTK_NEAREST_INTERPOLATION);
85  }
86  void SetInterpolationModeToLinear() { this->SetInterpolationMode(VTK_LINEAR_INTERPOLATION); }
87  void SetInterpolationModeToCubic() { this->SetInterpolationMode(VTK_CUBIC_INTERPOLATION); }
88  const char* GetInterpolationModeAsString();
90 
95 
99  vtkMTimeType GetMTime() override;
100 
101 protected:
103  ~vtkGridTransform() override;
104 
108  void InternalUpdate() override;
109 
113  void InternalDeepCopy(vtkAbstractTransform* transform) override;
114 
116 
119  void ForwardTransformPoint(const float in[3], float out[3]) override;
120  void ForwardTransformPoint(const double in[3], double out[3]) override;
122 
123  void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override;
125  const double in[3], double out[3], double derivative[3][3]) override;
126 
127  void InverseTransformPoint(const float in[3], float out[3]) override;
128  void InverseTransformPoint(const double in[3], double out[3]) override;
129 
130  void InverseTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override;
132  const double in[3], double out[3], double derivative[3][3]) override;
133 
134  void (*InterpolationFunction)(double point[3], double displacement[3], double derivatives[3][3],
135  void* gridPtr, int gridType, int inExt[6], vtkIdType inInc[3]);
136 
140 
141  void* GridPointer;
143  double GridSpacing[3];
144  double GridOrigin[3];
145  int GridExtent[6];
146  vtkIdType GridIncrements[3];
147 
148 private:
149  vtkGridTransform(const vtkGridTransform&) = delete;
150  void operator=(const vtkGridTransform&) = delete;
151 
152  vtkGridTransformConnectionHolder* ConnectionHolder;
153 };
154 
155 //----------------------------------------------------------------------------
157 {
158  switch (this->InterpolationMode)
159  {
160  case VTK_GRID_NEAREST:
161  return "NearestNeighbor";
162  case VTK_GRID_LINEAR:
163  return "Linear";
164  case VTK_GRID_CUBIC:
165  return "Cubic";
166  default:
167  return "";
168  }
169 }
170 
171 VTK_ABI_NAMESPACE_END
172 #endif
superclass for all geometric transformations
Proxy object to connect input/output ports.
a nonlinear warp transformation
virtual void SetDisplacementGridData(vtkImageData *)
Set/Get the grid transform (the grid transform must have three components for displacement in x,...
void InverseTransformPoint(const float in[3], float out[3]) override
If the InverseFlag is set to 1, then a call to InternalTransformPoint results in a call to InverseTra...
void InverseTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override
Calculate the inverse transform as well as the derivative of the forward transform (that's correct: t...
void InverseTransformDerivative(const double in[3], double out[3], double derivative[3][3]) override
Calculate the inverse transform as well as the derivative of the forward transform (that's correct: t...
void SetInterpolationMode(int mode)
Set interpolation mode for sampling the grid.
vtkAbstractTransform * MakeTransform() override
Make another transform of the same type.
void InternalDeepCopy(vtkAbstractTransform *transform) override
Copy this transform from another of the same type.
void SetInterpolationModeToLinear()
Set interpolation mode for sampling the grid.
void SetInterpolationModeToCubic()
Set interpolation mode for sampling the grid.
void ForwardTransformPoint(const float in[3], float out[3]) override
Internal functions for calculating the transformation.
void ForwardTransformPoint(const double in[3], double out[3]) override
Internal functions for calculating the transformation.
vtkMTimeType GetMTime() override
Get the MTime.
void InverseTransformPoint(const double in[3], double out[3]) override
If the InverseFlag is set to 1, then a call to InternalTransformPoint results in a call to InverseTra...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetInterpolationModeToNearestNeighbor()
Set interpolation mode for sampling the grid.
void InternalUpdate() override
Update the displacement grid.
void ForwardTransformDerivative(const double in[3], double out[3], double derivative[3][3]) override
Calculate the forward transform as well as the derivative.
const char * GetInterpolationModeAsString()
Set interpolation mode for sampling the grid.
virtual void SetDisplacementGridConnection(vtkAlgorithmOutput *)
Set/Get the grid transform (the grid transform must have three components for displacement in x,...
void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override
Calculate the forward transform as well as the derivative.
static vtkGridTransform * New()
~vtkGridTransform() override
virtual vtkImageData * GetDisplacementGrid()
Set/Get the grid transform (the grid transform must have three components for displacement in x,...
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
a simple class to control print indentation
Definition: vtkIndent.h:38
superclass for nonlinear geometric transformations
@ point
Definition: vtkX3D.h:236
@ mode
Definition: vtkX3D.h:247
#define VTK_GRID_LINEAR
#define VTK_GRID_CUBIC
#define VTK_GRID_NEAREST
#define VTK_CUBIC_INTERPOLATION
#define VTK_NEAREST_INTERPOLATION
#define VTK_LINEAR_INTERPOLATION
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270