ITK  5.0.0
Insight Segmentation and Registration Toolkit
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
itk::PoolMultiThreader Class Reference

#include <itkPoolMultiThreader.h>

+ Inheritance diagram for itk::PoolMultiThreader:
+ Collaboration diagram for itk::PoolMultiThreader:

Detailed Description

A class for performing multithreaded execution with a thread pool back end.

Definition at line 45 of file itkPoolMultiThreader.h.


struct  ThreadPoolInfoStruct

Public Types

using ConstPointer = SmartPointer< const Self >
using Pointer = SmartPointer< Self >
using Self = PoolMultiThreader
using Superclass = MultiThreaderBase
- Public Types inherited from itk::MultiThreaderBase
using ArrayThreadingFunctorType = std::function< void(SizeValueType) >
using ConstPointer = SmartPointer< const Self >
using Pointer = SmartPointer< Self >
using Self = MultiThreaderBase
using Superclass = Object
template<unsigned int VDimension>
using TemplatedThreadingFunctorType = std::function< void(const ImageRegion< VDimension > &)>
enum  ThreaderType {
  Platform = 0,
  First = Platform,
  Last = TBB,
  Unknown = -1
using ThreadingFunctorType = std::function< void(const IndexValueType index[], const SizeValueType size[])>
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
using Pointer = SmartPointer< Self >
using Self = Object
using Superclass = LightObject
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
using Pointer = SmartPointer< Self >
using Self = LightObject

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother () const
virtual const char * GetNameOfClass () const
void ParallelizeArray (SizeValueType firstIndex, SizeValueType lastIndexPlus1, ArrayThreadingFunctorType aFunc, ProcessObject *filter) override
void ParallelizeImageRegion (unsigned int dimension, const IndexValueType index[], const SizeValueType size[], ThreadingFunctorType funcP, ProcessObject *filter) override
void SetMaximumNumberOfThreads (ThreadIdType numberOfThreads) override
void SetSingleMethod (ThreadFunctionType, void *data) override
void SingleMethodExecute () override
- Public Member Functions inherited from itk::MultiThreaderBase
virtual ThreadIdType GetMaximumNumberOfThreads () const
virtual void SetNumberOfWorkUnits (ThreadIdType numberOfWorkUnits)
virtual ThreadIdType GetNumberOfWorkUnits () const
 itkLegacyMacro (static void SetGlobalDefaultUseThreadPool(const bool GlobalDefaultUseThreadPool))
 itkLegacyMacro (static bool GetGlobalDefaultUseThreadPool())
template<unsigned int VDimension>
ITK_TEMPLATE_EXPORT void ParallelizeImageRegion (const ImageRegion< VDimension > &requestedRegion, TemplatedThreadingFunctorType< VDimension > funcP, ProcessObject *filter)
template<unsigned int VDimension>
ITK_TEMPLATE_EXPORT void ParallelizeImageRegionRestrictDirection (unsigned int restrictedDirection, const ImageRegion< VDimension > &requestedRegion, TemplatedThreadingFunctorType< VDimension > funcP, ProcessObject *filter)
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
unsigned long AddObserver (const EventObject &event, Command *) const
virtual void DebugOff () const
virtual void DebugOn () const
CommandGetCommand (unsigned long tag)
bool GetDebug () const
MetaDataDictionaryGetMetaDataDictionary ()
const MetaDataDictionaryGetMetaDataDictionary () const
virtual ModifiedTimeType GetMTime () const
virtual const TimeStampGetTimeStamp () const
bool HasObserver (const EventObject &event) const
void InvokeEvent (const EventObject &)
void InvokeEvent (const EventObject &) const
virtual void Modified () const
void Register () const override
void RemoveAllObservers ()
void RemoveObserver (unsigned long tag)
void SetDebug (bool debugFlag) const
void SetReferenceCount (int) override
void UnRegister () const noexceptoverride
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
virtual void SetObjectName (std::string _arg)
virtual const std::string & GetObjectName () const
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
virtual int GetReferenceCount () const
 itkCloneMacro (Self)
void Print (std::ostream &os, Indent indent=0) const

Static Public Member Functions

static Pointer New ()
- Static Public Member Functions inherited from itk::MultiThreaderBase
static Pointer New ()
static ThreaderType ThreaderTypeFromString (std::string threaderString)
static void SetGlobalMaximumNumberOfThreads (ThreadIdType val)
static ThreadIdType GetGlobalMaximumNumberOfThreads ()
static std::string ThreaderTypeToString (ThreaderType threader)
static void SetGlobalDefaultThreader (ThreaderType threaderType)
static ThreaderType GetGlobalDefaultThreader ()
static void SetGlobalDefaultNumberOfThreads (ThreadIdType val)
static ThreadIdType GetGlobalDefaultNumberOfThreads ()
static void HandleFilterProgress (ProcessObject *filter, float progress=-1.0f)
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
static void GlobalWarningDisplayOff ()
static void GlobalWarningDisplayOn ()
static Pointer New ()
static void SetGlobalWarningDisplay (bool flag)
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
static Pointer New ()

Protected Member Functions

