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
50template <typename TEquationContainer, typename TImage>
51class ITK_TEMPLATE_EXPORT LevelSetEvolution<TEquationContainer, LevelSetDenseImage<TImage>>
52 : public LevelSetEvolutionBase<TEquationContainer, LevelSetDenseImage<TImage>>
53{
54public:
55 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolution);
56
58
63
65 itkNewMacro(Self);
66
68 itkOverrideGetNameOfClassMacro(LevelSetEvolution);
69
70 using typename Superclass::EquationContainerType;
71 using typename Superclass::EquationContainerPointer;
72 using typename Superclass::TermContainerType;
73 using typename Superclass::TermContainerPointer;
74
75 using typename Superclass::TermType;
76 using typename Superclass::TermPointer;
77
78 using typename Superclass::InputImageType;
79 using typename Superclass::InputImagePixelType;
80 using typename Superclass::InputImageConstPointer;
81 using typename Superclass::InputImageRegionType;
82 using typename Superclass::InputPixelRealType;
83
84 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
85
86 using typename Superclass::LevelSetContainerType;
87
88 using typename Superclass::LevelSetIdentifierType;
89
91
92 using typename Superclass::LevelSetOutputType;
93 using typename Superclass::LevelSetOutputRealType;
94 using typename Superclass::LevelSetDataType;
95
96 using typename Superclass::IdListType;
97 using typename Superclass::IdListIterator;
98 using typename Superclass::IdListConstIterator;
99 using typename Superclass::IdListImageType;
100 using typename Superclass::CacheImageType;
101 using typename Superclass::DomainMapImageFilterType;
102
103 using typename Superclass::StoppingCriterionType;
104 using typename Superclass::StoppingCriterionPointer;
105
108
111
113
115
117
119 void
120 SetNumberOfWorkUnits(const ThreadIdType numberOfThreads);
121
125
126 ~LevelSetEvolution() override = default;
127
128protected:
130
133 void
135
137 void
139
141 void
143
145 void
146 UpdateLevelSets() override;
147
149 void
150 UpdateEquations() override;
151
153 void
155
156 typename LevelSetContainerType::Pointer m_UpdateBuffer{};
157
158 friend class LevelSetEvolutionComputeIterationThreader<LevelSetType,
159 ThreadedImageRegionPartitioner<TImage::ImageDimension>,
160 Self>;
163 ThreadedImageRegionPartitioner<TImage::ImageDimension>,
164 Self>;
165 typename SplitLevelSetComputeIterationThreaderType::Pointer m_SplitLevelSetComputeIterationThreader{};
166
167 using DomainMapConstIteratorType = typename DomainMapImageFilterType::DomainMapType::const_iterator;
172 typename SplitDomainMapComputeIterationThreaderType::Pointer m_SplitDomainMapComputeIterationThreader{};
173
174 friend class LevelSetEvolutionUpdateLevelSetsThreader<LevelSetType,
175 ThreadedImageRegionPartitioner<TImage::ImageDimension>,
176 Self>;
179 ThreadedImageRegionPartitioner<TImage::ImageDimension>,
180 Self>;
181 typename SplitLevelSetUpdateLevelSetsThreaderType::Pointer m_SplitLevelSetUpdateLevelSetsThreader{};
182
184 const IdListType * m_IdListToProcessWhenThreading{};
185};
186
187
188template <typename TEquationContainer, typename TOutput, unsigned int VDimension>
189class ITK_TEMPLATE_EXPORT LevelSetEvolution<TEquationContainer, WhitakerSparseLevelSetImage<TOutput, VDimension>>
190 : public LevelSetEvolutionBase<TEquationContainer, WhitakerSparseLevelSetImage<TOutput, VDimension>>
191{
192public:
193 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolution);
194
196
201
203 itkNewMacro(Self);
204
206 itkOverrideGetNameOfClassMacro(LevelSetEvolution);
207
208 using typename Superclass::EquationContainerType;
209 using typename Superclass::EquationContainerPointer;
210 using typename Superclass::TermContainerType;
211 using typename Superclass::TermContainerPointer;
212
213 using typename Superclass::TermType;
214 using typename Superclass::TermPointer;
215
216 using typename Superclass::InputImageType;
217 using typename Superclass::InputImagePixelType;
218 using typename Superclass::InputImageConstPointer;
219 using typename Superclass::InputImageRegionType;
220 using typename Superclass::InputPixelRealType;
221
222 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
223
224 using typename Superclass::LevelSetContainerType;
225 using typename Superclass::LevelSetIdentifierType;
226
227 using typename Superclass::LevelSetInputType;
228 using typename Superclass::LevelSetOutputType;
229 using typename Superclass::LevelSetOutputRealType;
230 using typename Superclass::LevelSetDataType;
231
233
236
237
238 using typename Superclass::IdListType;
239 using typename Superclass::IdListIterator;
240 using typename Superclass::IdListImageType;
241 using typename Superclass::CacheImageType;
242 using typename Superclass::DomainMapImageFilterType;
243
244 using typename Superclass::StoppingCriterionType;
245 using typename Superclass::StoppingCriterionPointer;
246
248
252
254 void
255 SetNumberOfWorkUnits(const ThreadIdType numberOfWorkUnits);
256
260
261protected:
264
265 using NodePairType = std::pair<LevelSetInputType, LevelSetOutputType>;
266
267 // For sparse case, the update buffer needs to be the size of the active layer
268 std::map<IdentifierType, LevelSetLayerType *> m_UpdateBuffer{};
269
272 void
274
276 void
278
280 void
282
284 void
285 UpdateLevelSets() override;
286
288 void
289 UpdateEquations() override;
290
295 typename SplitLevelSetComputeIterationThreaderType::Pointer m_SplitLevelSetComputeIterationThreader{};
296};
297
298
299// Shi
300template <typename TEquationContainer, unsigned int VDimension>
301class ITK_TEMPLATE_EXPORT LevelSetEvolution<TEquationContainer, ShiSparseLevelSetImage<VDimension>>
302 : public LevelSetEvolutionBase<TEquationContainer, ShiSparseLevelSetImage<VDimension>>
303{
304public:
305 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolution);
306
308
313
315 itkNewMacro(Self);
316
318 itkOverrideGetNameOfClassMacro(LevelSetEvolution);
319
320 using typename Superclass::EquationContainerType;
321 using typename Superclass::EquationContainerPointer;
322 using typename Superclass::TermContainerType;
323 using typename Superclass::TermContainerPointer;
324
325 using typename Superclass::TermType;
326 using typename Superclass::TermPointer;
327
328 using typename Superclass::InputImageType;
329 using typename Superclass::InputImagePixelType;
330 using typename Superclass::InputImageConstPointer;
331 using typename Superclass::InputImageRegionType;
332 using typename Superclass::InputPixelRealType;
333
334 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
335
336 using typename Superclass::LevelSetContainerType;
337 using typename Superclass::LevelSetIdentifierType;
338
339 using typename Superclass::LevelSetInputType;
340 using typename Superclass::LevelSetOutputType;
341 using typename Superclass::LevelSetOutputRealType;
342 using typename Superclass::LevelSetDataType;
343
345
348
349
350 using typename Superclass::IdListType;
351 using typename Superclass::IdListIterator;
352 using typename Superclass::IdListImageType;
353 using typename Superclass::CacheImageType;
354 using typename Superclass::DomainMapImageFilterType;
355
356 using typename Superclass::StoppingCriterionType;
357 using typename Superclass::StoppingCriterionPointer;
358
360
363
364 LevelSetEvolution() = default;
365 ~LevelSetEvolution() override = default;
366
367protected:
369 void
370 UpdateLevelSets() override;
371
373 void
374 UpdateEquations() override;
375};
376
377// Malcolm
378template <typename TEquationContainer, unsigned int VDimension>
379class ITK_TEMPLATE_EXPORT LevelSetEvolution<TEquationContainer, MalcolmSparseLevelSetImage<VDimension>>
380 : public LevelSetEvolutionBase<TEquationContainer, MalcolmSparseLevelSetImage<VDimension>>
381{
382public:
383 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolution);
384
386
391
393 itkNewMacro(Self);
394
396 itkOverrideGetNameOfClassMacro(LevelSetEvolution);
397
398 using typename Superclass::EquationContainerType;
399 using typename Superclass::EquationContainerPointer;
400 using typename Superclass::TermContainerType;
401 using typename Superclass::TermContainerPointer;
402
403 using typename Superclass::TermType;
404 using typename Superclass::TermPointer;
405
406 using typename Superclass::InputImageType;
407 using typename Superclass::InputImagePixelType;
408 using typename Superclass::InputImageConstPointer;
409 using typename Superclass::InputImageRegionType;
410 using typename Superclass::InputPixelRealType;
411
412 static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
413
414 using typename Superclass::LevelSetContainerType;
415 using typename Superclass::LevelSetIdentifierType;
416
417 using typename Superclass::LevelSetInputType;
418 using typename Superclass::LevelSetOutputType;
419 using typename Superclass::LevelSetOutputRealType;
420 using typename Superclass::LevelSetDataType;
421
424
427
428
429 using typename Superclass::IdListType;
430 using typename Superclass::IdListIterator;
431 using typename Superclass::IdListImageType;
432 using typename Superclass::CacheImageType;
433 using typename Superclass::DomainMapImageFilterType;
434
435 using typename Superclass::StoppingCriterionType;
436 using typename Superclass::StoppingCriterionPointer;
437
439
442
443 LevelSetEvolution() = default;
444 ~LevelSetEvolution() override = default;
445
446protected:
447 void
448 UpdateLevelSets() override;
449 void
450 UpdateEquations() override;
451};
452} // namespace itk
453
454#ifndef ITK_MANUAL_INSTANTIATION
455# include "itkLevelSetEvolution.hxx"
456#endif
457
458#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