VTK
vtkThinPlateSplineTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkThinPlateSplineTransform.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 =========================================================================*/
42 #ifndef vtkThinPlateSplineTransform_h
43 #define vtkThinPlateSplineTransform_h
44 
45 #include "vtkCommonTransformsModule.h" // For export macro
46 #include "vtkWarpTransform.h"
47 
48 #define VTK_RBF_CUSTOM 0
49 #define VTK_RBF_R 1
50 #define VTK_RBF_R2LOGR 2
51 
52 class VTKCOMMONTRANSFORMS_EXPORT vtkThinPlateSplineTransform : public vtkWarpTransform
53 {
54 public:
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60 
63  vtkGetMacro(Sigma,double);
64  vtkSetMacro(Sigma,double);
66 
68 
75  void SetBasis(int basis);
76  vtkGetMacro(Basis,int);
77  void SetBasisToR() { this->SetBasis(VTK_RBF_R); };
78  void SetBasisToR2LogR() { this->SetBasis(VTK_RBF_R2LOGR); };
79  const char *GetBasisAsString();
81 
83 
87  void SetBasisFunction(double (*U)(double r)) {
88  if (this->BasisFunction == U) { return; }
89  this->SetBasis(VTK_RBF_CUSTOM);
90  this->BasisFunction = U;
91  this->Modified(); };
92  void SetBasisDerivative(double (*dUdr)(double r, double &dU)) {
93  this->BasisDerivative = dUdr;
94  this->Modified(); };
96 
98 
103  void SetSourceLandmarks(vtkPoints *source);
104  vtkGetObjectMacro(SourceLandmarks,vtkPoints);
106 
108 
113  void SetTargetLandmarks(vtkPoints *target);
114  vtkGetObjectMacro(TargetLandmarks,vtkPoints);
116 
120  vtkMTimeType GetMTime() override;
121 
126 
127 protected:
129  ~vtkThinPlateSplineTransform() override;
130 
134  void InternalUpdate() override;
135 
139  void InternalDeepCopy(vtkAbstractTransform *transform) override;
140 
141  void ForwardTransformPoint(const float in[3], float out[3]) override;
142  void ForwardTransformPoint(const double in[3], double out[3]) override;
143 
144  void ForwardTransformDerivative(const float in[3], float out[3],
145  float derivative[3][3]) override;
146  void ForwardTransformDerivative(const double in[3], double out[3],
147  double derivative[3][3]) override;
148 
149  double Sigma;
152 
153  // the radial basis function to use
154  double (*BasisFunction)(double r);
155  double (*BasisDerivative)(double r, double& dUdr);
156 
157  int Basis;
158 
160  double **MatrixW;
161 private:
163  void operator=(const vtkThinPlateSplineTransform&) = delete;
164 };
165 
166 #endif
167 
168 
169 
170 
171 
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...
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkMTimeType GetMTime() override
Override GetMTime necessary because of inverse transforms.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
#define VTK_RBF_R
void SetBasisDerivative(double(*dUdr)(double r, double &dU))
Set the radial basis function to a custom function.
virtual void InternalUpdate()
Perform any subclass-specific Update.
virtual vtkAbstractTransform * MakeTransform()=0
Make another transform of the same type.
a nonlinear warp transformation
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.
a simple class to control print indentation
Definition: vtkIndent.h:39
void SetBasisToR2LogR()
Specify the radial basis function to use.
superclass for all geometric transformations
#define VTK_RBF_R2LOGR
virtual void Modified()
Update the modification time for this object.
#define VTK_RBF_CUSTOM
superclass for nonlinear geometric transformations
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
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.
void SetBasisToR()
Specify the radial basis function to use.
represent and manipulate 3D points
Definition: vtkPoints.h:39
void SetBasisFunction(double(*U)(double r))
Set the radial basis function to a custom function.