v2.0.0
Loading...
Searching...
No Matches
minimumnormsettingsview.cpp
Go to the documentation of this file.
1//=============================================================================================================
15
16//=============================================================================================================
17// INCLUDES
18//=============================================================================================================
19
21
22#include "ui_minimumnormsettingsview.h"
23
24//=============================================================================================================
25// QT INCLUDES
26//=============================================================================================================
27
28#include <QFileDialog>
29#include <QFileInfo>
30#include <QPushButton>
31#include <QSettings>
32
33//=============================================================================================================
34// EIGEN INCLUDES
35//=============================================================================================================
36
37//=============================================================================================================
38// USED NAMESPACES
39//=============================================================================================================
40
41using namespace DISPLIB;
42
43//=============================================================================================================
44// DEFINE MEMBER METHODS
45//=============================================================================================================
46
48 const QString& sMethod,
49 QWidget *parent,
50 Qt::WindowFlags f)
51: AbstractView(parent, f)
52, m_pUi(new Ui::MinimumNormSettingsViewWidget)
53{
54 m_sSettingsPath = sSettingsPath;
55 m_sMethod = sMethod;
56 m_pUi->setupUi(this);
57
58 connect(m_pUi->m_comboBox_method, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
60
61 connect(m_pUi->m_comboBox_triggerType, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
63
64 connect(m_pUi->m_spinBox_timepoint, &QSpinBox::editingFinished,
66
67 connect(m_pUi->m_pushButton_browseModelCheckpoint, &QPushButton::clicked,
69
70 if(!m_sMethod.isEmpty())
71 {
72 m_pUi->m_comboBox_method->setCurrentIndex(m_pUi->m_comboBox_method->findText(m_sMethod));
73 m_pUi->m_comboBox_method->setEnabled(false);
74 }
75
76 updateCmneWidgetVisibility(m_pUi->m_comboBox_method->currentText());
77
78 this->setWindowTitle("InvMinimumNorm Settings");
79 this->setMinimumWidth(330);
80 this->setMaximumWidth(330);
81
83}
84
85//=============================================================================================================
86
92
93//=============================================================================================================
94
95void MinimumNormSettingsView::setTriggerTypes(const QStringList& lTriggerTypes)
96{
97 for(const QString &sTriggerType : lTriggerTypes) {
98 if(m_pUi->m_comboBox_triggerType->findText(sTriggerType) == -1) {
99 m_pUi->m_comboBox_triggerType->addItem(sTriggerType);
100 }
101 }
102}
103
104//=============================================================================================================
105
107{
108 if(m_sSettingsPath.isEmpty()) {
109 return;
110 }
111
112 QSettings settings("MNECPP");
113 settings.setValue(m_sSettingsPath + QString("/MinimumNormSettingsView/modelCheckpoint"),
115}
116
117//=============================================================================================================
118
120{
121 if(m_sSettingsPath.isEmpty()) {
122 return;
123 }
124
125 QSettings settings("MNECPP");
126 const QString sStored = settings.value(m_sSettingsPath + QString("/MinimumNormSettingsView/modelCheckpoint"),
127 QString()).toString();
128 if(!sStored.isEmpty()) {
129 setModelCheckpoint(sStored);
130 }
131}
132
133//=============================================================================================================
134
136{
137 switch(mode) {
139 break;
140 default: // default is research mode
141 break;
142 }
143}
144
145//=============================================================================================================
146
148{
149 switch(mode) {
151 break;
152 default: // default is realtime mode
153 break;
154 }
155}
156
157//=============================================================================================================
158
160{
162 emit methodChanged(method);
163}
164
165//=============================================================================================================
166
168{
169 if(m_sModelCheckpoint == sPath) {
170 return;
171 }
172 m_sModelCheckpoint = sPath;
173 m_pUi->m_lineEdit_modelCheckpoint->setText(sPath);
174 saveSettings();
175 emit modelCheckpointChanged(sPath);
176}
177
178//=============================================================================================================
179
184
185//=============================================================================================================
186
188{
189 const bool bIsCmne = (method == QLatin1String("CMNE"));
190 m_pUi->m_label_modelCheckpoint->setVisible(bIsCmne);
191 m_pUi->m_lineEdit_modelCheckpoint->setVisible(bIsCmne);
192 m_pUi->m_pushButton_browseModelCheckpoint->setVisible(bIsCmne);
193}
194
195//=============================================================================================================
196
198{
199 const QString sStartDir = m_sModelCheckpoint.isEmpty() ? QString()
200 : QFileInfo(m_sModelCheckpoint).absolutePath();
201 const QString sFile = QFileDialog::getOpenFileName(this,
202 tr("Select CMNE model checkpoint"),
203 sStartDir,
204 tr("ONNX model (*.onnx);;All files (*)"));
205 if(!sFile.isEmpty()) {
206 setModelCheckpoint(sFile);
207 }
208}
209
210//=============================================================================================================
211
212void MinimumNormSettingsView::onTriggerTypeChanged(const QString& sTriggerType)
213{
214 emit triggerTypeChanged(sTriggerType);
215}
216
217//=============================================================================================================
218
220{
221 emit timePointChanged(m_pUi->m_spinBox_timepoint->value());
222}
223
224//=============================================================================================================
225
Minimum-norm inverse-solution method / regularisation panel (MNE, dSPM, sLORETA).
2-D display widgets and visualisation helpers (charts, topography, colour maps).
AbstractView(QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
void setModelCheckpoint(const QString &sPath)
void updateProcessingMode(ProcessingMode mode)
void onMethodChanged(const QString &method)
void onTriggerTypeChanged(const QString &sTriggerType)
MinimumNormSettingsView(const QString &sSettingsPath="", const QString &sMethod="", QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
void timePointChanged(int iTimePoint)
void updateCmneWidgetVisibility(const QString &method)
void triggerTypeChanged(const QString &triggerType)
void setTriggerTypes(const QStringList &lTriggerTypes)
void modelCheckpointChanged(const QString &sPath)
void methodChanged(const QString &method)
Ui::MinimumNormSettingsViewWidget * m_pUi