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 =========================================================================*/
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 
57  virtual void SetDisplacementGridConnection(vtkAlgorithmOutput*);
58  virtual void SetDisplacementGridData(vtkImageData*);
59  virtual vtkImageData* GetDisplacementGrid();
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  { this->SetInterpolationMode(VTK_NEAREST_INTERPOLATION); };
93  { this->SetInterpolationMode(VTK_LINEAR_INTERPOLATION); };
95  { 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],
132  float derivative[3][3]) override;
133  void ForwardTransformDerivative(const double in[3], double out[3],
134  double derivative[3][3]) override;
135 
136  void InverseTransformPoint(const float in[3], float out[3]) override;
137  void InverseTransformPoint(const double in[3], double out[3]) override;
138 
139  void InverseTransformDerivative(const float in[3], float out[3],
140  float derivative[3][3]) override;
141  void InverseTransformDerivative(const double in[3], double out[3],
142  double derivative[3][3]) override;
143 
144  void (*InterpolationFunction)(double point[3], double displacement[3],
145  double derivatives[3][3],
146  void *gridPtr, int gridType,
147  int inExt[6], vtkIdType inInc[3]);
148 
152 
153  void *GridPointer;
155  double GridSpacing[3];
156  double GridOrigin[3];
157  int GridExtent[6];
158  vtkIdType GridIncrements[3];
159 
160 private:
161  vtkGridTransform(const vtkGridTransform&) = delete;
162  void operator=(const vtkGridTransform&) = delete;
163 
164  vtkGridTransformConnectionHolder* ConnectionHolder;
165 };
166 
167 //----------------------------------------------------------------------------
169 {
170  switch (this->InterpolationMode)
171  {
172  case VTK_GRID_NEAREST:
173  return "NearestNeighbor";
174  case VTK_GRID_LINEAR:
175  return "Linear";
176  case VTK_GRID_CUBIC:
177  return "Cubic";
178  default:
179  return "";
180  }
181 }
182 
183 #endif
184 
185 
186 
187 
188 
VTK_GRID_LINEAR
#define VTK_GRID_LINEAR
Definition: vtkGridTransform.h:39
vtkGridTransform::SetInterpolationModeToCubic
void SetInterpolationModeToCubic()
Definition: vtkGridTransform.h:94
vtkAbstractTransform
superclass for all geometric transformations
Definition: vtkAbstractTransform.h:50
vtkGridTransform::GridPointer
void * GridPointer
Definition: vtkGridTransform.h:153
vtkIdType
int vtkIdType
Definition: vtkType.h:347
VTK_GRID_NEAREST
#define VTK_GRID_NEAREST
Definition: vtkGridTransform.h:38
vtkGridTransform::SetInterpolationModeToNearestNeighbor
void SetInterpolationModeToNearestNeighbor()
Definition: vtkGridTransform.h:90
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkAbstractTransform::InternalUpdate
virtual void InternalUpdate()
Perform any subclass-specific Update.
Definition: vtkAbstractTransform.h:337
vtkWarpTransform::InverseTransformDerivative
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...
vtkGridTransform::DisplacementShift
double DisplacementShift
Definition: vtkGridTransform.h:151
VTK_GRID_CUBIC
#define VTK_GRID_CUBIC
Definition: vtkGridTransform.h:40
VTK_CUBIC_INTERPOLATION
#define VTK_CUBIC_INTERPOLATION
Definition: vtkSystemIncludes.h:109
vtkWarpTransform::ForwardTransformPoint
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...
VTK_NEAREST_INTERPOLATION
#define VTK_NEAREST_INTERPOLATION
Definition: vtkSystemIncludes.h:107
vtkWarpTransform::ForwardTransformDerivative
virtual void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3])=0
Calculate the forward transform as well as the derivative.
vtkX3D::point
Definition: vtkX3D.h:236
vtkGridTransform::GetInterpolationModeAsString
const char * GetInterpolationModeAsString()
Definition: vtkGridTransform.h:168
vtkGridTransform
a nonlinear warp transformation
Definition: vtkGridTransform.h:42
vtkGridTransform::InterpolationMode
int InterpolationMode
Definition: vtkGridTransform.h:149
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkAbstractTransform::GetMTime
vtkMTimeType GetMTime() override
Override GetMTime necessary because of inverse transforms.
VTK_LINEAR_INTERPOLATION
#define VTK_LINEAR_INTERPOLATION
Definition: vtkSystemIncludes.h:108
vtkGridTransform::SetInterpolationModeToLinear
void SetInterpolationModeToLinear()
Definition: vtkGridTransform.h:92
vtkGridTransform::DisplacementScale
double DisplacementScale
Definition: vtkGridTransform.h:150
vtkWarpTransform.h
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkWarpTransform::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::mode
Definition: vtkX3D.h:247
vtkWarpTransform::InverseTransformPoint
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...
vtkAbstractTransform::MakeTransform
virtual vtkAbstractTransform * MakeTransform()=0
Make another transform of the same type.
vtkGridTransform::GridScalarType
int GridScalarType
Definition: vtkGridTransform.h:154
vtkWarpTransform
superclass for nonlinear geometric transformations
Definition: vtkWarpTransform.h:31
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkAbstractTransform::InternalDeepCopy
virtual void InternalDeepCopy(vtkAbstractTransform *)
Perform any subclass-specific DeepCopy.
Definition: vtkAbstractTransform.h:342