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 
37 class vtkAlgorithmOutput;
38 class vtkGridTransformConnectionHolder;
39 class 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 
45 class VTKFILTERSHYBRID_EXPORT vtkGridTransform : public vtkWarpTransform
46 {
47 public:
48  static vtkGridTransform *New();
50  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
51 
53 
60  virtual void SetDisplacementGridConnection(vtkAlgorithmOutput*);
61  virtual void SetDisplacementGridData(vtkImageData*);
62  virtual vtkImageData* GetDisplacementGrid();
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  { this->SetInterpolationMode(VTK_NEAREST_INTERPOLATION); };
96  { this->SetInterpolationMode(VTK_LINEAR_INTERPOLATION); };
98  { this->SetInterpolationMode(VTK_CUBIC_INTERPOLATION); };
99  const char *GetInterpolationModeAsString();
101 
106 
111 
112 protected:
114  ~vtkGridTransform();
115 
119  void InternalUpdate();
120 
124  void InternalDeepCopy(vtkAbstractTransform *transform);
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 
156  void *GridPointer;
158  double GridSpacing[3];
159  double GridOrigin[3];
160  int GridExtent[6];
161  vtkIdType GridIncrements[3];
162 
163 private:
164  vtkGridTransform(const vtkGridTransform&) VTK_DELETE_FUNCTION;
165  void operator=(const vtkGridTransform&) VTK_DELETE_FUNCTION;
166 
167  vtkGridTransformConnectionHolder* ConnectionHolder;
168 };
169 
170 //----------------------------------------------------------------------------
171 inline const char *vtkGridTransform::GetInterpolationModeAsString()
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 
virtual void ForwardTransformPoint(const float in[3], float out[3])=0
If the InverseFlag is set to 0, then a call to InternalTransformPoint results in a call to ForwardTra...
virtual 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...
vtkMTimeType GetMTime() override
Override GetMTime necessary because of inverse transforms.
#define VTK_LINEAR_INTERPOLATION
virtual 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...
virtual void InternalUpdate()
Perform any subclass-specific Update.
#define VTK_GRID_LINEAR
int vtkIdType
Definition: vtkType.h:287
#define VTK_CUBIC_INTERPOLATION
virtual VTK_NEWINSTANCE vtkAbstractTransform * MakeTransform()=0
Make another transform of the same type.
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
Proxy object to connect input/output ports.
void SetInterpolationModeToLinear()
Set interpolation mode for sampling the grid.
virtual void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3])=0
Calculate the forward transform as well as the derivative.
virtual void InternalDeepCopy(vtkAbstractTransform *)
Perform any subclass-specific DeepCopy.
void SetInterpolationModeToNearestNeighbor()
Set interpolation mode for sampling the grid.
#define VTK_GRID_CUBIC
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
superclass for all geometric transformations
superclass for nonlinear geometric transformations
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_GRID_NEAREST
void SetInterpolationModeToCubic()
Set interpolation mode for sampling the grid.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_NEAREST_INTERPOLATION
a nonlinear warp transformation