contrib/mul/msm/msm_shape_model.h
Go to the documentation of this file.
00001 #ifndef msm_shape_model_h_
00002 #define msm_shape_model_h_
00003 //:
00004 // \file
00005 // \brief Contains mean/modes etc of a shape model and aligner details
00006 // \author Tim Cootes
00007 
00008 #include <msm/msm_ref_shape_model.h>
00009 #include <msm/msm_aligner.h>
00010 #include <vcl_iosfwd.h>
00011 
00012 //: Contains mean/modes etc of a shape model
00013 //  Container to hold the components of a statistical shape model.
00014 //  Uses a linear model the shape variation.
00015 //  Global pose form defined by the choice of msm_aligner class.
00016 //
00017 //  The associated msm_shape_instance class contains functions to
00018 //  synthesize and match to shapes using this model.
00019 class msm_shape_model : public msm_ref_shape_model
00020 {
00021  private:
00022   //: Pose to use as a default (for convenience)
00023   vnl_vector<double> default_pose_;
00024 
00025   //: Object used to deal with global transformations
00026   mbl_cloneable_ptr<msm_aligner> aligner_;
00027 
00028  public:
00029 
00030   // Dflt ctor
00031   msm_shape_model();
00032 
00033   // Destructor
00034   ~msm_shape_model();
00035 
00036   //: Set up model
00037   void set(const msm_points& mean,
00038            const vnl_matrix<double>& modes,
00039            const vnl_vector<double>& mode_var,
00040            const vnl_vector<double>& default_pose,
00041            const msm_aligner& aligner,
00042            const msm_param_limiter& param_limiter);
00043 
00044   //: Pose to use as a default (for convenience)
00045   const vnl_vector<double> default_pose() const
00046   { return default_pose_; }
00047 
00048   //: Object used to deal with global transformations
00049   const msm_aligner& aligner() const { return aligner_; }
00050 
00051   //: Version number for I/O
00052   short version_no() const;
00053 
00054   //: Name of the class
00055   vcl_string is_a() const;
00056 
00057   //: Print class to os
00058   void print_summary(vcl_ostream& os) const;
00059 
00060   //: Save class to binary file stream
00061   void b_write(vsl_b_ostream& bfs) const;
00062 
00063   //: Load class from binary file stream
00064   void b_read(vsl_b_istream& bfs);
00065 
00066   //: Equality test
00067   bool operator==(const msm_shape_model& points);
00068 };
00069 
00070 
00071 //: Binary file stream output operator for class reference
00072 void vsl_b_write(vsl_b_ostream& bfs, const msm_shape_model& pts);
00073 
00074 
00075 //: Binary file stream input operator for class reference
00076 void vsl_b_read(vsl_b_istream& bfs, msm_shape_model& pts);
00077 
00078 //: Stream output operator for class reference
00079 vcl_ostream& operator<<(vcl_ostream& os,const msm_shape_model& pts);
00080 
00081 //: Stream output operator for class reference
00082 void vsl_print_summary(vcl_ostream& os,const msm_shape_model& pts);
00083 
00084 #endif // msm_shape_model_h_