VTK: Filters/Hybrid/vtkGridTransform.h Source File

| VTK 9.3.1

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();
38 vtkTypeMacro(vtkGridTransform, vtkWarpTransform);
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
42
49 virtual void SetDisplacementGridConnection(vtkAlgorithmOutput*);
50 virtual void SetDisplacementGridData(vtkImageData*);
51 virtual vtkImageData* GetDisplacementGrid();
53
55
60 vtkSetMacro(DisplacementScale, double);
61 vtkGetMacro(DisplacementScale, double);
63
65
70 vtkSetMacro(DisplacementShift, double);
71 vtkGetMacro(DisplacementShift, double);
73
75
80 void SetInterpolationMode(int mode);
81 vtkGetMacro(InterpolationMode, int);
82 void SetInterpolationModeToNearestNeighbor()
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
94 vtkAbstractTransform* MakeTransform() override;
95
99 vtkMTimeType GetMTime() override;
100
101 protected:
102 vtkGridTransform();
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;
124 void ForwardTransformDerivative(
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;
131 void InverseTransformDerivative(
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
137 int InterpolationMode;
138 double DisplacementScale;
139 double DisplacementShift;
140
141 void* GridPointer;
142 int GridScalarType;
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 //----------------------------------------------------------------------------
156 inline const char* vtkGridTransform::GetInterpolationModeAsString()
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
vtkAbstractTransform
superclass for all geometric transformations
Definition: vtkAbstractTransform.h:39
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:41
vtkGridTransform
a nonlinear warp transformation
Definition: vtkGridTransform.h:35
vtkGridTransform::InterpolationMode
int InterpolationMode
Definition: vtkGridTransform.h:137
vtkGridTransform::SetDisplacementGridData
virtual void SetDisplacementGridData(vtkImageData *)
Set/Get the grid transform (the grid transform must have three components for displacement in x,...
vtkGridTransform::InverseTransformPoint
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...
vtkGridTransform::GridScalarType
int GridScalarType
Definition: vtkGridTransform.h:142
vtkGridTransform::InverseTransformDerivative
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...
vtkGridTransform::InverseTransformDerivative
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...
vtkGridTransform::SetInterpolationMode
void SetInterpolationMode(int mode)
Set interpolation mode for sampling the grid.
vtkGridTransform::MakeTransform
vtkAbstractTransform * MakeTransform() override
Make another transform of the same type.
vtkGridTransform::InternalDeepCopy
void InternalDeepCopy(vtkAbstractTransform *transform) override
Copy this transform from another of the same type.
vtkGridTransform::SetInterpolationModeToLinear
void SetInterpolationModeToLinear()
Set interpolation mode for sampling the grid.
Definition: vtkGridTransform.h:86
vtkGridTransform::SetInterpolationModeToCubic
void SetInterpolationModeToCubic()
Set interpolation mode for sampling the grid.
Definition: vtkGridTransform.h:87
vtkGridTransform::ForwardTransformPoint
void ForwardTransformPoint(const float in[3], float out[3]) override
Internal functions for calculating the transformation.
vtkGridTransform::DisplacementShift
double DisplacementShift
Definition: vtkGridTransform.h:139
vtkGridTransform::ForwardTransformPoint
void ForwardTransformPoint(const double in[3], double out[3]) override
Internal functions for calculating the transformation.
vtkGridTransform::DisplacementScale
double DisplacementScale
Definition: vtkGridTransform.h:138
vtkGridTransform::GetMTime
vtkMTimeType GetMTime() override
Get the MTime.
vtkGridTransform::InverseTransformPoint
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...
vtkGridTransform::GridPointer
void * GridPointer
Definition: vtkGridTransform.h:141
vtkGridTransform::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGridTransform::SetInterpolationModeToNearestNeighbor
void SetInterpolationModeToNearestNeighbor()
Set interpolation mode for sampling the grid.
Definition: vtkGridTransform.h:82
vtkGridTransform::vtkGridTransform
vtkGridTransform()
vtkGridTransform::InternalUpdate
void InternalUpdate() override
Update the displacement grid.
vtkGridTransform::ForwardTransformDerivative
void ForwardTransformDerivative(const double in[3], double out[3], double derivative[3][3]) override
Calculate the forward transform as well as the derivative.
vtkGridTransform::GetInterpolationModeAsString
const char * GetInterpolationModeAsString()
Set interpolation mode for sampling the grid.
Definition: vtkGridTransform.h:156
vtkGridTransform::SetDisplacementGridConnection
virtual void SetDisplacementGridConnection(vtkAlgorithmOutput *)
Set/Get the grid transform (the grid transform must have three components for displacement in x,...
vtkGridTransform::ForwardTransformDerivative
void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override
Calculate the forward transform as well as the derivative.
vtkGridTransform::New
static vtkGridTransform * New()
vtkGridTransform::~vtkGridTransform
~vtkGridTransform() override
vtkGridTransform::GetDisplacementGrid
virtual vtkImageData * GetDisplacementGrid()
Set/Get the grid transform (the grid transform must have three components for displacement in x,...
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkWarpTransform
superclass for nonlinear geometric transformations
Definition: vtkWarpTransform.h:21
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkX3D::mode
@ mode
Definition: vtkX3D.h:247
VTK_GRID_LINEAR
#define VTK_GRID_LINEAR
Definition: vtkGridTransform.h:31
VTK_GRID_CUBIC
#define VTK_GRID_CUBIC
Definition: vtkGridTransform.h:32
VTK_GRID_NEAREST
#define VTK_GRID_NEAREST
Definition: vtkGridTransform.h:30
VTK_CUBIC_INTERPOLATION
#define VTK_CUBIC_INTERPOLATION
Definition: vtkSystemIncludes.h:84
VTK_NEAREST_INTERPOLATION
#define VTK_NEAREST_INTERPOLATION
Definition: vtkSystemIncludes.h:82
VTK_LINEAR_INTERPOLATION
#define VTK_LINEAR_INTERPOLATION
Definition: vtkSystemIncludes.h:83
vtkIdType
int vtkIdType
Definition: vtkType.h:315
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
vtkWarpTransform.h