ITK  4.4.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< class TEquationContainer, class TLevelSet >
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();
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 
155 
157  typename LevelSetContainerType::Pointer m_LevelSetContainer;
158 
164 
166  typename LevelSetContainerType::Iterator m_LevelSetContainerIteratorToProcessWhenThreading;
167  typename LevelSetContainerType::Iterator m_LevelSetUpdateContainerIteratorToProcessWhenThreading;
168 
169 private:
170  LevelSetEvolutionBase( const Self& ); // purposely not implemented
171  void operator = ( const Self& ); // purposely not implemented
172 };
173 }
174 
175 #ifndef ITK_MANUAL_INSTANTIATION
176 #include "itkLevelSetEvolutionBase.hxx"
177 #endif
178 
179 #endif // __itkLevelSetEvolutionBase_h
180