00001 /*!@file Neuro/VisualCortex.H The early visual processing stages */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00005 // 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: Laurent Itti <itti@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/VisualCortex.H $ 00035 // $Id: VisualCortex.H 12574 2010-01-15 02:09:17Z itti $ 00036 // 00037 00038 #ifndef VISUALCORTEX_H_DEFINED 00039 #define VISUALCORTEX_H_DEFINED 00040 00041 #include "Neuro/NeuroSimEvents.H" 00042 #include "Simulation/SimEvents.H" 00043 #include "Simulation/SimModule.H" 00044 00045 class RawVisualCortex; 00046 class IntegerRawVisualCortex; 00047 class IntegerMathEngine; 00048 class EnvVisualCortexFloat; 00049 00050 // ###################################################################### 00051 //! The Visual Cortex Base Class 00052 class VisualCortex : public SimModule 00053 { 00054 public: 00055 // ###################################################################### 00056 /*! @name Constructors/Destructor */ 00057 //@{ 00058 00059 //! Constructor 00060 /*! @param mgr our ModelManager (see ModelManager.H) 00061 @param descrName descriptive name for human usage 00062 @param tagName name for ParamMap usage */ 00063 VisualCortex(OptionManager& mgr, 00064 const std::string& descrName = "Visual Cortex", 00065 const std::string& tagName = "VisualCortex"); 00066 00067 //! Virtual destructor for safe inheritance. 00068 virtual ~VisualCortex(); 00069 00070 //@} 00071 00072 private: 00073 VisualCortex(const VisualCortex&); // not allowed 00074 VisualCortex& operator=(const VisualCortex&); // not allowed 00075 00076 }; 00077 00078 // ###################################################################### 00079 //! The Standard Visual Cortex 00080 /*! This basically wraps the functionality of RawVisualCortex. */ 00081 class VisualCortexStd : public VisualCortex 00082 { 00083 public: 00084 // ###################################################################### 00085 /*! @name Constructors/Destructor */ 00086 //@{ 00087 00088 //! Constructor 00089 VisualCortexStd(OptionManager& mgr, 00090 const std::string& descrName = "Visual Cortex", 00091 const std::string& tagName = "VisualCortex"); 00092 00093 //! Constructor using an existing RawVisualCortex 00094 VisualCortexStd(OptionManager& mgr, 00095 const std::string& descrName, 00096 const std::string& tagName, 00097 nub::ref<RawVisualCortex> vcx); 00098 00099 //! Virtual destructor for safe inheritance. 00100 virtual ~VisualCortexStd(); 00101 00102 //@} 00103 00104 protected: 00105 //! Callback for when a new input (retina) frame is available 00106 SIMCALLBACK_DECLARE(VisualCortexStd, SimEventRetinaImage); 00107 00108 //! Callback for every time we should save our outputs 00109 SIMCALLBACK_DECLARE(VisualCortexStd, SimEventSaveOutput); 00110 00111 //! Callback for every time someone wants our features 00112 SIMREQHANDLER_DECLARE(VisualCortexStd, SimReqVCXfeatures); 00113 00114 //! Callback for every time someone wants our maps 00115 SIMREQHANDLER_DECLARE(VisualCortexStd, SimReqVCXmaps); 00116 00117 //! Callback for every time someone wants to trigger a channel visitor 00118 SIMREQHANDLER_DECLARE(VisualCortexStd, SimReqVCXchanVis); 00119 00120 private: 00121 friend class VisualCortexConfigurator; // allow the configurator to configure our VCX 00122 nub::ref<RawVisualCortex> itsVCX; 00123 }; 00124 00125 // ###################################################################### 00126 //! An Integer-based VisualCortex 00127 /*! This basically wraps the functionality of 00128 IntegerRawVisualCortex. This uses fixed-point integer computations 00129 but remains quite flexible and similar to RawVisualCortex. */ 00130 class VisualCortexInt : public VisualCortex 00131 { 00132 public: 00133 // ###################################################################### 00134 /*! @name Constructors/Destructor */ 00135 //@{ 00136 00137 //! Constructor 00138 VisualCortexInt(OptionManager& mgr, 00139 const std::string& descrName = "Visual Cortex", 00140 const std::string& tagName = "VisualCortex"); 00141 00142 //! Constructor using an existing IntegerRawVisualCortex 00143 VisualCortexInt(OptionManager& mgr, 00144 const std::string& descrName, 00145 const std::string& tagName, 00146 nub::ref<IntegerMathEngine> ime, 00147 nub::ref<IntegerRawVisualCortex> vcx); 00148 00149 //! Virtual destructor for safe inheritance. 00150 virtual ~VisualCortexInt(); 00151 00152 //@} 00153 00154 protected: 00155 //! Callback for when a new input (retina) frame is available 00156 SIMCALLBACK_DECLARE(VisualCortexInt, SimEventRetinaImage); 00157 00158 //! Callback for every time we should save our outputs 00159 SIMCALLBACK_DECLARE(VisualCortexInt, SimEventSaveOutput); 00160 00161 //! Callback for every time someone wants our features 00162 SIMREQHANDLER_DECLARE(VisualCortexInt, SimReqVCXfeatures); 00163 00164 //! Callback for every time someone wants our maps 00165 SIMREQHANDLER_DECLARE(VisualCortexInt, SimReqVCXmaps); 00166 00167 //! Callback for every time someone wants to trigger a channel visitor 00168 SIMREQHANDLER_DECLARE(VisualCortexInt, SimReqVCXchanVis); 00169 00170 private: 00171 friend class VisualCortexConfigurator; // allow the configurator to configure our VCX 00172 nub::ref<IntegerMathEngine> itsIME; 00173 nub::ref<IntegerRawVisualCortex> itsVCX; 00174 PyramidCache<int> itsPcache; 00175 }; 00176 00177 // ###################################################################### 00178 //! An optimized C-based Integer-based VisualCortex 00179 /*! This used the EnvVisualCortex, it is fast but not flexible in 00180 terms of which channels are used, etc. */ 00181 class VisualCortexEnv : public VisualCortex 00182 { 00183 public: 00184 // ###################################################################### 00185 /*! @name Constructors/Destructor */ 00186 //@{ 00187 00188 //! Constructor 00189 VisualCortexEnv(OptionManager& mgr, 00190 const std::string& descrName = "Visual Cortex", 00191 const std::string& tagName = "VisualCortex"); 00192 00193 //! Virtual destructor for safe inheritance. 00194 virtual ~VisualCortexEnv(); 00195 00196 //@} 00197 00198 protected: 00199 //! Callback for when a new input (retina) frame is available 00200 SIMCALLBACK_DECLARE(VisualCortexEnv, SimEventRetinaImage); 00201 00202 //! Callback for every time we should save our outputs 00203 SIMCALLBACK_DECLARE(VisualCortexEnv, SimEventSaveOutput); 00204 00205 //! Callback for every time someone wants our features 00206 SIMREQHANDLER_DECLARE(VisualCortexEnv, SimReqVCXfeatures); 00207 00208 //! Callback for every time someone wants our maps 00209 SIMREQHANDLER_DECLARE(VisualCortexEnv, SimReqVCXmaps); 00210 00211 //! Callback for every time someone wants to trigger a channel visitor 00212 SIMREQHANDLER_DECLARE(VisualCortexEnv, SimReqVCXchanVis); 00213 00214 private: 00215 friend class VisualCortexConfigurator; // allow the configurator to configure our VCX 00216 nub::ref<EnvVisualCortexFloat> itsVCX; 00217 }; 00218 00219 00220 /* So things look consistent in everyone's emacs... */ 00221 /* Local Variables: */ 00222 /* indent-tabs-mode: nil */ 00223 /* End: */ 00224 00225 #endif