ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLevelSetEvolutionComputeIterationThreader.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 #ifndef itkLevelSetEvolutionComputeIterationThreader_h
19 #define itkLevelSetEvolutionComputeIterationThreader_h
20 
21 #include "itkDomainThreader.h"
24 
25 #include "itkLevelSetDenseImage.h"
27 
28 namespace itk
29 {
30 
38 template< typename TLevelSet, typename TDomainPartitioner, typename TLevelSetEvolution >
40 {};
41 
42 // For dense image level set split by putting part of the level set region in
43 // each thread.
44 template< typename TImage, typename TLevelSetEvolution >
45 class ITK_TEMPLATE_EXPORT LevelSetEvolutionComputeIterationThreader< LevelSetDenseImage< TImage >, ThreadedImageRegionPartitioner< TImage::ImageDimension >, TLevelSetEvolution >
46  : public DomainThreader< ThreadedImageRegionPartitioner< TImage::ImageDimension >, TLevelSetEvolution >
47 {
48 public:
49  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetEvolutionComputeIterationThreader);
50 
56 
59 
61  itkNewMacro( Self );
62 
64  using DomainType = typename Superclass::DomainType;
65  using AssociateType = typename Superclass::AssociateType;
66 
68  using LevelSetEvolutionType = TLevelSetEvolution;
69  using IdListType = typename LevelSetEvolutionType::IdListType;
70  using IdListConstIterator = typename LevelSetEvolutionType::IdListConstIterator;
71  using InputImageType = typename LevelSetEvolutionType::InputImageType;
72  using LevelSetType = typename LevelSetEvolutionType::LevelSetType;
75  using OffsetType = typename LevelSetType::OffsetType;
76  using LevelSetImageType = typename LevelSetEvolutionType::LevelSetImageType;
77  using LevelSetDataType = typename LevelSetEvolutionType::LevelSetDataType;
78  using LevelSetOutputRealType = typename LevelSetEvolutionType::LevelSetOutputRealType;
79  using LevelSetContainerType = typename LevelSetEvolutionType::LevelSetContainerType;
80  using EquationContainerType = typename LevelSetEvolutionType::EquationContainerType;
81  using TermContainerType = typename LevelSetEvolutionType::TermContainerType;
82 
83 protected:
85 
86  void ThreadedExecution( const DomainType & imageSubRegion, const ThreadIdType threadId ) override;
87 };
88 
89 // For dense image level set split by putting a level set domain in each thread.
90 template< typename TImage, typename TLevelSetEvolution >
92  ThreadedIteratorRangePartitioner< typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator >, TLevelSetEvolution >
93  : public DomainThreader< ThreadedIteratorRangePartitioner< typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator >, TLevelSetEvolution >
94 {
95 public:
96  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetEvolutionComputeIterationThreader);
97 
98  using DomainMapConstIteratorType = typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator;
100 
106 
109 
111  itkNewMacro( Self );
112 
114  using DomainType = typename Superclass::DomainType;
115  using AssociateType = typename Superclass::AssociateType;
116 
118  using LevelSetEvolutionType = TLevelSetEvolution;
119  using IdListType = typename LevelSetEvolutionType::IdListType;
120  using IdListConstIterator = typename LevelSetEvolutionType::IdListConstIterator;
121  using InputImageType = typename LevelSetEvolutionType::InputImageType;
122  using LevelSetType = typename LevelSetEvolutionType::LevelSetType;
125  using OffsetType = typename LevelSetType::OffsetType;
126  using LevelSetImageType = typename LevelSetEvolutionType::LevelSetImageType;
127  using LevelSetDataType = typename LevelSetEvolutionType::LevelSetDataType;
128  using LevelSetOutputRealType = typename LevelSetEvolutionType::LevelSetOutputRealType;
129  using LevelSetContainerType = typename LevelSetEvolutionType::LevelSetContainerType;
130  using EquationContainerType = typename LevelSetEvolutionType::EquationContainerType;
131  using TermContainerType = typename LevelSetEvolutionType::TermContainerType;
132 
133 protected:
135 
136  void ThreadedExecution( const DomainType & imageSubRegion, const ThreadIdType threadId ) override;
137 };
138 
139 // For Whitaker sparse level set split by putting part of the level set in each
140 // thread.
141 template< typename TOutput, unsigned int VDimension, typename TLevelSetEvolution >
143  WhitakerSparseLevelSetImage< TOutput, VDimension >,
144  ThreadedIteratorRangePartitioner< typename WhitakerSparseLevelSetImage< TOutput, VDimension >::LayerConstIterator >,
145  TLevelSetEvolution
146  >
147  : public DomainThreader< ThreadedIteratorRangePartitioner< typename WhitakerSparseLevelSetImage< TOutput, VDimension >::LayerConstIterator >, TLevelSetEvolution >
148 {
149 public:
150  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetEvolutionComputeIterationThreader);
151 
157 
160 
162  itkNewMacro( Self );
163 
165  using DomainType = typename Superclass::DomainType;
166  using AssociateType = typename Superclass::AssociateType;
167 
169  using LevelSetEvolutionType = TLevelSetEvolution;
170  using LevelSetType = typename LevelSetEvolutionType::LevelSetType;
173  using OffsetType = typename LevelSetType::OffsetType;
174  using LevelSetContainerType = typename LevelSetEvolutionType::LevelSetContainerType;
175  using LevelSetIdentifierType = typename LevelSetEvolutionType::LevelSetIdentifierType;
176  using LevelSetInputType = typename LevelSetEvolutionType::LevelSetInputType;
177  using LevelSetOutputType = typename LevelSetEvolutionType::LevelSetOutputType;
178  using LevelSetDataType = typename LevelSetEvolutionType::LevelSetDataType;
179  using TermContainerType = typename LevelSetEvolutionType::TermContainerType;
180  using NodePairType = typename LevelSetEvolutionType::NodePairType;
181 
182 protected:
184 
185  void BeforeThreadedExecution() override;
186 
187  void ThreadedExecution( const DomainType & iteratorSubRange, const ThreadIdType threadId ) override;
188 
189  void AfterThreadedExecution() override;
190 
191  using NodePairsPerThreadType = std::vector< std::vector< NodePairType > >;
193 };
194 
195 } // namespace itk
196 
197 #ifndef ITK_MANUAL_INSTANTIATION
198 #include "itkLevelSetEvolutionComputeIterationThreader.hxx"
199 #endif
200 
201 #endif
Light weight base class for most itk classes.
Multi-threaded processing on a domain by processing sub-domains per thread.
Class for partitioning of an ImageRegion.
Derived class for the sparse-field representation of level-set function.
Base class for the &quot;dense&quot; representation of a level-set function on one image.
Partitions an iterator range for threading.
unsigned int ThreadIdType
Definition: itkIntTypes.h:99