ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkLevelSetEvolutionBase.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 
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:
49  typedef Object Superclass;
50 
52  itkTypeMacro( LevelSetEvolutionBase, Object );
53 
54  typedef TEquationContainer EquationContainerType;
55  typedef typename EquationContainerType::Pointer EquationContainerPointer;
56  typedef typename EquationContainerType::TermContainerType
58  typedef typename TermContainerType::Pointer TermContainerPointer;
59 
60  typedef typename TermContainerType::TermType TermType;
61  typedef typename TermType::Pointer TermPointer;
62 
63  typedef typename TermContainerType::InputImageType InputImageType;
64  typedef typename InputImageType::PixelType InputImagePixelType;
65  typedef typename InputImageType::ConstPointer InputImageConstPointer;
66  typedef typename InputImageType::RegionType InputImageRegionType;
69 
70  itkStaticConstMacro ( ImageDimension, unsigned int, InputImageType::ImageDimension );
71 
72  typedef typename TermContainerType::LevelSetContainerType LevelSetContainerType;
73 
74  typedef typename LevelSetContainerType::LevelSetIdentifierType LevelSetIdentifierType;
75 
76  typedef TLevelSet LevelSetType;
81 
82  typedef typename LevelSetContainerType::IdListType IdListType;
83  typedef typename LevelSetContainerType::IdListIterator IdListIterator;
84  typedef typename LevelSetContainerType::IdListConstIterator IdListConstIterator;
85  typedef typename LevelSetContainerType::IdListImageType IdListImageType;
86  typedef typename LevelSetContainerType::CacheImageType CacheImageType;
87 
88  typedef typename LevelSetContainerType::DomainMapImageFilterType DomainMapImageFilterType;
89 
93 
94  itkSetObjectMacro( LevelSetContainer, LevelSetContainerType );
95  itkGetModifiableObjectMacro(LevelSetContainer, LevelSetContainerType );
96 
98  itkSetMacro( Alpha, LevelSetOutputRealType );
99  itkGetMacro( Alpha, LevelSetOutputRealType );
101 
103  void SetTimeStep( const LevelSetOutputRealType& iDt );
104 
106  itkSetObjectMacro( EquationContainer, EquationContainerType );
107  itkGetModifiableObjectMacro( EquationContainer, EquationContainerType );
109 
111  itkSetObjectMacro( StoppingCriterion, StoppingCriterionType );
112  itkGetModifiableObjectMacro( StoppingCriterion, StoppingCriterionType );
114 
116  itkGetConstMacro( NumberOfIterations, IdentifierType );
117 
121  void Update();
122 
123 protected:
125 
126  virtual ~LevelSetEvolutionBase() ITK_OVERRIDE;
127 
128  void CheckSetUp();
129 
131  void InitializeIteration();
132 
137  void Evolve();
138 
141  virtual void AllocateUpdateBuffer();
142 
145  virtual void ComputeIteration();
146 
148  virtual void ComputeTimeStepForNextIteration();
149 
150  virtual void UpdateLevelSets() = 0;
151 
152  virtual void UpdateEquations() = 0;
153 
154  StoppingCriterionPointer m_StoppingCriterion;
155 
156  EquationContainerPointer m_EquationContainer;
157  typename LevelSetContainerType::Pointer m_LevelSetContainer;
158 
161  LevelSetOutputRealType m_RMSChangeAccumulator;
162  bool m_UserGloballyDefinedTimeStep;
163  IdentifierType m_NumberOfIterations;
164 
166  typename LevelSetContainerType::Iterator m_LevelSetContainerIteratorToProcessWhenThreading;
167  typename LevelSetContainerType::Iterator m_LevelSetUpdateContainerIteratorToProcessWhenThreading;
168 
169 private:
170  ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetEvolutionBase);
171 };
172 }
173 
174 #ifndef ITK_MANUAL_INSTANTIATION
175 #include "itkLevelSetEvolutionBase.hxx"
176 #endif
177 
178 #endif // itkLevelSetEvolutionBase_h
EquationContainerType::TermContainerType TermContainerType
LevelSetType::OutputRealType LevelSetOutputRealType
LevelSetContainerType::LevelSetIdentifierType LevelSetIdentifierType
InputImageType::RegionType InputImageRegionType
TermContainerType::LevelSetContainerType LevelSetContainerType
LevelSetContainerType::DomainMapImageFilterType DomainMapImageFilterType
LevelSetType::InputType LevelSetInputType
InputImageType::PixelType InputImagePixelType
LevelSetType::LevelSetDataType LevelSetDataType
LevelSetContainerType::IdListIterator IdListIterator
TermContainerType::Pointer TermContainerPointer
StoppingCriterionType::Pointer StoppingCriterionPointer
TermContainerType::TermType TermType
InputImageType::ConstPointer InputImageConstPointer
LevelSetContainerType::IdListImageType IdListImageType
NumericTraits< InputImagePixelType >::RealType InputPixelRealType
Superclass::OutputRealType OutputRealType
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
LevelSetType::OutputType LevelSetOutputType
LevelSetContainerType::CacheImageType CacheImageType
EquationContainerType::Pointer EquationContainerPointer
SmartPointer< const Self > ConstPointer
Container of Level-Sets.
LevelSetContainerType::IdListType IdListType
LevelSetEvolutionStoppingCriterion< LevelSetContainerType > StoppingCriterionType
TEquationContainer EquationContainerType
Define additional traits for native types such as int or float.
Base class for most ITK classes.
Definition: itkObject.h:59
TermContainerType::InputImageType InputImageType
Superclass::LevelSetDataType LevelSetDataType
Class for iterating and evolving the dense level-set function.
LevelSetContainerType::IdListConstIterator IdListConstIterator