Skip to content

Commit

Permalink
remove unused iter argument to ExecuteSurf
Browse files Browse the repository at this point in the history
GUI dialog boxes still need to be updated to remove this field
  • Loading branch information
JostMigenda committed Jul 10, 2024
1 parent ba8542d commit 5358530
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 19 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, 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);
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, 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
Expand Down
8 changes: 3 additions & 5 deletions CemrgApp/Modules/CemrgAppModule/test/CemrgCommandLineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,14 @@ void TestCemrgCommandLine::cleanupTestCase() {

void TestCemrgCommandLine::ExecuteSurf_data() {
QTest::addColumn<QString>("segPath");
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>, 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++)
Expand All @@ -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!");
}

Expand Down
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"), 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";
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"), 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";
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"), 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";
Expand Down Expand Up @@ -1992,6 +1992,7 @@ bool AtrialFibresView::GetUserAnalysisSelectorInputs(){
}

bool AtrialFibresView::GetUserMeshingInputs(){
// TODO: uiMesh_iter parameter is no longer used; remove from dialog box
bool userInputAccepted=false;

if(userHasSetMeshingParams){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<item>
<widget class="QLineEdit" name="lineEdit_4">
<property name="placeholderText">
<string>'Close' iterations (default=0)</string>
<string>'Close' iterations (IGNORED)</string>
</property>
</widget>
</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ void MmcwView::CreateSurf() {
if (dialogCode == QDialog::Accepted) {

bool ok1, ok2, ok3, ok4;
// TODO: iter parameter is no longer used; remove from dialog box
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);
Expand All @@ -582,7 +583,7 @@ void MmcwView::CreateSurf() {
this->BusyCursorOn();
mitk::ProgressBar::GetInstance()->AddStepsToDo(3);
std::unique_ptr<CemrgCommandLine> 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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<string/>
</property>
<property name="placeholderText">
<string>Iteration (default = 1)</string>
<string>Iteration (IGNORED)</string>
</property>
</widget>
</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ void AtrialScarClipperView::iniPreSurf() {
if (dialogCode == QDialog::Accepted) {

bool ok1, ok2, ok3, ok4;
// TODO: iter parameter is no longer used; remove from dialog box
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);
Expand All @@ -211,7 +212,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, iter, th, blur, smth);
QString output = cmd->ExecuteSurf(directory, path, 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, 1, .5, 0, 10);
QString output1 = cmd->ExecuteSurf(direct, segCleanPath, .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"), 1, .5, 0, 10);
QString output2 = cmd->ExecuteSurf(direct, (direct + "/PVeinsCroppedImage.nii"), .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", 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<mitk::Surface>(mviShellPath.toStdString());
vtkSmartPointer<vtkImplicitPolyDataDistance> implicitFn = vtkSmartPointer<vtkImplicitPolyDataDistance>::New();
Expand Down Expand Up @@ -1177,6 +1177,7 @@ void AtrialScarView::CreateSurf() {
if (dialogCode == QDialog::Accepted) {

bool ok1, ok2, ok3, ok4;
// TODO: iter parameter is no longer used; remove from dialog box
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);
Expand All @@ -1197,7 +1198,7 @@ void AtrialScarView::CreateSurf() {
mitk::ProgressBar::GetInstance()->AddStepsToDo(3);
std::unique_ptr<CemrgCommandLine> 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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<string/>
</property>
<property name="placeholderText">
<string>Iteration (default = 1)</string>
<string>Iteration (IGNORED)</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 5358530

Please sign in to comment.