00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00067 #ifndef __vtkThinPlateSplineTransform_h
00068 #define __vtkThinPlateSplineTransform_h
00069
00070 #include "vtkWarpTransform.h"
00071
00072 #define VTK_RBF_CUSTOM 0
00073 #define VTK_RBF_R 1
00074 #define VTK_RBF_R2LOGR 2
00075
00076 class VTK_EXPORT vtkThinPlateSplineTransform : public vtkWarpTransform
00077 {
00078 public:
00079 vtkTypeMacro(vtkThinPlateSplineTransform,vtkWarpTransform);
00080 void PrintSelf(ostream& os, vtkIndent indent);
00081 static vtkThinPlateSplineTransform *New();
00082
00084 vtkGetMacro(Sigma,double);
00085 vtkSetMacro(Sigma,double);
00086
00089 void SetBasis(int basis);
00090 vtkGetMacro(Basis,int);
00091 void SetBasisToR() { this->SetBasis(VTK_RBF_R); };
00092 void SetBasisToR2LogR() { this->SetBasis(VTK_RBF_R2LOGR); };
00093 const char *GetBasisAsString();
00094
00095
00098 void SetBasisFunction(double (*U)(double r)) {
00099 if (this->BasisFunction == U) { return; }
00100 this->SetBasis(VTK_RBF_CUSTOM);
00101 this->BasisFunction = U;
00102 this->Modified(); };
00103 void SetBasisDerivative(double (*dUdr)(double r, double &dU)) {
00104 this->BasisDerivative = dUdr;
00105 this->Modified(); };
00106
00107
00111 void SetSourceLandmarks(vtkPoints *source);
00112 vtkGetObjectMacro(SourceLandmarks,vtkPoints);
00113
00117 void SetTargetLandmarks(vtkPoints *target);
00118 vtkGetObjectMacro(TargetLandmarks,vtkPoints);
00119
00121 unsigned long GetMTime();
00122
00124 vtkAbstractTransform *MakeTransform();
00125
00126 protected:
00127 vtkThinPlateSplineTransform();
00128 ~vtkThinPlateSplineTransform();
00129 vtkThinPlateSplineTransform(const vtkThinPlateSplineTransform&) {};
00130 void operator=(const vtkThinPlateSplineTransform&) {};
00131
00133 void InternalUpdate();
00134
00136 void InternalDeepCopy(vtkAbstractTransform *transform);
00137
00138 void ForwardTransformPoint(const float in[3], float out[3]);
00139 void ForwardTransformPoint(const double in[3], double out[3]);
00140
00141 void ForwardTransformDerivative(const float in[3], float out[3],
00142 float derivative[3][3]);
00143 void ForwardTransformDerivative(const double in[3], double out[3],
00144 double derivative[3][3]);
00145
00146 double Sigma;
00147 vtkPoints *SourceLandmarks;
00148 vtkPoints *TargetLandmarks;
00149
00150
00151
00152 double (*BasisFunction)(double r);
00153 double (*BasisDerivative)(double r, double& dUdr);
00154
00155 int Basis;
00156
00157 int NumberOfPoints;
00158 double **MatrixW;
00159 };
00160
00161 #endif
00162
00163
00164
00165
00166