// clitk
#include "clitkFilterBase.h"
+#include "clitkCommon.h"
//--------------------------------------------------------------------
clitk::FilterBase::FilterBase()
SetVerboseOption(false);
SetCurrentStepNumber(0);
SetCurrentStepBaseId("");
- StopOnErrorOn();
- ResetLastError();
- VerboseWarningOffOn(); // OffOn, it's cool not ?
+ VerboseWarningOffOn(); // OffOn, it's cool no ?
SetWarning("");
-}
-//--------------------------------------------------------------------
-
-
-//--------------------------------------------------------------------
-void clitk::FilterBase::ResetLastError()
-{
- m_LastError = "";
-}
-//--------------------------------------------------------------------
-
-
-//--------------------------------------------------------------------
-void clitk::FilterBase::SetLastError(std::string e)
-{
- m_LastError = e;
- if (GetStopOnError()) {
- std::cerr << GetLastError() << std::endl;
- exit(0);
- }
+ m_IsCancelled = false;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
void clitk::FilterBase::StartNewStep(std::string s)
{
+ if (Cancelled()) {
+ throw clitk::ExceptionObject("Filter is canceled.");
+ }
+
m_CurrentStepNumber++;
if (GetCurrentStepBaseId() != "") {
std::ostringstream oss;
SetCurrentStepId(oss.str());
}
+ m_CurrentStepName = "Step "+GetCurrentStepId()+" -- "+s;
if (m_VerboseStep) {
- std::cout << "Step " << GetCurrentStepId() << " -- " << s << std::endl;
+ std::cout << m_CurrentStepName << std::endl;
+ //"Step " << GetCurrentStepId() << " -- " << s << std::endl;
}
}
//--------------------------------------------------------------------
}
//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+void clitk::FilterBase::Cancel()
+{
+ m_IsCancelled = true;
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+ bool clitk::FilterBase::Cancelled()
+ {
+ return m_IsCancelled;
+ }
+//--------------------------------------------------------------------
+