ITK  6.0.0
Insight Toolkit
itkNarrowBand.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#ifndef itkNarrowBand_h
19#define itkNarrowBand_h
20
21#include "itkLightObject.h"
22#include "itkObjectFactory.h"
23#include "itkNumericTraits.h"
24#include <vector>
25
26namespace itk
27{
34template <typename TIndexType, typename TDataType>
35class ITK_TEMPLATE_EXPORT BandNode
36{
37public:
38 TDataType m_Data;
39 TIndexType m_Index;
40 signed char m_NodeState{ 0 };
42 : m_Data(TDataType{})
43 {}
44};
45
50template <typename NodeType>
51class ITK_TEMPLATE_EXPORT NarrowBand : public LightObject
52{
53public:
54 ITK_DISALLOW_COPY_AND_MOVE(NarrowBand);
55
61
63 itkNewMacro(Self);
64
66 itkOverrideGetNameOfClassMacro(NarrowBand);
67
68 using NodeContainerType = std::vector<NodeType>;
69 using SizeType = typename NodeContainerType::size_type;
70 using ConstIterator = typename NodeContainerType::const_iterator;
71 using Iterator = typename NodeContainerType::iterator;
72
76 {
79 };
80
83#if !defined(ITK_WRAPPING_PARSER)
84 std::vector<RegionType>
86
87#endif
88
91 {
92 return m_NodeContainer.begin();
93 }
94
95 ConstIterator
96 Begin() const
97 {
98 return m_NodeContainer.begin();
99 }
100
101 Iterator
103 {
104 return m_NodeContainer.end();
105 }
106
107 ConstIterator
108 End() const
109 {
110 return m_NodeContainer.end();
111 }
112
114 Size() const
115 {
116 return m_NodeContainer.size();
117 }
118
119 bool
120 Empty() const
121 {
122 return m_NodeContainer.empty();
123 }
124
126 void
128 {
129 m_NodeContainer.clear();
130 }
131
132 void
134 {
135 m_NodeContainer.reserve(n);
136 }
137
138 void
139 PushBack(const NodeType & n)
140 {
141 m_NodeContainer.push_back(n);
142 }
143
144 void
146 {
147 m_NodeContainer.pop_back();
148 }
149
150 void
152 {
153 m_NodeContainer.resize(n);
154 }
155
156 NodeType & operator[](SizeType n) { return m_NodeContainer[n]; }
157
158 const NodeType & operator[](SizeType n) const { return m_NodeContainer[n]; }
159
163 void
164 SetTotalRadius(const float val)
165 {
166 m_TotalRadius = val;
167 }
168
169 float
171 {
172 return m_TotalRadius;
173 }
174
177 void
178 SetInnerRadius(const float val)
179 {
180 m_InnerRadius = val;
181 }
182
183 float
185 {
186 return m_InnerRadius;
187 }
188
189protected:
190 NarrowBand() = default;
191
192 float m_TotalRadius{ 0.0 };
193 float m_InnerRadius{ 0.0 };
194
195private:
196 NodeContainerType m_NodeContainer{};
197};
198} // end namespace itk
199
200#ifndef ITK_MANUAL_INSTANTIATION
201# include "itkNarrowBand.hxx"
202#endif
203
204#endif
TDataType m_Data
Definition: itkNarrowBand.h:38
TIndexType m_Index
Definition: itkNarrowBand.h:39
Light weight base class for most itk classes.
Narrow Band class.
Definition: itkNarrowBand.h:52
std::vector< NodeType > NodeContainerType
Definition: itkNarrowBand.h:68
const NodeType & operator[](SizeType n) const
void SetTotalRadius(const float val)
void SetInnerRadius(const float val)
Iterator Begin()
Definition: itkNarrowBand.h:90
SizeType Size() const
void PushBack(const NodeType &n)
float GetTotalRadius() const
typename NodeContainerType::const_iterator ConstIterator
Definition: itkNarrowBand.h:70
Iterator End()
float GetInnerRadius() const
std::vector< RegionType > SplitBand(const SizeType &)
NodeType & operator[](SizeType n)
void Reserve(SizeType n)
typename NodeContainerType::size_type SizeType
Definition: itkNarrowBand.h:69
ConstIterator End() const
void Resize(SizeType n)
ConstIterator Begin() const
Definition: itkNarrowBand.h:96
typename NodeContainerType::iterator Iterator
Definition: itkNarrowBand.h:71
NarrowBand()=default
bool Empty() const
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....