ITK  6.0.0
Insight Toolkit
itkLevelSetEquationContainer.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#ifndef itkLevelSetEquationContainer_h
20#define itkLevelSetEquationContainer_h
21
22#include "itkObject.h"
23#include "itkObjectFactory.h"
24
25namespace itk
26{
57template <typename TTermContainer>
58class ITK_TEMPLATE_EXPORT LevelSetEquationContainer : public Object
59{
60public:
61 ITK_DISALLOW_COPY_AND_MOVE(LevelSetEquationContainer);
68
70 itkNewMacro(Self);
71
73 itkOverrideGetNameOfClassMacro(LevelSetEquationContainer);
74
75 using TermContainerType = TTermContainer;
77
78 using InputImageType = typename TermContainerType::InputImageType;
79 using InputImagePointer = typename TermContainerType::InputImagePointer;
80
81 using LevelSetOutputRealType = typename TermContainerType::LevelSetOutputRealType;
82 using LevelSetInputIndexType = typename TermContainerType::LevelSetInputIndexType;
83
84 using LevelSetIdentifierType = typename TermContainerType::LevelSetIdentifierType;
85 using LevelSetContainerType = typename TermContainerType::LevelSetContainerType;
86 using LevelSetContainerPointer = typename TermContainerType::LevelSetContainerPointer;
87
89 void
91
95
97 void
99
101 void
103 const LevelSetOutputRealType & oldValue,
104 const LevelSetOutputRealType & newValue);
105
107 void
109
114
116 itkSetObjectMacro(Input, InputImageType);
117 itkGetModifiableObjectMacro(Input, InputImageType);
121 itkGetModifiableObjectMacro(LevelSetContainer, LevelSetContainerType);
122
123protected:
124 using MapContainerType = std::map<LevelSetIdentifierType, TermContainerPointer>;
125 using MapContainerIterator = typename MapContainerType::iterator;
126 using MapContainerConstIterator = typename MapContainerType::const_iterator;
127
128public:
129 class Iterator;
130 friend class Iterator;
131
133 {
134 public:
135 ConstIterator() = default;
137 : m_Iterator(it)
138 {}
139 ~ConstIterator() = default;
141 : m_Iterator(it.m_Iterator)
142 {}
145 {
146 return *this;
147 }
150 {
151 return this;
152 }
155 {
156 ++m_Iterator;
157 return *this;
158 }
161 {
162 ConstIterator tmp(*this);
163 ++(*this);
164 return tmp;
165 }
168 {
169 --m_Iterator;
170 return *this;
171 }
174 {
175 ConstIterator tmp(*this);
176 --(*this);
177 return tmp;
178 }
179 bool
180 operator==(const Iterator & it) const
181 {
182 return (m_Iterator == it.m_Iterator);
183 }
184
186
187 bool
188 operator==(const ConstIterator & it) const
189 {
190 return (m_Iterator == it.m_Iterator);
191 }
192
194
197 {
198 return m_Iterator->first;
199 }
200
203 {
204 return m_Iterator->second;
205 }
206
207 private:
209 friend class Iterator;
210 };
211
213 {
214 public:
215 Iterator() = default;
217 : m_Iterator(it)
218 {}
220 : m_Iterator(it.m_Iterator)
221 {}
222 ~Iterator() = default;
223
224 Iterator &
226 {
227 return *this;
228 }
229 Iterator *
231 {
232 return this;
233 }
234
235 Iterator &
237 {
238 ++m_Iterator;
239 return *this;
240 }
243 {
244 Iterator tmp(*this);
245 ++(*this);
246 return tmp;
247 }
248 Iterator &
250 {
251 --m_Iterator;
252 return *this;
253 }
256 {
257 Iterator tmp(*this);
258 --(*this);
259 return tmp;
260 }
261
262 bool
263 operator==(const Iterator & it) const
264 {
265 return (m_Iterator == it.m_Iterator);
266 }
267
269
270 bool
271 operator==(const ConstIterator & it) const
272 {
273 return (m_Iterator == it.m_Iterator);
274 }
275
277
280 {
281 return m_Iterator->first;
282 }
283
286 {
287 return m_Iterator->second;
288 }
289
290 private:
292 friend class ConstIterator;
293 };
294
299
301 Begin() const;
303 End() const;
304
305protected:
307 ~LevelSetEquationContainer() override = default;
308
309 LevelSetContainerPointer m_LevelSetContainer{};
310 MapContainerType m_Container{};
312};
313} // namespace itk
314
315#ifndef ITK_MANUAL_INSTANTIATION
316# include "itkLevelSetEquationContainer.hxx"
317#endif
318
319#endif // itkLevelSetEquationContainer_h
Container of Level-Sets.
bool operator==(const ConstIterator &it) const
Class for holding a set of level set equations (PDEs).
typename MapContainerType::iterator MapContainerIterator
typename TermContainerType::LevelSetContainerType LevelSetContainerType
typename TermContainerType::Pointer TermContainerPointer
typename TermContainerType::LevelSetContainerPointer LevelSetContainerPointer
void UpdatePixel(const LevelSetInputIndexType &iP, const LevelSetOutputRealType &oldValue, const LevelSetOutputRealType &newValue)
ConstIterator Begin() const
typename TermContainerType::InputImageType InputImageType
typename TermContainerType::LevelSetIdentifierType LevelSetIdentifierType
std::map< LevelSetIdentifierType, TermContainerPointer > MapContainerType
typename MapContainerType::const_iterator MapContainerConstIterator
ConstIterator End() const
typename TermContainerType::LevelSetInputIndexType LevelSetInputIndexType
void AddEquation(const LevelSetIdentifierType &iId, TermContainerType *iEquation)
~LevelSetEquationContainer() override=default
typename TermContainerType::InputImagePointer InputImagePointer
TermContainerType * GetEquation(const LevelSetIdentifierType &iId) const
typename TermContainerType::LevelSetOutputRealType LevelSetOutputRealType
LevelSetOutputRealType ComputeCFLContribution() const
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....