Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
rgrl_initializer_ran_sam Class Reference

Generate the initial estimate using random sampling. More...

#include <rgrl_initializer_ran_sam.h>

Inheritance diagram for rgrl_initializer_ran_sam:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 rgrl_initializer_ran_sam ()
 Constructor using a non-deterministic random-sampling seed.
 rgrl_initializer_ran_sam (int seed)
 Constructor using a given random-sampling seed.
virtual ~rgrl_initializer_ran_sam ()
void set_gen_all_samples ()
 Indicate that all possible minimal subset samples should be tried.
void set_sampling_params (double max_outlier_frac=0.5, double desired_prob_good=0.99, unsigned int max_populations_expected=1, unsigned int min_samples=0)
 Set the parameters for random sampling.
void set_data (rgrl_match_set_sptr init_match_set, rgrl_scale_estimator_unwgted_sptr scale_est, rgrl_view_sptr prior_view, bool should_estimate_global_region=true)
 Initialize the data with a view, which contains the regions and the transformation estimator.
void set_data (rgrl_match_set_sptr init_match_set, rgrl_scale_estimator_unwgted_sptr scale_est, rgrl_mask_sptr const &from_image_roi, rgrl_mask_sptr const &to_image_roi, rgrl_mask_box const &initial_from_image_roi, rgrl_estimator_sptr xform_estimator, unsigned initial_resolution=0, bool should_estimate_global_region=true)
 Initialize with a set of information without packing everything into a vie.
void set_data (rgrl_match_set_sptr init_match_set, rgrl_scale_estimator_unwgted_sptr scale_est, rgrl_mask_sptr const &from_image_roi, rgrl_mask_sptr const &to_image_roi, rgrl_estimator_sptr xform_estimator, unsigned initial_resolution=0)
 Initialize with a set of information, assuming that registration applies to from_image_roi always.
void set_data (rgrl_match_set_sptr init_match_set, rgrl_scale_estimator_unwgted_sptr scale_est, rgrl_mask_sptr const &from_image_roi, rgrl_estimator_sptr xform_estimator, unsigned initial_resolution=0)
 Initialize with a set of information, assuming that registration applies to from_image_roi always;.
bool next_initial (rgrl_view_sptr &view, rgrl_scale_sptr &prior_scale)
 Get next initial estimate when first called, but return false thereafter.
rgrl_scale_sptr scale () const
 Get the scale estimate.
rgrl_transformation_sptr transformation () const
 Get the parameter estimate.
int samples_tested () const
 Get the number of samples tested in during estimation.
 rgrl_type_macro (rgrl_initializer_ran_sam, rgrl_initializer)
bool next_initial (rgrl_mask_sptr &from_image_roi, rgrl_mask_sptr &to_image_roi, rgrl_mask_box &current_region, rgrl_mask_box &global_region, rgrl_estimator_sptr &xform_estimator, rgrl_transformation_sptr &xform_estimate, unsigned &current_resolution, rgrl_scale_sptr &prior_scale)
 Get next set of initial information without the notion of a view.
bool next_initial (rgrl_mask_box &current_region, rgrl_estimator_sptr &xform_estimator, rgrl_transformation_sptr &xform_estimate, unsigned &current_resolution, rgrl_scale_sptr &prior_scale)
 Get next set of initial information, assuming current_region is the region of interest for registration.
bool next_initial (rgrl_mask_box &current_region, rgrl_estimator_sptr &xform_estimator, rgrl_transformation_sptr &xform_estimate, rgrl_scale_sptr &prior_scale)
 Get next set of initial information, assuming current_region is the region of interest for registration, and single-resol.
void set_prior_geometric_scale (double scale)
 force the setting of prior scale.
 rgrl_type_macro (rgrl_initializer, rgrl_object)
virtual bool is_type (const vcl_type_info &type) const
void set_debug_flag (unsigned int debugFlag) const
 Set the value of the debug flag. A non-zero value turns debugging on.
unsigned int debug_flag () const
 Get the value of the debug flag.
void set_warning (bool) const
 Set the flag for warning messages.
bool warning () const
 Get the warning flag.
unsigned int add_observer (rgrl_event_sptr event, rgrl_command_sptr)
 Allow people to add/remove/invoke observers (callbacks) to any rgrl object.
rgrl_command_sptr get_command (unsigned int tag)
 Get the command associated with the given tag.
void invoke_event (const rgrl_event &)
 Call execute(.) on all the rgrl_commands observing this event id.
void invoke_event (const rgrl_event &) const
 Call execute(.) on all the rgrl_commands observing this event id.
void remove_observer (unsigned int tag)
 Remove the observer with this tag value.
