X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkFilterBase.h;h=1cd75794d6aa2bdc190c4d6bca4c755979cdd6a9;hb=44ebb81a500e42cf19964d209e14a59812a0dd4d;hp=7c3922a95a2822e625e5ee6e7421c105a589bc28;hpb=03c0a567e50d4b3dcdee11112b0a404789468857;p=clitk.git diff --git a/common/clitkFilterBase.h b/common/clitkFilterBase.h index 7c3922a..1cd7579 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" @@ -31,10 +32,11 @@ namespace clitk { //-------------------------------------------------------------------- /* - Convenient class to manage options from GGO gengetopt) to filter + Convenient class to manage options from GGO (gengetopt) to filter */ //-------------------------------------------------------------------- - class FilterBase { + class FilterBase + { public: // Standard class typedefs @@ -60,6 +62,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 +80,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 @@ -85,15 +91,6 @@ namespace clitk { template void VerboseOptionV(std::string name, int nb, OptionType * value); - // Error - void SetLastError(std::string e); - void ResetLastError(); - itkGetConstMacro(LastError, std::string); - bool HasError() { return (GetLastError() != ""); } - itkSetMacro(StopOnError, bool); - itkGetConstMacro(StopOnError, bool); - itkBooleanMacro(StopOnError); - void SetWarning(std::string e); itkGetConstMacro(Warning, std::string); itkSetMacro(VerboseWarningOff, bool); @@ -101,6 +98,10 @@ namespace clitk { itkBooleanMacro(VerboseWarningOff); GGO_DefineOption_Flag(verboseWarningOff, SetVerboseWarningOff); + // Use this function to cancel the filter between step + void Cancel(); + bool Cancelled(); + protected: FilterBase(); virtual ~FilterBase() {} @@ -113,12 +114,15 @@ 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; - bool m_StopOnError; + std::string m_CurrentStepName; std::string m_Warning; bool m_VerboseWarningOff; + bool m_IsCancelled; + Timer m_CurrentStepTimer; + private: FilterBase(const Self&); //purposely not implemented