ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkPoolMultiThreader.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef itkPoolMultiThreader_h
29 #define itkPoolMultiThreader_h
30 
31 #include "itkMultiThreaderBase.h"
32 #include "itkThreadPool.h"
33 
34 namespace itk
35 {
45 class ITKCommon_EXPORT PoolMultiThreader : public MultiThreaderBase
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_ASSIGN(PoolMultiThreader);
49 
55 
57  itkNewMacro(Self);
58 
60  itkTypeMacro(PoolMultiThreader, MultiThreaderBase);
61 
62 
67  void SingleMethodExecute() override;
68 
73  void SetSingleMethod(ThreadFunctionType, void *data) override;
74 
77  void
78  ParallelizeArray(
79  SizeValueType firstIndex,
80  SizeValueType lastIndexPlus1,
82  ProcessObject* filter ) override;
83 
85  void
86  ParallelizeImageRegion(
87  unsigned int dimension,
88  const IndexValueType index[],
89  const SizeValueType size[],
91  ProcessObject* filter) override;
92 
95  void SetMaximumNumberOfThreads( ThreadIdType numberOfThreads ) override;
96 
97  struct ThreadPoolInfoStruct :WorkUnitInfo
98  {
99  std::future< ITK_THREAD_RETURN_TYPE > Future;
100  };
101 
102 protected:
104  ~PoolMultiThreader() override;
105  void PrintSelf(std::ostream & os, Indent indent) const override;
106 
107 private:
108  // Thread pool instance and factory
110 
115 
119  friend class ProcessObject;
120 };
121 
122 } // end namespace itk
123 #endif
void(* ThreadFunctionType)(void *)
Light weight base class for most itk classes.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
constexpr std::vcl_size_t ITK_MAX_THREADS
std::function< void(SizeValueType) > ArrayThreadingFunctorType
A class for performing multithreaded execution with a thread pool back end.
std::function< void(const IndexValueType index[], const SizeValueType size[])> ThreadingFunctorType
signed long IndexValueType
Definition: itkIntTypes.h:90
ThreadPool::Pointer m_ThreadPool
A class for performing multithreaded execution.
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
Control indentation during Print() invocation.
Definition: itkIndent.h:49
std::future< ITK_THREAD_RETURN_TYPE > Future
Base class for most ITK classes.
Definition: itkObject.h:60