19 #ifndef rtkProgressCommands_h 20 #define rtkProgressCommands_h 36 template <
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))
90 template <
typename TCaller>
104 Run(
const TCaller * caller)
override 106 int newPercentage = (int)(caller->GetProgress() * 100.);
107 if (newPercentage > percentage)
110 std::cout <<
"\r" << caller->GetNameOfClass() <<
" " << newPercentage <<
"% completed." << std::flush;
111 percentage = newPercentage;
116 End(
const TCaller * itkNotUsed(caller))
override 118 std::cout << std::endl;
void Execute(const itk::Object *caller, const itk::EventObject &event) override
itk::SmartPointer< Self > Pointer
Outputs every time a filter progresses by at least one percent.
void End(const TCaller *) override
ProgressCommand< TCaller > Superclass
itk::SmartPointer< Self > Pointer
virtual void End(const TCaller *)
void Run(const TCaller *caller) override
PercentageProgressCommand Self
Abstract superclass to all progress callbacks. Derived classes must implement the Run() method...
void Execute(itk::Object *caller, const itk::EventObject &event) override