mbl_thin_plate_spline_2d Class Reference

#include <mbl_thin_plate_spline_2d.h>

List of all members.


Detailed Description

Construct thin plate spline to map 2D to 2D.

I.e. does some mapping (x',y') = f(x,y). (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.

   vcl_vector<vgl_point_2d<double> > src_pts(n_points),dest_pts(n_points);
  
   Fill src_pts and dest_pts
   .....
  
   Construct spline object
   mbl_thin_plate_spline_2d tps;
   tps.build(src_pts,dest_pts);
  
   // Apply to point p:
   vgl_point_3d<double> p(1,2);
  
   vgl_point_2d<double> new_p = tps(p);
   

Definition at line 42 of file mbl_thin_plate_spline_2d.h.


Public Member Functions

 mbl_thin_plate_spline_2d ()
 Dflt ctor.
virtual ~mbl_thin_plate_spline_2d ()
 Destructor.
void build (const vcl_vector< vgl_point_2d< double > > &source_pts, const vcl_vector< vgl_point_2d< 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_2d< double > > &source_pts)
 Define source point positions.
void build (const vcl_vector< vgl_point_2d< double > > &dest_pts)
 Sets up internal transformation to map source_pts onto dest_pts.
vgl_point_2d< double > operator() (double x, double y) const
 Return transformed version of (x,y).
vgl_point_2d< double > operator() (const vgl_point_2d< double > &p) const
 Return transformed version of (x,y).
double bendingEnergyX () const
 Bending energy of X component (zero for pure affine).
double bendingEnergyY () const
 Bending energy of X component (zero for pure affine).
void set_pure_affine (bool val)
 If this parameter is set to true, then only global affine part of the currently computed transformation is used.
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_2d &tps) const
 Comparison operator.

Private Member Functions

void build_pure_affine (const vcl_vector< vgl_point_2d< double > > &source_pts, const vcl_vector< vgl_point_2d< double > > &dest_pts)
 Build from small number of points.
void set_params (const vnl_vector< double > &W1, const vnl_vector< double > &W2)
 Set parameters from vectors.
void set_up_rhs (vnl_vector< double > &Bx, vnl_vector< double > &By, const vcl_vector< vgl_point_2d< double > > &dest_pts)
void compute_energy (vnl_vector< double > &W1, vnl_vector< double > &W2, const vnl_matrix< double > &L)
 Compute spline-bending energy.

Private Attributes

vnl_vector< double > Wx_
vnl_vector< double > Wy_
double Ax0_
double AxX_
double AxY_
double Ay0_
double AyX_
double AyY_
double energy_x_
double energy_y_
bool return_pure_affine_
vcl_vector< vgl_point_2d
< double > > 
src_pts_
vnl_matrix< double > L_inv_
 Used to estimate weights in set_source_points().

Constructor & Destructor Documentation

mbl_thin_plate_spline_2d::mbl_thin_plate_spline_2d (  ) 

Dflt ctor.

Definition at line 27 of file mbl_thin_plate_spline_2d.cxx.

mbl_thin_plate_spline_2d::~mbl_thin_plate_spline_2d (  )  [virtual]

Destructor.

Definition at line 38 of file mbl_thin_plate_spline_2d.cxx.


Member Function Documentation

void mbl_thin_plate_spline_2d::build_pure_affine ( const vcl_vector< vgl_point_2d< double > > &  source_pts,
const vcl_vector< vgl_point_2d< double > > &  dest_pts 
) [private]

Build from small number of points.

Definition at line 127 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::set_params ( const vnl_vector< double > &  W1,
const vnl_vector< double > &  W2 
) [private]

Set parameters from vectors.

Definition at line 262 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::set_up_rhs ( vnl_vector< double > &  Bx,
vnl_vector< double > &  By,
const vcl_vector< vgl_point_2d< double > > &  dest_pts 
) [private]

Definition at line 315 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::compute_energy ( vnl_vector< double > &  W1,
vnl_vector< double > &  W2,
const vnl_matrix< double > &  L 
) [private]

