00001 /*!@file staticContourNeuronProp.H CINNIC classes */ 00002 //! Holds the property for each neuron 00003 /*! this class is used to process and hold the membrane potential 00004 of each neuron. It keeps track of total potential as well as 00005 potential that is "up" or "down" that is, to simulate the 00006 effects of tranfering energy from neuron to another neuron it 00007 holds energy in either a positive or negative energy bank. 00008 */ 00009 00010 00011 // //////////////////////////////////////////////////////////////////// // 00012 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00013 // University of Southern California (USC) and the iLab at USC. // 00014 // See http://iLab.usc.edu for information about this project. // 00015 // //////////////////////////////////////////////////////////////////// // 00016 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00017 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00018 // in Visual Environments, and Applications'' by Christof Koch and // 00019 // Laurent Itti, California Institute of Technology, 2001 (patent // 00020 // pending; application number 09/912,225 filed July 23, 2001; see // 00021 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00022 // //////////////////////////////////////////////////////////////////// // 00023 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00024 // // 00025 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00026 // redistribute it and/or modify it under the terms of the GNU General // 00027 // Public License as published by the Free Software Foundation; either // 00028 // version 2 of the License, or (at your option) any later version. // 00029 // // 00030 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00031 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00032 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00033 // PURPOSE. See the GNU General Public License for more details. // 00034 // // 00035 // You should have received a copy of the GNU General Public License // 00036 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00037 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00038 // Boston, MA 02111-1307 USA. // 00039 // //////////////////////////////////////////////////////////////////// // 00040 // 00041 // Primary maintainer for this file: T. Nathan Mundhenk <mundhenk@usc.edu> 00042 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/CINNIC/staticContourNeuronProp.H $ 00043 // $Id: staticContourNeuronProp.H 5270 2005-08-09 03:56:55Z mundhenk $ 00044 00045 // ############################################################ 00046 // ############################################################ 00047 // ##### ---CINNIC2--- 00048 // ##### Contour Integration: 00049 // ##### T. Nathan Mundhenk nathan@mundhenk.com 00050 // ############################################################ 00051 // ############################################################ 00052 00053 #ifndef STATICCONTOURNEURONPROP2_H_DEFINED 00054 #define STATICCONTOURNEURONPROP2_H_DEFINED 00055 00056 //! Holds generally non-temporal neuron properties 00057 template <class FLOAT, class INT> class staticContourNeuronProp 00058 { 00059 private: 00060 //! this is how many other active neurons I connect to 00061 unsigned int sCNP_activeNeuronCount; 00062 //! This neurons unique ID 00063 INT sCNP_ID; 00064 //! group modifier, a pointer 00065 FLOAT *sCNP_groupMod; 00066 //! list of whether a neuron interaction is excite or supress 00067 std::vector<bool> sCNP_otherNeuronPol; 00068 //! list of coordinates to other active connected neurons 00069 std::vector<unsigned char> sCNP_otherNeuronAlpha; 00070 //! list of coordinates to other active connected neurons 00071 std::vector<unsigned char> sCNP_otherNeuron_i; 00072 //! list of coordinates to other active connected neurons 00073 std::vector<unsigned char> sCNP_otherNeuron_j; 00074 //! list of weight computed between neurons 00075 std::vector<FLOAT> sCNP_weightStoreValue; 00076 00077 public: 00078 //! the amount to resize any vector when resize is called 00079 const static int sCNP_vecSize = 32; 00080 //! default constructor 00081 staticContourNeuronProp(); 00082 //! destructor 00083 ~staticContourNeuronProp(); 00084 //! set the ID of this neuron 00085 inline void sCNP_setID(const INT ID); 00086 //! get this neurons ID 00087 inline INT sCNP_getID() const; 00088 //! set a local copy of this neurons group modifer 00089 inline void sCNP_setGroupMod(FLOAT *gmod); 00090 //! get a local copy of this neurons group modifer 00091 inline FLOAT* sCNP_getGroupMod() const; 00092 //! insert another neuron as active to this one 00093 inline void sCNP_insertStoreList(const unsigned char a, 00094 const unsigned char i, 00095 const unsigned char j, 00096 const bool polarity, 00097 const FLOAT storeVal); 00098 00099 //! get polarity to other neuron 00100 inline bool sCNP_getOtherNeuronPol( unsigned int i) const; 00101 //! get the weight value to the other neuron 00102 inline FLOAT sCNP_getWeightStoreVal( unsigned int i) const; 00103 //! get coords to the other neuron 00104 inline unsigned char sCNP_getOtherNeuronAlpha(unsigned int i) const; 00105 //! get coords to the other neuron 00106 inline unsigned char sCNP_getOtherNeuron_i( unsigned int i) const; 00107 //! get coords to the other neuron 00108 inline unsigned char sCNP_getOtherNeuron_j( unsigned int i) const; 00109 //! get how many active neurons there are 00110 inline unsigned int sCNP_getActiveNeuronCount() const; 00111 }; 00112 00113 //################################################################# 00114 template <class FLOAT, class INT> 00115 inline staticContourNeuronProp<FLOAT,INT>::staticContourNeuronProp() 00116 { 00117 sCNP_activeNeuronCount = 0; 00118 00119 sCNP_otherNeuronAlpha.resize(sCNP_activeNeuronCount + sCNP_vecSize,0); 00120 sCNP_otherNeuron_i.resize(sCNP_activeNeuronCount + sCNP_vecSize,0); 00121 sCNP_otherNeuron_j.resize(sCNP_activeNeuronCount + sCNP_vecSize,0); 00122 sCNP_otherNeuronPol.resize(sCNP_activeNeuronCount + sCNP_vecSize,false); 00123 sCNP_weightStoreValue.resize(sCNP_activeNeuronCount + sCNP_vecSize,0.0F); 00124 } 00125 00126 //################################################################# 00127 template <class FLOAT, class INT> 00128 inline staticContourNeuronProp<FLOAT,INT>::~staticContourNeuronProp() 00129 {} 00130 00131 //################################################################# 00132 template <class FLOAT, class INT> 00133 inline void staticContourNeuronProp<FLOAT,INT>::sCNP_setID(const INT ID) 00134 { 00135 sCNP_ID = ID; 00136 } 00137 00138 //################################################################# 00139 template <class FLOAT, class INT> 00140 inline INT staticContourNeuronProp<FLOAT,INT>::sCNP_getID() const 00141 { 00142 return sCNP_ID; 00143 } 00144 00145 //################################################################# 00146 template <class FLOAT, class INT> 00147 inline void staticContourNeuronProp<FLOAT,INT>::sCNP_setGroupMod(FLOAT *gmod) 00148 { 00149 sCNP_groupMod = gmod; 00150 } 00151 00152 //################################################################# 00153 template <class FLOAT, class INT> 00154 inline FLOAT *staticContourNeuronProp<FLOAT,INT>::sCNP_getGroupMod() const 00155 { 00156 return sCNP_groupMod; 00157 } 00158 00159 //################################################################# 00160 template <class FLOAT, class INT> 00161 inline void staticContourNeuronProp<FLOAT,INT>::sCNP_insertStoreList( 00162 const unsigned char a, 00163 const unsigned char i, 00164 const unsigned char j, 00165 const bool polarity, 00166 const FLOAT storeVal) 00167 { 00168 if(sCNP_activeNeuronCount == (sCNP_weightStoreValue.size() - 1)) 00169 { 00170 sCNP_otherNeuronAlpha.resize(sCNP_activeNeuronCount + sCNP_vecSize); 00171 sCNP_otherNeuron_i.resize(sCNP_activeNeuronCount + sCNP_vecSize); 00172 sCNP_otherNeuron_j.resize(sCNP_activeNeuronCount + sCNP_vecSize); 00173 sCNP_otherNeuronPol.resize(sCNP_activeNeuronCount + sCNP_vecSize); 00174 sCNP_weightStoreValue.resize(sCNP_activeNeuronCount + sCNP_vecSize); 00175 } 00176 00177 sCNP_otherNeuronAlpha[sCNP_activeNeuronCount] = a; 00178 sCNP_otherNeuron_i[sCNP_activeNeuronCount] = i; 00179 sCNP_otherNeuron_j[sCNP_activeNeuronCount] = j; 00180 sCNP_otherNeuronPol[sCNP_activeNeuronCount] = polarity; 00181 sCNP_weightStoreValue[sCNP_activeNeuronCount] = storeVal; 00182 00183 sCNP_activeNeuronCount++; 00184 } 00185 00186 //################################################################# 00187 template <class FLOAT, class INT> inline bool 00188 staticContourNeuronProp<FLOAT,INT>::sCNP_getOtherNeuronPol(unsigned int i) const 00189 { 00190 return sCNP_otherNeuronPol[i]; 00191 } 00192 00193 //################################################################# 00194 template <class FLOAT, class INT> inline FLOAT 00195 staticContourNeuronProp<FLOAT,INT>::sCNP_getWeightStoreVal(unsigned int i) const 00196 { 00197 return sCNP_weightStoreValue[i]; 00198 } 00199 00200 //################################################################# 00201 template <class FLOAT, class INT> inline unsigned char 00202 staticContourNeuronProp<FLOAT,INT>::sCNP_getOtherNeuronAlpha(unsigned int i) const 00203 { 00204 return sCNP_otherNeuronAlpha[i]; 00205 } 00206 00207 //################################################################# 00208 template <class FLOAT, class INT> inline unsigned char 00209 staticContourNeuronProp<FLOAT,INT>::sCNP_getOtherNeuron_i(unsigned int i) const 00210 { 00211 return sCNP_otherNeuron_i[i]; 00212 } 00213 00214 //################################################################# 00215 template <class FLOAT, class INT> inline unsigned char 00216 staticContourNeuronProp<FLOAT,INT>::sCNP_getOtherNeuron_j(unsigned int i) const 00217 { 00218 return sCNP_otherNeuron_j[i]; 00219 } 00220 //################################################################# 00221 template <class FLOAT, class INT> inline unsigned int 00222 staticContourNeuronProp<FLOAT,INT>::sCNP_getActiveNeuronCount() const 00223 { 00224 return sCNP_activeNeuronCount; 00225 } 00226 00227 00228 #endif