00001 #ifndef TPS_H_ 00002 #define TPS_H_ 00003 00004 #include <vector> 00005 #include <Matrix.h> 00006 00007 using namespace std; 00008 00010 const double MIN_TOLERANCE = 1e-12; 00011 00013 class TPS 00014 { 00015 00016 public: 00017 00023 TPS( double **reference = 0, 00024 double **target = 0, 00025 int landmarks = 0, 00026 int dimensions = 0 ); 00027 00029 virtual ~TPS(); 00030 00036 void LoadData( double **reference, 00037 double **target, 00038 int landmarks = 0, 00039 int dimensions = 0 ); 00040 00042 void PerformTPS(); 00043 00046 void GetReference(Matrix<double> *ref); 00047 00050 void GetTarget(Matrix<double> *target); 00051 00054 void SetReference(double **ref); 00055 00058 void SetTarget(double **target); 00059 00063 void WarpPoint(double *point, vector<double> *wpoint); 00064 00069 void WarpPoints(double **points, Matrix<double> *wpoints, int n); 00070 00075 void WarpPoints(double *points, Matrix<double> *wpoints, int n); 00076 00077 00080 int GetNumberOfLandmarks(); 00081 00084 int GetNumberOfDimensions(); 00085 00088 double GetBendingEnergy(); 00089 00092 void GetBendingEnergyMatrix(Matrix<double> *BE); 00093 00096 bool IsCalculated(); 00097 00098 00099 private: 00100 00101 bool m_calculated; 00102 int m_landmarks; 00103 int m_dimensions; 00104 00105 double *m_reference; 00106 double *m_target; 00107 double *m_spline; 00108 double m_bendingEnergy; 00109 Matrix<double> m_uniform; 00110 Matrix<double> m_nonuniform; 00111 float **m_cache; 00112 }; 00113 00114 #endif // TPS_H_ 00115