ITK  4.3.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< class TLevelSet, class TDomainPartitioner, class TLevelSetEvolution >
40 {};
41 
42 // For dense image level set split by putting part of the level set region in
43 // each thread.
44 template< class TImage, class 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 LevelSetEvolutionType::LevelSetImageType LevelSetImageType;
72  typedef typename LevelSetEvolutionType::LevelSetDataType LevelSetDataType;
73  typedef typename LevelSetEvolutionType::LevelSetOutputRealType LevelSetOutputRealType;
74  typedef typename LevelSetEvolutionType::LevelSetContainerType LevelSetContainerType;
75  typedef typename LevelSetEvolutionType::EquationContainerType EquationContainerType;
76  typedef typename LevelSetEvolutionType::TermContainerType TermContainerType;
77 
78 protected:
80 
81  virtual void ThreadedExecution( const DomainType & imageSubRegion, const ThreadIdType threadId );
82 
83 private:
84  LevelSetEvolutionComputeIterationThreader( const Self & ); // purposely not implemented
85  void operator=( const Self & ); // purposely not implemented
86 };
87 
88 // For dense image level set split by putting a level set domain in each thread.
89 template< class TImage, class TLevelSetEvolution >
91  ThreadedIteratorRangePartitioner< typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator >, TLevelSetEvolution >
92  : public DomainThreader< ThreadedIteratorRangePartitioner< typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator >, TLevelSetEvolution >
93 {
94 public:
95  typedef typename TLevelSetEvolution::DomainMapImageFilterType::DomainMapType::const_iterator DomainMapConstIteratorType;
97 
103 
106 
108  itkNewMacro( Self );
109 
111  typedef typename Superclass::DomainType DomainType;
113 
115  typedef TLevelSetEvolution LevelSetEvolutionType;
116  typedef typename LevelSetEvolutionType::IdListType IdListType;
117  typedef typename LevelSetEvolutionType::IdListConstIterator IdListConstIterator;
118  typedef typename LevelSetEvolutionType::InputImageType InputImageType;
119  typedef typename LevelSetEvolutionType::LevelSetType LevelSetType;
120  typedef typename LevelSetEvolutionType::LevelSetImageType LevelSetImageType;
121  typedef typename LevelSetEvolutionType::LevelSetDataType LevelSetDataType;
122  typedef typename LevelSetEvolutionType::LevelSetOutputRealType LevelSetOutputRealType;
123  typedef typename LevelSetEvolutionType::LevelSetContainerType LevelSetContainerType;
124  typedef typename LevelSetEvolutionType::EquationContainerType EquationContainerType;
125  typedef typename LevelSetEvolutionType::TermContainerType TermContainerType;
126 
127 protected:
129 
130  virtual void ThreadedExecution( const DomainType & imageSubRegion, const ThreadIdType threadId );
131 
132 private:
133  LevelSetEvolutionComputeIterationThreader( const Self & ); // purposely not implemented
134  void operator=( const Self & ); // purposely not implemented
135 };
136 
137 // For Whitaker sparse level set split by putting part of the level set in each
138 // thread.
139 template< class TOutput, unsigned int VDimension, class TLevelSetEvolution >
141  WhitakerSparseLevelSetImage< TOutput, VDimension >,
142  ThreadedIteratorRangePartitioner< typename WhitakerSparseLevelSetImage< TOutput, VDimension >::LayerConstIterator >,
143  TLevelSetEvolution
144  >
145  : public DomainThreader< ThreadedIteratorRangePartitioner< typename WhitakerSparseLevelSetImage< TOutput, VDimension >::LayerConstIterator >, TLevelSetEvolution >
146 {
147 public:
153 
156 
158  itkNewMacro( Self );
159 
161  typedef typename Superclass::DomainType DomainType;
163 
165  typedef TLevelSetEvolution LevelSetEvolutionType;
166  typedef typename LevelSetEvolutionType::LevelSetType LevelSetType;
167  typedef typename LevelSetEvolutionType::LevelSetContainerType LevelSetContainerType;
168  typedef typename LevelSetEvolutionType::LevelSetIdentifierType LevelSetIdentifierType;
169  typedef typename LevelSetEvolutionType::LevelSetInputType LevelSetInputType;
170  typedef typename LevelSetEvolutionType::LevelSetOutputType LevelSetOutputType;
171  typedef typename LevelSetEvolutionType::LevelSetDataType LevelSetDataType;
172  typedef typename LevelSetEvolutionType::TermContainerType TermContainerType;
173  typedef typename LevelSetEvolutionType::NodePairType NodePairType;
174 
175 protected:
177 
178  virtual void BeforeThreadedExecution();
179 
180  virtual void ThreadedExecution( const DomainType & iteratorSubRange, const ThreadIdType threadId );
181 
182  virtual void AfterThreadedExecution();
183 
184  typedef std::vector< std::vector< NodePairType > > NodePairsPerThreadType;
186 
187 private:
188  LevelSetEvolutionComputeIterationThreader( const Self & ); // purposely not implemented
189  void operator=( const Self & ); // purposely not implemented
190 };
191 
192 } // namespace itk
193 
194 #ifndef ITK_MANUAL_INSTANTIATION
195 #include "itkLevelSetEvolutionComputeIterationThreader.hxx"
196 #endif
197 
198 #endif
199