VTK  9.1.0
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=========================================================================*/
28#ifndef vtkGridTransform_h
29#define vtkGridTransform_h
30
31#include "vtkFiltersHybridModule.h" // For export macro
32#include "vtkWarpTransform.h"
33
35class vtkGridTransformConnectionHolder;
36class vtkImageData;
37
38#define VTK_GRID_NEAREST VTK_NEAREST_INTERPOLATION
39#define VTK_GRID_LINEAR VTK_LINEAR_INTERPOLATION
40#define VTK_GRID_CUBIC VTK_CUBIC_INTERPOLATION
41
42class VTKFILTERSHYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
43{
44public:
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
50
61
63
68 vtkSetMacro(DisplacementScale, double);
69 vtkGetMacro(DisplacementScale, double);
71
73
78 vtkSetMacro(DisplacementShift, double);
79 vtkGetMacro(DisplacementShift, double);
81
83
88 void SetInterpolationMode(int mode);
89 vtkGetMacro(InterpolationMode, int);
91 {
92 this->SetInterpolationMode(VTK_NEAREST_INTERPOLATION);
93 }
94 void SetInterpolationModeToLinear() { this->SetInterpolationMode(VTK_LINEAR_INTERPOLATION); }
95 void SetInterpolationModeToCubic() { this->SetInterpolationMode(VTK_CUBIC_INTERPOLATION); }
96 const char* GetInterpolationModeAsString();
98
103
108
109protected:
112
116 void InternalUpdate() override;
117
121 void InternalDeepCopy(vtkAbstractTransform* transform) override;
122
124
127 void ForwardTransformPoint(const float in[3], float out[3]) override;
128 void ForwardTransformPoint(const double in[3], double out[3]) override;
130
131 void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override;
133 const double in[3], double out[3], double derivative[3][3]) override;
134
135 void InverseTransformPoint(const float in[3], float out[3]) override;
136 void InverseTransformPoint(const double in[3], double out[3]) override;
137
138 void InverseTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override;
140 const double in[3], double out[3], double derivative[3][3]) override;
141
142 void (*InterpolationFunction)(double point[3], double displacement[3], double derivatives[3][3],
143 void* gridPtr, int gridType, int inExt[6], vtkIdType inInc[3]);
144
148
151 double GridSpacing[3];
152 double GridOrigin[3];
153 int GridExtent[6];
154 vtkIdType GridIncrements[3];
155
156private:
157 vtkGridTransform(const vtkGridTransform&) = delete;
158 void operator=(const vtkGridTransform&) = delete;
159
160 vtkGridTransformConnectionHolder* ConnectionHolder;
161};
162
163//----------------------------------------------------------------------------
165{
166 switch (this->InterpolationMode)
167 {
168 case VTK_GRID_NEAREST:
169 return "NearestNeighbor";
170 case VTK_GRID_LINEAR:
171 return "Linear";
172 case VTK_GRID_CUBIC:
173 return "Cubic";
174 default:
175 return "";
176 }
177}
178
179#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:157
a simple class to control print indentation
Definition: vtkIndent.h:113
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