ITK  6.0.0
Insight Toolkit
Public Member Functions | Protected Member Functions | Private Types | Private Attributes | List of all members
itk::SimpleFilterWatcher Class Reference

#include <itkSimpleFilterWatcher.h>

Detailed Description

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>; auto 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.

Todo:
Allow any stream object to be used for the output (not just std::cout)
ITK Sphinx Examples:
  • <a href=
  • <a href=

Definition at line 68 of file itkSimpleFilterWatcher.h.

+ Inheritance diagram for itk::SimpleFilterWatcher:
+ Collaboration diagram for itk::SimpleFilterWatcher:

Public Member Functions

std::string GetComment ()
 
const char * GetNameOfClass ()
 
ProcessObjectGetProcess ()
 
TimeProbeGetTimeProbe ()
 
SimpleFilterWatcheroperator= (const SimpleFilterWatcher &)
 
 SimpleFilterWatcher ()
 
 SimpleFilterWatcher (const SimpleFilterWatcher &)
 
 SimpleFilterWatcher (itk::ProcessObject *o, const char *comment="")
 
virtual ~SimpleFilterWatcher ()
 
void QuietOn ()
 
void QuietOff ()
 
void TestAbortOn ()
 
void TestAbortOff ()
 
void SetSteps (int val)
 
int GetSteps () const
 
void SetIterations (int val)
 
int GetIterations () const
 
void SetQuiet (bool val)
 
bool GetQuiet () const
 

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 {}
 
std::mutex m_ProgressOutput {}
 
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 {}
 

Member Typedef Documentation

◆ CommandType

Definition at line 306 of file itkSimpleFilterWatcher.h.

Constructor & Destructor Documentation

◆ SimpleFilterWatcher() [1/3]

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.

◆ SimpleFilterWatcher() [2/3]

itk::SimpleFilterWatcher::SimpleFilterWatcher ( const SimpleFilterWatcher )

Copy constructor

◆ SimpleFilterWatcher() [3/3]

itk::SimpleFilterWatcher::SimpleFilterWatcher ( )

Default constructor. Only provided so that you can have std::vectors of SimpleFilterWatchers.

◆ ~SimpleFilterWatcher()

virtual itk::SimpleFilterWatcher::~SimpleFilterWatcher ( )
virtual

Destructor.

Member Function Documentation

◆ CreateCommands()

void itk::SimpleFilterWatcher::CreateCommands ( )
protected

Create commands for different event types.

◆ DeepCopy()

void itk::SimpleFilterWatcher::DeepCopy ( const SimpleFilterWatcher watch)
protected

The common code for copying this class.

◆ EndFilter()

virtual void itk::SimpleFilterWatcher::EndFilter ( )
inlineprotectedvirtual

Callback method to show the EndEvent

Reimplemented in itk::XMLFilterWatcher.

Definition at line 270 of file itkSimpleFilterWatcher.h.

◆ GetComment()

std::string itk::SimpleFilterWatcher::GetComment ( )
inline

Get the comment for the watcher.

Definition at line 177 of file itkSimpleFilterWatcher.h.

◆ GetIterations()

int itk::SimpleFilterWatcher::GetIterations ( ) const
inline

Set/Get the number of iterations completed.

Definition at line 155 of file itkSimpleFilterWatcher.h.

◆ GetNameOfClass()

const char * itk::SimpleFilterWatcher::GetNameOfClass ( )
inline

Method to get the name of the class be monitored by this SimpleFilterWatcher

Definition at line 92 of file itkSimpleFilterWatcher.h.

◆ GetProcess()

ProcessObject * itk::SimpleFilterWatcher::GetProcess ( )
inline

Methods to access member data Get a pointer to the process object being watched.

Definition at line 130 of file itkSimpleFilterWatcher.h.

◆ GetQuiet()

bool itk::SimpleFilterWatcher::GetQuiet ( ) const
inline

Set/Get the quiet mode boolean. If true, verbose progress is reported.

Definition at line 169 of file itkSimpleFilterWatcher.h.

◆ GetSteps()

int itk::SimpleFilterWatcher::GetSteps ( ) const
inline

Set/Get the steps completed.

Definition at line 142 of file itkSimpleFilterWatcher.h.

◆ GetTimeProbe()

TimeProbe & itk::SimpleFilterWatcher::GetTimeProbe ( )
inline

Get a reference to the TimeProbe

Definition at line 184 of file itkSimpleFilterWatcher.h.

◆ operator=()

SimpleFilterWatcher & itk::SimpleFilterWatcher::operator= ( const SimpleFilterWatcher )

operator=

◆ QuietOff()

void itk::SimpleFilterWatcher::QuietOff ( )
inline

Methods to control the verbosity of the messages. Quiet reporting limits the information emitted at a ProgressEvent.

Definition at line 105 of file itkSimpleFilterWatcher.h.

◆ QuietOn()

void itk::SimpleFilterWatcher::QuietOn ( )
inline

Methods to control the verbosity of the messages. Quiet reporting limits the information emitted at a ProgressEvent.

Definition at line 100 of file itkSimpleFilterWatcher.h.

◆ RemoveObservers()

void itk::SimpleFilterWatcher::RemoveObservers ( )
protected

Remove observers we have on the process object.

◆ SetIterations()

void itk::SimpleFilterWatcher::SetIterations ( int  val)
inline

