Go to the documentation of this file.00001 #ifndef msm_shape_model_builder_h_
00002 #define msm_shape_model_builder_h_
00003
00004
00005
00006
00007
00008 #include <vcl_cassert.h>
00009 #include <vcl_iosfwd.h>
00010 #include <vcl_string.h>
00011 #include <vsl/vsl_fwd.h>
00012 #include <msm/msm_shape_model.h>
00013 #include <msm/msm_param_limiter.h>
00014
00015
00016 class msm_shape_model_builder
00017 {
00018 private:
00019
00020 mbl_cloneable_ptr<msm_aligner> aligner_;
00021
00022
00023 mbl_cloneable_ptr<msm_param_limiter> param_limiter_;
00024
00025
00026 double var_prop_;
00027
00028
00029 unsigned min_modes_;
00030
00031
00032 unsigned max_modes_;
00033
00034 public:
00035
00036
00037 msm_shape_model_builder();
00038
00039
00040 ~msm_shape_model_builder();
00041
00042
00043 void set_aligner(const msm_aligner& aligner);
00044
00045
00046 void set_param_limiter(const msm_param_limiter&);
00047
00048
00049
00050 void set_mode_choice(unsigned min, unsigned max,
00051 double var_proportion);
00052
00053
00054 const msm_aligner& aligner() const { return aligner_; }
00055
00056
00057 const msm_param_limiter& param_limiter() const
00058 { return param_limiter_; }
00059
00060
00061 void build_model(const vcl_vector<msm_points>& shapes,
00062 msm_shape_model& shape_model);
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 void build_model(const vcl_vector<msm_points>& shapes,
00075 const vcl_vector<vcl_vector<unsigned> >& pts_used,
00076 msm_shape_model& shape_model);
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 void build_within_class_model(
00089 const vcl_vector<msm_points>& shapes,
00090 const vcl_vector<int>& id,
00091 const vcl_vector<vcl_vector<unsigned> >& pts_used,
00092 msm_shape_model& shape_model);
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 void build_within_class_model(
00103 const vcl_vector<msm_points>& shapes,
00104 const vcl_vector<int>& id,
00105 msm_shape_model& shape_model);
00106
00107
00108
00109
00110
00111 void build_from_files(const vcl_string& points_dir,
00112 const vcl_vector<vcl_string>& filenames,
00113 msm_shape_model& shape_model);
00114
00115
00116 short version_no() const;
00117
00118
00119 vcl_string is_a() const;
00120
00121
00122 void print_summary(vcl_ostream& os) const;
00123
00124
00125 void b_write(vsl_b_ostream& bfs) const;
00126
00127
00128 void b_read(vsl_b_istream& bfs);
00129 };
00130
00131
00132
00133 void msm_load_shapes(const vcl_string& points_dir,
00134 const vcl_vector<vcl_string>& filenames,
00135 vcl_vector<msm_points>& shapes);
00136
00137
00138 void vsl_b_write(vsl_b_ostream& bfs, const msm_shape_model_builder& pts);
00139
00140
00141 void vsl_b_read(vsl_b_istream& bfs, msm_shape_model_builder& pts);
00142
00143
00144 vcl_ostream& operator<<(vcl_ostream& os,const msm_shape_model_builder& pts);
00145
00146
00147 void vsl_print_summary(vcl_ostream& os,const msm_shape_model_builder& pts);
00148
00149 #endif // msm_shape_model_builder_h_