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 
26 namespace itk
27 {
34 template <typename TIndexType, typename TDataType>
35 class ITK_TEMPLATE_EXPORT BandNode
36 {
37 public:
38  TDataType m_Data;
39  TIndexType m_Index;
40  signed char m_NodeState{ 0 };
42  : m_Data(TDataType{})
43  {}
44 };
45 
50 template <typename NodeType>
51 class ITK_TEMPLATE_EXPORT NarrowBand : public LightObject
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_MOVE(NarrowBand);
55 
57  using Self = NarrowBand;
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 
75  struct RegionType
76  {
79  };
80 
83 #if !defined(ITK_WRAPPING_PARSER)
84  std::vector<RegionType>
85  SplitBand(const SizeType &);
86 
87 #endif
88 
89  Iterator
91  {
92  return m_NodeContainer.begin();
93  }
94 
95  ConstIterator
96  Begin() const
97  {
98  return m_NodeContainer.begin();
99  }
100 
101  Iterator
102  End()
103  {
104  return m_NodeContainer.end();
105  }
106 
107  ConstIterator
108  End() const
109  {
110  return m_NodeContainer.end();
111  }
112 
113  SizeType
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 
189 protected:
190  NarrowBand() = default;
191 
192  float m_TotalRadius{ 0.0 };
193  float m_InnerRadius{ 0.0 };
194 
195 private:
196  NodeContainerType m_NodeContainer{};
197 };
198 } // end namespace itk
199 
200 #ifndef ITK_MANUAL_INSTANTIATION
201 # include "itkNarrowBand.hxx"
202 #endif
203 
204 #endif
itk::NarrowBand::GetInnerRadius
float GetInnerRadius() const
Definition: itkNarrowBand.h:184
itk::NarrowBand::Clear
void Clear()
Definition: itkNarrowBand.h:127
itkObjectFactory.h
itk::NarrowBand::NodeContainerType
std::vector< NodeType > NodeContainerType
Definition: itkNarrowBand.h:68
itk::NarrowBand::operator[]
NodeType & operator[](SizeType n)
Definition: itkNarrowBand.h:156
itk::NarrowBand::Begin
ConstIterator Begin() const
Definition: itkNarrowBand.h:96
itk::NarrowBand::Reserve
void Reserve(SizeType n)
Definition: itkNarrowBand.h:133
itk::NarrowBand::End
Iterator End()
Definition: itkNarrowBand.h:102
itk::BandNode::m_Index
TIndexType m_Index
Definition: itkNarrowBand.h:39
itk::NarrowBand
Narrow Band class.
Definition: itkNarrowBand.h:51
itk::NarrowBand::PushBack
void PushBack(const NodeType &n)
Definition: itkNarrowBand.h:139
itk::NarrowBand::operator[]
const NodeType & operator[](SizeType n) const
Definition: itkNarrowBand.h:158
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::NarrowBand::Empty
bool Empty() const
Definition: itkNarrowBand.h:120
itk::SmartPointer< Self >
itk::NarrowBand::ConstIterator
typename NodeContainerType::const_iterator ConstIterator
Definition: itkNarrowBand.h:70
itk::NarrowBand::SetTotalRadius
void SetTotalRadius(const float val)
Definition: itkNarrowBand.h:164
itk::BandNode::BandNode
BandNode()
Definition: itkNarrowBand.h:41
itk::NarrowBand::Resize
void Resize(SizeType n)
Definition: itkNarrowBand.h:151
itk::NarrowBand::GetTotalRadius
float GetTotalRadius() const
Definition: itkNarrowBand.h:170
itk::NarrowBand::RegionType
Definition: itkNarrowBand.h:75
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::NarrowBand::SizeType
typename NodeContainerType::size_type SizeType
Definition: itkNarrowBand.h:69
itk::NarrowBand::RegionType::Begin
Iterator Begin
Definition: itkNarrowBand.h:77
itk::NarrowBand::Begin
Iterator Begin()
Definition: itkNarrowBand.h:90
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::NarrowBand::Size
SizeType Size() const
Definition: itkNarrowBand.h:114
itk::NarrowBand::SetInnerRadius
void SetInnerRadius(const float val)
Definition: itkNarrowBand.h:178
itk::BandNode::m_Data
TDataType m_Data
Definition: itkNarrowBand.h:38
itkNumericTraits.h
itk::NarrowBand::End
ConstIterator End() const
Definition: itkNarrowBand.h:108
itk::NarrowBand::RegionType::End
Iterator End
Definition: itkNarrowBand.h:78
itk::NarrowBand::PopBack
void PopBack()
Definition: itkNarrowBand.h:145
itk::BandNode
Definition: itkNarrowBand.h:35
itk::NarrowBand::Iterator
typename NodeContainerType::iterator Iterator
Definition: itkNarrowBand.h:71
itkLightObject.h