Compute spline-bending energy.

Definition at line 290 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::build ( const vcl_vector< vgl_point_2d< double > > &  source_pts,
const vcl_vector< vgl_point_2d< double > > &  dest_pts,
bool  compute_the_energy = false 
)

Sets up internal transformation to map source_pts onto dest_pts.

Definition at line 339 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::set_source_pts ( const vcl_vector< vgl_point_2d< double > > &  source_pts  ) 

Define source point positions.

Performs pre-computations so that build(dest_points) can be called multiple times efficiently

Definition at line 387 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::build ( const vcl_vector< vgl_point_2d< double > > &  dest_pts  ) 

Sets up internal transformation to map source_pts onto dest_pts.

Definition at line 411 of file mbl_thin_plate_spline_2d.cxx.

vgl_point_2d< double > mbl_thin_plate_spline_2d::operator() ( double  x,
double  y 
) const

Return transformed version of (x,y).

Definition at line 440 of file mbl_thin_plate_spline_2d.cxx.

vgl_point_2d<double> mbl_thin_plate_spline_2d::operator() ( const vgl_point_2d< double > &  p  )  const [inline]

Return transformed version of (x,y).

Definition at line 98 of file mbl_thin_plate_spline_2d.h.

double mbl_thin_plate_spline_2d::bendingEnergyX (  )  const [inline]

Bending energy of X component (zero for pure affine).

A measure of total amount of non-linear deformation

Definition at line 103 of file mbl_thin_plate_spline_2d.h.

double mbl_thin_plate_spline_2d::bendingEnergyY (  )  const [inline]

Bending energy of X component (zero for pure affine).

A measure of total amount of non-linear deformation

Definition at line 107 of file mbl_thin_plate_spline_2d.h.

void mbl_thin_plate_spline_2d::set_pure_affine ( bool  val  )  [inline]

If this parameter is set to true, then only global affine part of the currently computed transformation is used.

Definition at line 112 of file mbl_thin_plate_spline_2d.h.

short mbl_thin_plate_spline_2d::version_no (  )  const

Version number for I/O.

Definition at line 468 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::print_summary ( vcl_ostream &  os  )  const

Print class to os.

Definition at line 479 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::b_write ( vsl_b_ostream bfs  )  const

Save class to binary file stream.

Definition at line 495 of file mbl_thin_plate_spline_2d.cxx.

void mbl_thin_plate_spline_2d::b_read ( vsl_b_istream bfs  ) 

Load class from binary file stream.

Definition at line 511 of file mbl_thin_plate_spline_2d.cxx.

bool mbl_thin_plate_spline_2d::operator== ( const mbl_thin_plate_spline_2d tps  )  const

Comparison operator.

Definition at line 537 of file mbl_thin_plate_spline_2d.cxx.


Member Data Documentation

Definition at line 44 of file mbl_thin_plate_spline_2d.h.

Definition at line 44 of file mbl_thin_plate_spline_2d.h.

Definition at line 45 of file mbl_thin_plate_spline_2d.h.

Definition at line 45 of file mbl_thin_plate_spline_2d.h.

Definition at line 45 of file mbl_thin_plate_spline_2d.h.

Definition at line 46 of file mbl_thin_plate_spline_2d.h.

Definition at line 46 of file mbl_thin_plate_spline_2d.h.

Definition at line 46 of file mbl_thin_plate_spline_2d.h.

Definition at line 47 of file mbl_thin_plate_spline_2d.h.

Definition at line 47 of file mbl_thin_plate_spline_2d.h.

Definition at line 49 of file mbl_thin_plate_spline_2d.h.

vcl_vector<vgl_point_2d<double> > mbl_thin_plate_spline_2d::src_pts_ [private]

Definition at line 51 of file mbl_thin_plate_spline_2d.h.

Used to estimate weights in set_source_points().

Definition at line 54 of file mbl_thin_plate_spline_2d.h.


The documentation for this class was generated from the following files:

Generated on Sun Nov 22 06:23:15 2009 for contrib/mul/mbl by  doxygen 1.5.5