contrib/rpl/rgrl/rgrl_scale.h
Go to the documentation of this file.
00001 #ifndef rgrl_scale_h_
00002 #define rgrl_scale_h_
00003 //:
00004 // \file
00005 // \brief  Class to represent error scale estimates.
00006 // \author Chuck Stewart
00007 // \date   14 Nov 2002
00008 //
00009 // This class must be extended if covariance matrix for the geometric
00010 // error is to be added!
00011 // \verbatim
00012 //  Modifications
00013 //   Gehua Yang   Feb. 2006   add a flag to indicate whether the scale is prior or an estimate
00014 // \endverbatim
00015 
00016 
00017 #include <vnl/vnl_matrix.h>
00018 #include <vcl_iosfwd.h>
00019 
00020 #include "rgrl_scale_sptr.h"
00021 #include "rgrl_object.h"
00022 
00023 //:
00024 // Represents error scale estimates.
00025 //
00026 class rgrl_scale
00027   : public rgrl_object
00028 {
00029  public:
00030   rgrl_scale( );
00031 
00032   //: scale type
00033   enum type { prior, estimate };
00034 
00035   //:
00036   bool has_geometric_scale() const;
00037 
00038   //: Valid iff has_geometric_scale() is true.
00039   double geometric_scale( ) const;
00040 
00041   //:
00042   bool has_signature_inv_covar() const;
00043 
00044   //:  Valid iff has_signature_inv_covariance() is true.
00045   vnl_matrix<double> const& signature_inv_covar() const;
00046 
00047   //:  Set all scale information
00048   void set_scales( double                     geometric_scale,
00049                    vnl_matrix<double>  const& signature_inv_covar,
00050                    type                       new_type = estimate );
00051 
00052   //:  Set the geometric scale
00053   void set_geometric_scale( double scale, type new_type = estimate );
00054 
00055   //:  Set the signature covariance matrix
00056   void set_signature_inv_covar( vnl_matrix<double> const& covar );
00057 
00058   // Defines type-related functions
00059   rgrl_type_macro( rgrl_scale, rgrl_object );
00060 
00061   //: return scale type
00062   type geo_scale_type() const { return geo_scale_type_; }
00063 
00064   //: set scale type
00065   void set_geo_scale_type(type new_type)
00066   { geo_scale_type_ = new_type; }
00067 
00068   //: write to io stream
00069   void write( vcl_ostream& os ) const;
00070 
00071   //: read from io stream
00072   bool read( vcl_istream& is );
00073 
00074  private:
00075   bool                has_geometric_scale_;
00076   double              geometric_scale_;
00077   bool                has_signature_inv_covar_;
00078   vnl_matrix<double>  signature_inv_covar_;
00079 
00080   type                geo_scale_type_;
00081 };
00082 
00083 //: output operator
00084 vcl_ostream&
00085 operator<<( vcl_ostream& ofs, rgrl_scale const& scale );
00086 
00087 //: input operator
00088 vcl_istream&
00089 operator>>( vcl_istream& ifs, rgrl_scale& scale );
00090 
00091 #endif // rgrl_scale_h_