19#ifndef rtkProgressCommands_h
20#define rtkProgressCommands_h
36template <
typename TCaller>
54 const auto * cCaller =
dynamic_cast<const TCaller *
>(caller);
57 if (itk::EndEvent().CheckEvent(&event))
62 if (itk::ProgressEvent().CheckEvent(&event))
73 Run(
const TCaller * caller) = 0;
77 End(
const TCaller * itkNotUsed(caller))
90template <
typename TCaller>
104 Run(
const TCaller * caller)
override
106 int newPercentage = (int)(caller->GetProgress() * 100.);
110 std::cout <<
"\r" << caller->GetNameOfClass() <<
" " << newPercentage <<
"% completed." << std::flush;
116 End(
const TCaller * itkNotUsed(caller))
override
118 std::cout << std::endl;
Superclass for callback/observer methods.
Abstraction of the Events used to communicating among filters and with GUIs.
Base class for most ITK classes.
Implements transparent reference counting.
Outputs every time a filter progresses by at least one percent.
PercentageProgressCommand Self
void End(const TCaller *caller) override
itk::SmartPointer< Self > Pointer
ProgressCommand< TCaller > Superclass
void Run(const TCaller *caller) override
Abstract superclass to all progress callbacks. Derived classes must implement the Run() method.
virtual void Run(const TCaller *caller)=0
itk::SmartPointer< Self > Pointer
void Execute(const itk::Object *caller, const itk::EventObject &event) override
virtual void End(const TCaller *caller)
void Execute(itk::Object *caller, const itk::EventObject &event) override