bool has_observer (const rgrl_event &event) const
 Return true if an observer is registered for this event.
void ref ()
void unref ()
int get_references () const
bool is_referenced () const

Static Public Member Functions

static const vcl_type_info & type_id ()

Protected Member Functions

rgrl_scale_sptr enforce_prior_scale (rgrl_scale_sptr match_scale)
 Generate a prior scale depending on current settings.

Protected Attributes

rgrl_match_set_sptr match_set_
rgrl_estimator_sptr transform_estiamtor_
rgrl_scale_estimator_unwgted_sptr scale_estimator_
rgrl_view_sptr init_view_
bool called_before_
bool data_set_
rgrl_scale_sptr prior_scale_
bool use_prior_scale_from_match_

Private Member Functions

bool estimate ()
 Estimate the best transform.
void calc_num_samples (unsigned int num_matches)
 Calculate number of samples --- non-unique matching estimation problems.
void next_sample (unsigned int taken, unsigned int num_points, vcl_vector< int > &sample, unsigned int points_per_sample)
 Determine the next random sample, filling in the "sample" vector.
rgrl_match_set_sptr get_matches (const vcl_vector< int > &point_indices, unsigned int total_num_matches)
 Extract the matches indexed by the point_indices.
void trace_sample (const vcl_vector< int > &point_indices) const
 For debugging.
virtual int size () const
 return number of initializations.

Private Attributes

double max_outlier_frac_
double desired_prob_good_
unsigned int max_populations_expected_
unsigned int min_samples_
bool generate_all_
bool should_estimate_global_region_
vnl_randomgenerator_
 Random number generator.
bool own_generator_
rgrl_transformation_sptr xform_
rgrl_scale_sptr scale_
unsigned int samples_to_take_

Detailed Description

Generate the initial estimate using random sampling.

This is the re-implementation of rrel_ran_sam_search. Modifications include using unweighted scale estimator to perform selection of the best transformation.

Definition at line 25 of file rgrl_initializer_ran_sam.h.


Constructor & Destructor Documentation

rgrl_initializer_ran_sam::rgrl_initializer_ran_sam ( )

Constructor using a non-deterministic random-sampling seed.

Definition at line 32 of file rgrl_initializer_ran_sam.cxx.

rgrl_initializer_ran_sam::rgrl_initializer_ran_sam ( int  seed)

Constructor using a given random-sampling seed.

Definition at line 43 of file rgrl_initializer_ran_sam.cxx.

rgrl_initializer_ran_sam::~rgrl_initializer_ran_sam ( ) [virtual]

Definition at line 54 of file rgrl_initializer_ran_sam.cxx.


Member Function Documentation

unsigned int rgrl_object::add_observer ( rgrl_event_sptr  event,
rgrl_command_sptr  cmd 
) [inherited]

Allow people to add/remove/invoke observers (callbacks) to any rgrl object.

This is an implementation of the subject/observer design pattern. An observer is added by specifying an event to respond to and an rgrl_command to execute. It returns an unsigned long tag which can be used later to remove the event or retrieve the command.

Definition at line 47 of file rgrl_object.cxx.

void rgrl_initializer_ran_sam::calc_num_samples ( unsigned int  num_matches) [private]

Calculate number of samples --- non-unique matching estimation problems.

Definition at line 260 of file rgrl_initializer_ran_sam.cxx.

unsigned int rgrl_object::debug_flag ( ) const [inherited]

Get the value of the debug flag.

Definition at line 26 of file rgrl_object.cxx.

rgrl_scale_sptr rgrl_initializer::enforce_prior_scale ( rgrl_scale_sptr  match_scale) [protected, inherited]

Generate a prior scale depending on current settings.

Definition at line 101 of file rgrl_initializer.cxx.

bool rgrl_initializer_ran_sam::estimate ( ) [private]

Estimate the best transform.

Definition at line 187 of file rgrl_initializer_ran_sam.cxx.

rgrl_command_sptr rgrl_object::get_command ( unsigned int  tag) [inherited]

Get the command associated with the given tag.

Definition at line 57 of file rgrl_object.cxx.

rgrl_match_set_sptr rgrl_initializer_ran_sam::get_matches ( const vcl_vector< int > &  point_indices,
unsigned int  total_num_matches 
) [private]

Extract the matches indexed by the point_indices.

Definition at line 358 of file rgrl_initializer_ran_sam.cxx.

bool rgrl_object::has_observer ( const rgrl_event event) const [inherited]

Return true if an observer is registered for this event.

Definition at line 107 of file rgrl_object.cxx.

void rgrl_object::invoke_event ( const rgrl_event event) [inherited]

