Go to the documentation of this file.00001 #include "rgrl_feature_set_location_masked.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <rgrl/rgrl_feature_sptr.h>
00016 #include <rgrl/rgrl_mask.h>
00017
00018
00019 rgrl_mask_box
00020 rgrl_feature_set_location_masked::
00021 bounding_box() const
00022 { return fea_set_sptr_->bounding_box(); }
00023
00024 void
00025 rgrl_feature_set_location_masked::
00026 features_in_region( feature_vector& final_results, rgrl_mask_box const& roi ) const
00027 {
00028 feature_vector results;
00029 fea_set_sptr_->features_in_region( results, roi );
00030
00031 typedef feature_vector::iterator fvec_itr;
00032 for ( fvec_itr fitr = results.begin(); fitr != results.end(); ++fitr )
00033 if ( mask_->inside( (*fitr)->location() ) )
00034 final_results.push_back( *fitr );
00035 }
00036
00037
00038
00039 void
00040 rgrl_feature_set_location_masked::
00041 features_within_radius( feature_vector& final_results, vnl_vector<double> const& center, double radius ) const
00042 {
00043 feature_vector results;
00044 fea_set_sptr_->features_within_radius( results, center, radius );
00045
00046 typedef feature_vector::iterator fvec_itr;
00047 for ( fvec_itr fitr = results.begin(); fitr != results.end(); ++fitr )
00048 if ( mask_->inside( (*fitr)->location() ) )
00049 final_results.push_back( *fitr );
00050 }
00051
00052
00053
00054 rgrl_feature_sptr
00055 rgrl_feature_set_location_masked::
00056 nearest_feature( rgrl_feature_sptr const& feature ) const
00057 {
00058 return mask_->inside(feature->location()) ?
00059 fea_set_sptr_->nearest_feature( feature ) :
00060 (rgrl_feature_sptr)0;
00061 }
00062
00063
00064
00065 rgrl_feature_sptr
00066 rgrl_feature_set_location_masked::
00067 nearest_feature( const vnl_vector<double>& loc ) const
00068 {
00069 return mask_->inside(loc) ?
00070 fea_set_sptr_->nearest_feature( loc ) :
00071 (rgrl_feature_sptr)0;
00072 }
00073
00074
00075
00076 void
00077 rgrl_feature_set_location_masked::
00078 features_within_radius( feature_vector& results, rgrl_feature_sptr const& feature, double distance ) const
00079 {
00080 if ( mask_->inside(feature->location()) )
00081 fea_set_sptr_->features_within_radius(results, feature , distance);
00082 }
00083
00084
00085 void
00086 rgrl_feature_set_location_masked::
00087 k_nearest_features( feature_vector& results, const vnl_vector<double>& loc, unsigned int k ) const
00088 {
00089 if ( mask_->inside(loc) )
00090 fea_set_sptr_->k_nearest_features(results, loc, k);
00091 }
00092
00093
00094 void
00095 rgrl_feature_set_location_masked::
00096 k_nearest_features( feature_vector& results, rgrl_feature_sptr const& feature, unsigned int k ) const
00097 {
00098 if ( mask_->inside(feature->location()) )
00099 fea_set_sptr_->k_nearest_features(results, feature, k);
00100 }