 PoolMultiThreader ()
void PrintSelf (std::ostream &os, Indent indent) const override
 ~PoolMultiThreader () override
- Protected Member Functions inherited from itk::MultiThreaderBase
 MultiThreaderBase ()
 ~MultiThreaderBase () override
- Protected Member Functions inherited from itk::Object
 Object ()
bool PrintObservers (std::ostream &os, Indent indent) const
virtual void SetTimeStamp (const TimeStamp &time)
 ~Object () override
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 LightObject ()
virtual void PrintHeader (std::ostream &os, Indent indent) const
virtual void PrintTrailer (std::ostream &os, Indent indent) const
virtual ~LightObject ()

Private Attributes

ThreadPoolInfoStruct m_ThreadInfoArray [ITK_MAX_THREADS]
ThreadPool::Pointer m_ThreadPool


class ProcessObject

Additional Inherited Members

- Static Protected Member Functions inherited from itk::MultiThreaderBase
ParallelizeArrayHelper (void *arg)
ParallelizeImageRegionHelper (void *arg)
SingleMethodProxy (void *arg)
- Protected Attributes inherited from itk::MultiThreaderBase
ThreadIdType m_NumberOfWorkUnits
ThreadIdType m_MaximumNumberOfThreads
ThreadFunctionType m_SingleMethod
void * m_SingleData
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount

Member Typedef Documentation

Definition at line 54 of file itkPoolMultiThreader.h.

Definition at line 53 of file itkPoolMultiThreader.h.

Standard class type aliases.

Definition at line 51 of file itkPoolMultiThreader.h.

Definition at line 52 of file itkPoolMultiThreader.h.

Constructor & Destructor Documentation

itk::PoolMultiThreader::PoolMultiThreader ( )
itk::PoolMultiThreader::~PoolMultiThreader ( )

Member Function Documentation

virtual::itk::LightObject::Pointer itk::PoolMultiThreader::CreateAnother ( ) const

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::Object.

virtual const char* itk::PoolMultiThreader::GetNameOfClass ( ) const

Run-time type information (and related methods).

Reimplemented from itk::MultiThreaderBase.

static Pointer itk::PoolMultiThreader::New ( )

Method for creation through the object factory.

void itk::PoolMultiThreader::ParallelizeArray ( SizeValueType  firstIndex,
SizeValueType  lastIndexPlus1,
ArrayThreadingFunctorType  aFunc,
ProcessObject filter 

Parallelize an operation over an array. If filter argument is not nullptr, this function will update its progress as each index is completed.

Reimplemented from itk::MultiThreaderBase.

void itk::PoolMultiThreader::ParallelizeImageRegion ( unsigned int  dimension,
const IndexValueType  index[],
const SizeValueType  size[],
ThreadingFunctorType  funcP,
ProcessObject filter 

Break up region into smaller chunks, and call the function with chunks as parameters.

Reimplemented from itk::MultiThreaderBase.

void itk::PoolMultiThreader::PrintSelf ( std::ostream &  os,
Indent  indent 
) const

The number of work units to create.

Reimplemented from itk::MultiThreaderBase.

void itk::PoolMultiThreader::SetMaximumNumberOfThreads ( ThreadIdType  numberOfThreads)

Set the number of threads to use. PoolMultiThreader can only INCREASE its number of threads.

Reimplemented from itk::MultiThreaderBase.

void itk::PoolMultiThreader::SetSingleMethod ( ThreadFunctionType  ,
void *  data 

Set the SingleMethod to f() and the UserData field of the WorkUnitInfo that is passed to it will be data. This method must be of type itkThreadFunctionType and must take a single argument of type void.

Implements itk::MultiThreaderBase.

void itk::PoolMultiThreader::SingleMethodExecute ( )

Execute the SingleMethod (as define by SetSingleMethod) using m_NumberOfWorkUnits work units. As a side effect the m_NumberOfWorkUnits will be checked against the current m_GlobalMaximumNumberOfThreads and clamped if necessary.

Implements itk::MultiThreaderBase.

Friends And Related Function Documentation

friend class ProcessObject

Friends of Multithreader. ProcessObject is a friend so that it can call PrintSelf() on its Multithreader.

Friends of DataObject

Definition at line 119 of file itkPoolMultiThreader.h.

Member Data Documentation

ThreadPoolInfoStruct itk::PoolMultiThreader::m_ThreadInfoArray[ITK_MAX_THREADS]

An array of work unit information containing a work unit id (0, 1, 2, .. ITK_MAX_THREADS-1), work unit count, and a pointer to void so that user data can be passed to each thread.

Definition at line 114 of file itkPoolMultiThreader.h.

ThreadPool::Pointer itk::PoolMultiThreader::m_ThreadPool

Definition at line 109 of file itkPoolMultiThreader.h.

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