ITK  4.6.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 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;
71  typedef typename LevelSetType::IndexType IndexType;
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 );
85 
86 private:
87  LevelSetEvolutionComputeIterationThreader( const Self & ); // purposely not implemented
88  void operator=( const Self & ); // purposely not implemented
89 };
90 
91 // For dense image level set split by putting a level set domain in each thread.
92 template< typename TImage, typename TLevelSetEvolution >
94  ThreadedIteratorRangePartitioner< typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator >, TLevelSetEvolution >
95  : public DomainThreader< ThreadedIteratorRangePartitioner< typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator >, TLevelSetEvolution >
96 {
97 public:
98  typedef typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator DomainMapConstIteratorType;
100 
106 
109 
111  itkNewMacro( Self );
112 
114  typedef typename Superclass::DomainType DomainType;
115  typedef typename Superclass::AssociateType AssociateType;
116 
118  typedef TLevelSetEvolution LevelSetEvolutionType;
119  typedef typename LevelSetEvolutionType::IdListType IdListType;
120  typedef typename LevelSetEvolutionType::IdListConstIterator IdListConstIterator;
121  typedef typename LevelSetEvolutionType::InputImageType InputImageType;
122  typedef typename LevelSetEvolutionType::LevelSetType LevelSetType;
123  typedef typename LevelSetType::IndexType IndexType;
124  typedef typename LevelSetType::RegionType RegionType;
125  typedef typename LevelSetType::OffsetType OffsetType;
126  typedef typename LevelSetEvolutionType::LevelSetImageType LevelSetImageType;
127  typedef typename LevelSetEvolutionType::LevelSetDataType LevelSetDataType;
128  typedef typename LevelSetEvolutionType::LevelSetOutputRealType LevelSetOutputRealType;
129  typedef typename LevelSetEvolutionType::LevelSetContainerType LevelSetContainerType;
130  typedef typename LevelSetEvolutionType::EquationContainerType EquationContainerType;
131  typedef typename LevelSetEvolutionType::TermContainerType TermContainerType;
132 
133 protected:
135 
136  virtual void ThreadedExecution( const DomainType & imageSubRegion, const ThreadIdType threadId );
137 
138 private:
139  LevelSetEvolutionComputeIterationThreader( const Self & ); // purposely not implemented
140  void operator=( const Self & ); // purposely not implemented
141 };
142 
143 // For Whitaker sparse level set split by putting part of the level set in each
144 // thread.
145 template< typename TOutput, unsigned int VDimension, typename TLevelSetEvolution >
147  WhitakerSparseLevelSetImage< TOutput, VDimension >,
148  ThreadedIteratorRangePartitioner< typename WhitakerSparseLevelSetImage< TOutput, VDimension >::LayerConstIterator >,
149  TLevelSetEvolution
150  >
151  : public DomainThreader< ThreadedIteratorRangePartitioner< typename WhitakerSparseLevelSetImage< TOutput, VDimension >::LayerConstIterator >, TLevelSetEvolution >
152 {
153 public:
159 
162 
164  itkNewMacro( Self );
165 
167  typedef typename Superclass::DomainType DomainType;
169 
171  typedef TLevelSetEvolution LevelSetEvolutionType;
172  typedef typename LevelSetEvolutionType::LevelSetType LevelSetType;
173  typedef typename LevelSetType::IndexType IndexType;
174  typedef typename LevelSetType::RegionType RegionType;
175  typedef typename LevelSetType::OffsetType OffsetType;
176  typedef typename LevelSetEvolutionType::LevelSetContainerType LevelSetContainerType;
177  typedef typename LevelSetEvolutionType::LevelSetIdentifierType LevelSetIdentifierType;
178  typedef typename LevelSetEvolutionType::LevelSetInputType LevelSetInputType;
179  typedef typename LevelSetEvolutionType::LevelSetOutputType LevelSetOutputType;
180  typedef typename LevelSetEvolutionType::LevelSetDataType LevelSetDataType;
181  typedef typename LevelSetEvolutionType::TermContainerType TermContainerType;
182  typedef typename LevelSetEvolutionType::NodePairType NodePairType;
183 
184 protected:
186 
187  virtual void BeforeThreadedExecution();
188 
189  virtual void ThreadedExecution( const DomainType & iteratorSubRange, const ThreadIdType threadId );
190 
191  virtual void AfterThreadedExecution();
192 
193  typedef std::vector< std::vector< NodePairType > > NodePairsPerThreadType;
195 
196 private:
197  LevelSetEvolutionComputeIterationThreader( const Self & ); // purposely not implemented
198  void operator=( const Self & ); // purposely not implemented
199 };
200 
201 } // namespace itk
202 
203 #ifndef ITK_MANUAL_INSTANTIATION
204 #include "itkLevelSetEvolutionComputeIterationThreader.hxx"
205 #endif
206 
207 #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