LoCorrFinder.H

00001 /**
00002    \file  Robots/LoBot/control/LoCorrFinder.H
00003    \brief A class for finding point correspondences between the point
00004    lists of a reference experiment and another experiment.
00005 
00006    An Experiment contains several different lists of points. The point
00007    lists in Experiments across a Dataset will have different
00008    cardinalities. To compute average-case behaviour for the robot, we
00009    will have to first "normalize" the point list sizes so that they all
00010    have the same number of points as some reference Experiment. Then, for
00011    each point in the reference Experiment's point list, we will have to
00012    find the corresponding points in the other Experiments making up the
00013    Dataset.
00014 
00015    The point correspondences for one Experiment are independent of those
00016    of another Experiment. Therefore, we can compute the point
00017    correspondences for all the Experiments in a Dataset in parallel by
00018    running multiple threads.
00019 
00020    This file defines a class that encapsulates the multithreaded point
00021    correspondence finding procedure.
00022 */
00023 
00024 // //////////////////////////////////////////////////////////////////// //
00025 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00026 // by the University of Southern California (USC) and the iLab at USC.  //
00027 // See http://iLab.usc.edu for information about this project.          //
00028 // //////////////////////////////////////////////////////////////////// //
00029 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00030 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00031 // in Visual Environments, and Applications'' by Christof Koch and      //
00032 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00033 // pending; application number 09/912,225 filed July 23, 2001; see      //
00034 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00035 // //////////////////////////////////////////////////////////////////// //
00036 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00037 //                                                                      //
00038 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00039 // redistribute it and/or modify it under the terms of the GNU General  //
00040 // Public License as published by the Free Software Foundation; either  //
00041 // version 2 of the License, or (at your option) any later version.     //
00042 //                                                                      //
00043 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00044 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00045 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00046 // PURPOSE.  See the GNU General Public License for more details.       //
00047 //                                                                      //
00048 // You should have received a copy of the GNU General Public License    //
00049 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00050 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00051 // Boston, MA 02111-1307 USA.                                           //
00052 // //////////////////////////////////////////////////////////////////// //
00053 //
00054 // Primary maintainer for this file: mviswana usc edu
00055 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/metlog/LoCorrFinder.H $
00056 // $Id: LoCorrFinder.H 13934 2010-09-14 23:17:01Z mviswana $
00057 //
00058 
00059 #ifndef LOBOT_CORRESPONDENCE_FINDER_DOT_H
00060 #define LOBOT_CORRESPONDENCE_FINDER_DOT_H
00061 
00062 //------------------------------ HEADERS --------------------------------
00063 
00064 // lobot headers
00065 #include "Robots/LoBot/metlog/LoPointTypes.H"
00066 #include "Robots/LoBot/thread/LoThread.H"
00067 
00068 //----------------------------- NAMESPACE -------------------------------
00069 
00070 namespace lobot {
00071 
00072 //------------------------- CLASS DEFINITION ----------------------------
00073 
00074 // Forward declarations
00075 class Experiment ;
00076 class Dataset ;
00077 class PointMatrix ;
00078 
00079 /**
00080    \class lobot::CorrFinder
00081    \brief A class for finding point correspondences between a
00082    lobot::Experiment and a refernce Experiment in a separate thread.
00083 
00084    This class implements an interface for launching a point
00085    correspondence finding algorithm in a separate thread. This
00086    correspondence finder's job is to look at a reference Experiment's
00087    point list of interest and find the closest points in another
00088    Experiment. The resulting list of points is added to a PointMatrix.
00089 */
00090 class CorrFinder : private Thread {
00091 public:
00092    /// This class uses the "named constructor" idiom to ensure that
00093    /// clients not create instances of it on the stack. This method is
00094    /// the named constructor (aka factory method).
00095    ///
00096    /// When clients create correspondence finders, they should supply a
00097    /// reference experiment and the dataset containing all the
00098    /// experiments. Additionally, the correspondence finder also needs to
00099    /// know the point list for which the client is interested in finding
00100    /// point correspondences.
00101    ///
00102    /// Upon instantiation, this class will automatically launch a new
00103    /// thread to perform the correspondence finding operations. Once it
00104    /// has found the desired correspondences, it will send its results to
00105    /// the point matrix supplied by the client.
00106    ///
00107    /// NOTE: This named constructor is the only publically accessible
00108    /// thing in this class. Once a correspondence finder object is
00109    /// created, the rest of its work proceeds automatically. Clients can
00110    /// either continue on with their business or choose to wait for all
00111    /// the correspondence finder threads to complete.
00112    static CorrFinder* create(const Experiment*, const Dataset&,
00113                              PointListName, PointMatrix*) ;
00114 
00115 private:
00116    /// Private constructor because only the factory method or named
00117    /// constructor can be used to instantiate this class.
00118    CorrFinder(const Experiment*, const Dataset&, PointListName, PointMatrix*) ;
00119 
00120    /// These data members are the inputs to the correspondence finder.
00121    //@{
00122    const Experiment* m_refexp ;
00123    const Dataset&    m_dataset ;
00124    PointListName     m_point_list ;
00125    //@}
00126 
00127    /// This data member references the output object for the
00128    /// correspondence finder.
00129    PointMatrix* m_point_matrix ;
00130 
00131    // Since we're using private inheritance, Thread::start() won't be
00132    // visible to subclasses without this explicit say-so.
00133    using Thread::start ;
00134 
00135    /// This method implements the correspondence finding functionality.
00136    /// It executes in a separate thread.
00137    void run() ;
00138 
00139    // Prevent copy and assignment
00140    CorrFinder(const CorrFinder&) ;
00141    CorrFinder& operator=(const CorrFinder&) ;
00142 } ;
00143 
00144 //-----------------------------------------------------------------------
00145 
00146 } // end of namespace encapsulating this file's definitions
00147 
00148 #endif
00149 
00150 /* So things look consistent in everyone's emacs... */
00151 /* Local Variables: */
00152 /* indent-tabs-mode: nil */
00153 /* End: */
Generated on Sun May 8 08:41:30 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3