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
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
- ======================================================================-====*/
+ ===========================================================================**/
// vv
#include "vvThreadedFilter.h"
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()) {
}
temp = m_FilterBase->GetCurrentStepName();
}
- this->wait(200); // in milisecond
+ this->wait(200); // in miliseconds
qApp->processEvents();
}
}
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();
}
//------------------------------------------------------------------------------