ITK  6.0.0
Insight Toolkit
itkLevelSetEvolution.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkLevelSetEvolution_h
19#define itkLevelSetEvolution_h
20
23
26
29
32
35
36namespace itk
37{
47template <typename TEquationContainer, typename TLevelSet>
48class ITK_TEMPLATE_EXPORT LevelSetEvolution
49{};
50
51template <typename TEquationContainer, typename TImage>
52class ITK_TEMPLATE_EXPORT LevelSetEvolution<TEquationContainer, LevelSetDenseImage<TImage>>
53 : public LevelSetEvolutionBase<TEquationContainer, LevelSetDenseImage<TImage>>
54{
55public:
56 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolution);
57
59
64
66 itkNewMacro(Self);
67
69 itkOverrideGetNameOfClassMacro(LevelSetEvolution);
70
71 using typename Superclass::EquationContainerType;
72 using typename Superclass::EquationContainerPointer;
73 using typename Superclass::TermContainerType;
74 using typename Superclass::TermContainerPointer;
75
76 using typename Superclass::TermType;
77 using typename Superclass::TermPointer;
78
79 using typename Superclass::InputImageType;
80 using typename Superclass::InputImagePixelType;
81 using typename Superclass::InputImageConstPointer;
82 using typename Superclass::InputImageRegionType;
83 using typename Superclass::InputPixelRealType;
84
85 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
86
87 using typename Superclass::LevelSetContainerType;
88
89 using typename Superclass::LevelSetIdentifierType;
90
92
93 using typename Superclass::LevelSetOutputType;
94 using typename Superclass::LevelSetOutputRealType;
95 using typename Superclass::LevelSetDataType;
96
97 using typename Superclass::IdListType;
98 using typename Superclass::IdListIterator;
99 using typename Superclass::IdListConstIterator;
100 using typename Superclass::IdListImageType;
101 using typename Superclass::CacheImageType;
102 using typename Superclass::DomainMapImageFilterType;
103
104 using typename Superclass::StoppingCriterionType;
105 using typename Superclass::StoppingCriterionPointer;
106
109
112
114
116
118
120 void
121 SetNumberOfWorkUnits(const ThreadIdType numberOfThreads);
122
126
127 ~LevelSetEvolution() override = default;
128
129protected:
131
134 void
136
138 void
140
142 void
144
146 void
147 UpdateLevelSets() override;
148
150 void
151 UpdateEquations() override;
152
154 void
156
157 typename LevelSetContainerType::Pointer m_UpdateBuffer{};
158
159 friend class LevelSetEvolutionComputeIterationThreader<LevelSetType,
160 ThreadedImageRegionPartitioner<TImage::ImageDimension>,
161 Self>;
164 ThreadedImageRegionPartitioner<TImage::ImageDimension>,
165 Self>;
166 typename SplitLevelSetComputeIterationThreaderType::Pointer m_SplitLevelSetComputeIterationThreader{};
167
168 using DomainMapConstIteratorType = typename DomainMapImageFilterType::DomainMapType::const_iterator;
173 typename SplitDomainMapComputeIterationThreaderType::Pointer m_SplitDomainMapComputeIterationThreader{};
174
175 friend class LevelSetEvolutionUpdateLevelSetsThreader<LevelSetType,
176 ThreadedImageRegionPartitioner<TImage::ImageDimension>,
177 Self>;
180 ThreadedImageRegionPartitioner<TImage::ImageDimension>,
181 Self>;
182 typename SplitLevelSetUpdateLevelSetsThreaderType::Pointer m_SplitLevelSetUpdateLevelSetsThreader{};
183
185 const IdListType * m_IdListToProcessWhenThreading{};
186};
187
188
189template <typename TEquationContainer, typename TOutput, unsigned int VDimension>
190class ITK_TEMPLATE_EXPORT LevelSetEvolution<TEquationContainer, WhitakerSparseLevelSetImage<TOutput, VDimension>>
191 : public LevelSetEvolutionBase<TEquationContainer, WhitakerSparseLevelSetImage<TOutput, VDimension>>
192{
193public:
194 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolution);
195
197
202
204 itkNewMacro(Self);
205
207 itkOverrideGetNameOfClassMacro(LevelSetEvolution);
208
209 using typename Superclass::EquationContainerType;
210 using typename Superclass::EquationContainerPointer;
211 using typename Superclass::TermContainerType;
212 using typename Superclass::TermContainerPointer;
213
214 using typename Superclass::TermType;
215 using typename Superclass::TermPointer;
216
217 using typename Superclass::InputImageType;
218 using typename Superclass::InputImagePixelType;
219 using typename Superclass::InputImageConstPointer;
220 using typename Superclass::InputImageRegionType;
221 using typename Superclass::InputPixelRealType;
222
223 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
224
225 using typename Superclass::LevelSetContainerType;
226 using typename Superclass::LevelSetIdentifierType;
227
228 using typename Superclass::LevelSetInputType;
229 using typename Superclass::LevelSetOutputType;
230 using typename Superclass::LevelSetOutputRealType;
231 using typename Superclass::LevelSetDataType;
232
234
237
238
239 using typename Superclass::IdListType;
240 using typename Superclass::IdListIterator;
241 using typename Superclass::IdListImageType;
242 using typename Superclass::CacheImageType;
243 using typename Superclass::DomainMapImageFilterType;
244
245 using typename Superclass::StoppingCriterionType;
246 using typename Superclass::StoppingCriterionPointer;
247
249
253
255 void
256 SetNumberOfWorkUnits(const ThreadIdType numberOfThreads);
257
261
262protected:
265
266 using NodePairType = std::pair<LevelSetInputType, LevelSetOutputType>;
267
268 // For sparse case, the update buffer needs to be the size of the active layer
269 std::map<IdentifierType, LevelSetLayerType *> m_UpdateBuffer{};
270
273 void
275
277 void
279
281 void
283
285 void
286 UpdateLevelSets() override;
287
289 void
290 UpdateEquations() override;
291
296 typename SplitLevelSetComputeIterationThreaderType::Pointer m_SplitLevelSetComputeIterationThreader{};
297};
298
299
300// Shi
301template <typename TEquationContainer, unsigned int VDimension>
302class ITK_TEMPLATE_EXPORT LevelSetEvolution<TEquationContainer, ShiSparseLevelSetImage<VDimension>>
303 : public LevelSetEvolutionBase<TEquationContainer, ShiSparseLevelSetImage<VDimension>>
304{
305public:
306 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolution);
307
309
314
316 itkNewMacro(Self);
317
319 itkOverrideGetNameOfClassMacro(LevelSetEvolution);
320
321 using typename Superclass::EquationContainerType;
322 using typename Superclass::EquationContainerPointer;
323 using typename Superclass::TermContainerType;
324 using typename Superclass::TermContainerPointer;
325
326 using typename Superclass::TermType;
327 using typename Superclass::TermPointer;
328
329 using typename Superclass::InputImageType;
330 using typename Superclass::InputImagePixelType;
331 using typename Superclass::InputImageConstPointer;
332 using typename Superclass::InputImageRegionType;
333 using typename Superclass::InputPixelRealType;
334
335 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
336
337 using typename Superclass::LevelSetContainerType;
338 using typename Superclass::LevelSetIdentifierType;
339
340 using typename Superclass::LevelSetInputType;
341 using typename Superclass::LevelSetOutputType;
342 using typename Superclass::LevelSetOutputRealType;
343 using typename Superclass::LevelSetDataType;
344
346
349
350
351 using typename Superclass::IdListType;
352 using typename Superclass::IdListIterator;
353 using typename Superclass::IdListImageType;
354 using typename Superclass::CacheImageType;
355 using typename Superclass::DomainMapImageFilterType;
356
357 using typename Superclass::StoppingCriterionType;
358 using typename Superclass::StoppingCriterionPointer;
359
361
364
365 LevelSetEvolution() = default;
366 ~LevelSetEvolution() override = default;
367
368protected:
370 void
371 UpdateLevelSets() override;
372
374 void
375 UpdateEquations() override;
376};
377
378// Malcolm
379template <typename TEquationContainer, unsigned int VDimension>
380class ITK_TEMPLATE_EXPORT LevelSetEvolution<TEquationContainer, MalcolmSparseLevelSetImage<VDimension>>
381 : public LevelSetEvolutionBase<TEquationContainer, MalcolmSparseLevelSetImage<VDimension>>
382{
383public:
384 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolution);
385
387
392
394 itkNewMacro(Self);
395
397 itkOverrideGetNameOfClassMacro(LevelSetEvolution);
398
399 using typename Superclass::EquationContainerType;
400 using typename Superclass::EquationContainerPointer;
401 using typename Superclass::TermContainerType;
402 using typename Superclass::TermContainerPointer;
403
404 using typename Superclass::TermType;
405 using typename Superclass::TermPointer;
406
407 using typename Superclass::InputImageType;
408 using typename Superclass::InputImagePixelType;
409 using typename Superclass::InputImageConstPointer;
410 using typename Superclass::InputImageRegionType;
411 using typename Superclass::InputPixelRealType;
412
413 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
414
415 using typename Superclass::LevelSetContainerType;
416 using typename Superclass::LevelSetIdentifierType;
417
418 using typename Superclass::LevelSetInputType;
419 using typename Superclass::LevelSetOutputType;
420 using typename Superclass::LevelSetOutputRealType;
421 using typename Superclass::LevelSetDataType;
422
425
428
429
430 using typename Superclass::IdListType;
431 using typename Superclass::IdListIterator;
432 using typename Superclass::IdListImageType;
433 using typename Superclass::CacheImageType;
434 using typename Superclass::DomainMapImageFilterType;
435
436 using typename Superclass::StoppingCriterionType;
437 using typename Superclass::StoppingCriterionPointer;
438
440
443
444 LevelSetEvolution() = default;
445 ~LevelSetEvolution() override = default;
446
447protected:
448 void
449 UpdateLevelSets() override;
450 void
451 UpdateEquations() override;
452};
453} // namespace itk
454
455#ifndef ITK_MANUAL_INSTANTIATION
456# include "itkLevelSetEvolution.hxx"
457#endif
458
459#endif // itkLevelSetEvolution_h
Pixel-wise addition of two images.
Binarize an input image by thresholding.
A multi-dimensional iterator templated over image type that walks an image region and is specialized ...
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:71
Base class for the "dense" representation of a level-set function on one image.
Class for iterating and evolving the dense level-set function.
typename DomainMapImageFilterType::DomainMapType::const_iterator DomainMapConstIteratorType
Class for iterating and evolving the level-set function.
std::map< InputType, OutputType, Functor::LexicographicCompare > LayerType
typename LabelMapType::Pointer LabelMapPointer
Light weight base class for most itk classes.
Derived class for the Malcolm representation of level-set function.
Derived class for the shi representation of level-set function.
This filter calculates the Euclidean distance transform of a binary image in linear time for arbitrar...
Class for partitioning of an ImageRegion.
Partitions an iterator range for threading.
Base class for updating the Malcolm representation of level-set function.
Base class for updating the Shi representation of level-set function.
Base class for updating the level-set function.
Derived class for the sparse-field representation of level-set function.
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition: itkIntTypes.h:102