VTK
dox/Common/Transforms/vtkThinPlateSplineTransform.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkThinPlateSplineTransform.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00041 #ifndef __vtkThinPlateSplineTransform_h
00042 #define __vtkThinPlateSplineTransform_h
00043 
00044 #include "vtkCommonTransformsModule.h" // For export macro
00045 #include "vtkWarpTransform.h"
00046 
00047 #define VTK_RBF_CUSTOM 0
00048 #define VTK_RBF_R      1
00049 #define VTK_RBF_R2LOGR 2
00050 
00051 class VTKCOMMONTRANSFORMS_EXPORT vtkThinPlateSplineTransform : public vtkWarpTransform
00052 {
00053 public:
00054   vtkTypeMacro(vtkThinPlateSplineTransform,vtkWarpTransform);
00055   void PrintSelf(ostream& os, vtkIndent indent);
00056   static vtkThinPlateSplineTransform *New();
00057 
00059 
00060   vtkGetMacro(Sigma,double);
00061   vtkSetMacro(Sigma,double);
00063 
00065 
00069   void SetBasis(int basis);
00070   vtkGetMacro(Basis,int);
00071   void SetBasisToR() { this->SetBasis(VTK_RBF_R); };
00072   void SetBasisToR2LogR() { this->SetBasis(VTK_RBF_R2LOGR); };
00073   const char *GetBasisAsString();
00075 
00076 //BTX
00078 
00080   void SetBasisFunction(double (*U)(double r)) {
00081     if (this->BasisFunction == U) { return; }
00082     this->SetBasis(VTK_RBF_CUSTOM);
00083     this->BasisFunction = U;
00084     this->Modified(); };
00085   void SetBasisDerivative(double (*dUdr)(double r, double &dU)) {
00086     this->BasisDerivative = dUdr;
00087     this->Modified(); };
00088 //ETX
00090 
00092 
00095   void SetSourceLandmarks(vtkPoints *source);
00096   vtkGetObjectMacro(SourceLandmarks,vtkPoints);
00098 
00100 
00103   void SetTargetLandmarks(vtkPoints *target);
00104   vtkGetObjectMacro(TargetLandmarks,vtkPoints);
00106 
00108   unsigned long GetMTime();
00109 
00111   vtkAbstractTransform *MakeTransform();
00112 
00113 protected:
00114   vtkThinPlateSplineTransform();
00115   ~vtkThinPlateSplineTransform();
00116 
00118   void InternalUpdate();
00119 
00121   void InternalDeepCopy(vtkAbstractTransform *transform);
00122 
00123   void ForwardTransformPoint(const float in[3], float out[3]);
00124   void ForwardTransformPoint(const double in[3], double out[3]);
00125 
00126   void ForwardTransformDerivative(const float in[3], float out[3],
00127                                   float derivative[3][3]);
00128   void ForwardTransformDerivative(const double in[3], double out[3],
00129                                   double derivative[3][3]);
00130 
00131   double Sigma;
00132   vtkPoints *SourceLandmarks;
00133   vtkPoints *TargetLandmarks;
00134 
00135 //BTX
00136   // the radial basis function to use
00137   double (*BasisFunction)(double r);
00138   double (*BasisDerivative)(double r, double& dUdr);
00139 //ETX
00140   int Basis;
00141 
00142   int NumberOfPoints;
00143   double **MatrixW;
00144 private:
00145   vtkThinPlateSplineTransform(const vtkThinPlateSplineTransform&);  // Not implemented.
00146   void operator=(const vtkThinPlateSplineTransform&);  // Not implemented.
00147 };
00148 
00149 #endif
00150 
00151 
00152 
00153 
00154