contrib/rpl/rgrl/rgrl_feature_landmark.h
Go to the documentation of this file.
00001 #ifndef rgrl_feature_landmark_h_
00002 #define rgrl_feature_landmark_h_
00003 //:
00004 // \file
00005 // \brief Derived class to represent a feature that is a landmark point - a branching or cross-over of vascular.
00006 // \author Chuck Stewart
00007 // \date 12 Nov 2002
00008 // \verbatim
00009 // Modifications
00010 //      Nov 2008 J Becker: Added a clone function.
00011 // \endverbatim
00012 
00013 #include <vcl_vector.h>
00014 #include <vcl_iosfwd.h>
00015 #include <vnl/vnl_vector.h>
00016 #include <vbl/vbl_array_2d.h>
00017 
00018 #include "rgrl_feature.h"
00019 
00020 //: Represents a landmark feature.
00021 //
00022 // A landmark feature is a branching or cross-over point of a
00023 // vascular-like structure. It is characterized by a number of outgoing
00024 // direction vectors. The error_projection matrix is identity.
00025 //
00026 class rgrl_feature_landmark
00027   : public rgrl_feature
00028 {
00029  public:
00030   //:  Constructor to initialize feature_landmark location.
00031   //
00032   // Works for 2d and 3d.
00033   rgrl_feature_landmark( vnl_vector<double> const& loc,
00034                          vcl_vector< vnl_vector<double> > const& outgoing_directions );
00035 
00036   //: read in feature
00037   virtual
00038   bool read( vcl_istream& is, bool skip_tag=false );
00039 
00040   //: write out feature
00041   virtual
00042   void write( vcl_ostream& os ) const;
00043 
00044   vnl_matrix<double> const&
00045   error_projector() const;
00046 
00047   vnl_matrix<double> const&
00048   error_projector_sqrt() const;
00049 
00050   unsigned int
00051   num_constraints() const;
00052 
00053   // Defines type-related functions
00054   rgrl_type_macro( rgrl_feature_landmark, rgrl_feature );
00055 
00056   rgrl_feature_sptr transform( rgrl_transformation const&  xform ) const;
00057 
00058   //:  signature_weight from the signature similarity
00059   //
00060   double absolute_signature_weight( rgrl_feature_sptr other ) const;
00061 
00062   //: make a clone copy
00063   virtual rgrl_feature_sptr clone() const;
00064 
00065  protected:
00066   friend class rgrl_feature_reader;
00067   rgrl_feature_landmark( rgrl_feature_landmark const& other );
00068 
00069   //: uninitialized constructor
00070   rgrl_feature_landmark();
00071 
00072   // to be able to use the protected constructor
00073   friend rgrl_feature_sptr
00074          rgrl_feature_reader( vcl_istream& is );
00075 
00076   // disabled, not implemented
00077   rgrl_feature_landmark& operator=( rgrl_feature_landmark const& );
00078 
00079   //:  Compute the maximum similarity between 2 landmarks.
00080   //
00081   //   The similarity is a measure of best alignment of the 2 sets of
00082   //   outgoing directions. It is computed as the sum of the
00083   //   dot-product of the matched directions, normalized by twice the
00084   //   size of the smallest set of outgoing directions. The details
00085   //   are in "A Feature-Based, Robust, Hierarchical Algorithm for
00086   //   Registering Pairs of Images of the Curved Human Retina",
00087   //   IEEE Pattern Analysis and Machine Intelligence, 24(3), 2002.
00088   //
00089   double max_similarity(const vcl_vector<vnl_vector<double> >& u,
00090                         const vcl_vector<vnl_vector<double> >& v,
00091                         int count,
00092                         const vbl_array_2d<bool>& invalid) const;
00093 
00094  private:
00095   // For the center location of the landmark
00096   vnl_matrix<double> error_proj_;
00097 
00098   // For the signature of the landmark
00099   vcl_vector< vnl_vector<double> >  outgoing_directions_;
00100 };
00101 
00102 #endif // rgrl_feature_landmark_h_