00001 #ifndef mcal_trivial_ca_h_ 00002 #define mcal_trivial_ca_h_ 00003 //: 00004 // \file 00005 // \author Tim Cootes 00006 // \brief Generates set of axis aligned modes for non-zero elements 00007 00008 #include <mcal/mcal_component_analyzer.h> 00009 #include <mcal/mcal_single_basis_cost.h> 00010 #include <vnl/io/vnl_io_vector.h> 00011 #include <vnl/io/vnl_io_matrix.h> 00012 #include <mbl/mbl_data_wrapper.h> 00013 #include <vcl_iosfwd.h> 00014 00015 //: Generates set of axis aligned modes for non-zero element 00016 // Given n-D input data, for each element which contains non-zero 00017 // variance, generate a unit mode vector along relevant axis. 00018 // 00019 // This is primarily used for testing, and trivial initialisations. 00020 class mcal_trivial_ca : public mcal_component_analyzer 00021 { 00022 private: 00023 public: 00024 00025 //: Dflt ctor 00026 mcal_trivial_ca(); 00027 00028 //: Destructor 00029 virtual ~mcal_trivial_ca(); 00030 00031 //: Compute modes of the supplied data relative to the supplied mean 00032 // Model is x = mean + modes*b, where b is a vector of weights on each mode. 00033 // mode_var[i] gives the variance of the data projected onto that mode. 00034 virtual void build_about_mean(mbl_data_wrapper<vnl_vector<double> >& data, 00035 const vnl_vector<double>& mean, 00036 vnl_matrix<double>& modes, 00037 vnl_vector<double>& mode_var); 00038 00039 //: Version number for I/O 00040 short version_no() const; 00041 00042 //: Name of the class 00043 virtual vcl_string is_a() const; 00044 00045 //: Create a copy on the heap and return base class pointer 00046 virtual mcal_component_analyzer* clone() const; 00047 00048 //: Print class to os 00049 virtual void print_summary(vcl_ostream& os) const; 00050 00051 //: Save class to binary file stream 00052 virtual void b_write(vsl_b_ostream& bfs) const; 00053 00054 //: Load class from binary file stream 00055 virtual void b_read(vsl_b_istream& bfs); 00056 00057 //: Read initialisation settings from a stream. 00058 // Parameters: 00059 // \verbatim 00060 // { 00061 // } 00062 // \endverbatim 00063 // \throw mbl_exception_parse_error if the parse fails. 00064 virtual void config_from_stream(vcl_istream & is); 00065 }; 00066 00067 #endif // mcal_trivial_ca_h_