ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkLevelSetContainerBase.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 itkLevelSetContainerBase_h
20#define itkLevelSetContainerBase_h
21
22#include <map>
23#include "itkObject.h"
24#include "itkObjectFactory.h"
27
28
29namespace itk
30{
41template <typename TIdentifier, typename TLevelSet>
42class ITK_TEMPLATE_EXPORT LevelSetContainerBase : public Object
43{
44public:
45 ITK_DISALLOW_COPY_AND_MOVE(LevelSetContainerBase);
46
51
53 itkOverrideGetNameOfClassMacro(LevelSetContainerBase);
56 using LevelSetType = TLevelSet;
57 using LevelSetPointer = typename LevelSetType::Pointer;
58 using InputIndexType = typename LevelSetType::InputType;
59 using OutputType = typename LevelSetType::OutputType;
60 using OutputRealType = typename LevelSetType::OutputRealType;
61 using GradientType = typename LevelSetType::GradientType;
62 using HessianType = typename LevelSetType::HessianType;
63 using LevelSetDataType = typename LevelSetType::LevelSetDataType;
66 using LevelSetIdentifierType = TIdentifier;
67
68 using LevelSetContainerType = std::map<LevelSetIdentifierType, LevelSetPointer>;
69 using LevelSetContainerConstIteratorType = typename LevelSetContainerType::const_iterator;
70 using LevelSetContainerIteratorType = typename LevelSetContainerType::iterator;
71
75 static constexpr unsigned int Dimension = LevelSetType::Dimension;
77 using IdListType = std::list<LevelSetIdentifierType>;
78 using IdListIterator = typename IdListType::iterator;
79 using IdListConstIterator = typename IdListType::const_iterator;
82
84
85 using LevelSetPairType = std::pair<LevelSetIdentifierType, LevelSetPointer>;
86
88 using LevelSetDomainType = typename DomainMapImageFilterType::LevelSetDomain;
89
90 using DomainContainerType = std::map<LevelSetIdentifierType, LevelSetDomainType>;
91 using DomainIteratorType = typename DomainContainerType::iterator;
92
94 class Iterator;
95 friend class Iterator;
96
102 {
103 public:
104 ConstIterator() = default;
108 ~ConstIterator() = default;
111 {}
112
113
116 {
117 return *this;
118 }
121 {
122 return this;
123 }
126 {
127 ++m_Iterator;
128 return *this;
129 }
132 {
133 ConstIterator tmp(*this);
134 ++(*this);
135 return tmp;
136 }
139 {
140 --m_Iterator;
141 return *this;
142 }
145 {
146 ConstIterator tmp(*this);
147 --(*this);
148 return tmp;
149 }
150 bool
151 operator==(const Iterator & it) const
152 {
153 return (m_Iterator == it.m_Iterator);
154 }
155
157
158 bool
159 operator==(const ConstIterator & it) const
160 {
161 return (m_Iterator == it.m_Iterator);
162 }
163
165
168 {
169 return m_Iterator->first;
170 }
171
174 {
175 return m_Iterator->second;
176 }
177
178 private:
180 friend class Iterator;
181 };
182
187 {
188 public:
189 Iterator() = default;
195 {}
196 ~Iterator() = default;
198
199 Iterator &
201 {
202 return *this;
203 }
204 Iterator *
206 {
207 return this;
208 }
209 Iterator &
211 {
212 ++m_Iterator;
213 return *this;
214 }
217 {
218 Iterator tmp(*this);
219 ++(*this);
220 return tmp;
221 }
222 Iterator &
224 {
225 --m_Iterator;
226 return *this;
227 }
230 {
231 Iterator tmp(*this);
232 --(*this);
233 return tmp;
234 }
235 bool
236 operator==(const Iterator & it) const
237 {
238 return (m_Iterator == it.m_Iterator);
239 }
240
242
243 bool
244 operator==(const ConstIterator & it) const
245 {
246 return (m_Iterator == it.m_Iterator);
247 }
248
250
253 {
254 return m_Iterator->first;
255 }
256
259 {
260 return m_Iterator->second;
261 }
262
263 private:
265 friend class ConstIterator;
266 };
267
270 Iterator
272
273 ConstIterator
274 Begin() const;
275 ConstIterator
276 End() const;
277
280 Size() const;
281
288
298 bool
299 AddLevelSet(const LevelSetIdentifierType & iId, LevelSetType * iLevelSet, const bool iForce = true);
300
306 bool
308
310 itkSetConstObjectMacro(Heaviside, HeavisideType);
311 itkGetConstObjectMacro(Heaviside, HeavisideType);
313
315 itkSetObjectMacro(DomainMapFilter, DomainMapImageFilterType);
316 itkGetModifiableObjectMacro(DomainMapFilter, DomainMapImageFilterType);
318
320 bool
322
323protected:
326
328 ~LevelSetContainerBase() override = default;
329
332 void
334
335private:
339};
340} // namespace itk
341
342#ifndef ITK_MANUAL_INSTANTIATION
343# include "itkLevelSetContainerBase.hxx"
344#endif
345
346#endif // itkLevelSetContainerBase_h
Base class of the Heaviside function.
Templated n-dimensional image class.
Definition itkImage.h:89
ConstIterator(const LevelSetContainerConstIteratorType &it)
bool operator==(const ConstIterator &it) const
LevelSetContainerConstIteratorType m_Iterator
bool operator==(const Iterator &it) const
Iterator(const LevelSetContainerIteratorType &it)
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(ConstIterator)
bool operator==(const ConstIterator &it) const
LevelSetIdentifierType GetIdentifier() const
LevelSetPointer GetLevelSet(const LevelSetIdentifierType &iId) const
Get the level set function given its id.
typename DomainMapImageFilterType::LevelSetDomain LevelSetDomainType
void SetContainer(const LevelSetContainerType &iContainer)
LevelSetContainerBase()=default
Default Constructor.
typename LevelSetContainerType::const_iterator LevelSetContainerConstIteratorType
HeavisideStepFunctionBase< OutputRealType, OutputRealType > HeavisideType
std::map< LevelSetIdentifierType, LevelSetPointer > LevelSetContainerType
LevelSetIdentifierType Size() const
bool AddLevelSet(const LevelSetIdentifierType &iId, LevelSetType *iLevelSet, const bool iForce=true)
Add one level set function given its id.
bool RemoveLevelSet(const LevelSetIdentifierType &iId)
Remove one level set function given its id.
std::map< LevelSetIdentifierType, LevelSetDomainType > DomainContainerType
const LevelSetContainerType & GetContainer() const
std::pair< LevelSetIdentifierType, LevelSetPointer > LevelSetPairType
typename DomainMapImageFilterType::Pointer DomainMapImageFilterPointer
typename LevelSetContainerType::iterator LevelSetContainerIteratorType
LevelSetDomainMapImageFilter< IdListImageType, CacheImageType > DomainMapImageFilterType
ConstIterator Begin() const
~LevelSetContainerBase() override=default
Default Destructor.
ConstIterator End() const
typename LevelSetContainerType::const_iterator LevelSetContainerConstIteratorType
std::map< LevelSetIdentifierType, LevelSetPointer > LevelSetContainerType
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....