00001 /*!@file CINNIC/contourNeuron.H 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/contourNeuron.H $ 00035 // $Id: contourNeuron.H 4663 2005-06-23 17:47:28Z rjpeters $ 00036 // 00037 00038 #ifndef CONTOURNEURON_H_DEFINED 00039 #define CONTOURNEURON_H_DEFINED 00040 00041 #include "Util/readConfig.H" 00042 #include "CINNIC/contourDefine.H" 00043 00044 // ############################################################ 00045 // ############################################################ 00046 // ##### ---CINNIC--- 00047 // ##### Contour Integration: 00048 // ##### T. Nathan Mundhenk nathan@mundhenk.com 00049 // ############################################################ 00050 // ############################################################ 00051 //CLASSES: 00052 //PropHold 00053 //ContourNeuronCreate 00054 00055 extern float AngleDropOff,AngleSupress,SupMult,OrthA,OrthB,OrthMult,valueCutOff; 00056 extern float coLinearCutOff; 00057 extern float NeuronExSize,NeuronSupSize,NeuronSupStart,NeuronOrthSize; 00058 extern float CoLinearDiff; 00059 extern float NeuralAngles[AnglesUsed]; 00060 extern float XCenter, YCenter, ExReach, SupReach,OrthReach; 00061 00062 //############################################################# 00063 //! this is a container class for the property at each hyper pixel for ContourNeuronCreate 00064 /*! This class is used to hold the properties of each hyper pixel in in the 4D 00065 neural template. each of the floats used here are essentilly weights used 00066 when a pixel in the ImageMap is run against each of the other pixels. In 00067 essence it simulates the connection weights of each neuron to each other 00068 neuron. This is used by ContourNeuronCreate. 00069 */ 00070 00071 class PropHold 00072 { 00073 public: 00074 //! misalignement modifier 00075 float mis; 00076 //! Beta angle modifier 00077 float ang; 00078 //! Alpha angle modifier 00079 float ang2; 00080 //! Aux angle modifer 00081 float ang3; 00082 //! Product of Alpha and Beta 00083 float angAB; 00084 //! Product of Alpha,Beta and distance 00085 float angABD; 00086 //! Generic distance modifier 00087 float dis; 00088 //! Excitation distance modifier 00089 float Edis; 00090 //! Supression distance modifier 00091 float Sdis; 00092 //! orthogonal distance modifier 00093 float Odis; 00094 //Mis-alignment of other neuron, angle to other neuron 00095 //(ang = 0-1-0,ang2 = 0-180), distance to other neuron 00096 //! polarity of hyper pixel 00097 bool pol; 00098 //! True if hyper pixel can pass on energy 00099 bool sender; 00100 //! true if this pixel is co-linear to the perfered angle 00101 bool coLinear; 00102 //! true if this pixel is fully orthogonoal to the perfered angle 00103 bool fullOrth; 00104 //! True if this hyper pixel is non-zero 00105 bool zero; //if true then neuron may recieve a charge, quad determins if 00106 //sender or reciever . zero is true if contains no data in this element 00107 //! This is true if the element is and orthogonal excitation connection 00108 bool orth; 00109 00110 }; 00111 00112 // ############################################################ 00113 00114 //! This class will create the neuron connection template 00115 /*! This class creates the 4D neuron template. It processes 00116 the excitation and inhabition each neuron should have to 00117 another neuron given the property of the two neurons. 00118 The result is a set of weights. The weight for each 00119 hyperpixel is held in PropHold. The entire set is held 00120 in a 4D array called FourDNeuralMap. 00121 */ 00122 00123 template <class TC2> class ContourNeuronCreate 00124 { 00125 private: 00126 float hold,theta,phi,OT; 00127 bool stop; 00128 float distanceX, distanceY,distance,AngleAlpha,AngleBeta; 00129 float Angle, AngleA; 00130 float ii,jj,kk,ll; 00131 float one; 00132 float factor,factor2,OFactorA,OFactorB; 00133 float foo; 00134 float bar; 00135 float FloatAngleCenter; 00136 public: 00137 //! create the 4D neuron map, return that map 00138 PropHold FourDNeuralMap[AnglesUsed][AnglesUsed][XSize+1][YSize+1]; 00139 //! find the ratio of XMax to X from 0 to 1 00140 float FindRatio(TC2& XMax,TC2& X); 00141 //! find the length from center to coord X,Y 00142 float FindDistance(TC2& PiX, TC2& PiY); 00143 //! Calculate the where the center pixel is 00144 void FindCenter(); 00145 //! calculate the reach of excitation or inhabition 00146 void FindReach(); 00147 //! find the angle to X,Y from the Center 00148 float FindAngleToRad(TC2& X, TC2& Y); 00149 //! Transform angle from radians to degrees 00150 float FindRadToDeg(TC2& r); 00151 //! Convert along linear function y=mx+b 00152 float FindLinear(TC2& m,TC2& n,TC2& o,TC2& x,TC2& b); 00153 //! common sigmoidal function 00154 float sigmoid(TC2& beta, TC2& v); 00155 //! Return the completed neuron 00156 PropHold GetCompleteNeuron(); 00157 //! Create the neuron using config file parameters 00158 /*! @param &config This is the config file object contaning parameters 00159 */ 00160 void CreateNeuron(readConfig &config); 00161 }; 00162 00163 #endif 00164 00165 // ###################################################################### 00166 /* So things look consistent in everyone's emacs... */ 00167 /* Local Variables: */ 00168 /* indent-tabs-mode: nil */ 00169 /* End: */