ITK  4.13.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:
54 
57 
59  itkNewMacro( Self );
60 
62  typedef typename Superclass::DomainType DomainType;
63  typedef typename Superclass::AssociateType AssociateType;
64 
66  typedef TLevelSetEvolution LevelSetEvolutionType;
67  typedef typename LevelSetEvolutionType::IdListType IdListType;
68  typedef typename LevelSetEvolutionType::IdListConstIterator IdListConstIterator;
69  typedef typename LevelSetEvolutionType::InputImageType InputImageType;
70  typedef typename LevelSetEvolutionType::LevelSetType LevelSetType;
72  typedef typename LevelSetType::RegionType RegionType;
73  typedef typename LevelSetType::OffsetType OffsetType;
74  typedef typename LevelSetEvolutionType::LevelSetImageType LevelSetImageType;
75  typedef typename LevelSetEvolutionType::LevelSetDataType LevelSetDataType;
76  typedef typename LevelSetEvolutionType::LevelSetOutputRealType LevelSetOutputRealType;
77  typedef typename LevelSetEvolutionType::LevelSetContainerType LevelSetContainerType;
78  typedef typename LevelSetEvolutionType::EquationContainerType EquationContainerType;
79  typedef typename LevelSetEvolutionType::TermContainerType TermContainerType;
80 
81 protected:
83 
84  virtual void ThreadedExecution( const DomainType & imageSubRegion, const ThreadIdType threadId ) ITK_OVERRIDE;
85 
86 private:
87  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetEvolutionComputeIterationThreader);
88 };
89 
90 // For dense image level set split by putting a level set domain in each thread.
91 template< typename TImage, typename TLevelSetEvolution >
93  ThreadedIteratorRangePartitioner< typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator >, TLevelSetEvolution >
94  : public DomainThreader< ThreadedIteratorRangePartitioner< typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator >, TLevelSetEvolution >
95 {
96 public:
97  typedef typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator DomainMapConstIteratorType;
99 
105 
108 
110  itkNewMacro( Self );
111 
113  typedef typename Superclass::DomainType DomainType;
115 
117  typedef TLevelSetEvolution LevelSetEvolutionType;
118  typedef typename LevelSetEvolutionType::IdListType IdListType;
119  typedef typename LevelSetEvolutionType::IdListConstIterator IdListConstIterator;
120  typedef typename LevelSetEvolutionType::InputImageType InputImageType;
121  typedef typename LevelSetEvolutionType::LevelSetType LevelSetType;
123  typedef typename LevelSetType::RegionType RegionType;
124  typedef typename LevelSetType::OffsetType OffsetType;
125  typedef typename LevelSetEvolutionType::LevelSetImageType LevelSetImageType;
126  typedef typename LevelSetEvolutionType::LevelSetDataType LevelSetDataType;
127  typedef typename LevelSetEvolutionType::LevelSetOutputRealType LevelSetOutputRealType;
128  typedef typename LevelSetEvolutionType::LevelSetContainerType LevelSetContainerType;
129  typedef typename LevelSetEvolutionType::EquationContainerType EquationContainerType;
130  typedef typename LevelSetEvolutionType::TermContainerType TermContainerType;
131 
132 protected:
134 
135  virtual void ThreadedExecution( const DomainType & imageSubRegion, const ThreadIdType threadId ) ITK_OVERRIDE;
136 
137 private:
138  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetEvolutionComputeIterationThreader);
139 };
140 
141 // For Whitaker sparse level set split by putting part of the level set in each
142 // thread.
143 template< typename TOutput, unsigned int VDimension, typename TLevelSetEvolution >
145  WhitakerSparseLevelSetImage< TOutput, VDimension >,
146  ThreadedIteratorRangePartitioner< typename WhitakerSparseLevelSetImage< TOutput, VDimension >::LayerConstIterator >,
147  TLevelSetEvolution
148  >
149  : public DomainThreader< ThreadedIteratorRangePartitioner< typename WhitakerSparseLevelSetImage< TOutput, VDimension >::LayerConstIterator >, TLevelSetEvolution >
150 {
151 public:
157 
160 
162  itkNewMacro( Self );
163 
165  typedef typename Superclass::DomainType DomainType;
167 
169  typedef TLevelSetEvolution LevelSetEvolutionType;
170  typedef typename LevelSetEvolutionType::LevelSetType LevelSetType;
172  typedef typename LevelSetType::RegionType RegionType;
173  typedef typename LevelSetType::OffsetType OffsetType;
174  typedef typename LevelSetEvolutionType::LevelSetContainerType LevelSetContainerType;
175  typedef typename LevelSetEvolutionType::LevelSetIdentifierType LevelSetIdentifierType;
176  typedef typename LevelSetEvolutionType::LevelSetInputType LevelSetInputType;
177  typedef typename LevelSetEvolutionType::LevelSetOutputType LevelSetOutputType;
178  typedef typename LevelSetEvolutionType::LevelSetDataType LevelSetDataType;
179  typedef typename LevelSetEvolutionType::TermContainerType TermContainerType;
180  typedef typename LevelSetEvolutionType::NodePairType NodePairType;
181 
182 protected:
184 
185  virtual void BeforeThreadedExecution() ITK_OVERRIDE;
186 
187  virtual void ThreadedExecution( const DomainType & iteratorSubRange, const ThreadIdType threadId ) ITK_OVERRIDE;
188 
189  virtual void AfterThreadedExecution() ITK_OVERRIDE;
190 
191  typedef std::vector< std::vector< NodePairType > > NodePairsPerThreadType;
192  NodePairsPerThreadType m_NodePairsPerThread;
193 
194 private:
195  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetEvolutionComputeIterationThreader);
196 };
197 
198 } // namespace itk
199 
200 #ifndef ITK_MANUAL_INSTANTIATION
201 #include "itkLevelSetEvolutionComputeIterationThreader.hxx"
202 #endif
203 
204 #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:159