From 21870a6531ab97e952ce52032e20be216675bf32 Mon Sep 17 00:00:00 2001 From: Jost Migenda Date: Wed, 10 Jul 2024 21:07:02 +0100 Subject: [PATCH] Update dialog boxes after removing iter argument to ExecuteSurf --- .../CemrgAppModule/include/CemrgCommandLine.h | 2 +- .../CemrgAppModule/src/CemrgCommandLine.cpp | 2 +- .../test/CemrgCommandLineTest.cpp | 8 +++--- .../src/internal/AtrialFibresView.cpp | 13 ++++------ .../src/internal/AtrialFibresView.h | 2 +- .../src/internal/AtrialFibresViewUIMeshing.ui | 13 +++------- .../src/internal/MmcwView.cpp | 20 +++++++------- .../src/internal/MmcwViewUIMeshing.ui | 20 ++++---------- .../src/internal/AtrialScarClipperView.cpp | 21 +++++++-------- .../src/internal/AtrialScarView.cpp | 26 +++++++++---------- .../src/internal/AtrialScarViewUIMeshing.ui | 20 ++++---------- 11 files changed, 55 insertions(+), 92 deletions(-) diff --git a/CemrgApp/Modules/CemrgAppModule/include/CemrgCommandLine.h b/CemrgApp/Modules/CemrgAppModule/include/CemrgCommandLine.h index 29f31231..e2e75013 100644 --- a/CemrgApp/Modules/CemrgAppModule/include/CemrgCommandLine.h +++ b/CemrgApp/Modules/CemrgAppModule/include/CemrgCommandLine.h @@ -49,7 +49,7 @@ class MITKCEMRGAPPMODULE_EXPORT CemrgCommandLine: public QObject { QDialog* GetDialog(); //Execute Plugin Specific Functions - QString ExecuteSurf(QString dir, QString segPath, int iter = 1, float th = 0.5, int blur = 0, int smth = 10); + QString ExecuteSurf(QString dir, QString segPath, float th = 0.5, int blur = 0, int smth = 10); QString ExecuteCreateCGALMesh(QString dir, QString outputName, QString paramsFullPath, QString segmentationName = "converted.inr"); void ExecuteTracking(QString dir, QString imgTimes, QString param, QString output = "tsffd.dof"); void ExecuteApplying(QString dir, QString inputMesh, double iniTime, QString dofin, int noFrames, int smooth); diff --git a/CemrgApp/Modules/CemrgAppModule/src/CemrgCommandLine.cpp b/CemrgApp/Modules/CemrgAppModule/src/CemrgCommandLine.cpp index 17d2a645..52a58022 100644 --- a/CemrgApp/Modules/CemrgAppModule/src/CemrgCommandLine.cpp +++ b/CemrgApp/Modules/CemrgAppModule/src/CemrgCommandLine.cpp @@ -93,7 +93,7 @@ QDialog* CemrgCommandLine::GetDialog() { ****************** Execute Plugin Specific Functions ********************** ***************************************************************************/ -QString CemrgCommandLine::ExecuteSurf(QString dir, QString segPath, int iter, float thresh, int blur, int smooth) { +QString CemrgCommandLine::ExecuteSurf(QString dir, QString segPath, float thresh, int blur, int smooth) { MITK_INFO << "[ATTENTION] SURFACE CREATION: Surface -> Smooth"; // Load input image into memory diff --git a/CemrgApp/Modules/CemrgAppModule/test/CemrgCommandLineTest.cpp b/CemrgApp/Modules/CemrgAppModule/test/CemrgCommandLineTest.cpp index 9f6371bd..f923b71c 100644 --- a/CemrgApp/Modules/CemrgAppModule/test/CemrgCommandLineTest.cpp +++ b/CemrgApp/Modules/CemrgAppModule/test/CemrgCommandLineTest.cpp @@ -123,15 +123,14 @@ void TestCemrgCommandLine::cleanupTestCase() { void TestCemrgCommandLine::ExecuteSurf_data() { QTest::addColumn("segPath"); - QTest::addColumn("iterations"); QTest::addColumn("threshold"); QTest::addColumn("blur"); QTest::addColumn("smoothness"); QTest::addColumn("result"); const array, 2> surfData { { - {"sphere_initial.nii", 1, 0.5, 0, 10, "/surf_expected_1.vtk"}, - {"sphere_shifted.nii", 1, 0.5, 0, 10, "/surf_expected_2.vtk"}, + {"sphere_initial.nii", 0.5, 0, 10, "/surf_expected_1.vtk"}, + {"sphere_shifted.nii", 0.5, 0, 10, "/surf_expected_2.vtk"}, } }; for (size_t i = 0; i < surfData.size(); i++) @@ -140,13 +139,12 @@ void TestCemrgCommandLine::ExecuteSurf_data() { void TestCemrgCommandLine::ExecuteSurf() { QFETCH(QString, segPath); - QFETCH(int, iterations); QFETCH(float, threshold); QFETCH(int, blur); QFETCH(int, smoothness); QFETCH(QString, result); - QString surfOutput = cemrgCommandLine->ExecuteSurf(dataPath, segPath, iterations, threshold, blur, smoothness); + QString surfOutput = cemrgCommandLine->ExecuteSurf(dataPath, segPath, threshold, blur, smoothness); QVERIFY2(EqualFiles(surfOutput, dataPath + result), "The function output is different from the expected output!"); } diff --git a/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresView.cpp b/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresView.cpp index a260bc1e..873aafc1 100644 --- a/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresView.cpp +++ b/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresView.cpp @@ -472,7 +472,7 @@ void AtrialFibresView::AutomaticAnalysis(){ std::unique_ptr cmd(new CemrgCommandLine()); cmd->SetUseDockerContainers(true); - cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth); + cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_th, uiMesh_bl, uiMesh_smth); atrium->ProjectTagsOnExistingSurface(tagAtriumAuto, directory, tagName+".vtk"); MITK_INFO << "[AUTOMATIC_PIPELINE] Add the mesh to storage"; @@ -673,7 +673,7 @@ void AtrialFibresView::IdentifyPV(){ std::unique_ptr cmd(new CemrgCommandLine()); cmd->SetUseDockerContainers(true); - cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth); + cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_th, uiMesh_bl, uiMesh_smth); //Add the mesh to storage std::string meshName = segNode->GetName() + "-Mesh"; @@ -728,7 +728,7 @@ void AtrialFibresView::CreateLabelledMesh(){ std::unique_ptr cmd(new CemrgCommandLine()); cmd->SetUseDockerContainers(true); - cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth); + cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_th, uiMesh_bl, uiMesh_smth); atrium->ProjectTagsOnExistingSurface(pveins, directory, tagName+".vtk"); MITK_INFO << "Add the mesh to storage"; @@ -1996,7 +1996,6 @@ bool AtrialFibresView::GetUserMeshingInputs(){ if(userHasSetMeshingParams){ QString msg = "The parameters have been set already, change them?\n"; - msg += "close iter= " + QString::number(uiMesh_iter) + '\n'; msg += "threshold= " + QString::number(uiMesh_th) + '\n'; msg += "blur= " + QString::number(uiMesh_bl) + '\n'; msg += "smooth iter= " + QString::number(uiMesh_smth); @@ -2017,19 +2016,17 @@ bool AtrialFibresView::GetUserMeshingInputs(){ //Act on dialog return code if (dialogCode == QDialog::Accepted) { - bool ok1, ok2, ok3, ok4; + bool ok1, ok2, ok3; uiMesh_th= m_UIMeshing.lineEdit_1->text().toDouble(&ok1); uiMesh_bl= m_UIMeshing.lineEdit_2->text().toDouble(&ok2); uiMesh_smth= m_UIMeshing.lineEdit_3->text().toDouble(&ok3); - uiMesh_iter= m_UIMeshing.lineEdit_4->text().toDouble(&ok4); //Set default values - if (!ok1 || !ok2 || !ok3 || !ok4) + if (!ok1 || !ok2 || !ok3) QMessageBox::warning(NULL, "Attention", "Reverting to default parameters!"); if (!ok1) uiMesh_th=0.5; if (!ok2) uiMesh_bl=0.0; if (!ok3) uiMesh_smth=10; - if (!ok4) uiMesh_iter=0; inputs->deleteLater(); userInputAccepted=true; diff --git a/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresView.h b/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresView.h index c988eea6..eee3f98a 100644 --- a/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresView.h +++ b/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresView.h @@ -173,7 +173,7 @@ protected slots: bool automaticPipeline, analysisOnLge, resurfaceMesh, userHasSetMeshingParams; // user-defined parameters - double uiMesh_th, uiMesh_bl, uiMesh_smth, uiMesh_iter; + double uiMesh_th, uiMesh_bl, uiMesh_smth; double uiRemesh_max, uiRemesh_avrg, uiRemesh_min, uiRemesh_surfcorr; bool uiRemesh_isscalar, uiRemesh_extractParts, uiRemesh_cleanmesh; int uiScar_minStep, uiScar_maxStep, uiScar_projectionMethod, uiScar_thresholdMethod, uiFormat_scale; diff --git a/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresViewUIMeshing.ui b/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresViewUIMeshing.ui index 182be0a7..5dfabddd 100644 --- a/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresViewUIMeshing.ui +++ b/CemrgApp/Plugins/kcl.cemrgapp.atrialfibres/src/internal/AtrialFibresViewUIMeshing.ui @@ -7,7 +7,7 @@ 0 0 222 - 196 + 160 @@ -19,13 +19,13 @@ 0 - 196 + 160 16777215 - 196 + 160 @@ -45,13 +45,6 @@ - - - - 'Close' iterations (default=0) - - - diff --git a/CemrgApp/Plugins/kcl.cemrgapp.mmcwplugin/src/internal/MmcwView.cpp b/CemrgApp/Plugins/kcl.cemrgapp.mmcwplugin/src/internal/MmcwView.cpp index abad5074..61d6c2db 100644 --- a/CemrgApp/Plugins/kcl.cemrgapp.mmcwplugin/src/internal/MmcwView.cpp +++ b/CemrgApp/Plugins/kcl.cemrgapp.mmcwplugin/src/internal/MmcwView.cpp @@ -564,25 +564,23 @@ void MmcwView::CreateSurf() { //Act on dialog return code if (dialogCode == QDialog::Accepted) { - bool ok1, ok2, ok3, ok4; - int iter = m_UIMeshing.lineEdit_1->text().toInt(&ok1); - float th = m_UIMeshing.lineEdit_2->text().toFloat(&ok2); - int blur = m_UIMeshing.lineEdit_3->text().toInt(&ok3); - int smth = m_UIMeshing.lineEdit_4->text().toInt(&ok4); + bool ok1, ok2, ok3; + float th = m_UIMeshing.lineEdit_1->text().toFloat(&ok1); + int blur = m_UIMeshing.lineEdit_2->text().toInt(&ok2); + int smth = m_UIMeshing.lineEdit_3->text().toInt(&ok3); //Set default values - if (!ok1 || !ok2 || !ok3 || !ok4) + if (!ok1 || !ok2 || !ok3) QMessageBox::warning(NULL, "Attention", "Reverting to default parameters!"); - if (!ok1) iter = 1; - if (!ok2) th = 0.5; - if (!ok3) blur = 0; - if (!ok4) smth = 10; + if (!ok1) th = 0.5; + if (!ok2) blur = 0; + if (!ok3) smth = 10; //_if this->BusyCursorOn(); mitk::ProgressBar::GetInstance()->AddStepsToDo(3); std::unique_ptr cmd(new CemrgCommandLine()); - QString output = cmd->ExecuteSurf(directory, path, iter, th, blur, smth); + QString output = cmd->ExecuteSurf(directory, path, th, blur, smth); QMessageBox::information(NULL, "Attention", "Command Line Operations Finished!"); this->BusyCursorOff(); diff --git a/CemrgApp/Plugins/kcl.cemrgapp.mmcwplugin/src/internal/MmcwViewUIMeshing.ui b/CemrgApp/Plugins/kcl.cemrgapp.mmcwplugin/src/internal/MmcwViewUIMeshing.ui index fdc04be8..b01ec331 100644 --- a/CemrgApp/Plugins/kcl.cemrgapp.mmcwplugin/src/internal/MmcwViewUIMeshing.ui +++ b/CemrgApp/Plugins/kcl.cemrgapp.mmcwplugin/src/internal/MmcwViewUIMeshing.ui @@ -7,7 +7,7 @@ 0 0 216 - 196 + 160 @@ -19,13 +19,13 @@ 0 - 196 + 160 16777215 - 196 + 160 @@ -50,30 +50,20 @@ - - Iteration (default = 1) - - - - - Threshold (default = 0.5) - + Blur (default = 0) - - - - + Smooth (default = 10) diff --git a/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarClipperView.cpp b/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarClipperView.cpp index 232f451e..f75c9332 100644 --- a/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarClipperView.cpp +++ b/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarClipperView.cpp @@ -190,20 +190,19 @@ void AtrialScarClipperView::iniPreSurf() { //Act on dialog return code if (dialogCode == QDialog::Accepted) { - bool ok1, ok2, ok3, ok4; - int iter = m_UIMeshing.lineEdit_1->text().toInt(&ok1); - float th = m_UIMeshing.lineEdit_2->text().toFloat(&ok2); - int blur = m_UIMeshing.lineEdit_3->text().toInt(&ok3); - int smth = m_UIMeshing.lineEdit_4->text().toInt(&ok4); + bool ok1, ok2, ok3; + // TODO: iter parameter is no longer used; remove from dialog box + float th = m_UIMeshing.lineEdit_1->text().toFloat(&ok1); + int blur = m_UIMeshing.lineEdit_2->text().toInt(&ok2); + int smth = m_UIMeshing.lineEdit_3->text().toInt(&ok3); float ds = 0.1; //Set default values - if (!ok1 || !ok2 || !ok3 || !ok4) + if (!ok1 || !ok2 || !ok3) QMessageBox::warning(NULL, "Attention", "Reverting to default parameters!"); - if (!ok1) iter = 1; - if (!ok2) th = 0.5; - if (!ok3) blur = 0; - if (!ok4) smth = 10; + if (!ok1) th = 0.5; + if (!ok2) blur = 0; + if (!ok3) smth = 10; //_if this->BusyCursorOn(); @@ -211,7 +210,7 @@ void AtrialScarClipperView::iniPreSurf() { mitk::IOUtil::Save(image, path.toStdString()); mitk::ProgressBar::GetInstance()->AddStepsToDo(3); std::unique_ptr cmd(new CemrgCommandLine()); - QString output = cmd->ExecuteSurf(directory, path, iter, th, blur, smth); + QString output = cmd->ExecuteSurf(directory, path, th, blur, smth); QMessageBox::information(NULL, "Attention", "Command Line Operations Finished!"); this->BusyCursorOff(); diff --git a/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarView.cpp b/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarView.cpp index f3a6e149..7da71685 100644 --- a/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarView.cpp +++ b/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarView.cpp @@ -540,7 +540,7 @@ void AtrialScarView::AutomaticAnalysis() { MITK_INFO << ("[...][3.1] Saved file: " + segCleanPath).toStdString(); MITK_INFO << "[AUTOMATIC_ANALYSIS][4] Vein clipping mesh"; - QString output1 = cmd->ExecuteSurf(direct, segCleanPath, 1, .5, 0, 10); + QString output1 = cmd->ExecuteSurf(direct, segCleanPath, .5, 0, 10); mitk::Surface::Pointer shell = mitk::IOUtil::Load(output1.toStdString()); vtkSmartPointer deci = vtkSmartPointer::New(); deci->SetInputData(shell->GetVtkPolyData()); @@ -662,7 +662,7 @@ void AtrialScarView::AutomaticAnalysis() { MITK_INFO << "[...][7.3] ClipVeinsImage finished ."; MITK_INFO << "[AUTOMATIC_ANALYSIS][8] Create a mesh from clipped segmentation of veins"; - QString output2 = cmd->ExecuteSurf(direct, (direct + "/PVeinsCroppedImage.nii"), 1, .5, 0, 10); + QString output2 = cmd->ExecuteSurf(direct, (direct + "/PVeinsCroppedImage.nii"), .5, 0, 10); mitk::Surface::Pointer LAShell = mitk::IOUtil::Load(output2.toStdString()); MITK_INFO << "[AUTOMATIC_ANALYSIS][9] Clip the mitral valve"; @@ -693,7 +693,7 @@ void AtrialScarView::AutomaticAnalysis() { mitk::IOUtil::Save(mitk::ImportItkImage(mvImage), (direct + "/prodMVI.nii").toStdString()); // Make vtk of prodMVI - QString mviShellPath = cmd->ExecuteSurf(direct, "prodMVI.nii", 1, 0.5, 0, 10); + QString mviShellPath = cmd->ExecuteSurf(direct, "prodMVI.nii", 0.5, 0, 10); // Implement code from command line tool mitk::Surface::Pointer ClipperSurface = mitk::IOUtil::Load(mviShellPath.toStdString()); vtkSmartPointer implicitFn = vtkSmartPointer::New(); @@ -1176,19 +1176,17 @@ void AtrialScarView::CreateSurf() { //Act on dialog return code if (dialogCode == QDialog::Accepted) { - bool ok1, ok2, ok3, ok4; - int iter = m_UIMeshing.lineEdit_1->text().toInt(&ok1); - float th = m_UIMeshing.lineEdit_2->text().toFloat(&ok2); - int blur = m_UIMeshing.lineEdit_3->text().toInt(&ok3); - int smth = m_UIMeshing.lineEdit_4->text().toInt(&ok4); + bool ok1, ok2, ok3; + float th = m_UIMeshing.lineEdit_1->text().toFloat(&ok1); + int blur = m_UIMeshing.lineEdit_2->text().toInt(&ok2); + int smth = m_UIMeshing.lineEdit_3->text().toInt(&ok3); //Set default values - if (!ok1 || !ok2 || !ok3 || !ok4) + if (!ok1 || !ok2 || !ok3) QMessageBox::warning(NULL, "Attention", "Reverting to default parameters!"); - if (!ok1) iter = 1; - if (!ok2) th = 0.5; - if (!ok3) blur = 0; - if (!ok4) smth = 10; + if (!ok1) th = 0.5; + if (!ok2) blur = 0; + if (!ok3) smth = 10; //_if this->BusyCursorOn(); @@ -1197,7 +1195,7 @@ void AtrialScarView::CreateSurf() { mitk::ProgressBar::GetInstance()->AddStepsToDo(3); std::unique_ptr cmd(new CemrgCommandLine()); cmd->SetUseDockerContainers(_useDockerInPlugin); - path = cmd->ExecuteSurf(directory, pathTemp, iter, th, blur, smth); + path = cmd->ExecuteSurf(directory, pathTemp, th, blur, smth); QMessageBox::information(NULL, "Attention", "Command Line Operations Finished!"); this->BusyCursorOff(); diff --git a/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarViewUIMeshing.ui b/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarViewUIMeshing.ui index 2a867859..c655a9ba 100644 --- a/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarViewUIMeshing.ui +++ b/CemrgApp/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarViewUIMeshing.ui @@ -7,7 +7,7 @@ 0 0 222 - 196 + 160 @@ -19,13 +19,13 @@ 0 - 196 + 160 16777215 - 196 + 160 @@ -50,30 +50,20 @@ - - Iteration (default = 1) - - - - - Threshold (default = 0.5) - + Blur (default = 0) - - - - + Smooth (default = 10)