Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
rgrl_feature_set_location< N > Class Template Reference

A set of features grouped only by N-d location. More...

#include <rgrl_feature_set_location.h>

Inheritance diagram for rgrl_feature_set_location< N >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef vcl_vector
< rgrl_feature_sptr
feature_vector

Public Member Functions

 rgrl_feature_set_location (feature_vector const &features, rgrl_feature_set_label const &label=rgrl_feature_set_label())
 Constructor.
 ~rgrl_feature_set_location ()
void features_in_region (feature_vector &results, rgrl_mask_box const &roi) const
 Return the features in a given ROI.
void features_within_radius (feature_vector &results, vnl_vector< double > const &center, double radius) const
 Return the features in a given circle/sphere.
rgrl_feature_sptr nearest_feature (const vnl_vector< double > &loc) const
 Nearest feature based on Euclidean distance.
rgrl_feature_sptr nearest_feature (rgrl_feature_sptr const &feature) const
 Nearest feature based on Euclidean distance.
void features_within_radius (feature_vector &results, rgrl_feature_sptr const &feature, double distance) const
 Return all features within a given Euclidean distance.
void k_nearest_features (feature_vector &results, const vnl_vector< double > &feature_loc, unsigned int k) const
 Return the k nearest features based on Euclidean distance.
void k_nearest_features (feature_vector &results, rgrl_feature_sptr const &feature, unsigned int k) const
 Return the k nearest features based on Euclidean distance.
rgrl_mask_box bounding_box () const
 Return the bounding box encloses the feature set.
const vcl_type_info & type () const
 Return the type of feature.
 rgrl_type_macro (rgrl_feature_set_location, rgrl_feature_set)
void set_label (rgrl_feature_set_label const &label)
 set label.
rgrl_feature_set_label const & label () const
 get label.
