Go to the documentation of this file.00001
00002 #ifndef mbl_thin_plate_spline_weights_3d_h_
00003 #define mbl_thin_plate_spline_weights_3d_h_
00004
00005
00006
00007
00008
00009 #include <vgl/vgl_point_3d.h>
00010 #include <vcl_vector.h>
00011 #include <vnl/vnl_vector.h>
00012 #include <vnl/vnl_matrix.h>
00013 #include <vsl/vsl_binary_io.h>
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 class mbl_thin_plate_spline_weights_3d
00027 {
00028 vnl_vector<double> Wx_,Wy_,Wz_;
00029 double Ax0_, AxX_, AxY_, AxZ_;
00030 double Ay0_, AyX_, AyY_, AyZ_;
00031 double Az0_, AzX_, AzY_, AzZ_;
00032 double energy_x_,energy_y_,energy_z_;
00033
00034 vcl_vector<vgl_point_3d<double> > src_pts_, pt_wts_;
00035
00036
00037 vnl_matrix<double> L_inv_;
00038
00039
00040 void build_pure_affine(const vcl_vector<vgl_point_3d<double> >& source_pts,
00041 const vcl_vector<vgl_point_3d<double> >& dest_pts);
00042
00043
00044 void set_params(const vnl_vector<double>& W1,
00045 const vnl_vector<double>& W2,
00046 const vnl_vector<double>& W3);
00047
00048 void set_up_rhs(vnl_vector<double>& Bx,
00049 vnl_vector<double>& By,
00050 vnl_vector<double>& Bz,
00051 const vcl_vector<vgl_point_3d<double> >& dest_pts);
00052
00053
00054 void compute_energy(vnl_vector<double>& W1,
00055 vnl_vector<double>& W2,
00056 vnl_vector<double>& W3,
00057 const vnl_matrix<double>& L);
00058
00059 public:
00060
00061
00062 mbl_thin_plate_spline_weights_3d();
00063
00064
00065 virtual ~mbl_thin_plate_spline_weights_3d();
00066
00067
00068 void build(const vcl_vector<vgl_point_3d<double> >& source_pts,
00069 const vcl_vector<vgl_point_3d<double> >& dest_pts,
00070 bool compute_the_energy=false);
00071
00072
00073
00074
00075 void set_source_pts(const vcl_vector<vgl_point_3d<double> >& source_pts);
00076
00077
00078
00079 void set_pt_wts( const vcl_vector<vgl_point_3d<double> >& pt_wts );
00080
00081
00082 void build(const vcl_vector<vgl_point_3d<double> >& dest_pts);
00083
00084
00085 vgl_point_3d<double> operator()(double x, double y, double z) const;
00086
00087
00088 vgl_point_3d<double> operator()(const vgl_point_3d<double>& p) const
00089 { return operator()(p.x(),p.y(),p.z()); }
00090
00091
00092
00093 double bendingEnergyX() const { return energy_x_; }
00094
00095
00096
00097 double bendingEnergyY() const { return energy_y_; }
00098
00099
00100
00101 double bendingEnergyZ() const { return energy_z_; }
00102
00103
00104 short version_no() const;
00105
00106
00107 void print_summary(vcl_ostream& os) const;
00108
00109
00110 void b_write(vsl_b_ostream& bfs) const;
00111
00112
00113 void b_read(vsl_b_istream& bfs);
00114
00115
00116 bool operator==(const mbl_thin_plate_spline_weights_3d& tps) const;
00117 };
00118
00119
00120 void vsl_b_write(vsl_b_ostream& bfs, const mbl_thin_plate_spline_weights_3d& b);
00121
00122
00123 void vsl_b_read(vsl_b_istream& bfs, mbl_thin_plate_spline_weights_3d& b);
00124
00125
00126 vcl_ostream& operator<<(vcl_ostream& os,const mbl_thin_plate_spline_weights_3d& b);
00127
00128 #endif
00129
00130