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 =========================================================================*/
39 #ifndef vtkThinPlateSplineTransform_h
40 #define vtkThinPlateSplineTransform_h
41 
42 #include "vtkCommonTransformsModule.h" // For export macro
43 #include "vtkWarpTransform.h"
44 
45 #define VTK_RBF_CUSTOM 0
46 #define VTK_RBF_R 1
47 #define VTK_RBF_R2LOGR 2
48 
49 class VTKCOMMONTRANSFORMS_EXPORT vtkThinPlateSplineTransform : public vtkWarpTransform
50 {
51 public:
53  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
57 
60  vtkGetMacro(Sigma,double);
61  vtkSetMacro(Sigma,double);
63 
65 
72  void SetBasis(int basis);
73  vtkGetMacro(Basis,int);
74  void SetBasisToR() { this->SetBasis(VTK_RBF_R); };
75  void SetBasisToR2LogR() { this->SetBasis(VTK_RBF_R2LOGR); };
76  const char *GetBasisAsString();
78 
80 
84  void SetBasisFunction(double (*U)(double r)) {
85  if (this->BasisFunction == U) { return; }
86  this->SetBasis(VTK_RBF_CUSTOM);
87  this->BasisFunction = U;
88  this->Modified(); };
89  void SetBasisDerivative(double (*dUdr)(double r, double &dU)) {
90  this->BasisDerivative = dUdr;
91  this->Modified(); };
93 
95 
100  void SetSourceLandmarks(vtkPoints *source);
101  vtkGetObjectMacro(SourceLandmarks,vtkPoints);
103 
105 
110  void SetTargetLandmarks(vtkPoints *target);
111  vtkGetObjectMacro(TargetLandmarks,vtkPoints);
113 
117  vtkMTimeType GetMTime() override;
118 
123 
124 protected:
126  ~vtkThinPlateSplineTransform() override;
127 
131  void InternalUpdate() override;
132 
136  void InternalDeepCopy(vtkAbstractTransform *transform) override;
137 
138  void ForwardTransformPoint(const float in[3], float out[3]) override;
139  void ForwardTransformPoint(const double in[3], double out[3]) override;
140 
141  void ForwardTransformDerivative(const float in[3], float out[3],
142  float derivative[3][3]) override;
143  void ForwardTransformDerivative(const double in[3], double out[3],
144  double derivative[3][3]) override;
145 
146  double Sigma;
149 
150  // the radial basis function to use
151  double (*BasisFunction)(double r);
152  double (*BasisDerivative)(double r, double& dUdr);
153 
154  int Basis;
155 
157  double **MatrixW;
158 private:
160  void operator=(const vtkThinPlateSplineTransform&) = delete;
161 };
162 
163 #endif
164 
165 
166 
167 
168 
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:300
#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:33
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:33
void SetBasisFunction(double(*U)(double r))
Set the radial basis function to a custom function.