X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkFilterBase.cxx;h=07b992512ce009257dedfdc7ae4640a9cce0a42c;hb=1a13aa34de4f99334b27050c18b32e6e4c8f0650;hp=74424d4c3c9e14266c6fe2db4133bff97efec45f;hpb=03c0a567e50d4b3dcdee11112b0a404789468857;p=clitk.git diff --git a/common/clitkFilterBase.cxx b/common/clitkFilterBase.cxx index 74424d4..07b9925 100644 --- a/common/clitkFilterBase.cxx +++ b/common/clitkFilterBase.cxx @@ -22,12 +22,13 @@ //-------------------------------------------------------------------- clitk::FilterBase::FilterBase() { + SetMustStop(false); SetVerboseOption(false); SetCurrentStepNumber(0); SetCurrentStepBaseId(""); StopOnErrorOn(); ResetLastError(); - VerboseWarningOffOn(); // OffOn, it's cool not ? + VerboseWarningOffOn(); // OffOn, it's cool no ? SetWarning(""); } //-------------------------------------------------------------------- @@ -67,6 +68,8 @@ void clitk::FilterBase::SetWarning(std::string e) //-------------------------------------------------------------------- void clitk::FilterBase::StartNewStep(std::string s) { + //m_CurrentStepTimer.Reset(); + // m_CurrentStepTimer.Start(); m_CurrentStepNumber++; if (GetCurrentStepBaseId() != "") { std::ostringstream oss; @@ -79,8 +82,10 @@ void clitk::FilterBase::StartNewStep(std::string s) 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; } } //-------------------------------------------------------------------- @@ -89,7 +94,33 @@ void clitk::FilterBase::StartNewStep(std::string s) //-------------------------------------------------------------------- void clitk::FilterBase::StopCurrentStep() { - + // m_CurrentStepTimer.Stop(); + // m_CurrentStepTimer.Print(std::cout); + // std::ostringstream oss; + //oss << " (" << + // m_CurrentStepName = m_CurrentStepName +" } //-------------------------------------------------------------------- + +//-------------------------------------------------------------------- +void clitk::FilterBase::SetMustStop(bool b) +{ + m_MustStop = b; + if (GetMustStop()) { + SetLastError("Filter is interrupted."); + } +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +bool clitk::FilterBase::GetMustStop() +{ + if (m_MustStop) return true; + if (HasError()) return true; + return false; +} +//-------------------------------------------------------------------- + +