VTK  9.2.6
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
38class vtkGridTransformConnectionHolder;
39class 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
45class VTKFILTERSHYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
46{
47public:
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
53
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 {
95 this->SetInterpolationMode(VTK_NEAREST_INTERPOLATION);
96 }
97 void SetInterpolationModeToLinear() { this->SetInterpolationMode(VTK_LINEAR_INTERPOLATION); }
98 void SetInterpolationModeToCubic() { this->SetInterpolationMode(VTK_CUBIC_INTERPOLATION); }
99 const char* GetInterpolationModeAsString();
101
106
111
112protected:
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], float derivative[3][3]) override;
136 const double in[3], double out[3], double derivative[3][3]) override;
137
138 void InverseTransformPoint(const float in[3], float out[3]) override;
139 void InverseTransformPoint(const double in[3], double out[3]) override;
140
141 void InverseTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override;
143 const double in[3], double out[3], double derivative[3][3]) override;
144
145 void (*InterpolationFunction)(double point[3], double displacement[3], double derivatives[3][3],
146 void* gridPtr, int gridType, int inExt[6], vtkIdType inInc[3]);
147
151
154 double GridSpacing[3];
155 double GridOrigin[3];
156 int GridExtent[6];
157 vtkIdType GridIncrements[3];
158
159private:
160 vtkGridTransform(const vtkGridTransform&) = delete;
161 void operator=(const vtkGridTransform&) = delete;
162
163 vtkGridTransformConnectionHolder* ConnectionHolder;
164};
165
166//----------------------------------------------------------------------------
168{
169 switch (this->InterpolationMode)
170 {
171 case VTK_GRID_NEAREST:
172 return "NearestNeighbor";
173 case VTK_GRID_LINEAR:
174 return "Linear";
175 case VTK_GRID_CUBIC:
176 return "Cubic";
177 default:
178 return "";
179 }
180}
181
182#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,...
virtual vtkImageData * GetDisplacementGrid()
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.
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...
vtkAbstractTransform * MakeTransform() override
Make another transform of the same type.
static vtkGridTransform * New()
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.
~vtkGridTransform() override
topologically and geometrically regular array of data
Definition: vtkImageData.h:54
a simple class to control print indentation
Definition: vtkIndent.h:40
superclass for nonlinear geometric transformations
#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:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287