00001 # ifndef NEURON_H 00002 # define NEURON_H 00003 00004 # include <axon.h> 00005 # include <math.h> 00006 # include <list> 00007 # include <iostream> 00008 # include <qglviewer.h> 00009 00010 using namespace qglviewer ; 00011 using namespace std; 00012 00013 class Neuron { 00014 private: 00015 list<Axon*> *axonsIn; 00016 list<Axon*> *axonsOut; 00017 int id; 00018 double outValue, outValueTemp, gradientValue, gradientValueTemp; 00019 ManipulatedFrame * frame_ ; 00020 00021 public: 00022 Neuron(int _id); 00023 00027 int getId(); 00028 double getOutValue(); 00029 double getGradientValue(); 00030 void setOutValue(double v); 00031 void setGradientValue(double v); 00032 00036 void draw( int selected, const bool names = false ) ; 00037 float getX( void ) ; 00038 float getY( void ) ; 00039 float getZ( void ) ; 00040 void setX( float x ) ; 00041 void setY( float y ) ; 00042 void setZ( float z ) ; 00043 ManipulatedFrame * frame( void ) ; 00044 00048 void addAxonIn(Axon *a); 00049 void removeAxonIn(int id_ax); 00050 void addAxonOut(Axon *a); 00051 void removeAxonOut(int id_ax); 00052 void removeAxons(); 00053 00057 void setOutValueTemp(double val); 00058 void incOutValueTemp(double val); 00059 void setGradientValueTemp(double val); 00060 void incGradientValueTemp(double val); 00061 double sigmoide(double val); 00062 double sigmoideDerived(double val); 00063 void computeOutValue(); 00064 void computeGradientValue(double err); 00065 void forwardPropagation(); 00066 void gradientBackPropagation(); 00067 }; 00068 00069 # endif