From f9799f2cc09277e2fae8b54e49ef112648e3312d Mon Sep 17 00:00:00 2001 From: RDoerfel Date: Sun, 27 Feb 2022 12:32:10 +0100 Subject: [PATCH 1/8] Maint: use default constructors --- applications/mne_scan/plugins/hpi/hpi.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/applications/mne_scan/plugins/hpi/hpi.cpp b/applications/mne_scan/plugins/hpi/hpi.cpp index 00f9a90b35d..525062a80fa 100644 --- a/applications/mne_scan/plugins/hpi/hpi.cpp +++ b/applications/mne_scan/plugins/hpi/hpi.cpp @@ -550,16 +550,8 @@ void Hpi::run() } // init hpi fit - HpiModelParameters hpiModelParameters(m_vCoilFreqs, - m_pFiffInfo->sfreq, - m_pFiffInfo->linefreq, - false); HpiFitResult fitResult; - fitResult.hpiFreqs = m_vCoilFreqs; - fitResult.errorDistances = QVector(m_vCoilFreqs.size()); - fitResult.devHeadTrans = m_pFiffInfo->dev_head_t; - fitResult.devHeadTrans.from = 1; - fitResult.devHeadTrans.to = 4; + HpiModelParameters hpiModelParameters; FiffCoordTrans transDevHeadRef = m_pFiffInfo->dev_head_t; From 1de88ae00676777dfc3ebea91e3fe92def59a40d Mon Sep 17 00:00:00 2001 From: RDoerfel Date: Sun, 27 Feb 2022 13:01:39 +0100 Subject: [PATCH 2/8] Maint: improve mutexing --- applications/mne_scan/plugins/hpi/hpi.cpp | 88 ++++++++++++----------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/applications/mne_scan/plugins/hpi/hpi.cpp b/applications/mne_scan/plugins/hpi/hpi.cpp index 525062a80fa..e1420470e83 100644 --- a/applications/mne_scan/plugins/hpi/hpi.cpp +++ b/applications/mne_scan/plugins/hpi/hpi.cpp @@ -217,7 +217,12 @@ void Hpi::update(SCMEASLIB::Measurement::SPtr pMeasurement) } } - if(m_bDoContinousHpi && (m_vCoilFreqs.size() >= 3)) { + m_mutex.lock(); + bool bDoContinousHpi = m_bDoContinousHpi; + int iNumberHpiCoils = m_vCoilFreqs.size(); + m_mutex.unlock(); + + if(bDoContinousHpi && (iNumberHpiCoils >= 3)) { for(unsigned char i = 0; i < pRTMSA->getMultiSampleArray().size(); ++i) { // Please note that we do not need a copy here since this function will block until // the buffer accepts new data again. Hence, the data is not deleted in the actual @@ -283,14 +288,7 @@ void Hpi::updateDigitizerInfo() void Hpi::initPluginControlWidgets() { - bool bFiffInfo = false; - m_mutex.lock(); if(m_pFiffInfo) { - bFiffInfo = true; - } - m_mutex.unlock(); - - if(bFiffInfo) { QList plControlWidgets; // Projects Settings @@ -366,14 +364,19 @@ void Hpi::updateProjections() } m_mutex.unlock(); + m_mutex.lock(); Eigen::MatrixXd matProjectors = Eigen::MatrixXd::Identity(m_pFiffInfo->chs.size(), m_pFiffInfo->chs.size()); Eigen::MatrixXd matComp = Eigen::MatrixXd::Identity(m_pFiffInfo->chs.size(), m_pFiffInfo->chs.size()); - if(m_bUseSSP) { + bool bUseSSP = m_bUseSSP; + m_mutex.unlock(); + + if(bUseSSP) { // Use SSP + SGM + calibration //Do a copy here because we are going to change the activity flags of the SSP's + m_mutex.lock(); FiffInfo infoTemp = *(m_pFiffInfo.data()); - + m_mutex.unlock(); //Turn on all SSP for(int i = 0; i < infoTemp.projs.size(); ++i) { infoTemp.projs[i].active = true; @@ -387,13 +390,19 @@ void Hpi::updateProjections() } } - if(m_bUseComp) { + m_mutex.lock(); + bool bUseComp = m_bUseComp; + m_mutex.unlock(); + + if(bUseComp) { // Setup Comps FiffCtfComp newComp; //Do this always from 0 since we always read new raw data, we never actually perform a multiplication on already existing data + m_mutex.lock(); if(m_pFiffInfo->make_compensator(0, 101, newComp)) { matComp = newComp.data->data; } + m_mutex.unlock(); } m_mutex.lock(); @@ -448,7 +457,11 @@ void Hpi::onDigitizersChanged(const QList& lDigitzers, void Hpi::onDoSingleHpiFit() { - if(m_vCoilFreqs.size() < 3) { + m_mutex.lock(); + int iNumberHpiCoils = m_vCoilFreqs.size(); + m_mutex.unlock(); + + if(iNumberHpiCoils < 3) { QMessageBox msgBox; msgBox.setText("Please input HPI coil frequencies first."); msgBox.exec(); @@ -464,14 +477,16 @@ void Hpi::onDoSingleHpiFit() void Hpi::onDoFreqOrder() { - if(m_vCoilFreqs.size() < 3) { + m_mutex.lock(); + int iNumberHpiCoils = m_vCoilFreqs.size(); + m_mutex.unlock(); + + if(iNumberHpiCoils < 3) { QMessageBox msgBox; msgBox.setText("Please input HPI coil frequencies first."); msgBox.exec(); return; } - - m_mutex.lock(); m_bDoFreqOrder = true; m_mutex.unlock(); } @@ -489,7 +504,9 @@ void Hpi::onCoilFrequenciesChanged(const QVector& vCoilFreqs) void Hpi::onSspStatusChanged(bool bChecked) { + m_mutex.lock(); m_bUseSSP = bChecked; + m_mutex.unlock(); updateProjections(); } @@ -497,7 +514,9 @@ void Hpi::onSspStatusChanged(bool bChecked) void Hpi::onCompStatusChanged(bool bChecked) { + m_mutex.lock(); m_bUseComp = bChecked; + m_mutex.unlock(); updateProjections(); } @@ -505,14 +524,11 @@ void Hpi::onCompStatusChanged(bool bChecked) void Hpi::onContHpiStatusChanged(bool bChecked) { -// if(m_vCoilFreqs.size() < 3) { -// QMessageBox msgBox; -// msgBox.setText("Please load a digitizer set with at least 3 HPI coils first."); -// msgBox.exec(); -// return; -// } + m_mutex.lock(); m_bDoContinousHpi = bChecked; + m_mutex.unlock(); + } //============================================================================================================= @@ -527,7 +543,9 @@ void Hpi::setFittingWindowSize(int winSize) void Hpi::onDevHeadTransAvailable(const FIFFLIB::FiffCoordTrans& devHeadTrans) { + m_mutex.lock(); m_pFiffInfo->dev_head_t = devHeadTrans; + m_mutex.unlock(); } //============================================================================================================= @@ -535,28 +553,20 @@ void Hpi::onDevHeadTransAvailable(const FIFFLIB::FiffCoordTrans& devHeadTrans) void Hpi::run() { // Wait for fiff info - bool bFiffInfo = false; - - while(true) { - m_mutex.lock(); - if(m_pFiffInfo) { - bFiffInfo = true; - } - m_mutex.unlock(); - if(bFiffInfo) { - break; - } + while(!m_pFiffInfo) { msleep(100); } - // init hpi fit - HpiFitResult fitResult; - HpiModelParameters hpiModelParameters; - + m_mutex.lock(); FiffCoordTrans transDevHeadRef = m_pFiffInfo->dev_head_t; - + int fittingWindowSize = m_iFittingWindowSize; + MatrixXd matDataMerged(m_pFiffInfo->chs.size(), fittingWindowSize); HpiDataUpdater hpiDataUpdater = HpiDataUpdater(m_pFiffInfo); + m_mutex.unlock(); + HPIFit HPI = HPIFit(hpiDataUpdater.getSensors()); + HpiFitResult fitResult; + HpiModelParameters hpiModelParameters; double dErrorMax = 0.0; double dMeanErrorDist = 0.0; @@ -569,11 +579,7 @@ void Hpi::run() int iDataIndexCounter = 0; MatrixXd matData; - m_mutex.lock(); - int fittingWindowSize = m_iFittingWindowSize; - m_mutex.unlock(); - MatrixXd matDataMerged(m_pFiffInfo->chs.size(), fittingWindowSize); bool bOrder = false; while(!isInterruptionRequested()) { From 273ff030f929abe931c49fbf851d30beb2275723 Mon Sep 17 00:00:00 2001 From: RDoerfel Date: Sun, 27 Feb 2022 13:12:35 +0100 Subject: [PATCH 3/8] Maint: qshared pointer already init as nullptr and no need to cast as QString --- libraries/inverse/hpiFit/sensorset.cpp | 2 +- libraries/inverse/hpiFit/sensorset.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/inverse/hpiFit/sensorset.cpp b/libraries/inverse/hpiFit/sensorset.cpp index 607a38fa870..736865e2ef0 100644 --- a/libraries/inverse/hpiFit/sensorset.cpp +++ b/libraries/inverse/hpiFit/sensorset.cpp @@ -131,7 +131,7 @@ void SensorSet::initMatrices(int ncoils, int np) SensorSetCreator::SensorSetCreator() { - const QString qPath = QString(QCoreApplication::applicationDirPath() + "/resources/general/coilDefinitions/coil_def.dat"); + const QString qPath = QCoreApplication::applicationDirPath() + "/resources/general/coilDefinitions/coil_def.dat"; m_pCoilDefinitions = FwdCoilSet::SPtr(FwdCoilSet::read_coil_defs(qPath)); } diff --git a/libraries/inverse/hpiFit/sensorset.h b/libraries/inverse/hpiFit/sensorset.h index 207515e2841..7ace548798a 100644 --- a/libraries/inverse/hpiFit/sensorset.h +++ b/libraries/inverse/hpiFit/sensorset.h @@ -269,7 +269,7 @@ class INVERSESHARED_EXPORT SensorSetCreator const Accuracy& accuracy); private: - QSharedPointer m_pCoilDefinitions{nullptr}; // the coil definitions as template + QSharedPointer m_pCoilDefinitions; // the coil definitions as template }; //============================================================================================================= From 8214d7607f9f22705ad488e3558aecbb1d14169a Mon Sep 17 00:00:00 2001 From: RDoerfel Date: Sun, 27 Feb 2022 13:21:53 +0100 Subject: [PATCH 4/8] Doc: add class descriptions --- libraries/inverse/hpiFit/hpimodelparameters.h | 4 ++-- libraries/inverse/hpiFit/sensorset.h | 13 ++++++++++--- libraries/inverse/hpiFit/signalmodel.h | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libraries/inverse/hpiFit/hpimodelparameters.h b/libraries/inverse/hpiFit/hpimodelparameters.h index b36cb7e602c..df0e1634f7e 100644 --- a/libraries/inverse/hpiFit/hpimodelparameters.h +++ b/libraries/inverse/hpiFit/hpimodelparameters.h @@ -70,9 +70,9 @@ namespace INVERSELIB { //============================================================================================================= /** - * Description of what this class is intended to do (in detail). + * HpiModelParamers holds the information to be used for the HpiFit in general, ans especially for extracting the hpi coil amplitudes from the measurement. * - * @brief Brief description of this class. + * @brief HpiModelParamers holds the information to be used for the HpiFit in general, ans especially for extracting the hpi coil amplitudes from the measurement. */ class INVERSESHARED_EXPORT HpiModelParameters { diff --git a/libraries/inverse/hpiFit/sensorset.h b/libraries/inverse/hpiFit/sensorset.h index 7ace548798a..1ce3415f1f5 100644 --- a/libraries/inverse/hpiFit/sensorset.h +++ b/libraries/inverse/hpiFit/sensorset.h @@ -75,7 +75,14 @@ namespace FIFFLIB{ namespace INVERSELIB { -enum class Accuracy : int{high = 2, medium = 1, low = 0}; +enum class Accuracy : int{low = 0, medium = 1, high = 2}; + +//============================================================================================================= +/** + * A SensorSet object holds information about the position and orientation of the MEG sensor arrays. + * + * @brief A SensorSet object holds information about the position and orientation of the MEG sensor arrays. + */ class INVERSESHARED_EXPORT SensorSet { @@ -240,9 +247,9 @@ inline bool SensorSet::operator!= (const SensorSet &b) const //============================================================================================================= /** - * Create a SensorSet struct from a channel list with specified accuracy. + * Create a SensorSet struct from a channel list with specified accuracy. Reads sensor information from Coil Definition file. * - * @brief Brief description of this class. + * @brief Create a SensorSet struct from a channel list with specified accuracy. Reads sensor information from Coil Definition file. */ class INVERSESHARED_EXPORT SensorSetCreator { diff --git a/libraries/inverse/hpiFit/signalmodel.h b/libraries/inverse/hpiFit/signalmodel.h index 1eb3efe7ac4..86ab3485f8d 100644 --- a/libraries/inverse/hpiFit/signalmodel.h +++ b/libraries/inverse/hpiFit/signalmodel.h @@ -67,9 +67,9 @@ namespace INVERSELIB //============================================================================================================= /** - * Description of what this class is intended to do (in detail). + * This class creates and fits a linear model to extract the amplitudes of the hpi coils from measurement data. * - * @brief Brief description of this class. + * @brief This class creates and fits a linear model to extract the amplitudes of the hpi coils from measurement data.. */ class INVERSESHARED_EXPORT SignalModel { From 398ccf1102e131e23573c465e7fc15df1c000777 Mon Sep 17 00:00:00 2001 From: RDoerfel Date: Sun, 27 Feb 2022 13:30:40 +0100 Subject: [PATCH 5/8] Maint: remove unnecessary default constructors --- libraries/inverse/hpiFit/hpifit.h | 7 ------- libraries/inverse/hpiFit/signalmodel.h | 6 ------ testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp | 2 -- 3 files changed, 15 deletions(-) diff --git a/libraries/inverse/hpiFit/hpifit.h b/libraries/inverse/hpiFit/hpifit.h index e477d583853..63bbc2568ca 100644 --- a/libraries/inverse/hpiFit/hpifit.h +++ b/libraries/inverse/hpiFit/hpifit.h @@ -138,13 +138,6 @@ class INVERSESHARED_EXPORT HPIFit typedef QSharedPointer SPtr; /**< Shared pointer type for HPIFit. */ typedef QSharedPointer ConstSPtr; /**< Const shared pointer type for HPIFit. */ - //========================================================================================================= - /** - * Default constructor. - * - */ - explicit HPIFit(); - //========================================================================================================= /** * Constructs the HPI from a SensorSet. diff --git a/libraries/inverse/hpiFit/signalmodel.h b/libraries/inverse/hpiFit/signalmodel.h index 86ab3485f8d..a7e146e87ff 100644 --- a/libraries/inverse/hpiFit/signalmodel.h +++ b/libraries/inverse/hpiFit/signalmodel.h @@ -78,12 +78,6 @@ class INVERSESHARED_EXPORT SignalModel typedef QSharedPointer SPtr; /**< Shared pointer type for SignalModel. */ typedef QSharedPointer ConstSPtr; /**< Const shared pointer type for SignalModel. */ - //========================================================================================================= - /** - * Constructs a SignalModel object. - */ - explicit SignalModel() = default; - //========================================================================================================= /** * Fit the data to the model constructed from given model parameters. diff --git a/testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp b/testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp index 825d785b790..5be571a9a6a 100644 --- a/testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp +++ b/testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp @@ -321,8 +321,6 @@ void TestHpiDataUpdater::testGetSensors() void TestHpiDataUpdater::testGetSensors_bads() { // extract data for channels to use - int iAccuracy = 2; - SensorSetCreator sensorCreator; SensorSet sensorsExpected = sensorCreator.updateSensorSet(m_lChannelsWithBads,Accuracy::high); From 5a0e722c76db87cad761ced943d3b741a7af030a Mon Sep 17 00:00:00 2001 From: RDoerfel Date: Sun, 27 Feb 2022 13:59:46 +0100 Subject: [PATCH 6/8] Maint: rename checkForUpdate in HpiFit to setSensorSet and let checkForUpdate of HDU return bool to indicate if things have changed --- applications/mne_scan/plugins/hpi/hpi.cpp | 7 ++++-- libraries/inverse/hpiFit/hpidataupdater.cpp | 3 ++- libraries/inverse/hpiFit/hpidataupdater.h | 4 ++-- libraries/inverse/hpiFit/hpifit.cpp | 2 +- libraries/inverse/hpiFit/hpifit.h | 4 ++-- .../test_hpiDataUpdater.cpp | 23 ++++++++++++++++--- testframes/test_hpiFit/test_hpiFit.cpp | 4 ++-- 7 files changed, 34 insertions(+), 13 deletions(-) diff --git a/applications/mne_scan/plugins/hpi/hpi.cpp b/applications/mne_scan/plugins/hpi/hpi.cpp index e1420470e83..06ae7e4e231 100644 --- a/applications/mne_scan/plugins/hpi/hpi.cpp +++ b/applications/mne_scan/plugins/hpi/hpi.cpp @@ -614,8 +614,11 @@ void Hpi::run() m_pFiffInfo->sfreq, m_pFiffInfo->linefreq, false); - hpiDataUpdater.checkForUpdate(m_pFiffInfo); - HPI.checkForUpdate(hpiDataUpdater.getSensors()); + bool bHasChanged = hpiDataUpdater.checkForUpdate(m_pFiffInfo); + + if(bHasChanged) { + HPI.setSensorSet(hpiDataUpdater.getSensors()); + } hpiDataUpdater.prepareDataAndProjectors(matDataMerged,m_matCompProjectors); bOrder = m_bDoFreqOrder; diff --git a/libraries/inverse/hpiFit/hpidataupdater.cpp b/libraries/inverse/hpiFit/hpidataupdater.cpp index ef9d7326e8b..cddaa745085 100644 --- a/libraries/inverse/hpiFit/hpidataupdater.cpp +++ b/libraries/inverse/hpiFit/hpidataupdater.cpp @@ -148,7 +148,7 @@ void HpiDataUpdater::updateHpiDigitizer(const QList& lDig) //============================================================================================================= -void HpiDataUpdater::checkForUpdate(const FiffInfo::SPtr pFiffInfo) +bool HpiDataUpdater::checkForUpdate(const FiffInfo::SPtr pFiffInfo) { const bool bUpdate = checkIfChanged(pFiffInfo->bads,pFiffInfo->chs); if(bUpdate) @@ -158,6 +158,7 @@ void HpiDataUpdater::checkForUpdate(const FiffInfo::SPtr pFiffInfo) updateHpiDigitizer(pFiffInfo->dig); updateSensors(m_lChannels); } + return bUpdate; } //============================================================================================================= diff --git a/libraries/inverse/hpiFit/hpidataupdater.h b/libraries/inverse/hpiFit/hpidataupdater.h index bed72c8781a..9f6dfdfcd10 100644 --- a/libraries/inverse/hpiFit/hpidataupdater.h +++ b/libraries/inverse/hpiFit/hpidataupdater.h @@ -103,9 +103,9 @@ class INVERSESHARED_EXPORT HpiDataUpdater * Check if information in FiffInfo changed and update if necessary. * * @param[in] pFiffInfo The FiffInfo to check for changes. - * + * @return If information in pFiffInfo has changed and data was updated. */ - void checkForUpdate(const QSharedPointer pFiffInfo); + bool checkForUpdate(const QSharedPointer pFiffInfo); //========================================================================================================= /** diff --git a/libraries/inverse/hpiFit/hpifit.cpp b/libraries/inverse/hpiFit/hpifit.cpp index 6310dba2919..1be4e6d77d9 100644 --- a/libraries/inverse/hpiFit/hpifit.cpp +++ b/libraries/inverse/hpiFit/hpifit.cpp @@ -99,7 +99,7 @@ HPIFit::HPIFit(const SensorSet& sensorSet) //============================================================================================================= -void HPIFit::checkForUpdate(const SensorSet &sensorSet) +void HPIFit::setSensorSet(const SensorSet &sensorSet) { if(m_sensors != sensorSet) { m_sensors = sensorSet; diff --git a/libraries/inverse/hpiFit/hpifit.h b/libraries/inverse/hpiFit/hpifit.h index 63bbc2568ca..967aca90ab3 100644 --- a/libraries/inverse/hpiFit/hpifit.h +++ b/libraries/inverse/hpiFit/hpifit.h @@ -152,7 +152,7 @@ class INVERSESHARED_EXPORT HPIFit * * @param[in] SensorSet The MEG sensorSet used for the hpi fitting. */ - void checkForUpdate(const SensorSet& sensorSet); + void setSensorSet(const SensorSet& sensorSet); //========================================================================================================= /** @@ -163,7 +163,7 @@ class INVERSESHARED_EXPORT HPIFit * @param[in] hpiModelParameters The model parameters to use for the Hpi Fitting, especially to compute the coil amplitudes. * @param[in] matCoilsHead The hpi coil locations in head space. * @param[in] bOrderFrequencies Order Hpi coils yes/no. - * @param[out] hpiFitResult The fitting results. + * @param[in,out] hpiFitResult The fitting results. */ void fit(const Eigen::MatrixXd& matProjectedData, const Eigen::MatrixXd& matProjectors, diff --git a/testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp b/testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp index 5be571a9a6a..04b0995e08a 100644 --- a/testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp +++ b/testframes/test_hpiDataUpdater/test_hpiDataUpdater.cpp @@ -89,6 +89,7 @@ private slots: void testPrepareData(); void testGetSensors(); void testGetSensors_bads(); + void testCheckForUpdates_return(); void testCheckForUpdates_sensors(); void testCheckForUpdates_data(); void testCheckForUpdates_projectors(); @@ -336,6 +337,22 @@ void TestHpiDataUpdater::testGetSensors_bads() //============================================================================================================= +void TestHpiDataUpdater::testCheckForUpdates_return() +{ + HpiDataUpdater hpiData = HpiDataUpdater(m_pFiffInfo); + m_pFiffInfo->bads << "MEG0113" << "MEG0112"; + SensorSetCreator sensorCreator; + SensorSet sensorsExpected = sensorCreator.updateSensorSet(m_lChannelsWithBads,Accuracy::high); + + /// act + bool hasChanged = hpiData.checkForUpdate(m_pFiffInfo); + + /// assert + QVERIFY(hasChanged); +} + +//============================================================================================================= + void TestHpiDataUpdater::testCheckForUpdates_sensors() { HpiDataUpdater hpiData = HpiDataUpdater(m_pFiffInfo); @@ -344,7 +361,7 @@ void TestHpiDataUpdater::testCheckForUpdates_sensors() SensorSet sensorsExpected = sensorCreator.updateSensorSet(m_lChannelsWithBads,Accuracy::high); /// act - hpiData.checkForUpdate(m_pFiffInfo); + bool bHasChanged = hpiData.checkForUpdate(m_pFiffInfo); SensorSet sensorsActual = hpiData.getSensors(); /// assert @@ -364,7 +381,7 @@ void TestHpiDataUpdater::testCheckForUpdates_data() } /// act - hpiData.checkForUpdate(m_pFiffInfo); + bool bHasChanged = hpiData.checkForUpdate(m_pFiffInfo); hpiData.prepareDataAndProjectors(m_matData,m_matProjectors); MatrixXd matDataPrepared = hpiData.getData(); @@ -393,7 +410,7 @@ void TestHpiDataUpdater::testCheckForUpdates_projectors() } // act - hpiData.checkForUpdate(m_pFiffInfo); + bool bHasChanged = hpiData.checkForUpdate(m_pFiffInfo); hpiData.prepareDataAndProjectors(m_matData,matProj); MatrixXd matProjPrepared = hpiData.getProjectors(); diff --git a/testframes/test_hpiFit/test_hpiFit.cpp b/testframes/test_hpiFit/test_hpiFit.cpp index d45ee93be76..25c055c2a4c 100644 --- a/testframes/test_hpiFit/test_hpiFit.cpp +++ b/testframes/test_hpiFit/test_hpiFit.cpp @@ -450,9 +450,9 @@ void TestHpiFit::testCheckForUpdate() HPIFit HPI = HPIFit(hpiDataUpdater.getSensors()); m_pFiffInfo->bads << "MEG0113" << "MEG0112"; - hpiDataUpdater.checkForUpdate(m_pFiffInfo); + bool bHasChanged = hpiDataUpdater.checkForUpdate(m_pFiffInfo); - HPI.checkForUpdate(hpiDataUpdater.getSensors()); + HPI.setSensorSet(hpiDataUpdater.getSensors()); hpiDataUpdater.prepareDataAndProjectors(m_matData,m_matProjectors); const auto& matProjectedData = hpiDataUpdater.getProjectedData(); From 895130066a9c6a6a37b8a18fa3089b122ea70738 Mon Sep 17 00:00:00 2001 From: RDoerfel Date: Sun, 27 Feb 2022 14:02:52 +0100 Subject: [PATCH 7/8] Maint: correct header guards --- libraries/inverse/hpiFit/hpimodelparameters.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/inverse/hpiFit/hpimodelparameters.h b/libraries/inverse/hpiFit/hpimodelparameters.h index df0e1634f7e..458437ee29d 100644 --- a/libraries/inverse/hpiFit/hpimodelparameters.h +++ b/libraries/inverse/hpiFit/hpimodelparameters.h @@ -32,8 +32,8 @@ * */ -#ifndef INVERSELIBE_HPIMODELPARAMETERS_H -#define INVERSELIBE_HPIMODELPARAMETERS_H +#ifndef HPIMODELPARAMETERS_H +#define HPIMODELPARAMETERS_H //============================================================================================================= // INCLUDES From 753eee21b3fad900581fadce2e78d40d8cf25a14 Mon Sep 17 00:00:00 2001 From: RDoerfel Date: Sat, 5 Mar 2022 17:25:26 +0100 Subject: [PATCH 8/8] Maint: lock mutex before unlocking to avoid crash whenever coil ordering is activated --- applications/mne_scan/plugins/hpi/hpi.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/mne_scan/plugins/hpi/hpi.cpp b/applications/mne_scan/plugins/hpi/hpi.cpp index 06ae7e4e231..c9642c57ab6 100644 --- a/applications/mne_scan/plugins/hpi/hpi.cpp +++ b/applications/mne_scan/plugins/hpi/hpi.cpp @@ -487,6 +487,7 @@ void Hpi::onDoFreqOrder() msgBox.exec(); return; } + m_mutex.lock(); m_bDoFreqOrder = true; m_mutex.unlock(); }