00001 /*!@file Neuro/TargetChecker.H check+count targets hit during a neural simulation */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Rob Peters <rjpeters at usc dot edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/TargetChecker.H $ 00035 // $Id: TargetChecker.H 10744 2009-02-03 04:51:40Z itti $ 00036 // 00037 00038 #ifndef NEURO_TARGETCHECKER_H_DEFINED 00039 #define NEURO_TARGETCHECKER_H_DEFINED 00040 00041 #include "Component/ModelComponent.H" 00042 #include "Component/ModelParam.H" 00043 #include "Image/Image.H" 00044 #include "Neuro/NeuroSimEvents.H" 00045 #include "Simulation/SimModule.H" 00046 00047 class InputFrame; 00048 00049 //! Check and count targets hit during a neural simulation 00050 /*! We look for SimEventRetinaImage as well as for SimEventWTAwinner, 00051 and post a SimEventBreak when all targets were attended to. */ 00052 class TargetChecker : public SimModule 00053 { 00054 public: 00055 //! Constructor 00056 TargetChecker(OptionManager& mgr, 00057 const std::string& descrName = "Target Checker", 00058 const std::string& tagName = "TargetChecker"); 00059 00060 //! Destructor 00061 virtual ~TargetChecker(); 00062 00063 protected: 00064 //! Callback for when a new WTA winner is available 00065 SIMCALLBACK_DECLARE(TargetChecker, SimEventWTAwinner); 00066 00067 //! Callback for when a new WTA winner is available 00068 SIMCALLBACK_DECLARE(TargetChecker, SimEventRetinaImage); 00069 00070 //! Callback for when a new target mask should be used 00071 SIMCALLBACK_DECLARE(TargetChecker, SimEventTargetMask); 00072 00073 //! Get started 00074 virtual void start1(); 00075 00076 //! Get reset 00077 virtual void reset1(); 00078 00079 private: 00080 // FOA radius for our drawings 00081 OModelParam<int> itsFOAradius; 00082 00083 // text log file name 00084 OModelParam<std::string> itsLogFile; 00085 00086 // filename of a targetmask image to load; or empty string for no targetmask 00087 OModelParam<std::string> itsTargetMaskFname; 00088 00089 // This is a visual memory of which locations in the visual field 00090 // have been covertly attended to; it starts as an empty image of 00091 // same dims as this->retinalImage, but FOAs get painted into it each time 00092 // a new shift of covert attention is made. NOTE: this concept works 00093 // well with a static input, but determining when the visual field 00094 // should be erased or shifted because the viewpoint changed should 00095 // come from the SaccadeController in a future implementation. The 00096 // same applies to SM and WTA, for that matter. 00097 Image<byte> itsVisualField; 00098 00099 // stores the image that was passed in to setTargetMask() 00100 Image<byte> itsRawTargetMask; 00101 00102 // binary mask indicating where targets are; if one was given to 00103 // Brain::input(), that's a copy of it with the targets found so far 00104 // painted in a different color, otherwise it's an initialized image 00105 Image<byte> itsTargetMask; 00106 00107 // number of targets that still need to be found 00108 int itsNumTargetsRemaining; 00109 }; 00110 00111 // ###################################################################### 00112 /* So things look consistent in everyone's emacs... */ 00113 /* Local Variables: */ 00114 /* indent-tabs-mode: nil */ 00115 /* End: */ 00116 00117 #endif // NEURO_TARGETCHECKER_H_DEFINED