SpikeStream Nemo Plugin
0.2
|
00001 #ifndef NEMOWIDGET_H 00002 #define NEMOWIDGET_H 00003 00004 //SpikeStream includes 00005 #include "MembranePotentialGraphDialog.h" 00006 #include "NemoWrapper.h" 00007 #include "SpikeRasterDialog.h" 00008 #include "SpikeStreamTypes.h" 00009 #include "RGBColor.h" 00010 00011 //Qt includes 00012 #include <QAction> 00013 #include <QCheckBox> 00014 #include <QComboBox> 00015 #include <QGroupBox> 00016 #include <QLabel> 00017 #include <QLineEdit> 00018 #include <QMutex> 00019 #include <QProgressDialog> 00020 #include <QPushButton> 00021 #include <QRadioButton> 00022 #include <QTimer> 00023 #include <QToolBar> 00024 #include <QWidget> 00025 00026 namespace spikestream { 00027 00029 class NemoWidget : public QWidget { 00030 Q_OBJECT 00031 00032 public: 00033 NemoWidget(QWidget* parent = 0); 00034 ~NemoWidget(); 00035 00036 private slots: 00037 void archiveStateChanged(int state); 00038 void checkLoadingProgress(); 00039 void checkResetWeightsProgress(); 00040 void checkSaveWeightsProgress(); 00041 void deleteMembranePotentialGraphDialog(int); 00042 void deleteRasterPlotDialog(int); 00043 void experimentEnded(); 00044 void experimentStarted(); 00045 void injectNoiseButtonClicked(); 00046 void injectPatternButtonClicked(); 00047 void loadPattern(QString comboStr); 00048 void loadSimulation(); 00049 void memPotGraphButtonClicked(); 00050 void monitorChanged(int state); 00051 void monitorNeuronsStateChanged(int monitorType); 00052 void nemoWrapperFinished(); 00053 void networkChanged(); 00054 void rasterButtonClicked(); 00055 void resetWeights(); 00056 void setArchiveDescription(); 00057 void setNeuronParameters(); 00058 void setNemoParameters(); 00059 void setSynapseParameters(); 00060 void saveWeights(); 00061 void setMonitorWeights(bool enable); 00062 void simulationRateChanged(int comboIndex); 00063 void simulationStopped(); 00064 void startSimulation(); 00065 void startStopSimulation(); 00066 void stepSimulation(); 00067 void stopSimulation(); 00068 void sustainNoiseChanged(bool enabled); 00069 void sustainPatternChanged(bool enabled); 00070 void unloadSimulation(bool confirmWithUser=true); 00071 void updateProgress(int stepsCompleted, int totalSteps); 00072 void updateTimeStep(unsigned int timeStep); 00073 void updateTimeStep(unsigned int timeStep, const QList<unsigned>& neuronIDList); 00074 void updateTimeStep(unsigned int timeStep, const QHash<unsigned, float>& membranePotentialMap); 00075 00076 private: 00077 //======================== VARIABLES ======================== 00079 NemoWrapper* nemoWrapper; 00080 00082 QGroupBox* mainGroupBox; 00083 00085 QGroupBox* monitorGroupBox; 00086 00088 QGroupBox* injectGroupBox; 00089 00091 QWidget* controlsWidget; 00092 00094 QPushButton* loadButton; 00095 00097 QPushButton* unloadButton; 00098 00100 QPushButton* neuronParametersButton; 00101 00103 QPushButton* synapseParametersButton; 00104 00106 QPushButton* nemoParametersButton; 00107 00109 QToolBar* toolBar; 00110 00112 QAction* playAction; 00113 00115 QAction* stopAction; 00116 00118 QAction* stepAction; 00119 00121 QRadioButton* noMonitorNeuronsButton; 00122 00124 QRadioButton* monitorFiringNeuronsButton; 00125 00127 QRadioButton* monitorMemPotNeuronsButton; 00128 00130 QPushButton* rasterButton; 00131 00133 QCheckBox* monitorWeightsCheckBox; 00134 00136 QCheckBox* archiveCheckBox; 00137 00139 QLineEdit* archiveDescriptionEdit; 00140 00142 QPushButton* setArchiveDescriptionButton; 00143 00145 QComboBox* simulationRateCombo; 00146 00148 QLabel* timeStepLabel; 00149 00151 QPushButton* saveWeightsButton; 00152 00154 QPushButton* resetWeightsButton; 00155 00157 QProgressDialog* progressDialog; 00158 00160 QMutex mutex; 00161 00163 bool taskCancelled; 00164 00166 RGBColor* neuronColor; 00167 00169 QTimer* loadingTimer; 00170 00172 QTimer* heavyTaskTimer; 00173 00175 bool updatingProgress; 00176 00178 QCheckBox* sustainNoiseChkBox; 00179 00181 QPushButton* injectNoiseButton; 00182 00184 QComboBox* injectNoisePercentCombo; 00185 00188 QComboBox* injectNoiseCurrentCombo; 00189 00191 QComboBox* injectNoiseNeuronGroupCombo; 00192 00194 QComboBox* injectPatternNeurGrpCombo; 00195 00197 QComboBox* patternCombo; 00198 00201 QComboBox* patternCurrentCombo; 00202 00204 QPushButton* injectPatternButton; 00205 00207 QCheckBox* sustainPatternChkBox; 00208 00210 QHash<QString, Pattern> patternMap; 00211 00214 QHash<int, RGBColor*> heatColorMap; 00215 00217 unsigned rasterDialogCtr; 00218 00221 QHash<unsigned, SpikeRasterDialog*> rasterDialogMap; 00222 00224 QPushButton* memPotGraphButton; 00225 00228 QHash<unsigned, MembranePotentialGraphDialog*> memPotGraphDialogMap; 00229 00230 //======================= METHODS ========================= 00231 bool checkForErrors(); 00232 void checkWidgetEnabled(); 00233 void createMembranePotentialColors(); 00234 void fillPatternCurrentCombo(); 00235 QString getFilePath(QString fileFilter); 00236 unsigned getNeuronGroupID(QString neurGrpStr); 00237 QString getPatternKey(const QString& patternComboText); 00238 QToolBar* getToolBar(); 00239 void loadNeuronGroups(); 00240 void setInjectNoise(bool sustain); 00241 void setInjectionPattern(bool sustain); 00242 }; 00243 00244 } 00245 00246 #endif//NEMOWIDGET_H 00247