21#include "ui_triggerdetectionview.h"
29#include <QColorDialog>
52,
m_pUi(new Ui::TriggerDetectionViewWidget)
57 this->setWindowTitle(
"Trigger Detection Settings");
58 this->setMinimumWidth(330);
59 this->setMaximumWidth(330);
82 connect(
m_pUi->m_checkBox_activateTriggerDetection, &QCheckBox::checkStateChanged,
85 m_pUi->m_comboBox_triggerChannels->clear();
93 connect(
m_pUi->m_comboBox_triggerChannels,
static_cast<void (QComboBox::*)(
const QString&)
>(&QComboBox::currentTextChanged),
96 connect(
m_pUi->m_comboBox_triggerColorType,
static_cast<void (QComboBox::*)(
const QString&)
>(&QComboBox::currentTextChanged),
99 connect(
m_pUi->m_pushButton_triggerColor,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
102 m_pUi->m_pushButton_triggerColor->setAutoFillBackground(
true);
103 m_pUi->m_pushButton_triggerColor->setFlat(
true);
104 QPalette* palette1 =
new QPalette();
105 palette1->setColor(QPalette::Button,QColor(177,0,0));
106 m_pUi->m_pushButton_triggerColor->setPalette(*palette1);
107 m_pUi->m_pushButton_triggerColor->update();
109 connect(
m_pUi->m_doubleSpinBox_detectionThresholdFirst,
static_cast<void (QDoubleSpinBox::*)(
double)
>(&QDoubleSpinBox::valueChanged),
112 connect(
m_pUi->m_spinBox_detectionThresholdSecond,
static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
115 connect(
m_pUi->m_pushButton_resetNumberTriggers,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
118 connect(
m_pUi->m_pushButton_DetectTriggers,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
130 m_pUi->m_label_numberDetectedTriggers->setText(QString(
"%1").arg(numberDetections));
134 QMapIterator<int,QList<QPair<int,double> > > i(mapDetectedTriggers);
135 while (i.hasNext()) {
138 for(
int j = 0; j < i.value().size(); ++j) {
139 if(
m_pUi->m_comboBox_triggerColorType->findText(QString::number(i.value().at(j).second)) == -1) {
140 m_pUi->m_comboBox_triggerColorType->addItem(QString::number(i.value().at(j).second));
154 QSettings settings(
"MNECPP");
156 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/Activated"),
m_pUi->m_checkBox_activateTriggerDetection->isChecked());
157 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/ChannelIndex"),
m_pUi->m_comboBox_triggerChannels->currentIndex());
158 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/FirstThresholdValue"),
m_pUi->m_doubleSpinBox_detectionThresholdFirst->value());
159 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/SecondThresholdValue"),
m_pUi->m_spinBox_detectionThresholdSecond->value());
161 settings.beginGroup(
m_sSettingsPath + QString(
"/TriggerDetectionView/Colors"));
164 settings.setValue(QString::number(i.key()), i.value());
178 QSettings settings(
"MNECPP");
180 m_pUi->m_checkBox_activateTriggerDetection->setChecked(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/Activated"),
false).toBool());
181 m_pUi->m_comboBox_triggerChannels->setCurrentIndex(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/ChannelIndex"), 0).toInt());
182 m_pUi->m_doubleSpinBox_detectionThresholdFirst->setValue(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/FirstThresholdValue"), 0.1).toDouble());
183 m_pUi->m_spinBox_detectionThresholdSecond->setValue(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/SecondThresholdValue"), -1).toInt());
185 settings.beginGroup(
m_sSettingsPath + QString(
"/TriggerDetectionView/Colors"));
186 QStringList keys = settings.childKeys();
187 foreach (QString key, keys) {
188 double dKey = key.toDouble();
214 m_pUi->label->hide();
215 m_pUi->label_9->hide();
216 m_pUi->m_pushButton_resetNumberTriggers->hide();
217 m_pUi->m_pushButton_triggerColor->hide();
218 m_pUi->m_checkBox_activateTriggerDetection->hide();
219 m_pUi->m_comboBox_triggerColorType->hide();
220 m_pUi->m_label_numberDetectedTriggers->hide();
221 m_pUi->m_pushButton_DetectTriggers->show();
224 m_pUi->label->show();
225 m_pUi->label_9->show();
226 m_pUi->m_pushButton_resetNumberTriggers->show();
227 m_pUi->m_pushButton_triggerColor->show();
228 m_pUi->m_checkBox_activateTriggerDetection->show();
229 m_pUi->m_comboBox_triggerColorType->show();
230 m_pUi->m_label_numberDetectedTriggers->show();
231 m_pUi->m_pushButton_DetectTriggers->hide();
241 m_pUi->m_checkBox_activateTriggerDetection->isChecked(),
242 m_pUi->m_comboBox_triggerChannels->currentText(),
243 m_pUi->m_doubleSpinBox_detectionThresholdFirst->value()*pow(10,
m_pUi->m_spinBox_detectionThresholdSecond->value()));
254 QColor color = QColorDialog::getColor(
m_qMapTriggerColor[
m_pUi->m_comboBox_triggerColorType->currentText().toDouble()],
this,
"Set trigger color");
257 QPalette* palette1 =
new QPalette();
258 palette1->setColor(QPalette::Button,color);
259 m_pUi->m_pushButton_triggerColor->setPalette(*palette1);
260 m_pUi->m_pushButton_triggerColor->update();
272 QPalette* palette1 =
new QPalette();
274 m_pUi->m_pushButton_triggerColor->setPalette(*palette1);
275 m_pUi->m_pushButton_triggerColor->update();
282 m_pUi->m_label_numberDetectedTriggers->setText(QString(
"0"));
283 m_pUi->m_comboBox_triggerColorType->clear();
294 if(
m_pUi->m_comboBox_triggerChannels->currentText() ==
""){
298 m_pUi->m_doubleSpinBox_detectionThresholdFirst->value()*pow(10,
m_pUi->m_spinBox_detectionThresholdSecond->value()));
305 return m_pUi->m_comboBox_triggerChannels->currentText();
Stim-channel chooser plus threshold spinbox for on-line trigger / event detection.
Full FIFF measurement metadata: everything from FIFFB_MEAS / FIFFB_MEAS_INFO needed to interpret a re...
FIFF file I/O, in-memory data structures and high-level readers/writers.
2-D display widgets and visualisation helpers (charts, topography, colour maps).
AbstractView(QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
void resetTriggerCounter()
Ui::TriggerDetectionViewWidget * m_pUi
void onRealTimeTriggerColorChanged(bool state)
TriggerDetectionView(const QString &sSettingsPath="", QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
QMap< double, QColor > m_qMapTriggerColor
void setNumberDetectedTriggersAndTypes(int totalNumberDetections, const QMap< int, QList< QPair< int, double > > > &mapDetectedTriggers)
QSharedPointer< FIFFLIB::FiffInfo > m_pFiffInfo
void onResetTriggerNumbers()
void onRealTimeTriggerColorTypeChanged(const QString &value)
void init(const QSharedPointer< FIFFLIB::FiffInfo > pFiffInfo)
void updateGuiMode(GuiMode mode)
void triggerInfoChanged(const QMap< double, QColor > &value, bool bActive, const QString &sTriggerCh, double dThreshold)
void updateProcessingMode(ProcessingMode mode)
QString getSelectedStimChannel()
void onTriggerInfoChanged()
void detectTriggers(const QString &sChannelName, double iThreshold)
QSharedPointer< FiffInfo > SPtr