ITK  5.4.0
Insight Toolkit
itkLevelSetEvolutionBase.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 
19 
20 #ifndef itkLevelSetEvolutionBase_h
21 #define itkLevelSetEvolutionBase_h
22 
23 #include <list>
24 
25 #include "itkImage.h"
30 #include "itkNumericTraits.h"
32 
33 namespace itk
34 {
42 template <typename TEquationContainer, typename TLevelSet>
43 class ITK_TEMPLATE_EXPORT LevelSetEvolutionBase : public Object
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_MOVE(LevelSetEvolutionBase);
47 
51  using Superclass = Object;
52 
54  itkOverrideGetNameOfClassMacro(LevelSetEvolutionBase);
55 
56  using EquationContainerType = TEquationContainer;
58  using TermContainerType = typename EquationContainerType::TermContainerType;
60 
61  using TermType = typename TermContainerType::TermType;
62  using TermPointer = typename TermType::Pointer;
63 
64  using InputImageType = typename TermContainerType::InputImageType;
65  using InputImagePixelType = typename InputImageType::PixelType;
69 
70  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
71 
72  using LevelSetContainerType = typename TermContainerType::LevelSetContainerType;
73 
74  using LevelSetIdentifierType = typename LevelSetContainerType::LevelSetIdentifierType;
75 
76  using LevelSetType = TLevelSet;
80  using LevelSetDataType = typename LevelSetType::LevelSetDataType;
81 
82  using IdListType = typename LevelSetContainerType::IdListType;
83  using IdListIterator = typename LevelSetContainerType::IdListIterator;
84  using IdListConstIterator = typename LevelSetContainerType::IdListConstIterator;
85  using IdListImageType = typename LevelSetContainerType::IdListImageType;
86  using CacheImageType = typename LevelSetContainerType::CacheImageType;
87 
88  using DomainMapImageFilterType = typename LevelSetContainerType::DomainMapImageFilterType;
89 
92 
93  itkSetObjectMacro(LevelSetContainer, LevelSetContainerType);
94  itkGetModifiableObjectMacro(LevelSetContainer, LevelSetContainerType);
95 
97  itkSetMacro(Alpha, LevelSetOutputRealType);
98  itkGetMacro(Alpha, LevelSetOutputRealType);
102  void
103  SetTimeStep(const LevelSetOutputRealType & iDt);
104 
106  itkSetObjectMacro(EquationContainer, EquationContainerType);
107  itkGetModifiableObjectMacro(EquationContainer, EquationContainerType);
111  itkSetObjectMacro(StoppingCriterion, StoppingCriterionType);
112  itkGetModifiableObjectMacro(StoppingCriterion, StoppingCriterionType);
116  itkGetConstMacro(NumberOfIterations, IdentifierType);
117 
121  void
122  Update();
123 
124 protected:
126 
127  ~LevelSetEvolutionBase() override = default;
128 
129  void
130  CheckSetUp();
131 
133  void
134  InitializeIteration();
135 
140  void
141  Evolve();
142 
145  virtual void
146  AllocateUpdateBuffer();
147 
150  virtual void
151  ComputeIteration();
152 
154  virtual void
155  ComputeTimeStepForNextIteration();
156 
157  virtual void
158  UpdateLevelSets() = 0;
159 
160  virtual void
161  UpdateEquations() = 0;
162 
163  StoppingCriterionPointer m_StoppingCriterion{};
164 
165  EquationContainerPointer m_EquationContainer{};
166  typename LevelSetContainerType::Pointer m_LevelSetContainer{};
167 
170  LevelSetOutputRealType m_RMSChangeAccumulator{};
171  bool m_UserGloballyDefinedTimeStep{};
172  IdentifierType m_NumberOfIterations{};
173 
175  typename LevelSetContainerType::Iterator m_LevelSetContainerIteratorToProcessWhenThreading{};
176  typename LevelSetContainerType::Iterator m_LevelSetUpdateContainerIteratorToProcessWhenThreading{};
177 };
178 } // namespace itk
179 
180 #ifndef ITK_MANUAL_INSTANTIATION
181 # include "itkLevelSetEvolutionBase.hxx"
182 #endif
183 
184 #endif // itkLevelSetEvolutionBase_h
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itkLevelSetEvolutionStoppingCriterion.h
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Index
Represent a n-dimensional index in a n-dimensional image.
Definition: itkIndex.h:70
itk::LevelSetBase< Index< VDimension >, VDimension, int8_t, ImageBase< VDimension > >::OutputRealType
typename NumericTraits< OutputType >::RealType OutputRealType
Definition: itkLevelSetBase.h:61
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::IdListIterator
typename LevelSetContainerType::IdListIterator IdListIterator
Definition: itkLevelSetEvolutionBase.h:83
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::IdListType
typename LevelSetContainerType::IdListType IdListType
Definition: itkLevelSetEvolutionBase.h:82
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::CacheImageType
typename LevelSetContainerType::CacheImageType CacheImageType
Definition: itkLevelSetEvolutionBase.h:86
itkDiscreteLevelSetImage.h
itkImage.h
itk::LevelSetEvolutionBase
Class for iterating and evolving the dense level-set function.
Definition: itkLevelSetEvolutionBase.h:43
itk::SmartPointer< Self >
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::TermContainerType
typename EquationContainerType::TermContainerType TermContainerType
Definition: itkLevelSetEvolutionBase.h:58
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkLevelSetEvolutionBase.h:65
itkImageRegionIteratorWithIndex.h
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::TermContainerPointer
typename TermContainerType::Pointer TermContainerPointer
Definition: itkLevelSetEvolutionBase.h:59
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkLevelSetEvolutionBase.h:67
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::IdListImageType
typename LevelSetContainerType::IdListImageType IdListImageType
Definition: itkLevelSetEvolutionBase.h:85
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::LevelSetInputType
typename LevelSetType::InputType LevelSetInputType
Definition: itkLevelSetEvolutionBase.h:77
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::DomainMapImageFilterType
typename LevelSetContainerType::DomainMapImageFilterType DomainMapImageFilterType
Definition: itkLevelSetEvolutionBase.h:88
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::LevelSetDataType
typename LevelSetType::LevelSetDataType LevelSetDataType
Definition: itkLevelSetEvolutionBase.h:80
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::TermType
typename TermContainerType::TermType TermType
Definition: itkLevelSetEvolutionBase.h:61
itkSignedMaurerDistanceMapImageFilter.h
itk::LevelSetContainer
Container of Level-Sets.
Definition: itkLevelSetContainer.h:39
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkLevelSetEvolutionBase.h:66
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:59
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::LevelSetOutputRealType
typename LevelSetType::OutputRealType LevelSetOutputRealType
Definition: itkLevelSetEvolutionBase.h:79
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::InputImageType
typename TermContainerType::InputImageType InputImageType
Definition: itkLevelSetEvolutionBase.h:64
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::IdListConstIterator
typename LevelSetContainerType::IdListConstIterator IdListConstIterator
Definition: itkLevelSetEvolutionBase.h:84
itk::ShiSparseLevelSetImage
Derived class for the shi representation of level-set function.
Definition: itkShiSparseLevelSetImage.h:37
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::LevelSetContainerType
typename TermContainerType::LevelSetContainerType LevelSetContainerType
Definition: itkLevelSetEvolutionBase.h:72
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::StoppingCriterionPointer
typename StoppingCriterionType::Pointer StoppingCriterionPointer
Definition: itkLevelSetEvolutionBase.h:91
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::LevelSetOutputType
typename LevelSetType::OutputType LevelSetOutputType
Definition: itkLevelSetEvolutionBase.h:78
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itkNumericTraits.h
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::InputPixelRealType
typename NumericTraits< InputImagePixelType >::RealType InputPixelRealType
Definition: itkLevelSetEvolutionBase.h:68
itkBinaryThresholdImageFilter.h
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::EquationContainerPointer
typename EquationContainerType::Pointer EquationContainerPointer
Definition: itkLevelSetEvolutionBase.h:57
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::EquationContainerType
TEquationContainer EquationContainerType
Definition: itkLevelSetEvolutionBase.h:56
itk::LevelSetBase< Index< VDimension >, VDimension, int8_t, ImageBase< VDimension > >::OutputType
int8_t OutputType
Definition: itkLevelSetBase.h:59
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::TermPointer
typename TermType::Pointer TermPointer
Definition: itkLevelSetEvolutionBase.h:62
itk::LevelSetEvolutionBase< TEquationContainer, ShiSparseLevelSetImage< VDimension > >::LevelSetIdentifierType
typename LevelSetContainerType::LevelSetIdentifierType LevelSetIdentifierType
Definition: itkLevelSetEvolutionBase.h:74
itk::LevelSetEvolutionStoppingCriterion
Definition: itkLevelSetEvolutionStoppingCriterion.h:33
itk::IdentifierType
SizeValueType IdentifierType
Definition: itkIntTypes.h:87