]> Creatis software - clitk.git/blobdiff - vv/vvToolExtractLung.cxx
Removed typename outside template which prevents MSVC compilation
[clitk.git] / vv / vvToolExtractLung.cxx
index c976b8c65570ea767c34c109a7864dc1d5686352..59b41331472a7798dea91d9bb3e80c1e0aaa54ed 100644 (file)
@@ -3,7 +3,7 @@
 
   Authors belong to:
   - University of LYON              http://www.universite-lyon.fr/
-  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 
   This software is distributed WITHOUT ANY WARRANTY; without even
@@ -14,7 +14,7 @@
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-  ======================================================================-====*/
+  ===========================================================================**/
 
 // vv
 #include "vvToolExtractLung.h"
@@ -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,15 +136,15 @@ 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;
+  //  mArgsInfo->remove1_given = 0;
   
   mArgsInfo->upper_arg = mAirUpperThresholdSlider->GetValue();
   mArgsInfo->lower_arg = mAirLowerThresholdSlider->GetValue();
@@ -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<vvImage::Pointer> output = mFilter->GetOutputVVImages();