40 #include "ui_dipolefitview.h"
53 using namespace DISPLIB;
59 DipoleFitView::DipoleFitView(QWidget *parent,
62 , m_pUi(new Ui::DipoleFitViewWidget)
65 this->setMinimumWidth(330);
89 case GuiMode::Clinical:
101 case ProcessingMode::Offline:
112 m_pUi->comboBox_bem->addItem(sFileName);
119 m_pUi->comboBox_mri->addItem(sFileName);
126 m_pUi->comboBox_noise->addItem(sFileName);
134 m_pUi->spinBox_tmax->value(),
135 m_pUi->spinBox_tstep->value(),
136 m_pUi->spinBox_tint->value());
138 emit
modalityChanged(m_pUi->checkBox_EEG->isChecked(), m_pUi->checkBox_MEG->isChecked());
141 m_pUi->doubleSpinBox_grid->value());
144 m_pUi->spinBox_bmax->value());
146 emit
noiseChanged(m_pUi->doubleSpinBox_gradnoise->value(),
147 m_pUi->doubleSpinBox_magnoise->value(),
148 m_pUi->doubleSpinBox_eegnoise->value());
150 emit
regChanged(m_pUi->doubleSpinBox_gradreg->value(),
151 m_pUi->doubleSpinBox_magreg->value(),
152 m_pUi->doubleSpinBox_eegreg->value());
155 m_pUi->doubleSpinBox_orgy->value(),
156 m_pUi->doubleSpinBox_orgz->value(),
157 m_pUi->doubleSpinBox_rad->value());
162 void DipoleFitView::initGui()
165 m_pUi->comboBox_bem->addItem(
"None");
166 m_pUi->comboBox_noise->addItem(
"None");
167 m_pUi->comboBox_mri->addItem(
"None");
168 m_pUi->comboBox_meas->addItem(
"None");
171 connect(m_pUi->pushButton_fit, &QPushButton::clicked, [=] {
172 emit performDipoleFit(m_pUi->lineEdit_name->text());
175 connect(m_pUi->spinBox_set, QOverload<int>::of(&QSpinBox::valueChanged),
179 connect(m_pUi->spinBox_tmin, QOverload<int>::of(&QSpinBox::valueChanged), [=](
int iValue){
180 emit timeChanged(iValue,
181 m_pUi->spinBox_tmax->value(),
182 m_pUi->spinBox_tstep->value(),
183 m_pUi->spinBox_tint->value());
185 connect(m_pUi->spinBox_tmax, QOverload<int>::of(&QSpinBox::valueChanged), [=](
int iValue){
186 emit timeChanged(m_pUi->spinBox_tmin->value(),
188 m_pUi->spinBox_tstep->value(),
189 m_pUi->spinBox_tint->value());
191 connect(m_pUi->spinBox_tstep, QOverload<int>::of(&QSpinBox::valueChanged), [=](
int iValue){
192 emit timeChanged(m_pUi->spinBox_tmin->value(),
193 m_pUi->spinBox_tmax->value(),
195 m_pUi->spinBox_tint->value());
197 connect(m_pUi->spinBox_tint, QOverload<int>::of(&QSpinBox::valueChanged), [=](
int iValue){
198 emit timeChanged(m_pUi->spinBox_tmin->value(),
199 m_pUi->spinBox_tmax->value(),
200 m_pUi->spinBox_tstep->value(),
205 connect(m_pUi->spinBox_bmin, QOverload<int>::of(&QSpinBox::valueChanged), [=](
int iValue){
206 if (iValue != m_pUi->spinBox_bmax->value()){
207 emit baselineChanged(iValue,
208 m_pUi->spinBox_bmax->value());
210 emit baselineChanged(1e6, 1e6);
213 connect(m_pUi->spinBox_bmax, QOverload<int>::of(&QSpinBox::valueChanged), [=](
int iValue){
214 if (iValue != m_pUi->spinBox_bmin->value()){
215 emit baselineChanged(m_pUi->spinBox_bmin->value(),
218 emit baselineChanged(1e6, 1e6);
223 connect(m_pUi->checkBox_EEG, &QCheckBox::toggled, [=](
bool bChecked){
224 emit modalityChanged(bChecked, m_pUi->checkBox_MEG->isChecked());
226 connect(m_pUi->checkBox_MEG, &QCheckBox::toggled, [=](
bool bChecked){
227 emit modalityChanged(m_pUi->checkBox_EEG->isChecked(), bChecked);
231 connect(m_pUi->doubleSpinBox_dist, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
232 emit fittingChanged(dValue,
233 m_pUi->doubleSpinBox_grid->value());
235 connect(m_pUi->doubleSpinBox_grid, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
236 emit fittingChanged(m_pUi->doubleSpinBox_dist->value(),
241 connect(m_pUi->doubleSpinBox_gradnoise, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
242 emit noiseChanged(dValue,
243 m_pUi->doubleSpinBox_magnoise->value(),
244 m_pUi->doubleSpinBox_eegnoise->value());
246 connect(m_pUi->doubleSpinBox_magnoise, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
247 emit noiseChanged(m_pUi->doubleSpinBox_gradnoise->value(),
249 m_pUi->doubleSpinBox_eegnoise->value());
251 connect(m_pUi->doubleSpinBox_eegnoise, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
252 emit noiseChanged(m_pUi->doubleSpinBox_gradnoise->value(),
253 m_pUi->doubleSpinBox_magnoise->value(),
258 connect(m_pUi->doubleSpinBox_gradreg, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
259 emit regChanged(dValue,
260 m_pUi->doubleSpinBox_magreg->value(),
261 m_pUi->doubleSpinBox_eegreg->value());
263 connect(m_pUi->doubleSpinBox_magreg, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
264 emit regChanged(m_pUi->doubleSpinBox_gradreg->value(),
266 m_pUi->doubleSpinBox_eegreg->value());
268 connect(m_pUi->doubleSpinBox_eegreg, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
269 emit regChanged(m_pUi->doubleSpinBox_gradreg->value(),
270 m_pUi->doubleSpinBox_magreg->value(),
275 connect(m_pUi->doubleSpinBox_orgx, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
276 emit sphereChanged(dValue,
277 m_pUi->doubleSpinBox_orgy->value(),
278 m_pUi->doubleSpinBox_orgz->value(),
279 m_pUi->doubleSpinBox_rad->value());
281 connect(m_pUi->doubleSpinBox_orgy, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
282 emit sphereChanged(m_pUi->doubleSpinBox_orgx->value(),
284 m_pUi->doubleSpinBox_orgz->value(),
285 m_pUi->doubleSpinBox_rad->value());
287 connect(m_pUi->doubleSpinBox_orgz, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
288 emit sphereChanged(m_pUi->doubleSpinBox_orgx->value(),
289 m_pUi->doubleSpinBox_orgy->value(),
291 m_pUi->doubleSpinBox_rad->value());
293 connect(m_pUi->doubleSpinBox_rad, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double dValue){
294 emit sphereChanged(m_pUi->doubleSpinBox_orgx->value(),
295 m_pUi->doubleSpinBox_orgy->value(),
296 m_pUi->doubleSpinBox_orgz->value(),
301 connect(m_pUi->comboBox_bem, &QComboBox::currentTextChanged,
302 this, &DipoleFitView::selectedBem, Qt::UniqueConnection);
303 connect(m_pUi->comboBox_noise, &QComboBox::currentTextChanged,
304 this, &DipoleFitView::selectedNoise, Qt::UniqueConnection);
305 connect(m_pUi->comboBox_mri, &QComboBox::currentTextChanged,
306 this, &DipoleFitView::selectedMri, Qt::UniqueConnection);
307 connect(m_pUi->comboBox_meas, &QComboBox::currentTextChanged, [=](
const QString& sFileName){
308 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
309 auto skip = QString::SkipEmptyParts;
311 auto skip = Qt::SkipEmptyParts;
313 QString sName = sFileName.split(
".",skip).at(0);
314 if(sName.endsWith(
"-ave") || sName.endsWith(
"_ave") || sName.endsWith(
"-raw") || sName.endsWith(
"_raw")){
317 m_pUi->lineEdit_name->setText(
"Dipole Fit - " + sName +
" - " + QDateTime::currentDateTime().toString(
"MMMM d yyyy hh:mm:ss"));
318 emit selectedMeas(sFileName);
325 void DipoleFitView::addMeas(
const QString &sFileName)
327 m_pUi->comboBox_meas->addItem(sFileName);
341 m_pUi->comboBox_meas->clear();
342 m_pUi->comboBox_bem->clear();
343 m_pUi->comboBox_mri->clear();
344 m_pUi->comboBox_noise->clear();
353 int iIndex = m_pUi->comboBox_meas->findText(sModelName);
355 m_pUi->comboBox_meas->removeItem(iIndex);
360 int iIndex = m_pUi->comboBox_bem->findText(sModelName);
362 m_pUi->comboBox_bem->removeItem(iIndex);
367 int iIndex = m_pUi->comboBox_mri->findText(sModelName);
369 m_pUi->comboBox_mri->removeItem(iIndex);
374 int iIndex = m_pUi->comboBox_noise->findText(sModelName);
376 m_pUi->comboBox_noise->removeItem(iIndex);
381 qWarning() <<
"[DipoleFitView::removeModel] Model type not recognized";