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
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) VTK_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
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
111
112protected:
115
120
125
127
130 void ForwardTransformPoint(const float in[3], float out[3]);
131 void ForwardTransformPoint(const double in[3], double out[3]);
133
134 void ForwardTransformDerivative(const float in[3], float out[3],
135 float derivative[3][3]);
136 void ForwardTransformDerivative(const double in[3], double out[3],
137 double derivative[3][3]);
138
139 void InverseTransformPoint(const float in[3], float out[3]);
140 void InverseTransformPoint(const double in[3], double out[3]);
141
142 void InverseTransformDerivative(const float in[3], float out[3],
143 float derivative[3][3]);
144 void InverseTransformDerivative(const double in[3], double out[3],
145 double derivative[3][3]);
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
158 double GridSpacing[3];
159 double GridOrigin[3];
160 int GridExtent[6];
161 vtkIdType GridIncrements[3];
162
163private:
164 vtkGridTransform(const vtkGridTransform&) VTK_DELETE_FUNCTION;
165 void operator=(const vtkGridTransform&) VTK_DELETE_FUNCTION;
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
superclass for all geometric transformations
Proxy object to connect input/output ports.
a nonlinear warp transformation
void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3])
Calculate the forward transform as well as the derivative.
void ForwardTransformPoint(const double in[3], double out[3])
virtual void SetDisplacementGridData(vtkImageData *)
virtual vtkImageData * GetDisplacementGrid()
void ForwardTransformDerivative(const double in[3], double out[3], double derivative[3][3])
vtkAbstractTransform * MakeTransform()
Make another transform of the same type.
void InternalUpdate()
Update the displacement grid.
void SetInterpolationMode(int mode)
Set interpolation mode for sampling the grid.
vtkMTimeType GetMTime()
Get the MTime.
void SetInterpolationModeToLinear()
void SetInterpolationModeToCubic()
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...
void InternalDeepCopy(vtkAbstractTransform *transform)
Copy this transform from another of the same type.
void InverseTransformPoint(const double in[3], double out[3])
static vtkGridTransform * New()
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...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void InverseTransformDerivative(const double in[3], double out[3], double derivative[3][3])
void SetInterpolationModeToNearestNeighbor()
const char * GetInterpolationModeAsString()
virtual void SetDisplacementGridConnection(vtkAlgorithmOutput *)
Set/Get the grid transform (the grid transform must have three components for displacement in x,...
void ForwardTransformPoint(const float in[3], float out[3])
Internal functions for calculating the transformation.
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
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
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
#define VTK_CUBIC_INTERPOLATION
#define VTK_NEAREST_INTERPOLATION
#define VTK_LINEAR_INTERPOLATION
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248