diff --git a/applications/mne_analyze/libs/anShared/Model/eventmodel.cpp b/applications/mne_analyze/libs/anShared/Model/eventmodel.cpp index 6225352f34a..58016008457 100644 --- a/applications/mne_analyze/libs/anShared/Model/eventmodel.cpp +++ b/applications/mne_analyze/libs/anShared/Model/eventmodel.cpp @@ -175,7 +175,7 @@ void EventModel::setSamplePos(int iSamplePos) int EventModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); - return m_EventManager.getEventsInGroups(m_selectedEventGroups)->size(); + return static_cast(m_EventManager.getEventsInGroups(m_selectedEventGroups)->size()); } //============================================================================================================= @@ -628,7 +628,7 @@ std::unique_ptr > EventModel::getEventsToDisplay(i void EventModel::eventsUpdated() { emit dataChanged(createIndex(0,0), createIndex(rowCount(), columnCount())); - emit headerDataChanged(Qt::Vertical, 0, m_EventManager.getAllEvents()->size()); + emit headerDataChanged(Qt::Vertical, 0, static_cast(m_EventManager.getAllEvents()->size())); } //============================================================================================================= diff --git a/applications/mne_analyze/plugins/coregistration/coregistration.cpp b/applications/mne_analyze/plugins/coregistration/coregistration.cpp index 792415dd7c0..85c0dacc006 100644 --- a/applications/mne_analyze/plugins/coregistration/coregistration.cpp +++ b/applications/mne_analyze/plugins/coregistration/coregistration.cpp @@ -445,7 +445,7 @@ void CoRegistration::onFitFiducials() Matrix3f matMri(digSetFidMRI.size(),3); Matrix4f matTrans; Vector3f vecWeights; // LPA, Nasion, RPA - float fScale = 0.0; + float fScale = 1.0f; // get coordinates for(int i = 0; i< digSetFidHead.size(); ++i) { diff --git a/examples/ex_averaging/main.cpp b/examples/ex_averaging/main.cpp index 490e8156d0f..aa6cf8c51e5 100644 --- a/examples/ex_averaging/main.cpp +++ b/examples/ex_averaging/main.cpp @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) fTMin, fTMax, event, - -1.0f, + true, -1.0f, true, mapReject, diff --git a/examples/ex_clustered_inverse_mne_raw/main.cpp b/examples/ex_clustered_inverse_mne_raw/main.cpp index 318ba80bae1..a5818a1831d 100644 --- a/examples/ex_clustered_inverse_mne_raw/main.cpp +++ b/examples/ex_clustered_inverse_mne_raw/main.cpp @@ -493,7 +493,7 @@ int main(int argc, char *argv[]) // Cluster forward solution; // MatrixXd D; - MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution(t_annotationSet, 20, D, noise_cov, evoked.info); + MNEForwardSolution t_clusteredFwd = t_Fwd.cluster_forward_solution(t_annotationSet, 20, D, noise_cov, evoked.info, "citiblock"); // // make an inverse operators diff --git a/examples/ex_connectivity_comparison/main.cpp b/examples/ex_connectivity_comparison/main.cpp index 2049e556098..4015288df18 100644 --- a/examples/ex_connectivity_comparison/main.cpp +++ b/examples/ex_connectivity_comparison/main.cpp @@ -383,7 +383,7 @@ int main(int argc, char *argv[]) lNetworks); for(int j = 0; j < lNetworkTreeItems.size(); ++j) { - lNetworkTreeItems.at(j)->setThresholds(QVector3D(0.9,0.95,1.0)); + lNetworkTreeItems.at(j)->setThresholds(QVector3D(0.9f, 0.95f, 1.0f)); } //Read and show sensor helmets diff --git a/examples/ex_connectivity_performance/main.cpp b/examples/ex_connectivity_performance/main.cpp index 1f235907ee3..0a7e07c3756 100644 --- a/examples/ex_connectivity_performance/main.cpp +++ b/examples/ex_connectivity_performance/main.cpp @@ -133,6 +133,9 @@ void customMessageHandler(QtMsgType type, const QMessageLogContext &context, con */ int main(int argc, char *argv[]) { + Q_UNUSED(argc); + Q_UNUSED(argv); + #ifdef STATICBUILD Q_INIT_RESOURCE(disp3d); #endif diff --git a/examples/ex_coreg/main.cpp b/examples/ex_coreg/main.cpp index 82fea966fe8..ba60ac1843e 100644 --- a/examples/ex_coreg/main.cpp +++ b/examples/ex_coreg/main.cpp @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) Matrix3f matDst(digSetDst.size(),3); Matrix4f matTrans; Vector3f vecWeights(digSetSrc.size()); // LPA, Nasion, RPA - float fScale; + float fScale = 1.0f; // get coordinates for(int i = 0; i< digSetSrc.size(); ++i) { @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) AbstractView::SPtr p3DAbstractView = AbstractView::SPtr(new AbstractView()); Data3DTreeModel::SPtr p3DDataModel = p3DAbstractView->getTreeModel(); DigitizerSetTreeItem* pDigSrcSetTreeItem = p3DDataModel->addDigitizerData("Sample", "Fiducials Transformed", digSetSrc); - DigitizerSetTreeItem* pDigHspSetTreeItem = p3DDataModel->addDigitizerData("Sample", "Digitizer", digSetHsp); +// DigitizerSetTreeItem* pDigHspSetTreeItem = p3DDataModel->addDigitizerData("Sample", "Digitizer", digSetHsp); pDigSrcSetTreeItem->setTransform(transHeadMri,true); BemTreeItem* pBemItem = p3DDataModel->addBemData("Sample", "Head", bemHead); diff --git a/examples/ex_roi_clustered_inverse_pwl_rap_music/main.cpp b/examples/ex_roi_clustered_inverse_pwl_rap_music/main.cpp index 82f02405d1d..83aae71215e 100644 --- a/examples/ex_roi_clustered_inverse_pwl_rap_music/main.cpp +++ b/examples/ex_roi_clustered_inverse_pwl_rap_music/main.cpp @@ -384,12 +384,12 @@ int main(int argc, char *argv[]) p3DDataModel->addSurfaceSet(parser.value(subjectOption), "HemiLRSet", t_surfSet, t_annotationSet); - MneDataTreeItem* pRTDataItem = p3DDataModel->addSourceData(parser.value(subjectOption), - "HemiLRSet", - sourceEstimate, - t_clusteredFwd, - t_surfSet, - t_annotationSet); +// MneDataTreeItem* pRTDataItem = p3DDataModel->addSourceData(parser.value(subjectOption), +// "HemiLRSet", +// sourceEstimate, +// t_clusteredFwd, +// t_surfSet, +// t_annotationSet); p3DAbstractView->show(); diff --git a/examples/ex_st_clustered_inverse_pwl_rap_music/main.cpp b/examples/ex_st_clustered_inverse_pwl_rap_music/main.cpp index 2bb195a2595..31d99a9ffc9 100644 --- a/examples/ex_st_clustered_inverse_pwl_rap_music/main.cpp +++ b/examples/ex_st_clustered_inverse_pwl_rap_music/main.cpp @@ -370,12 +370,12 @@ int main(int argc, char *argv[]) p3DDataModel->addSurfaceSet(parser.value(subjectOption), "HemiLRSet", t_surfSet, t_annotationSet); - MneDataTreeItem* pRTDataItem = p3DDataModel->addSourceData(parser.value(subjectOption), - "HemiLRSet", - sourceEstimate, - t_clusteredFwd, - t_surfSet, - t_annotationSet); + p3DDataModel->addSourceData(parser.value(subjectOption), + "HemiLRSet", + sourceEstimate, + t_clusteredFwd, + t_surfSet, + t_annotationSet); p3DAbstractView->show(); diff --git a/libraries/disp3D/engine/view/view3D.cpp b/libraries/disp3D/engine/view/view3D.cpp index 29cf697adba..7d1fed68050 100644 --- a/libraries/disp3D/engine/view/view3D.cpp +++ b/libraries/disp3D/engine/view/view3D.cpp @@ -494,7 +494,7 @@ void View3D::initMultiView() updateMultiViewAspectRatio(); - auto noDraw = new Qt3DRender::QNoDraw(clearBuffers); +// auto noDraw = new Qt3DRender::QNoDraw(clearBuffers); } //============================================================================================================= diff --git a/libraries/inverse/hpiFit/hpifit.cpp b/libraries/inverse/hpiFit/hpifit.cpp index cacfc3837db..ee05c1ed064 100644 --- a/libraries/inverse/hpiFit/hpifit.cpp +++ b/libraries/inverse/hpiFit/hpifit.cpp @@ -112,6 +112,11 @@ void HPIFit::fitHPI(const MatrixXd& t_mat, int iMaxIterations, float fAbortError) { + if(bDoDebug) + { + std::cout << "Debug mode ON\n"; + } + //Check if data was passed if(t_mat.rows() == 0 || t_mat.cols() == 0 ) { std::cout<(label_ids.rows()), curr_name.toUtf8().constData()); // // Get source space indeces @@ -875,7 +887,7 @@ FiffCov MNEForwardSolution::compute_depth_prior(const MatrixXd &Gain, const Fiff } } - printf("\tlimit = %d/%ld = %f", n_limit + 1, d.size(), sqrt(limit / ws[0])); + printf("\tlimit = %d/%ld = %f", n_limit + 1, static_cast(d.size()), sqrt(limit / ws[0])); double scale = 1.0 / limit; printf("\tscale = %g exp = %g", scale, exp); @@ -1773,7 +1785,7 @@ void MNEForwardSolution::restrict_gain_matrix(MatrixXd &G, const FiffInfo &info) // Figure out which ones have been used if(info.chs.size() != G.rows()) { - printf("Error G.rows() and length of info.chs do not match: %ld != %i", G.rows(), info.chs.size()); //ToDo throw + printf("Error G.rows() and length of info.chs do not match: %ld != %i", static_cast(G.rows()), info.chs.size()); //ToDo throw return; } @@ -1783,7 +1795,7 @@ void MNEForwardSolution::restrict_gain_matrix(MatrixXd &G, const FiffInfo &info) for(qint32 i = 0; i < sel.size(); ++i) G.row(i) = G.row(sel[i]); G.conservativeResize(sel.size(), G.cols()); - printf("\t%ld planar channels", sel.size()); + printf("\t%ld planar channels", static_cast(sel.size())); } else { @@ -1793,7 +1805,7 @@ void MNEForwardSolution::restrict_gain_matrix(MatrixXd &G, const FiffInfo &info) for(qint32 i = 0; i < sel.size(); ++i) G.row(i) = G.row(sel[i]); G.conservativeResize(sel.size(), G.cols()); - printf("\t%ld magnetometer or axial gradiometer channels", sel.size()); + printf("\t%ld magnetometer or axial gradiometer channels", static_cast(sel.size())); } else { @@ -1803,7 +1815,7 @@ void MNEForwardSolution::restrict_gain_matrix(MatrixXd &G, const FiffInfo &info) for(qint32 i = 0; i < sel.size(); ++i) G.row(i) = G.row(sel[i]); G.conservativeResize(sel.size(), G.cols()); - printf("\t%ld EEG channels\n", sel.size()); + printf("\t%ld EEG channels\n", static_cast(sel.size())); } else printf("Could not find MEG or EEG channels\n"); diff --git a/libraries/mne/mne_forwardsolution.h b/libraries/mne/mne_forwardsolution.h index a6b7bd70b2d..026b04a21a0 100644 --- a/libraries/mne/mne_forwardsolution.h +++ b/libraries/mne/mne_forwardsolution.h @@ -157,9 +157,7 @@ struct RegionData } }; -const static FIFFLIB::FiffCov defaultCov; -const static FIFFLIB::FiffInfo defaultInfo; -static Eigen::MatrixXd defaultD; + //============================================================================================================= /** @@ -225,19 +223,32 @@ class MNESHARED_EXPORT MNEForwardSolution * * @param[in] p_AnnotationSet Annotation set containing the annotation of left & right hemisphere. * @param[in] p_iClusterSize Maximal cluster size per roi. - * @param[out] p_D The cluster operator. - * @param[in] p_pNoise_cov. - * @param[in] p_pInfo. + * @param[out] p_D The cluster operator. + * @param[in] p_pNoise_cov + * @param[in] p_pInfo * @param[in] p_sMethod "cityblock" or "sqeuclidean". * * @return clustered MNE forward solution. */ MNEForwardSolution cluster_forward_solution(const FSLIB::AnnotationSet &p_AnnotationSet, qint32 p_iClusterSize, - Eigen::MatrixXd& p_D = defaultD, - const FIFFLIB::FiffCov &p_pNoise_cov = defaultCov, - const FIFFLIB::FiffInfo &p_pInfo = defaultInfo, - QString p_sMethod = "cityblock") const; + Eigen::MatrixXd& p_D, + const FIFFLIB::FiffCov &p_pNoise_cov, + const FIFFLIB::FiffInfo &p_pInfo, + QString p_sMethod) const; + + //========================================================================================================= + /** + * Cluster the forward solution and stores the result to p_fwdOut. + * The clustering is done by using the provided annotations + * + * @param[in] p_AnnotationSet Annotation set containing the annotation of left & right hemisphere. + * @param[in] p_iClusterSize Maximal cluster size per roi. + * + * @return clustered MNE forward solution. + */ + MNEForwardSolution cluster_forward_solution(const FSLIB::AnnotationSet &p_AnnotationSet, + qint32 p_iClusterSize) const; //========================================================================================================= /** diff --git a/libraries/mne/mne_inverse_operator.cpp b/libraries/mne/mne_inverse_operator.cpp index 269f1a60d9b..88e72c2492a 100644 --- a/libraries/mne/mne_inverse_operator.cpp +++ b/libraries/mne/mne_inverse_operator.cpp @@ -435,7 +435,7 @@ MatrixXd MNEInverseOperator::cluster_kernel(const AnnotationSet &p_AnnotationSet if (label_ids[i] != 0) { QString curr_name = t_CurrentColorTable.struct_names[i];//obj.label2AtlasName(label(i)); - printf("\tCluster %d / %ld %s...", i+1, label_ids.rows(), curr_name.toUtf8().constData()); + printf("\tCluster %d / %ld %s...", i+1, static_cast(label_ids.rows()), curr_name.toUtf8().constData()); // // Get source space indeces diff --git a/libraries/rtprocessing/icp.cpp b/libraries/rtprocessing/icp.cpp index 1be4bf932cf..54559c86161 100644 --- a/libraries/rtprocessing/icp.cpp +++ b/libraries/rtprocessing/icp.cpp @@ -92,8 +92,9 @@ bool RTPROCESSINGLIB::performIcp(const MNEProjectToSurface::SPtr mneSurfacePoint // Initialization int iNP = matPointCloud.rows(); // The number of points - float fMSEPrev,fMSE = 0.0; // The mean square error - float fScale = 1.0; + float fMSEPrev = 0.0f; // The mean square error of previous iteration. + float fMSE = 0.0f; // The mean square error + float fScale = 1.0f; MatrixXf matP0 = matPointCloud; // Initial Set of points MatrixXf matPk = matP0; // Transformed Set of points MatrixXf matYk(matPk.rows(),matPk.cols()); // Iterative closest points on the surface @@ -175,7 +176,6 @@ bool RTPROCESSINGLIB::fitMatchedPoints(const MatrixXf& matSrcPoint, Matrix3f matRot = Matrix3f::Identity(3,3); Vector3f vecTrans; float fTrace = 0.0; - fScale = 1.0; // test size of point clouds if(matSrcPoint.size() != matDstPoint.size()) { diff --git a/testframes/test_coregistration/test_coregistration.cpp b/testframes/test_coregistration/test_coregistration.cpp index de5107dab01..1c603f5e3e9 100644 --- a/testframes/test_coregistration/test_coregistration.cpp +++ b/testframes/test_coregistration/test_coregistration.cpp @@ -97,7 +97,6 @@ private slots: private: // declare your thresholds, variables and error values here - double dEpsilon; FiffCoordTrans transFitMatched; FiffCoordTrans transPerformICP; FiffCoordTrans transFitMatchedRef; @@ -107,7 +106,6 @@ private slots: //============================================================================================================= TestCoregistration::TestCoregistration() - : dEpsilon(0.000001) { } @@ -149,7 +147,7 @@ void TestCoregistration::initTestCase() Matrix3f matDst(digSetDst.size(),3); Matrix4f matTrans; Vector3f vecWeights(digSetSrc.size()); // LPA, Nasion, RPA - float fScale; + float fScale = 1.0f; bool bScale = true; // get coordinates @@ -173,7 +171,7 @@ void TestCoregistration::initTestCase() fiff_int_t iFrom = digSetSrc[0].coord_frame; fiff_int_t iTo = bemSurface.data()->coord_frame; transFitMatched = FiffCoordTrans::make(iFrom, iTo, matTrans); - transPerformICP = *new FiffCoordTrans(transFitMatched); + transPerformICP = FiffCoordTrans(transFitMatched); // Prepare Icp: VectorXf vecWeightsICP(digSetHsp.size()); // Weigths vector diff --git a/testframes/test_filtering/test_filtering.cpp b/testframes/test_filtering/test_filtering.cpp index e04e8d6529b..3542841b6af 100644 --- a/testframes/test_filtering/test_filtering.cpp +++ b/testframes/test_filtering/test_filtering.cpp @@ -149,7 +149,7 @@ void TestFiltering::initTestCase() fiff_int_t to = rawFirstInRaw.last_samp; // initialize filter settings - QString sFilterName = "example_cosine"; +// QString sFilterName = "example_cosine"; int type = FilterKernel::m_filterTypes.indexOf(FilterParameter("BPF")); double dSFreq = rawFirstInRaw.info.sfreq; double dCenterfreq = 10; diff --git a/testframes/test_geometryinfo/test_geometryinfo.cpp b/testframes/test_geometryinfo/test_geometryinfo.cpp index 26f18106af4..66f38de8b10 100644 --- a/testframes/test_geometryinfo/test_geometryinfo.cpp +++ b/testframes/test_geometryinfo/test_geometryinfo.cpp @@ -153,7 +153,7 @@ void TestGeometryInfo::testBadChannelFiltering() { return; } QVector vMegSensors; - for( const FiffChInfo &info : evoked.info.chs) { + for( const FiffChInfo &info : qAsConst(evoked.info.chs)) { if(info.kind == FIFFV_MEG_CH) { vMegSensors.push_back(info.chpos.r0); } @@ -166,7 +166,7 @@ void TestGeometryInfo::testBadChannelFiltering() { // filter for bad MEG channels: QVector vErasedColums = GeometryInfo::filterBadChannels(pDistanceMatrix, evoked.info, FIFFV_MEG_CH); - for (qint32 col : vErasedColums) { + for (qint32 col : qAsConst(vErasedColums)) { qint64 iNotInfCount = 0; for (qint32 row = 0; row < pDistanceMatrix->rows(); ++row) { if (pDistanceMatrix->coeff(row, col) != FLOAT_INFINITY) { diff --git a/testframes/test_hpiFit/test_hpiFit.cpp b/testframes/test_hpiFit/test_hpiFit.cpp index 21cba67c52b..2f35f6c4519 100644 --- a/testframes/test_hpiFit/test_hpiFit.cpp +++ b/testframes/test_hpiFit/test_hpiFit.cpp @@ -177,7 +177,6 @@ void TestHpiFit::initTestCase() FiffDigPointSet fittedPointSet; Eigen::MatrixXd mProjectors = Eigen::MatrixXd::Identity(pFiffInfo->chs.size(), pFiffInfo->chs.size()); QString sHPIResourceDir = QCoreApplication::applicationDirPath() + "/HPIFittingDebug"; - bool bDoDebug = true; HPIFit HPI = HPIFit(pFiffInfo, true); @@ -212,6 +211,9 @@ void TestHpiFit::initTestCase() } qInfo() << "HPI-Fit..."; + + bool bDoDebug = false; + HPI.fitHPI(mData, mProjectors, pFiffInfo->dev_head_t, @@ -220,7 +222,7 @@ void TestHpiFit::initTestCase() vGoF, fittedPointSet, pFiffInfo, - bDoDebug = 0, + bDoDebug, sHPIResourceDir, 200, 1e-5f); diff --git a/testframes/test_interpolation/test_interpolation.cpp b/testframes/test_interpolation/test_interpolation.cpp index 921e8ab136f..9a0762f877b 100644 --- a/testframes/test_interpolation/test_interpolation.cpp +++ b/testframes/test_interpolation/test_interpolation.cpp @@ -119,7 +119,7 @@ void TestInterpolation::initTestCase() if(evoked.isEmpty()) { return; } - for( const FiffChInfo &info : evoked.info.chs) { + for( const FiffChInfo &info : qAsConst(evoked.info.chs)) { if(info.kind == FIFFV_MEG_CH && info.unit == FIFF_UNIT_T) { vMegSensors.push_back(info.chpos.r0); } diff --git a/testframes/test_mne_msh_display_surface_set/test_mne_msh_display_surface_set.cpp b/testframes/test_mne_msh_display_surface_set/test_mne_msh_display_surface_set.cpp index 0dbc20412fa..abf28342b3d 100644 --- a/testframes/test_mne_msh_display_surface_set/test_mne_msh_display_surface_set.cpp +++ b/testframes/test_mne_msh_display_surface_set/test_mne_msh_display_surface_set.cpp @@ -79,15 +79,12 @@ private slots: void cleanupTestCase(); private: - double dEpsilon; - MneMshDisplaySurfaceSet::SPtr m_pSurfSetBemLoaded; }; //============================================================================================================= TestMneMshDisplaySurfaceSet::TestMneMshDisplaySurfaceSet() -: dEpsilon(0.000001) { }