21#include "ui_triggerdetectionview.h"
29#include <QColorDialog>
52,
m_pUi(std::make_unique<Ui::TriggerDetectionViewWidget>())
57 this->setWindowTitle(
"Trigger Detection Settings");
58 this->setMinimumWidth(330);
59 this->setMaximumWidth(330);
80 connect(
m_pUi->m_checkBox_activateTriggerDetection, &QCheckBox::checkStateChanged,
83 m_pUi->m_comboBox_triggerChannels->clear();
91 connect(
m_pUi->m_comboBox_triggerChannels,
static_cast<void (QComboBox::*)(
const QString&)
>(&QComboBox::currentTextChanged),
94 connect(
m_pUi->m_comboBox_triggerColorType,
static_cast<void (QComboBox::*)(
const QString&)
>(&QComboBox::currentTextChanged),
97 connect(
m_pUi->m_pushButton_triggerColor,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
100 m_pUi->m_pushButton_triggerColor->setAutoFillBackground(
true);
101 m_pUi->m_pushButton_triggerColor->setFlat(
true);
102 QPalette palette =
m_pUi->m_pushButton_triggerColor->palette();
103 palette.setColor(QPalette::Button, QColor(177, 0, 0));
104 m_pUi->m_pushButton_triggerColor->setPalette(palette);
105 m_pUi->m_pushButton_triggerColor->update();
107 connect(
m_pUi->m_doubleSpinBox_detectionThresholdFirst,
static_cast<void (QDoubleSpinBox::*)(
double)
>(&QDoubleSpinBox::valueChanged),
110 connect(
m_pUi->m_spinBox_detectionThresholdSecond,
static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
113 connect(
m_pUi->m_pushButton_resetNumberTriggers,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
116 connect(
m_pUi->m_pushButton_DetectTriggers,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
128 m_pUi->m_label_numberDetectedTriggers->setText(QString(
"%1").arg(numberDetections));
132 QMapIterator<int, QList<QPair<int, double>>> i(mapDetectedTriggers);
133 while (i.hasNext()) {
136 for (
int j = 0; j < i.value().size(); ++j) {
137 if (
m_pUi->m_comboBox_triggerColorType->findText(QString::number(i.value().at(j).second)) == -1) {
138 m_pUi->m_comboBox_triggerColorType->addItem(QString::number(i.value().at(j).second));
152 QSettings settings(
"MNECPP");
154 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/Activated"),
m_pUi->m_checkBox_activateTriggerDetection->isChecked());
155 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/ChannelIndex"),
m_pUi->m_comboBox_triggerChannels->currentIndex());
156 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/FirstThresholdValue"),
m_pUi->m_doubleSpinBox_detectionThresholdFirst->value());
157 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/SecondThresholdValue"),
m_pUi->m_spinBox_detectionThresholdSecond->value());
159 settings.beginGroup(
m_sSettingsPath + QString(
"/TriggerDetectionView/Colors"));
162 settings.setValue(QString::number(i.key()), i.value());
176 QSettings settings(
"MNECPP");
178 m_pUi->m_checkBox_activateTriggerDetection->setChecked(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/Activated"),
false).toBool());
179 m_pUi->m_comboBox_triggerChannels->setCurrentIndex(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/ChannelIndex"), 0).toInt());
180 m_pUi->m_doubleSpinBox_detectionThresholdFirst->setValue(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/FirstThresholdValue"), 0.1).toDouble());
181 m_pUi->m_spinBox_detectionThresholdSecond->setValue(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/SecondThresholdValue"), -1).toInt());
183 settings.beginGroup(
m_sSettingsPath + QString(
"/TriggerDetectionView/Colors"));
184 QStringList keys = settings.childKeys();
185 foreach (QString key, keys) {
186 double dKey = key.toDouble();
212 m_pUi->label->hide();
213 m_pUi->label_9->hide();
214 m_pUi->m_pushButton_resetNumberTriggers->hide();
215 m_pUi->m_pushButton_triggerColor->hide();
216 m_pUi->m_checkBox_activateTriggerDetection->hide();
217 m_pUi->m_comboBox_triggerColorType->hide();
218 m_pUi->m_label_numberDetectedTriggers->hide();
219 m_pUi->m_pushButton_DetectTriggers->show();
222 m_pUi->label->show();
223 m_pUi->label_9->show();
224 m_pUi->m_pushButton_resetNumberTriggers->show();
225 m_pUi->m_pushButton_triggerColor->show();
226 m_pUi->m_checkBox_activateTriggerDetection->show();
227 m_pUi->m_comboBox_triggerColorType->show();
228 m_pUi->m_label_numberDetectedTriggers->show();
229 m_pUi->m_pushButton_DetectTriggers->hide();
239 m_pUi->m_checkBox_activateTriggerDetection->isChecked(),
240 m_pUi->m_comboBox_triggerChannels->currentText(),
241 m_pUi->m_doubleSpinBox_detectionThresholdFirst->value() * pow(10,
m_pUi->m_spinBox_detectionThresholdSecond->value()));
252 QColor color = QColorDialog::getColor(
m_qMapTriggerColor[
m_pUi->m_comboBox_triggerColorType->currentText().toDouble()],
this,
"Set trigger color");
254 if (!color.isValid()) {
259 QPalette palette =
m_pUi->m_pushButton_triggerColor->palette();
260 palette.setColor(QPalette::Button, color);
261 m_pUi->m_pushButton_triggerColor->setPalette(palette);
262 m_pUi->m_pushButton_triggerColor->update();
274 QPalette palette =
m_pUi->m_pushButton_triggerColor->palette();
276 m_pUi->m_pushButton_triggerColor->setPalette(palette);
277 m_pUi->m_pushButton_triggerColor->update();
284 m_pUi->m_label_numberDetectedTriggers->setText(QString(
"0"));
285 m_pUi->m_comboBox_triggerColorType->clear();
296 if (
m_pUi->m_comboBox_triggerChannels->currentText() ==
"") {
300 m_pUi->m_doubleSpinBox_detectionThresholdFirst->value() * pow(10,
m_pUi->m_spinBox_detectionThresholdSecond->value()));
307 return m_pUi->m_comboBox_triggerChannels->currentText();
constexpr auto FIFFV_STIM_CH
Full FIFF measurement metadata: everything from FIFFB_MEAS / FIFFB_MEAS_INFO needed to interpret a re...
Stim-channel chooser plus threshold spinbox for on-line trigger / event detection.
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()
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)
std::unique_ptr< Ui::TriggerDetectionViewWidget > m_pUi
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