go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
elastix::ProgressCommand Class Reference

#include <elxProgressCommand.h>

Detailed Description

A specialized Command object for updating the progress of a filter.

There are 3 ways to use this class.

ProgressCommandType::Pointer command = ProgressCommandType::New();
command->ConnectObserver( filterpointer );
command->SetStartString( " Progress: " );
command->SetEndString( "%" );
filterpointer->Update(); // run the filter, progress messages are printed now
command->DisconnectObserver( filterPointer );

So, first an instantiation of this class is created, then it is connected to a filter, and some options are set. Whenever the filter throws a ProgressEvent(), this class asks for the progress and prints the percentage of progress.

ProgressCommandType::Pointer command = ProgressCommandType::New();
command->SetUpdateFrequency( maxnrofvoxels, 100 );
command->SetStartString( " Progress: " );
command->SetEndString( "%" );
elxout << "Looping over voxels... " << std::endl;
for ( unsigned int i =0; i < maxnrofvoxels; ++i )
{
command->UpdateAndPrintProgress( i );
}
command->PrintProgress(1.0); // make sure the 100% is reached
ProgressCommandType::Pointer command = ProgressCommandType::New();
command->SetStartString( " Progress: " );
command->SetEndString( "%" );
elxout << "Reading, casting, writing..."
command->PrintProgress( 0.0 );
reader->Update();
command->PrintProgress( 0.33 );
caster->Update();
command->PrintProgress( 0.67 );
writer->Update();
command->PrintProgress( 1.0 );
// example assumes reader, caster and writer have been configured before

Definition at line 90 of file elxProgressCommand.h.

Inheritance diagram for elastix::ProgressCommand:
Inheritance graph
[legend]

Public Types

typedef itk::SmartPointer< const SelfConstPointer
 
typedef itk::SmartPointer< SelfPointer
 
typedef ProcessObjectType::Pointer ProcessObjectPointer
 
typedef itk::ProcessObject ProcessObjectType
 
typedef ProgressCommand Self
 
typedef itk::Command Superclass
 

Public Member Functions

virtual void ConnectObserver (itk::ProcessObject *filter)
 
virtual void DisconnectObserver (itk::ProcessObject *filter)
 
virtual void Execute (itk::Object *caller, const itk::EventObject &event)
 
virtual void Execute (const itk::Object *caller, const itk::EventObject &event)
 
virtual const char * GetClassName () const
 
virtual const char * GetEndString () const
 
virtual const char * GetStartString () const
 
virtual const boolGetStreamOutputIsConsole ()
 
virtual void PrintProgress (const float &progress) const
 
virtual void SetEndString (const char *_arg)
 
virtual void SetStartString (const char *_arg)
 
virtual void SetUpdateFrequency (const unsigned long numberOfVoxels, const unsigned long numberOfUpdates)
 
virtual void UpdateAndPrintProgress (const unsigned long &currentVoxelNumber) const
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 ProgressCommand ()
 
virtual ~ProgressCommand ()
 

Private Attributes

std::string m_EndString
 
unsigned long m_NumberOfUpdates
 
unsigned long m_NumberOfVoxels
 
ProcessObjectPointer m_ObservedProcessObject
 
std::string m_StartString
 
bool m_StreamOutputIsConsole
 
unsigned long m_Tag
 
bool m_TagIsSet
 

Member Typedef Documentation

typedef itk::SmartPointer< const Self > elastix::ProgressCommand::ConstPointer

Definition at line 98 of file elxProgressCommand.h.

typedef itk::SmartPointer< Self > elastix::ProgressCommand::Pointer

Definition at line 97 of file elxProgressCommand.h.

typedef ProcessObjectType::Pointer elastix::ProgressCommand::ProcessObjectPointer

Definition at line 106 of file elxProgressCommand.h.

typedef itk::ProcessObject elastix::ProgressCommand::ProcessObjectType

Typedef's.

Definition at line 102 of file elxProgressCommand.h.

Smart pointer declaration methods.

Definition at line 95 of file elxProgressCommand.h.

Definition at line 96 of file elxProgressCommand.h.

Constructor & Destructor Documentation

elastix::ProgressCommand::ProgressCommand ( )
protected

The constructor.

virtual elastix::ProgressCommand::~ProgressCommand ( )
protectedvirtual

The destructor.

Member Function Documentation

virtual void elastix::ProgressCommand::ConnectObserver ( itk::ProcessObject *  filter)
virtual

Connect an observer to a process object.

virtual void elastix::ProgressCommand::DisconnectObserver ( itk::ProcessObject *  filter)
virtual

Disconnect an observer to a process object.

virtual void elastix::ProgressCommand::Execute ( itk::Object *  caller,
const itk::EventObject &  event 
)
virtual

Standard Command virtual methods.

virtual void elastix::ProgressCommand::Execute ( const itk::Object *  caller,
const itk::EventObject &  event 
)
virtual
virtual const char* elastix::ProgressCommand::GetClassName ( ) const
virtual

Standard ITK stuff.

virtual const char* elastix::ProgressCommand::GetEndString ( ) const
virtual
virtual const char* elastix::ProgressCommand::GetStartString ( ) const
virtual
virtual const bool& elastix::ProgressCommand::GetStreamOutputIsConsole ( )
virtual

Get a boolean indicating if the output is a console.

static Pointer elastix::ProgressCommand::New ( )
static
virtual void elastix::ProgressCommand::PrintProgress ( const float progress) const
virtual

Print the progress to screen. A float value between 0.0 and 1.0 is expected as input.

virtual void elastix::ProgressCommand::SetEndString ( const char *  _arg)
virtual

Set and get the string ending each progress report.

virtual void elastix::ProgressCommand::SetStartString ( const char *  _arg)
virtual

Set and get the string starting each progress report.

virtual void elastix::ProgressCommand::SetUpdateFrequency ( const unsigned long  numberOfVoxels,
const unsigned long  numberOfUpdates 
)
virtual

Define when to print the progress.

virtual void elastix::ProgressCommand::UpdateAndPrintProgress ( const unsigned long &  currentVoxelNumber) const
virtual

Update and possibly print the progress to screen. The progress information on screen is refreshed according to the UpdateFrequency, which is assumed being specified beforehand using the SetUpdateFrequency function.

Field Documentation

std::string elastix::ProgressCommand::m_EndString
private

Definition at line 159 of file elxProgressCommand.h.

unsigned long elastix::ProgressCommand::m_NumberOfUpdates
private

Definition at line 169 of file elxProgressCommand.h.

unsigned long elastix::ProgressCommand::m_NumberOfVoxels
private

Member variables that define the update frequency.

Definition at line 168 of file elxProgressCommand.h.

ProcessObjectPointer elastix::ProgressCommand::m_ObservedProcessObject
private

Definition at line 165 of file elxProgressCommand.h.

std::string elastix::ProgressCommand::m_StartString
private

Member variables to define a start and end string for printing.

Definition at line 158 of file elxProgressCommand.h.

bool elastix::ProgressCommand::m_StreamOutputIsConsole
private

Member variables to keep track of what is set.

Definition at line 162 of file elxProgressCommand.h.

unsigned long elastix::ProgressCommand::m_Tag
private

Definition at line 163 of file elxProgressCommand.h.

bool elastix::ProgressCommand::m_TagIsSet
private

Definition at line 164 of file elxProgressCommand.h.



Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo