Construct thin plate spline to map 3D to 3D. More...
#include <mbl_thin_plate_spline_weights_3d.h>
Public Member Functions | |
mbl_thin_plate_spline_weights_3d () | |
Dflt ctor. | |
virtual | ~mbl_thin_plate_spline_weights_3d () |
Destructor. | |
void | build (const vcl_vector< vgl_point_3d< double > > &source_pts, const vcl_vector< vgl_point_3d< double > > &dest_pts, bool compute_the_energy=false) |
Sets up internal transformation to map source_pts onto dest_pts. | |
void | set_source_pts (const vcl_vector< vgl_point_3d< double > > &source_pts) |
Define source point positions. | |
void | set_pt_wts (const vcl_vector< vgl_point_3d< double > > &pt_wts) |
Define source point weights. | |
void | build (const vcl_vector< vgl_point_3d< double > > &dest_pts) |
Sets up internal transformation to map source_pts onto dest_pts. | |
vgl_point_3d< double > | operator() (double x, double y, double z) const |
Return transformed version of (x,y,z). | |
vgl_point_3d< double > | operator() (const vgl_point_3d< double > &p) const |
Return transformed version of (x,y,z). | |
double | bendingEnergyX () const |
Bending energy of X component (zero for pure affine). | |
double | bendingEnergyY () const |
Bending energy of Y component (zero for pure affine). | |
double | bendingEnergyZ () const |
Bending energy of Z component (zero for pure affine). | |
short | version_no () const |
Version number for I/O. | |
void | print_summary (vcl_ostream &os) const |
Print class to os. | |
void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
bool | operator== (const mbl_thin_plate_spline_weights_3d &tps) const |
Comparison operator. | |
Private Member Functions | |
void | build_pure_affine (const vcl_vector< vgl_point_3d< double > > &source_pts, const vcl_vector< vgl_point_3d< double > > &dest_pts) |
Build from small number of points. | |
void | set_params (const vnl_vector< double > &W1, const vnl_vector< double > &W2, const vnl_vector< double > &W3) |
Set parameters from vectors. | |
void | set_up_rhs (vnl_vector< double > &Bx, vnl_vector< double > &By, vnl_vector< double > &Bz, const vcl_vector< vgl_point_3d< double > > &dest_pts) |
void | compute_energy (vnl_vector< double > &W1, vnl_vector< double > &W2, vnl_vector< double > &W3, const vnl_matrix< double > &L) |
Compute spline-bending energy. | |
Private Attributes | |
vnl_vector< double > | Wx_ |
vnl_vector< double > | Wy_ |
vnl_vector< double > | Wz_ |
double | Ax0_ |
double | AxX_ |
double | AxY_ |
double | AxZ_ |
double | Ay0_ |
double | AyX_ |
double | AyY_ |
double | AyZ_ |
double | Az0_ |
double | AzX_ |
double | AzY_ |
double | AzZ_ |
double | energy_x_ |
double | energy_y_ |
double | energy_z_ |
vcl_vector< vgl_point_3d < double > > | src_pts_ |
vcl_vector< vgl_point_3d < double > > | pt_wts_ |
vnl_matrix< double > | L_inv_ |
Used to estimate weights in set_source_points(). |
Construct thin plate spline to map 3D to 3D.
I.e. does some mapping (x',y',z') = f(x,y,z). (See Booksteins work, e.g. IPMI 1993) The warp is `guided' by a set of landmarks p(0) .. p(n-1) in the source plane which are to be mapped to a (possibly deformed) set q(0)..q(n-1) in the destination. Thus the mapping is constrained so that f(p(i)) = q(i) for i = 0..n-1. The points are given to the build() function to set up the object.
If one wishes to map a set of source points to multiple target points, use set_source_pts(src_pts); then build(target_pts); for each target set.
Definition at line 27 of file mbl_thin_plate_spline_weights_3d.h.
mbl_thin_plate_spline_weights_3d::mbl_thin_plate_spline_weights_3d | ( | ) |
Dflt ctor.
Definition at line 27 of file mbl_thin_plate_spline_weights_3d.cxx.
mbl_thin_plate_spline_weights_3d::~mbl_thin_plate_spline_weights_3d | ( | ) | [virtual] |
Destructor.
Definition at line 41 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::b_read | ( | vsl_b_istream & | bfs | ) |
Load class from binary file stream.
Definition at line 503 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::b_write | ( | vsl_b_ostream & | bfs | ) | const |
Save class to binary file stream.
Definition at line 481 of file mbl_thin_plate_spline_weights_3d.cxx.
double mbl_thin_plate_spline_weights_3d::bendingEnergyX | ( | ) | const [inline] |
Bending energy of X component (zero for pure affine).
A measure of total amount of non-linear deformation
Definition at line 94 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::bendingEnergyY | ( | ) | const [inline] |
Bending energy of Y component (zero for pure affine).
A measure of total amount of non-linear deformation
Definition at line 98 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::bendingEnergyZ | ( | ) | const [inline] |
Bending energy of Z component (zero for pure affine).
A measure of total amount of non-linear deformation
Definition at line 102 of file mbl_thin_plate_spline_weights_3d.h.
void mbl_thin_plate_spline_weights_3d::build | ( | const vcl_vector< vgl_point_3d< double > > & | source_pts, |
const vcl_vector< vgl_point_3d< double > > & | dest_pts, | ||
bool | compute_the_energy = false |
||
) |
Sets up internal transformation to map source_pts onto dest_pts.
Definition at line 292 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::build | ( | const vcl_vector< vgl_point_3d< double > > & | dest_pts | ) |
Sets up internal transformation to map source_pts onto dest_pts.
Definition at line 373 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::build_pure_affine | ( | const vcl_vector< vgl_point_3d< double > > & | source_pts, |
const vcl_vector< vgl_point_3d< double > > & | dest_pts | ||
) | [private] |
Build from small number of points.
Definition at line 144 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::compute_energy | ( | vnl_vector< double > & | W1, |
vnl_vector< double > & | W2, | ||
vnl_vector< double > & | W3, | ||
const vnl_matrix< double > & | L | ||
) | [private] |
Compute spline-bending energy.
Definition at line 233 of file mbl_thin_plate_spline_weights_3d.cxx.
vgl_point_3d< double > mbl_thin_plate_spline_weights_3d::operator() | ( | double | x, |
double | y, | ||
double | z | ||
) | const |
Return transformed version of (x,y,z).
Definition at line 405 of file mbl_thin_plate_spline_weights_3d.cxx.
vgl_point_3d<double> mbl_thin_plate_spline_weights_3d::operator() | ( | const vgl_point_3d< double > & | p | ) | const [inline] |
Return transformed version of (x,y,z).
Definition at line 89 of file mbl_thin_plate_spline_weights_3d.h.
bool mbl_thin_plate_spline_weights_3d::operator== | ( | const mbl_thin_plate_spline_weights_3d & | tps | ) | const |
Comparison operator.
Definition at line 534 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::print_summary | ( | vcl_ostream & | os | ) | const |
Print class to os.
Definition at line 459 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::set_params | ( | const vnl_vector< double > & | W1, |
const vnl_vector< double > & | W2, | ||
const vnl_vector< double > & | W3 | ||
) | [private] |
Set parameters from vectors.
Definition at line 193 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::set_pt_wts | ( | const vcl_vector< vgl_point_3d< double > > & | pt_wts | ) |
Define source point weights.
Sets x, y, z weights for each of the source points
Definition at line 367 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::set_source_pts | ( | const vcl_vector< vgl_point_3d< double > > & | source_pts | ) |
Define source point positions.
Performs pre-computations so that build(dest_points) can be called multiple times efficiently
Definition at line 342 of file mbl_thin_plate_spline_weights_3d.cxx.
void mbl_thin_plate_spline_weights_3d::set_up_rhs | ( | vnl_vector< double > & | Bx, |
vnl_vector< double > & | By, | ||
vnl_vector< double > & | Bz, | ||
const vcl_vector< vgl_point_3d< double > > & | dest_pts | ||
) | [private] |
Definition at line 263 of file mbl_thin_plate_spline_weights_3d.cxx.
short mbl_thin_plate_spline_weights_3d::version_no | ( | ) | const |
Version number for I/O.
Definition at line 448 of file mbl_thin_plate_spline_weights_3d.cxx.
double mbl_thin_plate_spline_weights_3d::Ax0_ [private] |
Definition at line 30 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AxX_ [private] |
Definition at line 30 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AxY_ [private] |
Definition at line 30 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AxZ_ [private] |
Definition at line 30 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::Ay0_ [private] |
Definition at line 31 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AyX_ [private] |
Definition at line 31 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AyY_ [private] |
Definition at line 31 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AyZ_ [private] |
Definition at line 31 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::Az0_ [private] |
Definition at line 32 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AzX_ [private] |
Definition at line 32 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AzY_ [private] |
Definition at line 32 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::AzZ_ [private] |
Definition at line 32 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::energy_x_ [private] |
Definition at line 33 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::energy_y_ [private] |
Definition at line 33 of file mbl_thin_plate_spline_weights_3d.h.
double mbl_thin_plate_spline_weights_3d::energy_z_ [private] |
Definition at line 33 of file mbl_thin_plate_spline_weights_3d.h.
vnl_matrix<double> mbl_thin_plate_spline_weights_3d::L_inv_ [private] |
Used to estimate weights in set_source_points().
Definition at line 38 of file mbl_thin_plate_spline_weights_3d.h.
vcl_vector<vgl_point_3d<double> > mbl_thin_plate_spline_weights_3d::pt_wts_ [private] |
Definition at line 35 of file mbl_thin_plate_spline_weights_3d.h.
vcl_vector<vgl_point_3d<double> > mbl_thin_plate_spline_weights_3d::src_pts_ [private] |
Definition at line 35 of file mbl_thin_plate_spline_weights_3d.h.
vnl_vector<double> mbl_thin_plate_spline_weights_3d::Wx_ [private] |
Definition at line 29 of file mbl_thin_plate_spline_weights_3d.h.
vnl_vector<double> mbl_thin_plate_spline_weights_3d::Wy_ [private] |
Definition at line 29 of file mbl_thin_plate_spline_weights_3d.h.
vnl_vector<double> mbl_thin_plate_spline_weights_3d::Wz_ [private] |
Definition at line 29 of file mbl_thin_plate_spline_weights_3d.h.