Implements progress tracking for a filter. More...
#include <itkProgressReporter.h>
Public Member Functions | |
ProgressReporter (ProcessObject *filter, int threadId, unsigned long numberOfPixels, unsigned long numberOfUpdates=100, float initialProgress=0.0f, float progressWeight=1.0f) | |
~ProgressReporter () | |
void | CompletedPixel () |
Protected Attributes | |
unsigned long | m_CurrentPixel |
ProcessObject * | m_Filter |
float | m_InitialProgress |
float | m_InverseNumberOfPixels |
unsigned long | m_PixelsBeforeUpdate |
unsigned long | m_PixelsPerUpdate |
float | m_ProgressWeight |
int | m_ThreadId |
Implements progress tracking for a filter.
This is a utility class for use by filter implementations in GenerateData() and ThreadedGenerateData().
The class constructor sets the progress to 0, and the destructor sets it to 1. In between, there should be one call to CompletedPixel() per pixel. The reporter will automatically update the filter's progress at an interval resulting in the specified number of updates. The default number of updates is 100.
Example usage:
ProgressReporter progress(this, threadId, threadRegion.GetNumberOfPixels(), 100); for( each pixel ) { ... progress.CompletedPixel(); }
When used in a non-threaded filter, the threadId argument should be 0.
Definition at line 58 of file itkProgressReporter.h.
itk::ProgressReporter::ProgressReporter | ( | ProcessObject * | filter, | |
int | threadId, | |||
unsigned long | numberOfPixels, | |||
unsigned long | numberOfUpdates = 100 , |
|||
float | initialProgress = 0.0f , |
|||
float | progressWeight = 1.0f | |||
) |
Constructor sets progress to 0 because the filter is starting.
itk::ProgressReporter::~ProgressReporter | ( | ) |
Destructor sets progress to 1 because the filter has finished.
void itk::ProgressReporter::CompletedPixel | ( | ) | [inline] |
Called by a filter once per pixel.
Definition at line 72 of file itkProgressReporter.h.
Referenced by itk::BoxAccumulateFunction(), itk::BoxMeanCalculatorFunction(), itk::BoxSigmaCalculatorFunction(), and itk::BoxSquareAccumulateFunction().
unsigned long itk::ProgressReporter::m_CurrentPixel [protected] |
Definition at line 102 of file itkProgressReporter.h.
ProcessObject* itk::ProgressReporter::m_Filter [protected] |
Definition at line 99 of file itkProgressReporter.h.
float itk::ProgressReporter::m_InitialProgress [protected] |
Definition at line 105 of file itkProgressReporter.h.
float itk::ProgressReporter::m_InverseNumberOfPixels [protected] |
Definition at line 101 of file itkProgressReporter.h.
unsigned long itk::ProgressReporter::m_PixelsBeforeUpdate [protected] |
Definition at line 104 of file itkProgressReporter.h.
unsigned long itk::ProgressReporter::m_PixelsPerUpdate [protected] |
Definition at line 103 of file itkProgressReporter.h.
float itk::ProgressReporter::m_ProgressWeight [protected] |
Definition at line 106 of file itkProgressReporter.h.
int itk::ProgressReporter::m_ThreadId [protected] |
Definition at line 100 of file itkProgressReporter.h.