virtual feature_vector const & all_features () const
 Return all the features.
 rgrl_type_macro (rgrl_feature_set, 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

void clear_temp_storage () const

Protected Attributes

rgrl_feature_set_label label_
feature_vector fea_vec_

Private Attributes

const vcl_type_info * feature_type_
rgrl_mask_box bounding_box_
rsdl_kd_tree_sptr kd_tree_
vcl_vector< rsdl_point > temp_points_
vcl_vector< int > temp_point_indices_

Detailed Description

template<unsigned N>
class rgrl_feature_set_location< N >

A set of features grouped only by N-d location.

This class is used to store a collection of discrete features for which proximity is determined only by location. There is no concepts of "segments"; each feature is considered independent.

The class is templated over the dimension in order to provide efficient implementation of the queries.

The underlying data structure is either rdsl_bins or rsdl_kd_tree. when using rsdl_bins, the image region is divided into rectangular bins, with the bin_size defaulted to 10 or defined by the user during construction. Feature point locations and associated values are stored in a list associated with the bin the location falls into. When performing region searches, all bins that intersect the query region are examined. When doing nearest-neighbor searches, spiral search is performed, starting at the bin containing the query point. rsdl_bins is the choice if the data is well distributed.

rsdl_kd_tree is multi-dimensional version of binary search tree. It handles data clustering better than rsdl_bins. Example applications include range data registration.

Definition at line 48 of file rgrl_feature_set_location.h.


Member Typedef Documentation

typedef vcl_vector<rgrl_feature_sptr> rgrl_feature_set::feature_vector [inherited]

Definition at line 64 of file rgrl_feature_set.h.


Constructor & Destructor Documentation

template<unsigned N>
rgrl_feature_set_location< N >::rgrl_feature_set_location ( feature_vector const &  features,
rgrl_feature_set_label const &  label = rgrl_feature_set_label() 
)

Constructor.

bin_size is only effective when use_bins is set true.

Definition at line 23 of file rgrl_feature_set_location.txx.

template<unsigned N>
rgrl_feature_set_location< N >::~rgrl_feature_set_location ( )

Definition at line 73 of file rgrl_feature_set_location.txx.


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.

virtual feature_vector const& rgrl_feature_set::all_features ( ) const [inline, virtual, inherited]

Return all the features.

Reimplemented in rgrl_feature_set_location_masked.

Definition at line 83 of file rgrl_feature_set.h.

template<unsigned N>
rgrl_mask_box rgrl_feature_set_location< N >::bounding_box ( ) const [virtual]

Return the bounding box encloses the feature set.

Implements rgrl_feature_set.

Definition at line 195 of file rgrl_feature_set_location.txx.

template<unsigned N>
void rgrl_feature_set_location< N >::clear_temp_storage ( ) const [inline, protected]

Definition at line 100 of file rgrl_feature_set_location.h.

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

Get the value of the debug flag.

Definition at line 26 of file rgrl_object.cxx.

template<unsigned N>
void rgrl_feature_set_location< N >::features_in_region ( feature_vector results,
rgrl_mask_box const &  roi 
) const [virtual]

Return the features in a given ROI.

Implements rgrl_feature_set.

Definition at line 81 of file rgrl_feature_set_location.txx.

template<unsigned N>
void rgrl_feature_set_location< N >::features_within_radius ( feature_vector results,
vnl_vector< double > const &  center,
double  radius 
) const [virtual]

Return the features in a given circle/sphere.

Implements rgrl_feature_set.

Definition at line 104 of file rgrl_feature_set_location.txx.

template<unsigned N>
void rgrl_feature_set_location< N >::features_within_radius ( feature_vector results,
rgrl_feature_sptr const &  feature,
double  distance 
) const [virtual]

Return all features within a given Euclidean distance.

Implements rgrl_feature_set.

Definition at line 145 of file rgrl_feature_set_location.txx.

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.

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.

template<unsigned N>
void rgrl_feature_set_location< N >::k_nearest_features ( feature_vector results,
const vnl_vector< double > &  feature_loc,
unsigned int  k 
) const [virtual]

Return the k nearest features based on Euclidean distance.

Implements rgrl_feature_set.

Definition at line 179 of file rgrl_feature_set_location.txx.

template<unsigned N>
void rgrl_feature_set_location< N >::k_nearest_features ( feature_vector results,
rgrl_feature_sptr const &  feature,
unsigned int  k 
) const [virtual]

Return the k nearest features based on Euclidean distance.

Implements rgrl_feature_set.

Definition at line 162 of file rgrl_feature_set_location.txx.

rgrl_feature_set_label const& rgrl_feature_set::label ( ) const [inline, inherited]

get label.

Definition at line 76 of file rgrl_feature_set.h.

template<unsigned N>
rgrl_feature_sptr rgrl_feature_set_location< N >::nearest_feature ( const vnl_vector< double > &  loc) const [virtual]

Nearest feature based on Euclidean distance.

Implements rgrl_feature_set.

Definition at line 133 of file rgrl_feature_set_location.txx.

template<unsigned N>
rgrl_feature_sptr rgrl_feature_set_location< N >::nearest_feature ( rgrl_feature_sptr const &  feature) const [virtual]

Nearest feature based on Euclidean distance.

Implements rgrl_feature_set.

Definition at line 121 of file rgrl_feature_set_location.txx.

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.

template<unsigned N>
rgrl_feature_set_location< N >::rgrl_type_macro ( rgrl_feature_set_location< N >  ,
rgrl_feature_set   
)
rgrl_feature_set::rgrl_type_macro ( rgrl_feature_set  ,
rgrl_object   
) [inherited]
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_feature_set::set_label ( rgrl_feature_set_label const &  label) [inline, inherited]

set label.

Definition at line 72 of file rgrl_feature_set.h.

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

Set the flag for warning messages.

Definition at line 33 of file rgrl_object.cxx.

template<unsigned N>
const vcl_type_info & rgrl_feature_set_location< N >::type ( ) const [virtual]

Return the type of feature.

Implements rgrl_feature_set.

Definition at line 203 of file rgrl_feature_set_location.txx.

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

template<unsigned N>
rgrl_mask_box rgrl_feature_set_location< N >::bounding_box_ [private]

Definition at line 112 of file rgrl_feature_set_location.h.

Definition at line 150 of file rgrl_feature_set.h.

template<unsigned N>
const vcl_type_info* rgrl_feature_set_location< N >::feature_type_ [private]

Definition at line 110 of file rgrl_feature_set_location.h.

template<unsigned N>
rsdl_kd_tree_sptr rgrl_feature_set_location< N >::kd_tree_ [private]

Definition at line 115 of file rgrl_feature_set_location.h.

Definition at line 149 of file rgrl_feature_set.h.

template<unsigned N>
vcl_vector<int> rgrl_feature_set_location< N >::temp_point_indices_ [mutable, private]

Definition at line 119 of file rgrl_feature_set_location.h.

template<unsigned N>
vcl_vector<rsdl_point> rgrl_feature_set_location< N >::temp_points_ [mutable, private]

Definition at line 118 of file rgrl_feature_set_location.h.


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