Call execute(.) on all the rgrl_commands observing this event id.

Definition at line 69 of file rgrl_object.cxx.

void rgrl_object::invoke_event ( const rgrl_event event) const [inherited]

Call execute(.) on all the rgrl_commands observing this event id.

The actions triggered by this call doesn't modify this object.

Definition at line 83 of file rgrl_object.cxx.

virtual bool rgrl_object::is_type ( const vcl_type_info &  type) const [inline, virtual, inherited]

Reimplemented in rgrl_scale_estimator.

Definition at line 66 of file rgrl_object.h.

bool rgrl_initializer::next_initial ( rgrl_mask_sptr from_image_roi,
rgrl_mask_sptr to_image_roi,
rgrl_mask_box current_region,
rgrl_mask_box global_region,
rgrl_estimator_sptr xform_estimator,
rgrl_transformation_sptr xform_estimate,
unsigned &  current_resolution,
rgrl_scale_sptr prior_scale 
) [inherited]

Get next set of initial information without the notion of a view.

Definition at line 17 of file rgrl_initializer.cxx.

bool rgrl_initializer::next_initial ( rgrl_mask_box current_region,
rgrl_estimator_sptr xform_estimator,
rgrl_transformation_sptr xform_estimate,
unsigned &  current_resolution,
rgrl_scale_sptr prior_scale 
) [inherited]

Get next set of initial information, assuming current_region is the region of interest for registration.

Definition at line 43 of file rgrl_initializer.cxx.

bool rgrl_initializer::next_initial ( rgrl_mask_box current_region,
rgrl_estimator_sptr xform_estimator,
rgrl_transformation_sptr xform_estimate,
rgrl_scale_sptr prior_scale 
) [inherited]

Get next set of initial information, assuming current_region is the region of interest for registration, and single-resol.

Definition at line 63 of file rgrl_initializer.cxx.

bool rgrl_initializer_ran_sam::next_initial ( rgrl_view_sptr view,
rgrl_scale_sptr prior_scale 
) [virtual]

Get next initial estimate when first called, but return false thereafter.

Implements rgrl_initializer.

Definition at line 152 of file rgrl_initializer_ran_sam.cxx.

void rgrl_initializer_ran_sam::next_sample ( unsigned int  taken,
unsigned int  num_points,
vcl_vector< int > &  sample,
unsigned int  points_per_sample 
) [private]

Determine the next random sample, filling in the "sample" vector.

Definition at line 298 of file rgrl_initializer_ran_sam.cxx.

void rgrl_object::remove_observer ( unsigned int  tag) [inherited]

Remove the observer with this tag value.

Definition at line 97 of file rgrl_object.cxx.

rgrl_initializer::rgrl_type_macro ( rgrl_initializer  ,
rgrl_object   
) [inherited]
rgrl_initializer_ran_sam::rgrl_type_macro ( rgrl_initializer_ran_sam  ,
rgrl_initializer   
)
int rgrl_initializer_ran_sam::samples_tested ( ) const [inline]

Get the number of samples tested in during estimation.

Definition at line 100 of file rgrl_initializer_ran_sam.h.

rgrl_scale_sptr rgrl_initializer_ran_sam::scale ( ) const [inline]

Get the scale estimate.

Definition at line 94 of file rgrl_initializer_ran_sam.h.

void rgrl_initializer_ran_sam::set_data ( rgrl_match_set_sptr  init_match_set,
rgrl_scale_estimator_unwgted_sptr  scale_est,
rgrl_view_sptr  prior_view,
bool  should_estimate_global_region = true 
)

Initialize the data with a view, which contains the regions and the transformation estimator.

If should_estimate_global_region is true, the from_image_roi will be re-estimated/updated based on the transform estimate computed by the random sampling process.

Definition at line 84 of file rgrl_initializer_ran_sam.cxx.

void rgrl_initializer_ran_sam::set_data ( rgrl_match_set_sptr  init_match_set,
rgrl_scale_estimator_unwgted_sptr  scale_est,
rgrl_mask_sptr const &  from_image_roi,
rgrl_mask_sptr const &  to_image_roi,
rgrl_mask_box const &  initial_from_image_roi,
rgrl_estimator_sptr  xform_estimator,
unsigned  initial_resolution = 0,
bool  should_estimate_global_region = true 
)

Initialize with a set of information without packing everything into a vie.

Definition at line 100 of file rgrl_initializer_ran_sam.cxx.

void rgrl_initializer_ran_sam::set_data ( rgrl_match_set_sptr  init_match_set,
rgrl_scale_estimator_unwgted_sptr  scale_est,
rgrl_mask_sptr const &  from_image_roi,
rgrl_mask_sptr const &  to_image_roi,
rgrl_estimator_sptr  xform_estimator,
unsigned  initial_resolution = 0 
)

