Skip to content

Commit

Permalink
adapted fwdsettingsview for adaptive clustering
Browse files Browse the repository at this point in the history
  • Loading branch information
johaenns authored and LorenzE committed Apr 30, 2024
1 parent d7d0c6a commit 7e70d1d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/applications/mne_scan/plugins/rtfwd/rtfwd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ RtFwd::RtFwd()
m_pFwdSettings->include_eeg = true;
m_pFwdSettings->accurate = true;
m_pFwdSettings->mindist = 5.0f/1000.0f;
m_pFwdSettings->ncluster = 200;

m_sAtlasDir = QCoreApplication::applicationDirPath() + "/../resources/data/MNE-sample-data/subjects/sample/label";
}
Expand Down Expand Up @@ -345,6 +346,7 @@ void RtFwd::onDoForwardComputation()
{
m_mutex.lock();
m_bDoFwdComputation = true;
// get value for number in cluster and set m_pFwdSettings->ncluster here
m_mutex.unlock();
}

Expand Down Expand Up @@ -513,7 +515,7 @@ void RtFwd::run()

if(bDoClustering && bFwdReady) {
emit statusInformationChanged(3); // clustering
pClusteredFwd = MNEForwardSolution::SPtr(new MNEForwardSolution(pFwdSolution->cluster_forward_solution(*m_pAnnotationSet.data(), 200)));
pClusteredFwd = MNEForwardSolution::SPtr(new MNEForwardSolution(pFwdSolution->cluster_forward_solution(*m_pAnnotationSet.data(), m_pFwdSettings->ncluster)));
emit clusteringAvailable(pClusteredFwd->nsource);

m_pRTFSOutput->measurementData()->setValue(pClusteredFwd);
Expand Down
27 changes: 27 additions & 0 deletions src/libraries/disp/viewers/formfiles/fwdsettingsview.ui
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,33 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Desired number of clustered Sources</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_spinBox_iNDipoleClustered">
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down
3 changes: 3 additions & 0 deletions src/libraries/disp/viewers/fwdsettingsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
//=============================================================================================================

#include "fwdsettingsview.h"
#include "QtWidgets/qspinbox.h"
#include "ui_fwdsettingsview.h"

#include <fs/annotationset.h>
Expand Down Expand Up @@ -115,6 +116,8 @@ FwdSettingsView::FwdSettingsView(const QString& sSettingsPath,
this, &FwdSettingsView::onClusteringStatusChanged);
connect(m_pUi->m_qPushButton_ComputeForward, &QPushButton::clicked,
this, &FwdSettingsView::doForwardComputation);
connect(m_pUi->m_spinBox_iNDipoleClustered, &QSpinBox::valueChanged,
this, &FwdSettingsView::clusterNumberChanged);

// load settings
loadSettings();
Expand Down
16 changes: 16 additions & 0 deletions src/libraries/disp/viewers/fwdsettingsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ class DISPSHARED_EXPORT FwdSettingsView : public AbstractView
*/
bool getClusteringStatusChanged();

//=========================================================================================================
/**
* Get status of cluster size spin box.
*
* @return Desired number of sources in clustered source space.
*/
int getClusterNumber();

//=========================================================================================================
/**
* Shows atlas selection dialog
Expand Down Expand Up @@ -235,6 +243,14 @@ class DISPSHARED_EXPORT FwdSettingsView : public AbstractView
*/
void doForwardComputation();

//=========================================================================================================
/**
* Emit this signal whenever a forward computation is supposed to be triggered.
*
* @param[in] iNCluster Number of desired sources in the clustered source space.
*/
void clusterNumberChanged(int iNCluster);

};

//=============================================================================================================
Expand Down
1 change: 1 addition & 0 deletions src/libraries/fwd/computeFwd/compute_fwd_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class FWDSHARED_EXPORT ComputeFwdSettings
bool do_all;
QStringList labels; /**< Compute the solution only for these labels. */
int nlabel;
int ncluster; /**< Number of sources desired in clustered solution. */

QString eeg_model_file; /**< File of EEG sphere model specifications. */
QString eeg_model_name; /**< Name of the EEG model to use. */
Expand Down

0 comments on commit 7e70d1d

Please sign in to comment.