Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Hybrid/vtkThinPlateSplineTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkThinPlateSplineTransform.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00051 #ifndef __vtkThinPlateSplineTransform_h
00052 #define __vtkThinPlateSplineTransform_h
00053 
00054 #include "vtkWarpTransform.h"
00055 
00056 #define VTK_RBF_CUSTOM 0
00057 #define VTK_RBF_R      1
00058 #define VTK_RBF_R2LOGR 2
00059 
00060 class VTK_HYBRID_EXPORT vtkThinPlateSplineTransform : public vtkWarpTransform
00061 {
00062 public:
00063   vtkTypeRevisionMacro(vtkThinPlateSplineTransform,vtkWarpTransform);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065   static vtkThinPlateSplineTransform *New();
00066 
00068 
00069   vtkGetMacro(Sigma,double);
00070   vtkSetMacro(Sigma,double);
00072 
00074 
00076   void SetBasis(int basis);
00077   vtkGetMacro(Basis,int);
00078   void SetBasisToR() { this->SetBasis(VTK_RBF_R); };
00079   void SetBasisToR2LogR() { this->SetBasis(VTK_RBF_R2LOGR); };
00080   const char *GetBasisAsString();
00082 
00083 //BTX
00085   /*! Set the radial basis function to a custom function.  You must supply
00086       both the function and its derivative with respect to r. */
00087   void SetBasisFunction(double (*U)(double r)) {
00088     if (this->BasisFunction == U) { return; }
00089     this->SetBasis(VTK_RBF_CUSTOM);
00090     this->BasisFunction = U; 
00091     this->Modified(); };
00092   void SetBasisDerivative(double (*dUdr)(double r, double &dU)) {
00093     this->BasisDerivative = dUdr; 
00094     this->Modified(); };    
00096 //ETX
00097 
00099 
00102   void SetSourceLandmarks(vtkPoints *source);
00103   vtkGetObjectMacro(SourceLandmarks,vtkPoints);
00105 
00107 
00110   void SetTargetLandmarks(vtkPoints *target);
00111   vtkGetObjectMacro(TargetLandmarks,vtkPoints);
00113 
00115   unsigned long GetMTime();
00116 
00118   vtkAbstractTransform *MakeTransform();
00119 
00120 protected:
00121   vtkThinPlateSplineTransform();
00122   ~vtkThinPlateSplineTransform();
00123 
00125   void InternalUpdate();
00126 
00128   void InternalDeepCopy(vtkAbstractTransform *transform);
00129 
00130   void ForwardTransformPoint(const float in[3], float out[3]);
00131   void ForwardTransformPoint(const double in[3], double out[3]);
00132 
00133   void ForwardTransformDerivative(const float in[3], float out[3],
00134                                   float derivative[3][3]);
00135   void ForwardTransformDerivative(const double in[3], double out[3],
00136                                   double derivative[3][3]);
00137 
00138   double Sigma;
00139   vtkPoints *SourceLandmarks;
00140   vtkPoints *TargetLandmarks;
00141 
00142 //BTX
00143   // the radial basis function to use
00144   double (*BasisFunction)(double r);
00145   double (*BasisDerivative)(double r, double& dUdr);
00146 //ETX
00147   int Basis;
00148 
00149   int NumberOfPoints;
00150   double **MatrixW;
00151 private:
00152   vtkThinPlateSplineTransform(const vtkThinPlateSplineTransform&);  // Not implemented.
00153   void operator=(const vtkThinPlateSplineTransform&);  // Not implemented.
00154 };
00155 
00156 #endif
00157 
00158 
00159 
00160 
00161