Set/Get the number of iterations completed.

Definition at line 150 of file itkSimpleFilterWatcher.h.

◆ SetQuiet()

void itk::SimpleFilterWatcher::SetQuiet ( bool  val)
inline

Set/Get the quiet mode boolean. If true, verbose progress is reported.

Definition at line 164 of file itkSimpleFilterWatcher.h.

◆ SetSteps()

void itk::SimpleFilterWatcher::SetSteps ( int  val)
inline

Set/Get the steps completed.

Definition at line 137 of file itkSimpleFilterWatcher.h.

◆ ShowAbort()

virtual void itk::SimpleFilterWatcher::ShowAbort ( )
inlineprotectedvirtual

Callback method to show the AbortEvent

Definition at line 231 of file itkSimpleFilterWatcher.h.

◆ ShowIteration()

virtual void itk::SimpleFilterWatcher::ShowIteration ( )
inlineprotectedvirtual

Callback method to show the IterationEvent

Definition at line 238 of file itkSimpleFilterWatcher.h.

◆ ShowProgress()

virtual void itk::SimpleFilterWatcher::ShowProgress ( )
inlineprotectedvirtual

Callback method to show the ProgressEvent

Reimplemented in itk::XMLFilterWatcher.

Definition at line 192 of file itkSimpleFilterWatcher.h.

◆ StartFilter()

virtual void itk::SimpleFilterWatcher::StartFilter ( )
inlineprotectedvirtual

Callback method to show the StartEvent

Reimplemented in itk::XMLFilterWatcher.

Definition at line 246 of file itkSimpleFilterWatcher.h.

◆ TestAbortOff()

void itk::SimpleFilterWatcher::TestAbortOff ( )
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 120 of file itkSimpleFilterWatcher.h.

◆ TestAbortOn()

void itk::SimpleFilterWatcher::TestAbortOn ( )
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 115 of file itkSimpleFilterWatcher.h.

Member Data Documentation

◆ m_AbortFilterCommand

CommandType::Pointer itk::SimpleFilterWatcher::m_AbortFilterCommand {}
private

Definition at line 311 of file itkSimpleFilterWatcher.h.

◆ m_AbortTag

unsigned long itk::SimpleFilterWatcher::m_AbortTag { 0 }
private

Definition at line 317 of file itkSimpleFilterWatcher.h.

◆ m_Comment

std::string itk::SimpleFilterWatcher::m_Comment {}
private

Definition at line 302 of file itkSimpleFilterWatcher.h.

◆ m_EndFilterCommand

CommandType::Pointer itk::SimpleFilterWatcher::m_EndFilterCommand {}
private

Definition at line 308 of file itkSimpleFilterWatcher.h.

◆ m_EndTag

unsigned long itk::SimpleFilterWatcher::m_EndTag { 0 }
private

Definition at line 314 of file itkSimpleFilterWatcher.h.

◆ m_IterationFilterCommand

CommandType::Pointer itk::SimpleFilterWatcher::m_IterationFilterCommand {}
private

Definition at line 310 of file itkSimpleFilterWatcher.h.

◆ m_Iterations

int itk::SimpleFilterWatcher::m_Iterations { 0 }
private

Definition at line 299 of file itkSimpleFilterWatcher.h.

◆ m_IterationTag

unsigned long itk::SimpleFilterWatcher::m_IterationTag { 0 }
private

Definition at line 316 of file itkSimpleFilterWatcher.h.

◆ m_Process

itk::ProcessObject::Pointer itk::SimpleFilterWatcher::m_Process {}
private

Definition at line 303 of file itkSimpleFilterWatcher.h.

◆ m_ProgressFilterCommand

CommandType::Pointer itk::SimpleFilterWatcher::m_ProgressFilterCommand {}
private

Definition at line 309 of file itkSimpleFilterWatcher.h.

◆ m_ProgressOutput

std::mutex itk::SimpleFilterWatcher::m_ProgressOutput {}
private

Definition at line 304 of file itkSimpleFilterWatcher.h.

◆ m_ProgressTag

unsigned long itk::SimpleFilterWatcher::m_ProgressTag { 0 }
private

Definition at line 315 of file itkSimpleFilterWatcher.h.

◆ m_Quiet

bool itk::SimpleFilterWatcher::m_Quiet { false }
private

Definition at line 300 of file itkSimpleFilterWatcher.h.

◆ m_StartFilterCommand

CommandType::Pointer itk::SimpleFilterWatcher::m_StartFilterCommand {}
private

Definition at line 307 of file itkSimpleFilterWatcher.h.

◆ m_StartTag

unsigned long itk::SimpleFilterWatcher::m_StartTag { 0 }
private

Definition at line 313 of file itkSimpleFilterWatcher.h.

◆ m_Steps

int itk::SimpleFilterWatcher::m_Steps { 0 }
private

Definition at line 298 of file itkSimpleFilterWatcher.h.

◆ m_TestAbort

bool itk::SimpleFilterWatcher::m_TestAbort { false }
private

Definition at line 301 of file itkSimpleFilterWatcher.h.

◆ m_TimeProbe

TimeProbe itk::SimpleFilterWatcher::m_TimeProbe {}
private

Definition at line 297 of file itkSimpleFilterWatcher.h.


The documentation for this class was generated from the following file: