00001 /*!@file ModelNeuron/IZNeuron.H Class declarations for an Izhikevich neuron */ 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 J. Berg <dberg@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/ModelNeuron/IZNeuron.H $ 00035 00036 #ifndef MODELNEURON_IZNEURON_H_DEFINED 00037 #define MODELNEURON_IZNEURON_H_DEFINED 00038 00039 #include "ModelNeuron/Synapse.H" 00040 00041 // ###################################################################### 00042 //! The Izhikevich neural model of spike generation as presented in 00043 //! his 2003,2008 paper 00044 //###################################################################### 00045 class IZNeuronFunc 00046 { 00047 public: 00048 //! Constructor with default params 00049 IZNeuronFunc(const double& a = 0.15, // timescale of recovery variable(u) 00050 const double& b = 8.0, // sensitivity of u to voltage 00051 const double& c = -55.0, // after-spike reset value of v 00052 const double& d = 200.0, // after-spike reset value of u 00053 const double& k = 1.0, // current voltage relationship 00054 const double& Cm = 20.0, // in microfarads 00055 const double& V_rest = -55.0, // in millivolts 00056 const double& V_thresh = -40.0, // in millivolts 00057 const double& V_peak = 25.0) : // in millivolts 00058 itsSpike(false), itsV(V_rest), itsI(0.0), itsU(0.0),itsa(a), itsb(b), 00059 itsc(c), itsd(d), itsk(k),itsCm(Cm), itsVr(V_rest), itsVth(V_thresh), 00060 itsVp(V_peak) { }; 00061 00062 //!destructor 00063 ~IZNeuronFunc() { }; 00064 00065 //since our last integration time step did we spike? 00066 const bool getSpike() const {return itsSpike; }; 00067 00068 //! integrate 1ms 00069 void integrate(); 00070 00071 //! initialize or reset 00072 void initialize(); 00073 00074 //! set membrane potential to given value (in mV) 00075 void setV(const double& val) { itsV = val; }; 00076 00077 //!set the current (picoamps) of the cell 00078 void setCurrent(const double& current) {itsI = current; }; 00079 00080 //! get current membrane potential (mV) 00081 const double getV() const { return itsV; }; 00082 00083 //! get peak voltage (mV) 00084 const double getVpeak() const { return itsVp; }; 00085 00086 //! get the value of the recovery variable 00087 const double getU() const { return itsU; }; 00088 00089 //! get the last set input current (picoAmps) 00090 const double getCurrent() const { return itsI; }; 00091 00092 //! setup different neuron types 00093 void setup(const std::string& name, const bool use_random = false); 00094 00095 private: 00096 //! reset state when a spike occurs 00097 void reset(); 00098 00099 bool itsSpike; //did we spike in the last time step 00100 00101 double itsV; // membrane potential in millivolts 00102 double itsI; // input current in picoamperes 00103 double itsU; //recovery variable 00104 00105 double itsa; //dimenionless param 00106 double itsb; //dimenionless param 00107 double itsc; //dimenionless param 00108 double itsd; //dimenionless param 00109 double itsk; //gain factor 00110 double itsCm; //membrane capacitance 00111 double itsVr; //resting voltage 00112 double itsVth; //threshold to spike 00113 double itsVp; //peak voltage 00114 }; 00115 00116 // ###################################################################### 00117 // ! The Izhikevich spike generation model with channels (from Dayan & Abbot 2001, and Izhikevich, 2008, 2004, 2003). 00118 // This class represents a neuron with four 'lumped' channel types, where all synapses of a given type are goverened by 00119 // a single equation with first order kinematics (see Synapse.H). The neuron contains AMPA and NMDA as excitatory 00120 // channels and GABAA and GABAB as inhibitory channles. Alternatevly, setI() can be used to set an external current (pA) 00121 // to the neuron. After a call to evolve, the external input will be reset to 0. 00122 // ###################################################################### 00123 class IZNeuron : public SimUnit 00124 { 00125 public: 00126 //! Constructor with default params 00127 IZNeuron(const double& a = 0.15, // timescale of recovery variable 00128 const double& b = 8.0, // sensitivity of u to voltage 00129 const double& c = -55.0, // after-spike reset value of v 00130 const double& d = 200.0, // after-spike reset value of u 00131 const double& k = 1.0, // current voltage relationship 00132 const double& Cm = 20.0, // in microfarads 00133 const double& V_rest = -55.0, // in millivolts 00134 const double& V_thresh = -40.0, // in millivolts 00135 const double& V_peak = 25.0, // in millivolts 00136 const std::string& name = "Neuron", 00137 const std::string& units = "spike"); 00138 00139 //!destructor 00140 ~IZNeuron() { }; 00141 00142 //set the voltage 00143 void setV(const double& voltage); 00144 00145 //!get the output for display purposes, the membrane voltage 00146 const double getDisplayOutput() const; 00147 00148 //!get the number of sub units 00149 const uint numSubs() const; 00150 00151 //!get sub unit 00152 const SimUnit& getSub(const uint i) const; 00153 00154 //!get the current voltage (mV) 00155 const double getV() const; 00156 00157 //!get the current current (pA) 00158 const double getI() const; 00159 00160 //!set an external current. 00161 void setI (const double& current); 00162 00163 //!setup the neuron and its parameters 00164 const IZNeuron& setup(const std::string& name, const bool use_random = false); 00165 00166 protected: 00167 //!get the sub, unit mutable version 00168 SimUnit& editSub(const uint i); 00169 00170 private: 00171 //! integrate 1 time step 00172 double const doIntegrate(const SimTime& dt, 00173 const double& ine, const double& ini); 00174 00175 //!initialize or reset all receptors and variables 00176 void doInit(); 00177 00178 //!perform copy of IZNeuron 00179 IZNeuron* doClone() const; 00180 00181 double itsI; //for external current 00182 IZNeuronFunc itsN; //our neuron 00183 00184 //synapses 00185 AMPASynapse ampa; 00186 NMDASynapse nmda; 00187 GABAASynapse gabaa; 00188 GABABSynapse gabab; 00189 }; 00190 00191 struct RSNeuron : public IZNeuron 00192 { RSNeuron() : IZNeuron() { setup("RS"); }; 00193 RSNeuron* doClone() const { return new RSNeuron(*this); }; }; 00194 00195 struct FSNeuron : public IZNeuron 00196 { FSNeuron() : IZNeuron() { setup("FS"); }; 00197 FSNeuron* doClone() const { return new FSNeuron(*this); }; }; 00198 00199 struct EBNeuron : public IZNeuron 00200 { EBNeuron() : IZNeuron() { setup("EB"); }; 00201 EBNeuron* doClone() const { return new EBNeuron(*this); }; }; 00202 00203 // ###################################################################### 00204 // Register neuron types 00205 // ###################################################################### 00206 namespace 00207 { 00208 typedef SimUnit::Factory IZFactory; 00209 typedef SimUnit::Creator IZCreator; 00210 //define creation functions 00211 struct RegisterIZNeuron 00212 { 00213 RegisterIZNeuron() 00214 { 00215 IZFactory::instance().add("RSNeuron", IZCreator::make<RSNeuron>()); 00216 IZFactory::instance().add("FSNeuron", IZCreator::make<FSNeuron>()); 00217 IZFactory::instance().add("EBNeuron", IZCreator::make<EBNeuron>()); 00218 } 00219 }; 00220 static RegisterIZNeuron registerizn; 00221 } 00222 00223 /* 00224 // ###################################################################### 00225 // The Izhikevich spike generation model (as in the class above), but 00226 // this class supports an arbitrary number of synapses. Synpaptic 00227 // structures is defined through calls to addSynapse. inputSynpase 00228 // allows targeting inputs to specific synapses. Calls to the general 00229 // input function will effect the cell's current directly. NOTE: 00230 // Currently this is under construction. Using inputSynapse is 00231 // dangerous and could lead to scaling problems if modules are not at 00232 // the same timestep. the functionality of the default input is 00233 // completely ignored. We will also want to add a linked list 00234 // implementation. 00235 // ###################################################################### 00236 class IZNeuronSyn : public SimUnit 00237 { 00238 public: 00239 //! Constructor with default params 00240 IZNeuronSyn(const double& a = 0.15, // timescale of recovery variable 00241 const double& b = 8.0, // sensitivity of u to voltage 00242 const double& c = -55.0, // after-spike reset value of v 00243 const double& d = 200.0, // after-spike reset value of u 00244 const double& k = 1.0, // current voltage relationship 00245 const double& Cm = 20.0, // in microfarads 00246 const double& V_rest = -55.0, // in millivolts 00247 const double& V_thresh = -40.0, // in millivolts 00248 const double& V_peak = 25.0, // in millivolts 00249 const std::string& name = "Neuron", 00250 const std::string& units = "spike"); 00251 00252 //copy constructor 00253 IZNeuronSyn(const IZNeuronSyn& rhs); 00254 00255 //assignment 00256 IZNeuronSyn& operator=(const IZNeuronSyn& rhs); 00257 00258 //!destructor 00259 ~IZNeuronSyn(); 00260 00261 //set the voltage 00262 void setV(const double& voltage); 00263 00264 //!get the output for display purposes, the membrane voltage 00265 const double getDisplayOutput() const; 00266 00267 //!get the number of sub units 00268 const uint numSubs() const; 00269 00270 //!get sub unit 00271 const SimUnit& getSub(const uint i) const; 00272 00273 //!get the current voltage (mV) 00274 const double getV() const; 00275 00276 //!get the current current (pA) 00277 const double getI() const; 00278 00279 //!set an external current. 00280 void setI (const double& current); 00281 00282 //!setup the neuron and its parameters 00283 const IZNeuronSyn& setup(const std::string& name, 00284 const bool use_random = false); 00285 00286 //! add a synapse of a given type. Ratio is used to supply relative 00287 //! weighting to different receptor types. For example, in your 00288 //! model you would like the density of nmda receptors to be twice 00289 //! that of ampa receptors: 00290 //! addSynapse(NMDASynapse(), 2); addSynapse(AMPASynapse(), 1); 00291 template <class S, class I> 00292 void addSynapse(const Synapse<S, I>& synapse, const double& ratio = 1); 00293 00294 //input to a synapse of a particular type 00295 void inputSynapse(const double& input, const Receptor::Type receptor); 00296 00297 protected: 00298 //!get sub unit 00299 SimUnit& editSub(const uint i); 00300 00301 private: 00302 //! pointer cleanup 00303 void cleanup(); 00304 00305 //! integrate 1 time step 00306 double const doIntegrate(const SimTime& dt, 00307 const double& inp_exc, const double& inp_inh); 00308 00309 //!initialize or reset all receptors and variables 00310 void doInit(); 00311 00312 //!perform copy of IZNeuron 00313 IZNeuronSyn* doClone() const; 00314 00315 double itsI; 00316 IZNeuronFunc itsN; //our neuron 00317 00318 typedef std::pair<double, SimUnit*> pair; 00319 typedef std::map<Receptor::Type, pair > map; 00320 map itsS; 00321 }; 00322 */ 00323 00324 #endif 00325 // ###################################################################### 00326 /* So things look consistent in everyone's emacs... */ 00327 /* Local Variables: */ 00328 /* indent-tabs-mode: nil */ 00329 /* End: */