TarzaNN
TarzaNN neural network simulator
|
00001 /**************************************************************************** 00002 ** 00003 ** Copyright C 2002-2012 Laboratory for Active and Attentive Vision (LAAV), Department of Computer Science and Engineering, York University, Toronto, ON, Canada. 00004 ** All rights reserved. 00005 ** 00006 ** This file is part of the TarzaNN Neural Network Simulator. 00007 ** 00008 ** This file may be distributed and/or modified under the terms of the 00009 ** GNU General Public License version 2 as published by the Free Software 00010 ** Foundation and appearing in the file LICENSE.GPL included in the 00011 ** packaging of this file. 00012 ** 00013 ** See http://www.tarzann.org/gpl/ for GPL licensing information. 00014 ** 00015 ** Contact info@tarzann.org if any conditions of this licensing are 00016 ** not clear to you. 00017 ** 00018 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00019 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00020 ** 00021 ****************************************************************************/ 00022 00023 #include <QApplication> 00024 #include <QWidget> 00025 #include <QLayout> 00026 #include <QLineEdit> 00027 #include <QPushButton> 00028 #include <QLabel> 00029 #include <Q3ListView> 00030 #include <QEvent> 00031 #include <QGridLayout> 00032 #include <QPaintEvent> 00033 #include <QVector> 00034 00035 #include <qwt_plot.h> 00036 #include <qwt_plot_canvas.h> 00037 #include <qwt_plot_marker.h> 00038 #include <qwt_plot_curve.h> 00039 #include <qwt_scale_engine.h> 00040 #include <qwt_legend.h> 00041 #include <qwt_scale_draw.h> 00042 #include <qwt_math.h> 00043 00044 #include <math.h> 00045 #include "FeaturePlaneAbstract.h" 00046 #include "UI_Widget.h" 00047 00048 #define NPOINTS 5500 00049 class UI_NeuronTimeCourse : public UI_Widget, public Observer 00050 { 00051 Q_OBJECT 00052 public: 00053 UI_NeuronTimeCourse(FeaturePlaneAbstract* tmpFp, int x, int y, QWidget *p=0, const char *name=0); 00054 ~UI_NeuronTimeCourse(); 00055 virtual void updateNN(Observer* sourceFP, bool functional); 00056 virtual void paintEvent( QPaintEvent *e ); 00057 00058 #ifdef WIN32 //Fixing problem with plot->replot causing a crash 00059 virtual void update(); 00060 virtual void repaint(); 00061 #endif 00062 00063 FeaturePlaneAbstract *fp; 00064 QVector<int*> coords; 00065 QVector<double*>timecourses; 00066 QVector<QwtPlotCurve *> plotCurves; 00067 QVector<Q3ListViewItem *> theListItems; 00068 void insertPoint(int insertX, int insertY); 00069 00070 int neurons; 00071 public slots: 00072 void slotColorButtonClicked(); 00073 void slotInsertPoint(); 00074 private: 00075 void _slotInsertPoint(int insertX, int insertY); 00076 00077 QVBoxLayout* mainLayout; 00078 QwtPlot *plot; 00079 QPushButton *addCurveButton; 00080 QPushButton *colorValue; 00081 QLineEdit *editX, *editY; 00082 Q3ListView* theCurves; 00083 00084 QVector<QColor> defaultColors; 00085 int defaultColorsSize; 00086 double x[NPOINTS ]; 00087 int cur_point; 00088 00089 QMutex localAccess; 00090 };