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 {}
143 ConstIterator & operator*() { return *this; }
144 ConstIterator * operator->() { return this; }
147 {
148 ++m_Iterator;
149 return *this;
150 }
153 {
154 ConstIterator tmp(*this);
155 ++(*this);
156 return tmp;
157 }
160 {
161 --m_Iterator;
162 return *this;
163 }
166 {
167 ConstIterator tmp(*this);
168 --(*this);
169 return tmp;
170 }
171 bool
172 operator==(const Iterator & it) const
173 {
174 return (m_Iterator == it.m_Iterator);
175 }
176
178
179 bool
180 operator==(const ConstIterator & it) const
181 {
182 return (m_Iterator == it.m_Iterator);
183 }
184
186
189 {
190 return m_Iterator->first;
191 }
192
195 {
196 return m_Iterator->second;
197 }
198
199 private:
201 friend class Iterator;
202 };
203
205 {
206 public:
207 Iterator() = default;
209 : m_Iterator(it)
210 {}
212 : m_Iterator(it.m_Iterator)
213 {}
214 ~Iterator() = default;
215
216 Iterator & operator*() { return *this; }
217 Iterator * operator->() { return this; }
218
219 Iterator &
221 {
222 ++m_Iterator;
223 return *this;
224 }
227 {
228 Iterator tmp(*this);
229 ++(*this);
230 return tmp;
231 }
232 Iterator &
234 {
235 --m_Iterator;
236 return *this;
237 }
240 {
241 Iterator tmp(*this);
242 --(*this);
243 return tmp;
244 }
245
246 bool
247 operator==(const Iterator & it) const
248 {
249 return (m_Iterator == it.m_Iterator);
250 }
251
253
254 bool
255 operator==(const ConstIterator & it) const
256 {
257 return (m_Iterator == it.m_Iterator);
258 }
259
261
264 {
265 return m_Iterator->first;
266 }
267
270 {
271 return m_Iterator->second;
272 }
273
274 private:
276 friend class ConstIterator;
277 };
278
283
285 Begin() const;
287 End() const;
288
289protected:
291 ~LevelSetEquationContainer() override = default;
292
293 LevelSetContainerPointer m_LevelSetContainer{};
294 MapContainerType m_Container{};
296};
297} // namespace itk
298
299#ifndef ITK_MANUAL_INSTANTIATION
300# include "itkLevelSetEquationContainer.hxx"
301#endif
302
303#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....