ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkNarrowBand.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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(NumericTraits<TDataType>::ZeroValue())
43  {}
44 };
45 
50 template< typename NodeType >
51 class ITK_TEMPLATE_EXPORT NarrowBand:public LightObject
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_ASSIGN(NarrowBand);
55 
57  using Self = NarrowBand;
61 
63  itkNewMacro(Self);
64 
66  itkTypeMacro(NarrowBand, LightObject);
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  typedef struct RegionStruct {
78  } RegionType;
79 
82 #if !defined( ITK_WRAPPING_PARSER )
83  std::vector< RegionType > SplitBand(const SizeType&);
84 
85 #endif
86 
88  {
89  return m_NodeContainer.begin();
90  }
91 
93  {
94  return m_NodeContainer.begin();
95  }
96 
98  {
99  return m_NodeContainer.end();
100  }
101 
103  {
104  return m_NodeContainer.end();
105  }
106 
107  SizeType Size() const
108  {
109  return m_NodeContainer.size();
110  }
111 
112  bool Empty() const
113  {
114  return m_NodeContainer.empty();
115  }
116 
118  void Clear()
119  {
120  m_NodeContainer.clear();
121  }
122 
124  {
125  m_NodeContainer.reserve(n);
126  }
127 
128  void PushBack(const NodeType & n)
129  {
130  m_NodeContainer.push_back(n);
131  }
132 
133  void PopBack()
134  {
135  m_NodeContainer.pop_back();
136  }
137 
138  void Resize(SizeType n)
139  {
140  m_NodeContainer.resize(n);
141  }
142 
143  NodeType & operator[](SizeType n)
144  {
145  return m_NodeContainer[n];
146  }
147 
148  const NodeType & operator[](SizeType n) const
149  {
150  return m_NodeContainer[n];
151  }
152 
156  void SetTotalRadius(const float& val) { m_TotalRadius = val; }
157 
158  float GetTotalRadius() const { return m_TotalRadius; }
159 
162  void SetInnerRadius(const float& val) { m_InnerRadius = val; }
163 
164  float GetInnerRadius() const { return m_InnerRadius; }
165 
166 protected:
168 
169  float m_TotalRadius{ 0.0 };
170  float m_InnerRadius{ 0.0 };
171 
172 private:
174 };
175 } // end namespace itk
176 
177 #ifndef ITK_MANUAL_INSTANTIATION
178 #include "itkNarrowBand.hxx"
179 #endif
180 
181 #endif
float GetInnerRadius() const
Light weight base class for most itk classes.
void Resize(SizeType n)
void SetInnerRadius(const float &val)
void Reserve(SizeType n)
Define numeric traits for std::vector.
Iterator End()
Definition: itkNarrowBand.h:97
Iterator Begin()
Definition: itkNarrowBand.h:87
typename NodeContainerType::size_type SizeType
Definition: itkNarrowBand.h:69
NodeContainerType m_NodeContainer
const NodeType & operator[](SizeType n) const
TDataType m_Data
Definition: itkNarrowBand.h:38
typename NodeContainerType::const_iterator ConstIterator
Definition: itkNarrowBand.h:70
std::vector< NodeType > NodeContainerType
Definition: itkNarrowBand.h:68
ConstIterator End() const
void SetTotalRadius(const float &val)
float GetTotalRadius() const
void PushBack(const NodeType &n)
NodeType & operator[](SizeType n)
SizeType Size() const
bool Empty() const
Narrow Band class.
Definition: itkNarrowBand.h:51
TIndexType m_Index
Definition: itkNarrowBand.h:39
typename NodeContainerType::iterator Iterator
Definition: itkNarrowBand.h:71
ConstIterator Begin() const
Definition: itkNarrowBand.h:92