X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkFilterBase.h;h=a53a181490b07ab0180e34b7d2e7c1b2e09ac879;hb=5dc155f99385ef56e5c80dbcc0b7f56760629ade;hp=7c3922a95a2822e625e5ee6e7421c105a589bc28;hpb=03c0a567e50d4b3dcdee11112b0a404789468857;p=clitk.git diff --git a/common/clitkFilterBase.h b/common/clitkFilterBase.h index 7c3922a..a53a181 100644 --- a/common/clitkFilterBase.h +++ b/common/clitkFilterBase.h @@ -21,6 +21,7 @@ // clitk #include "clitkCommon.h" +#include "clitkTimer.h" #include "clitkFilterMacros.txx" #include "clitkLabelizeParameters.h" @@ -60,6 +61,8 @@ namespace clitk { GGO_DefineOption_Flag(verboseOption, SetVerboseOption); // Steps management + itkSetMacro(NumberOfSteps, int); + itkGetConstMacro(NumberOfSteps, int); itkSetMacro(VerboseStep, bool); itkGetConstMacro(VerboseStep, bool); itkBooleanMacro(VerboseStep); @@ -76,6 +79,8 @@ namespace clitk { itkGetConstMacro(CurrentStepId, std::string); itkSetMacro(CurrentStepBaseId, std::string); itkGetConstMacro(CurrentStepBaseId, std::string); + itkSetMacro(CurrentStepName, std::string); + itkGetConstMacro(CurrentStepName, std::string); // Convenient function for verbose option template @@ -101,6 +106,10 @@ namespace clitk { itkBooleanMacro(VerboseWarningOff); GGO_DefineOption_Flag(verboseWarningOff, SetVerboseWarningOff); + // Use this function to stop (when threaded) + void SetMustStop(bool b); + bool GetMustStop(); + protected: FilterBase(); virtual ~FilterBase() {} @@ -113,12 +122,16 @@ namespace clitk { bool m_VerboseStep; bool m_WriteStep; int m_CurrentStepNumber; + int m_NumberOfSteps; std::string m_CurrentStepId; std::string m_CurrentStepBaseId; std::string m_LastError; + std::string m_CurrentStepName; bool m_StopOnError; std::string m_Warning; bool m_VerboseWarningOff; + bool m_MustStop; + Timer m_CurrentStepTimer; private: FilterBase(const Self&); //purposely not implemented @@ -130,6 +143,8 @@ namespace clitk { } // end namespace clitk //-------------------------------------------------------------------- +#define StartNewStepOrStop(s) StartNewStep(s); if (GetMustStop()) return; + #ifndef ITK_MANUAL_INSTANTIATION #include "clitkFilterBase.txx" #endif