Skip to content

Commit

Permalink
remove unused morphOperation argument to ExecuteSurf
Browse files Browse the repository at this point in the history
Delete superfluous test case (which only differed in the morphOperation from the first test case)
  • Loading branch information
JostMigenda committed Jul 10, 2024
1 parent 7de0a86 commit ba8542d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CemrgApp/Modules/CemrgAppModule/include/CemrgCommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class MITKCEMRGAPPMODULE_EXPORT CemrgCommandLine: public QObject {
QDialog* GetDialog();

//Execute Plugin Specific Functions
QString ExecuteSurf(QString dir, QString segPath, QString morphOperation = "close", int iter = 1, float th = 0.5, int blur = 0, int smth = 10);
QString ExecuteSurf(QString dir, QString segPath, int iter = 1, 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);
Expand Down
2 changes: 1 addition & 1 deletion CemrgApp/Modules/CemrgAppModule/src/CemrgCommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ QDialog* CemrgCommandLine::GetDialog() {
****************** Execute Plugin Specific Functions **********************
***************************************************************************/

QString CemrgCommandLine::ExecuteSurf(QString dir, QString segPath, QString morphOperation, int iter, float thresh, int blur, int smooth) {
QString CemrgCommandLine::ExecuteSurf(QString dir, QString segPath, int iter, float thresh, int blur, int smooth) {
MITK_INFO << "[ATTENTION] SURFACE CREATION: Surface -> Smooth";

// Load input image into memory
Expand Down
11 changes: 4 additions & 7 deletions CemrgApp/Modules/CemrgAppModule/test/CemrgCommandLineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,15 @@ void TestCemrgCommandLine::cleanupTestCase() {

void TestCemrgCommandLine::ExecuteSurf_data() {
QTest::addColumn<QString>("segPath");
QTest::addColumn<QString>("morphOperation");
QTest::addColumn<int>("iterations");
QTest::addColumn<float>("threshold");
QTest::addColumn<int>("blur");
QTest::addColumn<int>("smoothness");
QTest::addColumn<QString>("result");

const array<tuple<QString, QString, int, float, int, int, QString>, 3> surfData { {
{"sphere_initial.nii", "close", 1, 0.5, 0, 10, "/surf_expected_1.vtk"},
{"sphere_shifted.nii", "dilate", 1, 0.5, 0, 10, "/surf_expected_2.vtk"},
{"sphere_initial.nii", "erode", 1, 0.5, 0, 10, "/surf_expected_3.vtk"}
const array<tuple<QString, QString, int, float, int, int, QString>, 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"},
} };

for (size_t i = 0; i < surfData.size(); i++)
Expand All @@ -142,14 +140,13 @@ void TestCemrgCommandLine::ExecuteSurf_data() {

void TestCemrgCommandLine::ExecuteSurf() {
QFETCH(QString, segPath);
QFETCH(QString, morphOperation);
QFETCH(int, iterations);
QFETCH(float, threshold);
QFETCH(int, blur);
QFETCH(int, smoothness);
QFETCH(QString, result);

QString surfOutput = cemrgCommandLine->ExecuteSurf(dataPath, segPath, morphOperation, iterations, threshold, blur, smoothness);
QString surfOutput = cemrgCommandLine->ExecuteSurf(dataPath, segPath, iterations, threshold, blur, smoothness);
QVERIFY2(EqualFiles(surfOutput, dataPath + result), "The function output is different from the expected output!");
}

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ void AtrialFibresView::AutomaticAnalysis(){
std::unique_ptr<CemrgCommandLine> cmd(new CemrgCommandLine());
cmd->SetUseDockerContainers(true);

cmd->ExecuteSurf(directory, Path("prodClean.nii"), "close", uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth);
cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth);
atrium->ProjectTagsOnExistingSurface(tagAtriumAuto, directory, tagName+".vtk");

MITK_INFO << "[AUTOMATIC_PIPELINE] Add the mesh to storage";
Expand Down Expand Up @@ -673,7 +673,7 @@ void AtrialFibresView::IdentifyPV(){
std::unique_ptr<CemrgCommandLine> cmd(new CemrgCommandLine());
cmd->SetUseDockerContainers(true);

cmd->ExecuteSurf(directory, Path("prodClean.nii"), "close", uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth);
cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth);

//Add the mesh to storage
std::string meshName = segNode->GetName() + "-Mesh";
Expand Down Expand Up @@ -728,7 +728,7 @@ void AtrialFibresView::CreateLabelledMesh(){
std::unique_ptr<CemrgCommandLine> cmd(new CemrgCommandLine());
cmd->SetUseDockerContainers(true);

cmd->ExecuteSurf(directory, Path("prodClean.nii"), "close", uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth);
cmd->ExecuteSurf(directory, Path("prodClean.nii"), uiMesh_iter, uiMesh_th, uiMesh_bl, uiMesh_smth);
atrium->ProjectTagsOnExistingSurface(pveins, directory, tagName+".vtk");

MITK_INFO << "Add the mesh to storage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ void MmcwView::CreateSurf() {
this->BusyCursorOn();
mitk::ProgressBar::GetInstance()->AddStepsToDo(3);
std::unique_ptr<CemrgCommandLine> cmd(new CemrgCommandLine());
QString output = cmd->ExecuteSurf(directory, path, "close", iter, th, blur, smth);
QString output = cmd->ExecuteSurf(directory, path, iter, th, blur, smth);
QMessageBox::information(NULL, "Attention", "Command Line Operations Finished!");
this->BusyCursorOff();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void AtrialScarClipperView::iniPreSurf() {
mitk::IOUtil::Save(image, path.toStdString());
mitk::ProgressBar::GetInstance()->AddStepsToDo(3);
std::unique_ptr<CemrgCommandLine> cmd(new CemrgCommandLine());
QString output = cmd->ExecuteSurf(directory, path, "close", iter, th, blur, smth);
QString output = cmd->ExecuteSurf(directory, path, iter, th, blur, smth);
QMessageBox::information(NULL, "Attention", "Command Line Operations Finished!");
this->BusyCursorOff();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, "close", 1, .5, 0, 10);
QString output1 = cmd->ExecuteSurf(direct, segCleanPath, 1, .5, 0, 10);
mitk::Surface::Pointer shell = mitk::IOUtil::Load<mitk::Surface>(output1.toStdString());
vtkSmartPointer<vtkDecimatePro> deci = vtkSmartPointer<vtkDecimatePro>::New();
deci->SetInputData(shell->GetVtkPolyData());
Expand Down Expand Up @@ -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"), "close", 1, .5, 0, 10);
QString output2 = cmd->ExecuteSurf(direct, (direct + "/PVeinsCroppedImage.nii"), 1, .5, 0, 10);
mitk::Surface::Pointer LAShell = mitk::IOUtil::Load<mitk::Surface>(output2.toStdString());

MITK_INFO << "[AUTOMATIC_ANALYSIS][9] Clip the mitral valve";
Expand Down Expand Up @@ -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", "close", 1, 0.5, 0, 10);
QString mviShellPath = cmd->ExecuteSurf(direct, "prodMVI.nii", 1, 0.5, 0, 10);
// Implement code from command line tool
mitk::Surface::Pointer ClipperSurface = mitk::IOUtil::Load<mitk::Surface>(mviShellPath.toStdString());
vtkSmartPointer<vtkImplicitPolyDataDistance> implicitFn = vtkSmartPointer<vtkImplicitPolyDataDistance>::New();
Expand Down Expand Up @@ -1197,7 +1197,7 @@ void AtrialScarView::CreateSurf() {
mitk::ProgressBar::GetInstance()->AddStepsToDo(3);
std::unique_ptr<CemrgCommandLine> cmd(new CemrgCommandLine());
cmd->SetUseDockerContainers(_useDockerInPlugin);
path = cmd->ExecuteSurf(directory, pathTemp, "close", iter, th, blur, smth);
path = cmd->ExecuteSurf(directory, pathTemp, iter, th, blur, smth);
QMessageBox::information(NULL, "Attention", "Command Line Operations Finished!");
this->BusyCursorOff();

Expand Down

0 comments on commit ba8542d

Please sign in to comment.