VTK  9.0.1
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 
34 class vtkAlgorithmOutput;
35 class vtkGridTransformConnectionHolder;
36 class 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 
42 class VTKFILTERSHYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
43 {
44 public:
45  static vtkGridTransform* New();
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 
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 
107  vtkMTimeType GetMTime() override;
108 
109 protected:
111  ~vtkGridTransform() override;
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 
149  void* GridPointer;
151  double GridSpacing[3];
152  double GridOrigin[3];
153  int GridExtent[6];
154  vtkIdType GridIncrements[3];
155 
156 private:
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 *)
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
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()
void SetInterpolationModeToCubic()
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
vtkMTimeType GetMTime() override
Get the MTime.
void InverseTransformPoint(const double in[3], double out[3]) override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetInterpolationModeToNearestNeighbor()
void InternalUpdate() override
Update the displacement grid.
void ForwardTransformDerivative(const double in[3], double out[3], double derivative[3][3]) override
const char * GetInterpolationModeAsString()
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()
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
a simple class to control print indentation
Definition: vtkIndent.h:34
superclass for nonlinear geometric transformations
@ point
Definition: vtkX3D.h:242
@ mode
Definition: vtkX3D.h:253
#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:338
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293