X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvToolExtractLung.cxx;h=cf2546603c2d5837a548825a46c7cfc697387295;hb=fdc97293cc66a4894a2c1c4f04f53d6473ab8ab2;hp=c976b8c65570ea767c34c109a7864dc1d5686352;hpb=c5669e2c629b8248e22d8892c6576ada7a14cc25;p=clitk.git diff --git a/vv/vvToolExtractLung.cxx b/vv/vvToolExtractLung.cxx index c976b8c..cf25466 100644 --- a/vv/vvToolExtractLung.cxx +++ b/vv/vvToolExtractLung.cxx @@ -76,7 +76,7 @@ void vvToolExtractLung::Initialize() { SetToolMenuName("Extract lungs"); SetToolIconFilename(":/common/icons/lung-overlay.png"); SetToolTip("Extract lung mask from thorax CT."); - // SetToolExperimental(true); + SetToolExperimental(true); // SetToolInMenu("Segmentation"); } //------------------------------------------------------------------------------ @@ -136,12 +136,12 @@ void vvToolExtractLung::SetGUIFromArgsInfo() //------------------------------------------------------------------------------ void vvToolExtractLung::GetArgsInfoFromGUI() { - mArgsInfo->patientBG_arg = mPatientMaskInputWidget->GetBackgroundValue(); + // mArgsInfo->patientBG_arg = mPatientMaskInputWidget->GetBackgroundValue(); mArgsInfo->verboseOption_flag = true; // DEBUG. TO CHANGE mArgsInfo->verboseStep_flag = true; // DEBUG. TO CHANGE mArgsInfo->writeStep_flag = false; mArgsInfo->input_given = 0; - mArgsInfo->patient_given = 0; + // mArgsInfo->patient_given = 0; mArgsInfo->output_given = 0; mArgsInfo->outputTrachea_given = 0; mArgsInfo->remove1_given = 0; @@ -174,7 +174,7 @@ void vvToolExtractLung::apply() // Create new filter if (mFilter) delete mFilter; mFilter = new FilterType; // needed when thread cancel the filter - mFilter->StopOnErrorOff(); + // mFilter->StopOnErrorOff(); // mFilter->SetIOVerbose(true); mFilter->AddInputVVImage(mCurrentImage); // CT mFilter->AddInputVVImage(mPatient); // patient mask @@ -184,8 +184,13 @@ void vvToolExtractLung::apply() vvThreadedFilter thread; connect(&thread, SIGNAL(ThreadInterrupted()), this, SLOT(ThreadInterrupted())); thread.SetFilter(mFilter); - thread.Update(); + try { + thread.Update(); + } + catch(std::runtime_error e) { + DD("Error exception handling"); + DD(m_IsThreadInterrupted); // Check if the thread has been canceled. In this case, return if (m_IsThreadInterrupted) { m_IsThreadInterrupted = false; @@ -195,11 +200,12 @@ void vvToolExtractLung::apply() disconnect(&thread, SIGNAL(ThreadInterrupted()), this, SLOT(ThreadInterrupted())); // Check error during filter - if (mFilter->HasError()) { + // if (mFilter->HasError()) { QApplication::restoreOverrideCursor(); - QMessageBox::information(this,tr("Error"), mFilter->GetLastError().c_str()); + QMessageBox::information(this,tr("Error"), e.what());//mFilter->GetLastError().c_str()); return; - } + // } + } // end exception // Get output std::vector output = mFilter->GetOutputVVImages();