ITK
5.0.0
Insight Segmentation and Registration Toolkit
|
#include <itkSimpleFilterWatcher.h>
Simple mechanism for monitoring the pipeline events of a filter and reporting these events to std::cout.
SimpleFilterWatcher provides a simple mechanism for monitoring the execution of filter. SimpleFilterWatcher is a stack-based object which takes a pointer to a ProcessObject at constructor time. SimpleFilterWatcher creates a series of commands that are registered as observers to the specified ProcessObject. The events monitored are:
StartEvent EndEvent ProgressEvent IterationEvent AbortEvent
The callbacks routines registered for these events emit a simple message to std::cout.
Example of use:
using FilterType = itk::BinaryThresholdImageFilter<ImageType>; FilterType::Pointer thresholdFilter = FilterType::New();
SimpleFilterWatcher watcher(thresholdFilter, "Threshold");
The second argument to the constructor to SimpleFilterWatcher is an optional string that is prepended to the event messages. This allows the user to associate the emitted messages to a particular filter/variable.
Definition at line 67 of file itkSimpleFilterWatcher.h.
Public Member Functions | |
std::string | GetComment () |
const char * | GetNameOfClass () |
ProcessObject * | GetProcess () |
TimeProbe & | GetTimeProbe () |
SimpleFilterWatcher & | operator= (const SimpleFilterWatcher &) |
SimpleFilterWatcher (itk::ProcessObject *o, const char *comment="") | |
SimpleFilterWatcher (const SimpleFilterWatcher &) | |
SimpleFilterWatcher () | |
virtual | ~SimpleFilterWatcher () |
void | QuietOn () |
void | QuietOff () |
void | TestAbortOn () |
void | TestAbortOff () |
void | SetSteps (int val) |
int | GetSteps () |
void | SetIterations (int val) |
int | GetIterations () |
void | SetQuiet (bool val) |
bool | GetQuiet () |
Protected Member Functions | |
void | CreateCommands () |
void | DeepCopy (const SimpleFilterWatcher &watch) |
void | RemoveObservers () |
virtual void | ShowAbort () |
virtual void | ShowIteration () |
virtual void | ShowProgress () |
virtual void | StartFilter () |
virtual void | EndFilter () |
Private Types | |
using | CommandType = SimpleMemberCommand< SimpleFilterWatcher > |
Private Attributes | |
CommandType::Pointer | m_AbortFilterCommand |
unsigned long | m_AbortTag {0} |
std::string | m_Comment |
CommandType::Pointer | m_EndFilterCommand |
unsigned long | m_EndTag {0} |
CommandType::Pointer | m_IterationFilterCommand |
int | m_Iterations {0} |
unsigned long | m_IterationTag {0} |
itk::ProcessObject::Pointer | m_Process |
CommandType::Pointer | m_ProgressFilterCommand |
unsigned long | m_ProgressTag {0} |
bool | m_Quiet {false} |
CommandType::Pointer | m_StartFilterCommand |
unsigned long | m_StartTag {0} |
int | m_Steps {0} |
bool | m_TestAbort {false} |
TimeProbe | m_TimeProbe |
|
private |
Definition at line 247 of file itkSimpleFilterWatcher.h.
itk::SimpleFilterWatcher::SimpleFilterWatcher | ( | itk::ProcessObject * | o, |
const char * | comment = "" |
||
) |
Constructor. Takes a ProcessObject to monitor and an optional comment string that is prepended to each event message.
itk::SimpleFilterWatcher::SimpleFilterWatcher | ( | const SimpleFilterWatcher & | ) |
Copy constructor
itk::SimpleFilterWatcher::SimpleFilterWatcher | ( | ) |
Default constructor. Only provided so that you can have std::vectors of SimpleFilterWatchers.
|
virtual |
Destructor.
|
protected |
Create commands for different event types.
|
protected |
The common code for copying this class.
|
inlineprotectedvirtual |
Callback method to show the EndEvent
Reimplemented in itk::XMLFilterWatcher.
Definition at line 209 of file itkSimpleFilterWatcher.h.
|
inline |
Get the comment for the watcher.
Definition at line 129 of file itkSimpleFilterWatcher.h.
|
inline |
Set/Get the number of iterations completed.
Definition at line 119 of file itkSimpleFilterWatcher.h.
|
inline |
Method to get the name of the class be monitored by this SimpleFilterWatcher
Definition at line 89 of file itkSimpleFilterWatcher.h.
|
inline |
Methods to access member data Get a pointer to the process object being watched.
Definition at line 110 of file itkSimpleFilterWatcher.h.
|
inline |
Set/Get the quiet mode boolean. If true, verbose progress is reported.
Definition at line 125 of file itkSimpleFilterWatcher.h.
|
inline |
Set/Get the steps completed.
Definition at line 114 of file itkSimpleFilterWatcher.h.
|
inline |
Get a reference to the TimeProbe
Definition at line 132 of file itkSimpleFilterWatcher.h.
SimpleFilterWatcher& itk::SimpleFilterWatcher::operator= | ( | const SimpleFilterWatcher & | ) |
operator=
|
inline |
Methods to control the verbosity of the messages. Quiet reporting limits the information emitted at a ProgressEvent.
Definition at line 97 of file itkSimpleFilterWatcher.h.
|
inline |
Methods to control the verbosity of the messages. Quiet reporting limits the information emitted at a ProgressEvent.
Definition at line 96 of file itkSimpleFilterWatcher.h.
|
protected |
Remove observers we have on the process object.
|
inline |
Set/Get the number of iterations completed.
Definition at line 118 of file itkSimpleFilterWatcher.h.
|
inline |
Set/Get the quiet mode boolean. If true, verbose progress is reported.
Definition at line 124 of file itkSimpleFilterWatcher.h.
|
inline |
Set/Get the steps completed.
Definition at line 113 of file itkSimpleFilterWatcher.h.
|
inlineprotectedvirtual |
Callback method to show the AbortEvent
Definition at line 171 of file itkSimpleFilterWatcher.h.
|
inlineprotectedvirtual |
Callback method to show the IterationEvent
Definition at line 177 of file itkSimpleFilterWatcher.h.
|
inlineprotectedvirtual |
Callback method to show the ProgressEvent
Reimplemented in itk::XMLFilterWatcher.
Definition at line 137 of file itkSimpleFilterWatcher.h.
|
inlineprotectedvirtual |
Callback method to show the StartEvent
Reimplemented in itk::XMLFilterWatcher.
Definition at line 184 of file itkSimpleFilterWatcher.h.
|
inline |
Methods to use to test the AbortEvent of the a filter. If TestAbort is on, the filter being watched will be aborted when the progress reaches 30%.
Definition at line 104 of file itkSimpleFilterWatcher.h.
|
inline |
Methods to use to test the AbortEvent of the a filter. If TestAbort is on, the filter being watched will be aborted when the progress reaches 30%.
Definition at line 103 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 252 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 258 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 244 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 249 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 255 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 251 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 241 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 257 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 245 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 250 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 256 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 242 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 248 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 254 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 240 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 243 of file itkSimpleFilterWatcher.h.
|
private |
Definition at line 239 of file itkSimpleFilterWatcher.h.