SC.H

Go to the documentation of this file.
00001 /*!@file ModelNeuron/SC.H a model of the mamillian SC. */
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: David Berg <dberg@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu:/software/invt/trunk/saliency/src/ModelNeuron/SC.H $
00035 
00036 #ifndef  NEURALMODEL_SC_H_DEFINED
00037 #define  NEURALMODEL_SC_H_DEFINED
00038 
00039 #include "ModelNeuron/CompLayer.H"
00040 
00041 // ######################################################################
00042 //  SC base interface
00043 //  ######################################################################
00044 struct SCInterface : public Structure<SimStructure*>
00045 {
00046   SCInterface(const SimTime& timestep, const uint width, const uint height, 
00047               const std::string name = "", const std::string units = "") 
00048     : Structure<SimStructure*>(timestep, width, height, name, units) { }
00049   
00050   virtual ~SCInterface() { }
00051   
00052   //set bottom-up input
00053   virtual void input_sgs(const Image<double>& inp) = 0;
00054   
00055   //set top-down input
00056   virtual void input_sgi(const Image<double>& inp) = 0;
00057 };
00058   
00059 // ######################################################################
00060 //  SC model
00061 //  ######################################################################
00062 class SC : public SCInterface
00063 {
00064 public:
00065   //! constructor
00066   SC(const double& SCs_SCi, const double& SCi_PreM, const double& PreM_SCi, const double& SCi_SCs,
00067      const BorderPolicy bp, const SimTime& timestep, const uint width, const uint height, 
00068      const std::string name = "", const std::string units = "")
00069     : SCInterface(timestep, width, height, name, units), 
00070       itsS_I(SCs_SCi), itsI_M(SCi_PreM), itsI_S(SCi_SCs), itsM_I(PreM_SCi)
00071   { 
00072     //derived classes should configure the SCs and SCi layers and set the motor unit with setLayers
00073   }
00074   
00075   //default copy and assignment OK
00076   
00077   //!destructor 
00078   virtual ~SC() { };  
00079   
00080   template<class EUnit, class IUnit, class MUnit>
00081   void setLayers(const CompLayer<EUnit, IUnit>& SCs, const CompLayer<EUnit, IUnit>& SCi, const MUnit& premotor)
00082   {
00083     //superficial and intermediate layers
00084     addSub(SCs);
00085     addSub(SCi);
00086     editSub(0).setName("SCs");
00087     editSub(1).setName("SCi");
00088 
00089     //deep premotor layer
00090     Layer<MUnit,WeightsEmpty> motorlayer(getTimeStep(), getOutWidth(), getOutHeight(), "PreMotor", "");
00091     motorlayer.setModule(premotor);
00092     addSub(motorlayer);
00093 
00094     //SCs is the default input and pre-motor is the default output
00095     setDefaultIO(0,2);
00096   }
00097 
00098   //set bottom-up input
00099   void input_sgs(const Image<double>& inp) 
00100   {
00101     input(inp,0);
00102   }
00103 
00104   //set top-down input
00105   void input_sgi(const Image<double>& inp)
00106   {
00107     input(inp,1);
00108   }
00109 
00110   //!clone the unit
00111   SC* clone() const {return new SC(*this); }
00112   
00113 private:
00114   //!do our class specific interactions
00115   void interact()
00116   { 
00117     //sgs -> sgi  : uniform weights
00118     Image<double> sgs = getSub(0).getOutput();
00119     sgs *= itsS_I;
00120     input(sgs, 1);
00121     
00122     //sgi -> motor layer : uniform weights
00123     Image<double> sgi = getSub(1).getOutput();
00124     sgi *= itsI_M;
00125     input(sgi, 2);
00126     
00127     //inhibitory cells of sgi -> sgs excitatory : uniform Weights
00128     Image<double> sgi_i = getSub(1).getSub(1).getOutput();
00129     sgi_i *= itsI_S;
00130     input(sgi_i, 0);
00131     
00132     //pre-motor nurons to inhibitory of sgi : Fully connected 
00133     Image<double> prem = getSub(2).getOutput();
00134     prem = itsM_I.compute(prem);
00135     editSub(1).input(prem, 1);
00136   }
00137   
00138   //our weights
00139   const double itsS_I, itsI_M, itsI_S;
00140   WeightsAll itsM_I;
00141 };
00142 #endif
00143   
00144 // ######################################################################
00145 /* So things look consistent in everyone's emacs... */
00146 /* Local Variables: */
00147 /* indent-tabs-mode: nil */
00148 /* End: */
Generated on Sun May 8 08:05:21 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3