Skip to content

Commit

Permalink
[ENH] Flexible number of sources in 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 7e70d1d commit d3ed4d0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/applications/mne_scan/plugins/rtfwd/rtfwd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ void RtFwd::initPluginControlWidgets()
this, &RtFwd::onClusteringStatusChanged);
connect(pFwdSettingsView, &FwdSettingsView::atlasDirChanged,
this, &RtFwd::onAtlasDirChanged);
connect(pFwdSettingsView, &FwdSettingsView::clusterNumberChanged,
this, &RtFwd::onClusterNumberChanged);
connect(pFwdSettingsView, &FwdSettingsView::doForwardComputation,
this, &RtFwd::onDoForwardComputation);

Expand Down Expand Up @@ -392,6 +394,15 @@ void RtFwd::onAtlasDirChanged(const QString& sDirPath, const AnnotationSet::SPtr

//=============================================================================================================

void RtFwd::onClusterNumberChanged(int iNClusterNumber)
{
m_mutex.lock();
m_pFwdSettings->ncluster = iNClusterNumber;
m_mutex.unlock();
}

//=============================================================================================================

void RtFwd::run()
{
// Wait for fiff the info to arrive
Expand Down
8 changes: 8 additions & 0 deletions src/applications/mne_scan/plugins/rtfwd/rtfwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ class RTFWDSHARED_EXPORT RtFwd : public SCSHAREDLIB::AbstractAlgorithm
*/
void onClusteringStatusChanged(bool bDoRecomputation);

//=========================================================================================================
/**
* Call this function whenever the number of dipoles per cluster changed.
*
* @param[in] iNClusterNumber Number of dipoles per cluster.
*/
void onClusterNumberChanged(int iNClusterNumber);

//=========================================================================================================
/**
* Call this function whenever the atlas directory is set.
Expand Down
8 changes: 4 additions & 4 deletions src/libraries/disp/viewers/formfiles/fwdsettingsview.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>333</width>
<width>362</width>
<height>939</height>
</rect>
</property>
Expand Down Expand Up @@ -226,7 +226,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Desired number of clustered Sources</string>
<string>Number of sources per cluster</string>
</property>
</widget>
</item>
Expand All @@ -239,10 +239,10 @@
</size>
</property>
<property name="minimum">
<number>20</number>
<number>5</number>
</property>
<property name="maximum">
<number>1000</number>
<number>999</number>
</property>
</widget>
</item>
Expand Down
8 changes: 8 additions & 0 deletions src/libraries/disp/viewers/fwdsettingsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ FwdSettingsView::FwdSettingsView(const QString& sSettingsPath,
m_pUi->m_lineEdit_sSourceOri->setText("fixed");
m_pUi->m_lineEdit_sCoordFrame->setText("Head Space");
m_pUi->m_lineEdit_iNDipoleClustered->setText("Not Clustered");
m_pUi->m_spinBox_iNDipoleClustered->setValue(200);

// load init annotation set
QString t_sAtlasDir = QCoreApplication::applicationDirPath() + "/../resources/data/MNE-sample-data/subjects/sample/label";
Expand Down Expand Up @@ -258,6 +259,13 @@ bool FwdSettingsView::getClusteringStatusChanged()

//=============================================================================================================

int FwdSettingsView::getClusterNumber()
{
return m_pUi->m_spinBox_iNDipoleClustered->value();
}

//=============================================================================================================

void FwdSettingsView::onClusteringStatusChanged(bool bChecked)
{
if(!m_bAnnotaionsLoaded) {
Expand Down

0 comments on commit d3ed4d0

Please sign in to comment.