00001 /*!@file CINNIC/contourNeuronProp.C CINNIC classes */ 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: T Nathan Mundhenk <mundhenk@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/CINNIC/contourNeuronProp.C $ 00035 // $Id: contourNeuronProp.C 4663 2005-06-23 17:47:28Z rjpeters $ 00036 // 00037 00038 #include "CINNIC/contourNeuronProp.H" 00039 #include "Util/log.H" 00040 00041 // ############################################################ 00042 // ############################################################ 00043 // ##### ---CINNIC--- 00044 // ##### Contour Integration: 00045 // ##### T. Nathan Mundhenk nathan@mundhenk.com 00046 // ############################################################ 00047 // ############################################################ 00048 00049 00050 00051 //################################################################# 00052 /*!This method when called will place a charge in this neuron telling it 00053 where the charge came from and the polarity properties of the placing 00054 neuron 00055 */ 00056 00057 template <class CH, class X, class Y> 00058 ContourNeuronProp<CH,X,Y>::ContourNeuronProp() 00059 { 00060 } 00061 00062 template <class CH, class X, class Y> 00063 ContourNeuronProp<CH,X,Y>::~ContourNeuronProp() 00064 { 00065 } 00066 00067 template <class CH, class X, class Y> 00068 CH& ContourNeuronProp<CH,X,Y>::getCharge() 00069 { 00070 return charge; 00071 } 00072 00073 template <class CH, class X, class Y> 00074 CH& ContourNeuronProp<CH,X,Y>::getThreshold() 00075 { 00076 return threshold; 00077 } 00078 00079 template <class CH, class X, class Y> 00080 CH& ContourNeuronProp<CH,X,Y>::getSupressionMod() 00081 { 00082 return supressionMod; 00083 } 00084 00085 template <class CH, class X, class Y> 00086 void ContourNeuronProp<CH,X,Y>::setSupressionMod(CH& sup) 00087 { 00088 supressionMod = sup; 00089 } 00090 00091 template <class CH, class X, class Y> 00092 void ContourNeuronProp<CH,X,Y>::setSupressionBool() 00093 { 00094 supress = false; 00095 } 00096 00097 template <class CH, class X, class Y> 00098 void ContourNeuronProp<CH,X,Y>::setSupressionThresh(CH& thresh, CH& changeVal, CH& max) 00099 { 00100 supressionModThresh = thresh; 00101 supressionModChange = changeVal; 00102 supressionCeiling = max; 00103 } 00104 00105 template <class CH, class X, class Y> 00106 void ContourNeuronProp<CH,X,Y>::Charge(CH& _charge, bool _pol, bool _sender) 00107 { 00108 if(_pol == true) 00109 { 00110 if(_charge > 0) 00111 { 00112 chargePos+=(_charge*(float)(1/resistance)); 00113 //add charges which will go to pos polarity synapses 00114 } 00115 } 00116 else 00117 { 00118 if(_charge > 0) 00119 { 00120 chargeNeg+=(_charge*(float)(1/resistance)); 00121 //add charges which will go to neg polarity synapses 00122 } 00123 } 00124 charge+=_charge; 00125 } 00126 00127 template <class CH, class X, class Y> 00128 void ContourNeuronProp<CH,X,Y>::ChargeSimple(CH& _charge) 00129 { 00130 charge+=_charge; 00131 } 00132 00133 /*!This method when called will return all the charges that should go to a 00134 another neuron from this neuron given the other neurons polarity 00135 */ 00136 template <class CH, class X, class Y> 00137 CH& ContourNeuronProp<CH,X,Y>::DisCharge(bool _pol, bool _sender, int a, int cascadeType) 00138 { 00139 if(_sender == true) 00140 { 00141 discharge = 0; 00142 } 00143 else 00144 { 00145 if((a == 0) || (cascadeType == 2))// allow cross over for cascade at 0 degrees 00146 { 00147 discharge = chargePos + chargeNeg; 00148 } 00149 else 00150 { 00151 if(_pol == true) 00152 { 00153 discharge = chargePos; 00154 } 00155 else 00156 { 00157 discharge = chargeNeg; 00158 } 00159 } 00160 } 00161 return discharge; 00162 } 00163 00164 /*!this method stores the neurons fireing threshold at which point 00165 it fires a salience charge 00166 */ 00167 template <class CH, class X, class Y> 00168 void ContourNeuronProp<CH,X,Y>::setThreshold(CH& Threshold, CH& Resistance) 00169 { 00170 threshold = Threshold; 00171 resistance = 1/Resistance; 00172 } 00173 00174 /*!This method resets the place counter for the charge storage 00175 vector in effect putting its charge to 0; 00176 */ 00177 template <class CH, class X, class Y> 00178 void ContourNeuronProp<CH,X,Y>::ResetTempCharge() 00179 { 00180 chargePos = 0; 00181 chargeNeg = 0; 00182 } 00183 00184 template <class CH, class X, class Y> 00185 void ContourNeuronProp<CH,X,Y>::ResetCharge() 00186 { 00187 charge = 0; 00188 } 00189 00190 template <class CH, class X, class Y> 00191 void ContourNeuronProp<CH,X,Y>::ResetChargeAll() 00192 { 00193 charge = 0; 00194 chargePos = 0; 00195 chargeNeg = 0; 00196 } 00197 00198 template <class CH, class X, class Y> 00199 void ContourNeuronProp<CH,X,Y>::setUpperLimit() 00200 { 00201 // FIXME had to comment this out because 'upperLimit' is not declared 00202 // anywhere 00203 00204 // charge = upperLimit; 00205 } 00206 00207 #if 0 00208 // commented this section out; see explanation in contourNeuronProp.H 00209 00210 void ContourNeuronPropVec::setSize(int t, int i, int j, int k) 00211 { 00212 T=t;I=i;J=j;K=k; 00213 LINFO("setting image size as %d,%d,%d,%d",T,I,J,K); 00214 ContourNeuronProp<float,int,int> Ptemp[T][I][J][K]; 00215 NeuronMatrix[T][I][J][K] = ****Ptemp; 00216 LINFO("done"); 00217 } 00218 00219 int ContourNeuronPropVec::getSizeT() 00220 { 00221 return T; 00222 } 00223 00224 #endif 00225 00226 template class ContourNeuronProp<float, int, int>; 00227 00228 // ###################################################################### 00229 /* So things look consistent in everyone's emacs... */ 00230 /* Local Variables: */ 00231 /* indent-tabs-mode: nil */ 00232 /* End: */