Initialize with a set of information, assuming that registration applies to from_image_roi always.

Definition at line 119 of file rgrl_initializer_ran_sam.cxx.

void rgrl_initializer_ran_sam::set_data ( rgrl_match_set_sptr  init_match_set,
rgrl_scale_estimator_unwgted_sptr  scale_est,
rgrl_mask_sptr const &  from_image_roi,
rgrl_estimator_sptr  xform_estimator,
unsigned  initial_resolution = 0 
)

Initialize with a set of information, assuming that registration applies to from_image_roi always;.

And from_image_roi and to_image_roi are the same

Definition at line 136 of file rgrl_initializer_ran_sam.cxx.

void rgrl_object::set_debug_flag ( unsigned int  debugFlag) const [inherited]

Set the value of the debug flag. A non-zero value turns debugging on.

Definition at line 19 of file rgrl_object.cxx.

void rgrl_initializer_ran_sam::set_gen_all_samples ( )

Indicate that all possible minimal subset samples should be tried.

Definition at line 62 of file rgrl_initializer_ran_sam.cxx.

void rgrl_initializer::set_prior_geometric_scale ( double  scale) [inherited]

force the setting of prior scale.

scale > 0 set to this scale value scale == 0 scale pointer is NULL, which indicates to use unwgted scale estimate scale < 0 use whatever scale set by the match

Definition at line 85 of file rgrl_initializer.cxx.

void rgrl_initializer_ran_sam::set_sampling_params ( double  max_outlier_frac = 0.5,
double  desired_prob_good = 0.99,
unsigned int  max_populations_expected = 1,
unsigned int  min_samples = 0 
)

Set the parameters for random sampling.

Definition at line 69 of file rgrl_initializer_ran_sam.cxx.

void rgrl_object::set_warning ( bool  flag) const [inherited]

Set the flag for warning messages.

Definition at line 33 of file rgrl_object.cxx.

virtual int rgrl_initializer_ran_sam::size ( ) const [inline, private, virtual]

return number of initializations.

-1 stands for unknown

Implements rgrl_initializer.

Definition at line 126 of file rgrl_initializer_ran_sam.h.

void rgrl_initializer_ran_sam::trace_sample ( const vcl_vector< int > &  point_indices) const [private]

For debugging.

Definition at line 393 of file rgrl_initializer_ran_sam.cxx.

rgrl_transformation_sptr rgrl_initializer_ran_sam::transformation ( ) const [inline]

Get the parameter estimate.

Definition at line 97 of file rgrl_initializer_ran_sam.h.

static const vcl_type_info& rgrl_object::type_id ( ) [inline, static, inherited]

Reimplemented in rgrl_scale_estimator.

Definition at line 63 of file rgrl_object.h.

bool rgrl_object::warning ( ) const [inherited]

Get the warning flag.

Definition at line 40 of file rgrl_object.cxx.


Member Data Documentation

Definition at line 134 of file rgrl_initializer_ran_sam.h.

Definition at line 135 of file rgrl_initializer_ran_sam.h.

Definition at line 142 of file rgrl_initializer_ran_sam.h.

Definition at line 145 of file rgrl_initializer_ran_sam.h.

Random number generator.

Normally, this will point to the "global" generator, but a could point to a local one if the user wants to specify a seed.

Definition at line 151 of file rgrl_initializer_ran_sam.h.

Definition at line 133 of file rgrl_initializer_ran_sam.h.

Definition at line 130 of file rgrl_initializer_ran_sam.h.

Definition at line 141 of file rgrl_initializer_ran_sam.h.

Definition at line 143 of file rgrl_initializer_ran_sam.h.

Definition at line 144 of file rgrl_initializer_ran_sam.h.

Definition at line 152 of file rgrl_initializer_ran_sam.h.

Reimplemented in rgrl_initializer_prior, and rgrl_initializer_reader.

Definition at line 86 of file rgrl_initializer.h.

Definition at line 161 of file rgrl_initializer_ran_sam.h.

Definition at line 157 of file rgrl_initializer_ran_sam.h.

Definition at line 132 of file rgrl_initializer_ran_sam.h.

Definition at line 146 of file rgrl_initializer_ran_sam.h.

Definition at line 131 of file rgrl_initializer_ran_sam.h.

bool rgrl_initializer::use_prior_scale_from_match_ [protected, inherited]

Definition at line 87 of file rgrl_initializer.h.

Definition at line 156 of file rgrl_initializer_ran_sam.h.


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