Go to the documentation of this file.00001 #ifndef mfpf_region_finder_h_
00002 #define mfpf_region_finder_h_
00003 
00004 
00005 
00006 
00007 
00008 #include <mfpf/mfpf_point_finder.h>
00009 #include <mfpf/mfpf_vec_cost.h>
00010 #include <mbl/mbl_cloneable_ptr.h>
00011 #include <mbl/mbl_chord.h>
00012 #include <vgl/vgl_fwd.h>
00013 #include <vcl_iosfwd.h>
00014 
00015 
00016 
00017 
00018 
00019 
00020 class mfpf_region_finder : public mfpf_point_finder
00021 {
00022  private:
00023   
00024   double ref_x_;
00025   
00026   double ref_y_;
00027 
00028   
00029   vcl_vector<mbl_chord> roi_;
00030 
00031   
00032   unsigned roi_ni_;
00033   
00034   unsigned roi_nj_;
00035 
00036   
00037   unsigned n_pixels_;
00038 
00039   
00040   mbl_cloneable_ptr<mfpf_vec_cost> cost_;
00041 
00042   
00043   short norm_method_;
00044 
00045   
00046   
00047   double overlap_f_;
00048 
00049   
00050   double var_min_;
00051 
00052   
00053   bool draw_only_1st_plane_;
00054 
00055   
00056   void set_defaults();
00057 
00058  public:
00059 
00060   
00061   mfpf_region_finder();
00062 
00063   
00064   virtual ~mfpf_region_finder();
00065 
00066   
00067   void set(const vcl_vector<mbl_chord>& roi,
00068            double ref_x, double ref_y,
00069            const mfpf_vec_cost& cost,
00070            short norm_method=1);
00071 
00072   
00073   
00074   void set_overlap_f(double);
00075 
00076   
00077   void set_var_min(double var_min) {var_min_=var_min;}
00078 
00079   
00080   double var_min() const {return var_min_;}
00081 
00082   
00083   virtual double radius() const;
00084 
00085   
00086   const mfpf_vec_cost& cost() const { return cost_; }
00087 
00088   
00089   mfpf_vec_cost& cost() { return cost_; }
00090 
00091   
00092   
00093   virtual double evaluate(const vimt_image_2d_of<float>& image,
00094                           const vgl_point_2d<double>& p,
00095                           const vgl_vector_2d<double>& u);
00096 
00097   
00098   
00099   
00100   
00101   
00102   
00103   
00104   virtual void evaluate_region(const vimt_image_2d_of<float>& image,
00105                                const vgl_point_2d<double>& p,
00106                                const vgl_vector_2d<double>& u,
00107                                vimt_image_2d_of<double>& response);
00108 
00109   
00110   
00111   
00112   
00113   virtual double search_one_pose(const vimt_image_2d_of<float>& image,
00114                                  const vgl_point_2d<double>& p,
00115                                  const vgl_vector_2d<double>& u,
00116                                  vgl_point_2d<double>& new_p);
00117 
00118   
00119   
00120   
00121   bool is_inside(const mfpf_pose& pose,
00122                  const vgl_point_2d<double>& p,
00123                  double f=1.0) const;
00124 
00125   
00126   
00127   virtual bool overlap(const mfpf_pose& pose1,
00128                        const mfpf_pose& pose2) const;
00129 
00130   
00131   
00132   
00133   virtual void get_outline(vcl_vector<vgl_point_2d<double> >& pts) const;
00134 
00135   
00136   
00137   
00138   
00139   virtual void get_image_of_model(vimt_image_2d_of<vxl_byte>& image) const;
00140 
00141   
00142   short version_no() const;
00143 
00144   
00145   virtual vcl_string is_a() const;
00146 
00147   
00148   virtual mfpf_point_finder* clone() const;
00149 
00150   
00151   virtual void print_summary(vcl_ostream& os) const;
00152 
00153   
00154   void print_shape(vcl_ostream& os) const;
00155 
00156   
00157   virtual void b_write(vsl_b_ostream& bfs) const;
00158 
00159   
00160   virtual void b_read(vsl_b_istream& bfs);
00161 
00162   
00163   bool operator==(const mfpf_region_finder& nc) const;
00164 };
00165 
00166 #endif