vvLabelImageLoaderWidget.cxx
vvToolExtractPatient.cxx
vvToolExtractLung.cxx
- vvToolPlastimatch.cxx
+ # vvToolPlastimatch.cxx
# vvToolConnectedComponentLabeling.cxx
)
vvLabelImageLoaderWidget.h
vvToolExtractPatient.h
vvToolExtractLung.h
- vvToolPlastimatch.h
+ # vvToolPlastimatch.h
# vvToolConnectedComponentLabeling.h
)
qt_ui/vvLabelImageLoaderWidget.ui
qt_ui/vvToolExtractPatient.ui
qt_ui/vvToolExtractLung.ui
- qt_ui/vvToolPlastimatch.ui
+ # qt_ui/vvToolPlastimatch.ui
# qt_ui/vvToolConnectedComponentLabeling.ui
)
this->setTerminationEnabled(true);
std::string temp;
while (this->isRunning()) {
+ // try {
m_FilterBase = m_Filter->GetFilterBase(); // get filterbase is only set after Update
if (m_FilterBase != NULL) {
- // m_FilterBase->StopOnErrorOff(); // filter can be interrupted
progress.SetProgress(m_FilterBase->GetCurrentStepNumber(),
m_FilterBase->GetNumberOfSteps());
if (temp != m_FilterBase->GetCurrentStepName()) {
void vvThreadedFilter::run()
{
assert(m_Filter != NULL);
- m_Filter->Update();
+ try {
+ m_Filter->Update();
+ }
+ catch(clitk::ExceptionObject e) {
+ DD("vvThreadedFilter : exceptionobject handeled");
+ DD(e.what());
+ QApplication::restoreOverrideCursor();
+ QMessageBox::information(new QWidget, tr("Error"), e.what());
+ }
+ DD("end RUN");
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvThreadedFilter::reject()
{
- // First, say the filter it must stop
+ // First, say the filter it must stop as soon as possible. We then
+ // wait that an exception occur in the main thread.
if (m_FilterBase != NULL) {
- m_FilterBase->SetMustStop(true);
+ m_FilterBase->Cancel();
}
- // Indicate to the user it will stop
- QApplication::restoreOverrideCursor();
- QMessageBox::information(new QWidget, tr("Error"), m_FilterBase->GetLastError().c_str());
- // Quit the thread (is it needed ?)
- this->quit();
- emit ThreadInterrupted();
}
//------------------------------------------------------------------------------
SetToolMenuName("Extract lungs");
SetToolIconFilename(":/common/icons/lung-overlay.png");
SetToolTip("Extract lung mask from thorax CT.");
- // SetToolExperimental(true);
+ SetToolExperimental(true);
// SetToolInMenu("Segmentation");
}
//------------------------------------------------------------------------------
// 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
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;
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();
SetToolMenuName("Extract Patient");
SetToolIconFilename(":/common/icons/Patient-overlay.png");
SetToolTip("Extract Patient mask from thorax CT.");
- // SetToolExperimental(true);
+ SetToolExperimental(true);
// SetToolInMenu("Segmentation");
}
//------------------------------------------------------------------------------
//if (mFilter) delete mFilter;
DD("new filter");
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
vvThreadedFilter thread;
connect(&thread, SIGNAL(ThreadInterrupted()), this, SLOT(ThreadInterrupted()));
thread.SetFilter(mFilter);
+
+ try {
thread.Update();
+ }
+ catch(std::runtime_error e) {
// Check if the thread has been canceled. In this case, return
if (m_IsThreadInterrupted) {
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;
+ // }
+
}
// Get output