ITK
5.2.0
Insight Toolkit
|
#include <itkMultiThreaderBase.h>
Classes | |
struct | ArrayCallback |
struct | RegionAndCallback |
struct | WorkUnitInfo |
Public Types | |
using | ConstPointer = SmartPointer< const Self > |
using | Pointer = SmartPointer< Self > |
using | Self = MultiThreaderBase |
using | Superclass = Object |
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 const char * | GetNameOfClass () const |
Public Member Functions inherited from itk::Object | |
unsigned long | AddObserver (const EventObject &event, Command *) |
unsigned long | AddObserver (const EventObject &event, Command *) const |
unsigned long | AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const |
LightObject::Pointer | CreateAnother () const override |
virtual void | DebugOff () const |
virtual void | DebugOn () const |
Command * | GetCommand (unsigned long tag) |
bool | GetDebug () const |
MetaDataDictionary & | GetMetaDataDictionary () |
const MetaDataDictionary & | GetMetaDataDictionary () const |
virtual ModifiedTimeType | GetMTime () const |
virtual const TimeStamp & | GetTimeStamp () 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 noexcept override |
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 | |
Pointer | Clone () const |
virtual void | Delete () |
virtual int | GetReferenceCount () const |
void | Print (std::ostream &os, Indent indent=0) const |
Additional Inherited Members | |
Protected Member Functions inherited from itk::Object | |
Object () | |
~Object () override | |
void | PrintSelf (std::ostream &os, Indent indent) const override |
bool | PrintObservers (std::ostream &os, Indent indent) const |
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
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 () |
Protected Attributes inherited from itk::LightObject | |
std::atomic< int > | m_ReferenceCount |
A class for performing multithreaded execution.
Multithreaders are a class hierarchy that provides support for multithreaded execution by abstracting away platform-specific details. This class can be used to execute a single method on multiple threads or to parallelize an operation over a given image region or array.
Definition at line 105 of file itkMultiThreaderBase.h.
using itk::MultiThreaderBase::ArrayThreadingFunctorType = std::function<void(SizeValueType)> |
The number of work units to create.
Definition at line 327 of file itkMultiThreaderBase.h.
using itk::MultiThreaderBase::ConstPointer = SmartPointer<const Self> |
Definition at line 114 of file itkMultiThreaderBase.h.
Definition at line 113 of file itkMultiThreaderBase.h.
Standard class type aliases.
Definition at line 111 of file itkMultiThreaderBase.h.
Definition at line 112 of file itkMultiThreaderBase.h.
using itk::MultiThreaderBase::TemplatedThreadingFunctorType = std::function<void(const ImageRegion<VDimension> &)> |
The number of work units to create.
Definition at line 325 of file itkMultiThreaderBase.h.
The number of work units to create.
Definition at line 163 of file itkMultiThreaderBase.h.
using itk::MultiThreaderBase::ThreadingFunctorType = std::function<void(const IndexValueType index[], const SizeValueType size[])> |
The number of work units to create.
Definition at line 326 of file itkMultiThreaderBase.h.
|
protected |
The number of work units to create.
|
overrideprotected |
The number of work units to create.
|
static |
The number of work units to create.
|
staticprivate |
Platform specific number of threads
|
static |
The number of work units to create.
|
static |
The number of work units to create.
|
virtual |
The number of work units to create.
|
virtual |
Run-time type information (and related methods).
Reimplemented from itk::Object.
Reimplemented in itk::PoolMultiThreader, and itk::TBBMultiThreader.
|
virtual |
The number of work units to create.
|
virtual |
The number of work units to create.
|
private |
Only used to synchronize the global variable across static libraries.
itk::MultiThreaderBase::itkLegacyMacro | ( | static bool | GetGlobalDefaultUseThreadPool() | ) |
The number of work units to create.
itk::MultiThreaderBase::itkLegacyMacro | ( | static void | SetGlobalDefaultUseThreadPoolconst bool GlobalDefaultUseThreadPool | ) |
Set/Get whether to use the to use the thread pool implementation or the spawning implementation of starting threads.
Deprecated: use Get/Set GlobalDefaultThreader.
|
static |
Method for creation through the object factory.
|
virtual |
Parallelize an operation over an array. If filter argument is not nullptr, this function will update its progress as each index is completed.
This implementation simply delegates parallelization to the old interface SetSingleMethod+SingleMethodExecute. This method is meant to be overloaded!
Reimplemented in itk::PoolMultiThreader, and itk::TBBMultiThreader.
|
staticprotected |
The number of work units to create.
|
inline |
Break up region into smaller chunks, and call the function with chunks as parameters. If filter argument is not nullptr, this function will update its progress as each work unit is completed. Delegates work to non-templated version.
Definition at line 345 of file itkMultiThreaderBase.h.
References itk::ImageRegion< VImageDimension >::GetIndex(), itk::ImageRegion< VImageDimension >::GetSize(), itk::Size< VDimension >::m_InternalArray, itk::Index< VDimension >::m_InternalArray, itk::ImageRegion< VImageDimension >::SetIndex(), and itk::ImageRegion< VImageDimension >::SetSize().
|
virtual |
Break up region into smaller chunks, and call the function with chunks as parameters. This overload does the actual work and should be implemented by derived classes.
Reimplemented in itk::PoolMultiThreader, and itk::TBBMultiThreader.
|
staticprotected |
The number of work units to create.
|
inline |
Similar to ParallelizeImageRegion, but do not split the region along one of the directions. If VDimension is 1, restrictedDirection is ignored and no parallelization occurs.
Definition at line 371 of file itkMultiThreaderBase.h.
References itk::ImageRegion< VImageDimension >::GetIndex(), itk::ImageRegion< VImageDimension >::GetNumberOfPixels(), itk::ImageRegion< VImageDimension >::GetSize(), itk::ImageRegion< VImageDimension >::SetIndex(), and itk::ImageRegion< VImageDimension >::SetSize().
|
overrideprotectedvirtual |
The number of work units to create.
Reimplemented from itk::LightObject.
Reimplemented in itk::PoolMultiThreader, and itk::TBBMultiThreader.
|
static |
Set/Get the value which is used to initialize the NumberOfThreads in the constructor. It will be clamped to the range [1, m_GlobalMaximumNumberOfThreads ]. Therefore the caller of this method should check that the requested number of threads was accepted.
|
static |
Set/Get whether the default multi-threader implementation.
The default multi-threader type is picked up from ITK_GLOBAL_DEFAULT_THREADER environment variable. Example ITK_GLOBAL_DEFAULT_THREADER=TBB A deprecated ITK_USE_THREADPOOL environment variable is also examined, but it can only choose Pool or Platform multi-threader. Platform multi-threader should be avoided, as it introduces the biggest overhead. If the SetGlobalDefaultThreaderType API is ever used by the developer, the developer's choice is respected over the environment variables.
|
static |
Set/Get the maximum number of threads to use when multithreading. It will be clamped to the range [ 1, ITK_MAX_THREADS ] because several arrays are already statically allocated using the ITK_MAX_THREADS number. Therefore the caller of this method should check that the requested number of threads was accepted.
|
virtual |
Get/Set the number of threads to use. It will be clamped to the range [ 1, m_GlobalMaximumNumberOfThreads ], so the caller of this method should check that the requested number of threads was accepted.
Reimplemented in itk::PoolMultiThreader.
|
virtual |
Get/Set the number of work units to create. It might be clamped to the range [ 1, SomeMaximumNumber ], so the caller of this method should check that the requested number of work units was accepted.
Reimplemented in itk::TBBMultiThreader.
|
pure virtual |
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 *.
Implemented in itk::PoolMultiThreader, and itk::TBBMultiThreader.
|
virtual |
The number of work units to create.
|
pure virtual |
Execute the SingleMethod (as define by SetSingleMethod) using m_NumberOfWorkUnits threads. As a side effect the m_NumberOfWorkUnits will be checked against the current m_GlobalMaximumNumberOfThreads and clamped if necessary.
Implemented in itk::PoolMultiThreader, and itk::TBBMultiThreader.
|
staticprotected |
Static function used as a "proxy callback" by multi-threaders. The threading library will call this routine for each thread, which will delegate the control to the prescribed SingleMethod. This routine acts as an intermediary between the multi-threaders and the user supplied callback (SingleMethod) in order to catch any exceptions thrown by the threads.
|
static |
Convert a threader name into its enum type.
|
inlinestatic |
Convert a threader enum type into a string for displaying or logging.
Definition at line 180 of file itkMultiThreaderBase.h.
|
friend |
Friends of Multithreader. ProcessObject is a friend so that it can call PrintSelf() on its Multithreader.
Friends of DataObject
Definition at line 500 of file itkMultiThreaderBase.h.
|
protected |
The number of threads to use. The m_MaximumNumberOfThreads must always be less than or equal to the m_GlobalMaximumNumberOfThreads before it is used during the execution of a threaded method. Its value is initialized to m_GlobalDefaultNumberOfThreads at construction time. Its value is clamped to the current m_GlobalMaximumNumberOfThreads in the SingleMethodExecute() method.
Definition at line 473 of file itkMultiThreaderBase.h.
|
protected |
The number of work units to create.
Definition at line 463 of file itkMultiThreaderBase.h.
|
staticprivate |
The number of work units to create.
Definition at line 496 of file itkMultiThreaderBase.h.
|
protected |
The data to be passed as argument.
Definition at line 488 of file itkMultiThreaderBase.h.
|
protected |
The method to invoke.
Definition at line 485 of file itkMultiThreaderBase.h.
|
private |
The number of work units to create.
Definition at line 494 of file itkMultiThreaderBase.h.