VTK  9.3.20240329
vtkThinPlateSplineTransform.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
50 #ifndef vtkThinPlateSplineTransform_h
51 #define vtkThinPlateSplineTransform_h
52 
53 #include "vtkCommonTransformsModule.h" // For export macro
54 #include "vtkWarpTransform.h"
55 
56 #define VTK_RBF_CUSTOM 0
57 #define VTK_RBF_R 1
58 #define VTK_RBF_R2LOGR 2
59 
60 VTK_ABI_NAMESPACE_BEGIN
61 class VTKCOMMONTRANSFORMS_EXPORT vtkThinPlateSplineTransform : public vtkWarpTransform
62 {
63 public:
65  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
69 
72  vtkGetMacro(Sigma, double);
73  vtkSetMacro(Sigma, double);
75 
77 
84  void SetBasis(int basis);
85  vtkGetMacro(Basis, int);
86  void SetBasisToR() { this->SetBasis(VTK_RBF_R); }
87  void SetBasisToR2LogR() { this->SetBasis(VTK_RBF_R2LOGR); }
88  const char* GetBasisAsString();
90 
92 
96  void SetBasisFunction(double (*U)(double r))
97  {
98  if (this->BasisFunction == U)
99  {
100  return;
101  }
102  this->SetBasis(VTK_RBF_CUSTOM);
103  this->BasisFunction = U;
104  this->Modified();
105  }
106  void SetBasisDerivative(double (*dUdr)(double r, double& dU))
107  {
108  this->BasisDerivative = dUdr;
109  this->Modified();
110  }
112 
114 
120  vtkGetObjectMacro(SourceLandmarks, vtkPoints);
122 
124 
130  vtkGetObjectMacro(TargetLandmarks, vtkPoints);
132 
136  vtkMTimeType GetMTime() override;
137 
142 
144 
160  vtkGetMacro(RegularizeBulkTransform, bool);
161  vtkSetMacro(RegularizeBulkTransform, bool);
162  vtkBooleanMacro(RegularizeBulkTransform, bool);
164 
165 protected:
168 
172  void InternalUpdate() override;
173 
177  void InternalDeepCopy(vtkAbstractTransform* transform) override;
178 
179  void ForwardTransformPoint(const float in[3], float out[3]) override;
180  void ForwardTransformPoint(const double in[3], double out[3]) override;
181 
182  void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override;
184  const double in[3], double out[3], double derivative[3][3]) override;
185 
186  double Sigma;
189 
190  // the radial basis function to use
191  double (*BasisFunction)(double r);
192  double (*BasisDerivative)(double r, double& dUdr);
193 
194  int Basis;
195 
197  double** MatrixW;
198 
200 
201 private:
203  void operator=(const vtkThinPlateSplineTransform&) = delete;
204 };
205 
206 VTK_ABI_NAMESPACE_END
207 #endif
superclass for all geometric transformations
a simple class to control print indentation
Definition: vtkIndent.h:108
virtual void Modified()
Update the modification time for this object.
represent and manipulate 3D points
Definition: vtkPoints.h:139
a nonlinear warp transformation
vtkAbstractTransform * MakeTransform() override
Make another transform of the same type.
void SetBasisToR()
Specify the radial basis function to use.
const char * GetBasisAsString()
Specify the radial basis function to use.
void InternalUpdate() override
Prepare the transformation for application.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ForwardTransformDerivative(const double in[3], double out[3], double derivative[3][3]) override
Calculate the forward transform as well as the derivative.
void ForwardTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override
Calculate the forward transform as well as the derivative.
void SetBasisFunction(double(*U)(double r))
Set the radial basis function to a custom function.
void SetBasisToR2LogR()
Specify the radial basis function to use.
void SetSourceLandmarks(vtkPoints *source)
Set the source landmarks for the warp.
void ForwardTransformPoint(const double in[3], double out[3]) override
If the InverseFlag is set to 0, then a call to InternalTransformPoint results in a call to ForwardTra...
vtkMTimeType GetMTime() override
Get the MTime.
void SetBasisDerivative(double(*dUdr)(double r, double &dU))
Set the radial basis function to a custom function.
~vtkThinPlateSplineTransform() override
void InternalDeepCopy(vtkAbstractTransform *transform) override
This method does no type checking, use DeepCopy instead.
void SetBasis(int basis)
Specify the radial basis function to use.
void ForwardTransformPoint(const float in[3], float out[3]) override
If the InverseFlag is set to 0, then a call to InternalTransformPoint results in a call to ForwardTra...
static vtkThinPlateSplineTransform * New()
void SetTargetLandmarks(vtkPoints *target)
Set the target landmarks for the warp.
superclass for nonlinear geometric transformations
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_RBF_R
#define VTK_RBF_CUSTOM
#define VTK_RBF_R2LOGR
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270