Go to the documentation of this file.00001 #ifndef rgrl_feature_set_location_h_
00002 #define rgrl_feature_set_location_h_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 class rsdl_kd_tree;
00015 #include <vbl/vbl_smart_ptr.h>
00016 typedef vbl_smart_ptr<rsdl_kd_tree> rsdl_kd_tree_sptr;
00017 #include <rsdl/rsdl_point.h>
00018
00019 #include <rgrl/rgrl_feature_set.h>
00020 #include <rgrl/rgrl_mask.h>
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 template<unsigned N>
00048 class rgrl_feature_set_location
00049 : public rgrl_feature_set
00050 {
00051 public:
00052
00053
00054 rgrl_feature_set_location( feature_vector const& features,
00055 rgrl_feature_set_label const& label = rgrl_feature_set_label() );
00056
00057 ~rgrl_feature_set_location();
00058
00059 void
00060 features_in_region( feature_vector& results, rgrl_mask_box const& roi ) const;
00061
00062
00063
00064 void
00065 features_within_radius( feature_vector& results, vnl_vector<double> const& center, double radius ) const;
00066
00067
00068 rgrl_feature_sptr
00069 nearest_feature( const vnl_vector<double>& loc ) const;
00070
00071
00072 rgrl_feature_sptr
00073 nearest_feature( rgrl_feature_sptr const& feature ) const;
00074
00075
00076 void
00077 features_within_radius( feature_vector& results, rgrl_feature_sptr const& feature, double distance ) const;
00078
00079
00080 void
00081 k_nearest_features( feature_vector& results, const vnl_vector<double>& feature_loc, unsigned int k ) const;
00082
00083
00084 void
00085 k_nearest_features( feature_vector& results, rgrl_feature_sptr const& feature, unsigned int k ) const;
00086
00087
00088 rgrl_mask_box
00089 bounding_box() const;
00090
00091
00092 const vcl_type_info&
00093 type() const;
00094
00095
00096 rgrl_type_macro( rgrl_feature_set_location, rgrl_feature_set );
00097
00098 protected:
00099 inline
00100 void clear_temp_storage() const
00101 {
00102
00103
00104
00105 temp_points_.resize(0);
00106 temp_point_indices_.resize(0);
00107 }
00108
00109 private:
00110 const vcl_type_info* feature_type_;
00111
00112 rgrl_mask_box bounding_box_;
00113
00114
00115 rsdl_kd_tree_sptr kd_tree_;
00116
00117
00118 mutable vcl_vector<rsdl_point> temp_points_;
00119 mutable vcl_vector<int> temp_point_indices_;
00120 };
00121
00122
00123 #endif // rgrl_feature_set_location_h_