ITK  4.6.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 BandNode
36 {
37 public:
38  TDataType m_Data;
39  TIndexType m_Index;
40  signed char m_NodeState;
42  m_Data(NumericTraits<TDataType>::ZeroValue()), m_NodeState(0)
43  {}
44 };
45 
50 template< typename NodeType >
51 class NarrowBand:public LightObject
52 {
53 public:
55  typedef NarrowBand Self;
59 
61  itkNewMacro(Self);
62 
64  itkTypeMacro(NarrowBand, LightObject);
65 
66  typedef std::vector< NodeType > NodeContainerType;
67  typedef typename NodeContainerType::size_type SizeType;
68  typedef typename NodeContainerType::const_iterator ConstIterator;
69  typedef typename NodeContainerType::iterator Iterator;
70 
73  typedef struct RegionStruct {
76  } RegionType;
77 
80 #if !defined( CABLE_CONFIGURATION )
81  std::vector< RegionType > SplitBand(const SizeType&);
82 
83 #endif
84 
86  {
87  return m_NodeContainer.begin();
88  }
89 
91  {
92  return m_NodeContainer.begin();
93  }
94 
96  {
97  return m_NodeContainer.end();
98  }
99 
101  {
102  return m_NodeContainer.end();
103  }
104 
105  SizeType Size() const
106  {
107  return m_NodeContainer.size();
108  }
109 
110  bool Empty() const
111  {
112  return m_NodeContainer.empty();
113  }
114 
116  void Clear()
117  {
118  m_NodeContainer.clear();
119  }
120 
122  {
123  m_NodeContainer.reserve(n);
124  }
125 
126  void PushBack(const NodeType & n)
127  {
128  m_NodeContainer.push_back(n);
129  }
130 
131  void PopBack()
132  {
133  m_NodeContainer.pop_back();
134  }
135 
136  void Resize(SizeType n)
137  {
138  m_NodeContainer.resize(n);
139  }
140 
141  NodeType & operator[](SizeType n)
142  {
143  return m_NodeContainer[n];
144  }
145 
146  const NodeType & operator[](SizeType n) const
147  {
148  return m_NodeContainer[n];
149  }
150 
154  void SetTotalRadius(const float& val) { m_TotalRadius = val; }
155 
156  float GetTotalRadius() const { return m_TotalRadius; }
157 
160  void SetInnerRadius(const float& val) { m_InnerRadius = val; }
161 
162  float GetInnerRadius() const { return m_InnerRadius; }
163 
164 protected:
165  NarrowBand() : m_TotalRadius( 0.0 ), m_InnerRadius( 0.0 ) {}
166 
169 
170 private:
171  NarrowBand(const Self &); //purposely not implemented
172  void operator=(const Self &); //purposely not implemented
173 
175 };
176 } // end namespace itk
177 
178 #ifndef ITK_MANUAL_INSTANTIATION
179 #include "itkNarrowBand.hxx"
180 #endif
181 
182 #endif
float GetInnerRadius() const
Light weight base class for most itk classes.
NarrowBand Self
Definition: itkNarrowBand.h:55
void Resize(SizeType n)
void SetInnerRadius(const float &val)
void Reserve(SizeType n)
std::vector< RegionType > SplitBand(const SizeType &)
Iterator End()
Definition: itkNarrowBand.h:95
Iterator Begin()
Definition: itkNarrowBand.h:85
NodeContainerType m_NodeContainer
const NodeType & operator[](SizeType n) const
TDataType m_Data
Definition: itkNarrowBand.h:38
NodeContainerType::size_type SizeType
Definition: itkNarrowBand.h:67
std::vector< NodeType > NodeContainerType
Definition: itkNarrowBand.h:64
ConstIterator End() const
void SetTotalRadius(const float &val)
float GetTotalRadius() const
void PushBack(const NodeType &n)
NodeContainerType::iterator Iterator
Definition: itkNarrowBand.h:69
signed char m_NodeState
Definition: itkNarrowBand.h:40
NodeType & operator[](SizeType n)
void operator=(const Self &)
SizeType Size() const
NodeContainerType::const_iterator ConstIterator
Definition: itkNarrowBand.h:68
bool Empty() const
Narrow Band class.
Definition: itkNarrowBand.h:51
TIndexType m_Index
Definition: itkNarrowBand.h:39
SmartPointer< Self > Pointer
Definition: itkNarrowBand.h:57
Define additional traits for native types such as int or float.
SmartPointer< const Self > ConstPointer
Definition: itkNarrowBand.h:58
LightObject Superclass
Definition: itkNarrowBand.h:56
struct itk::NarrowBand::RegionStruct RegionType
ConstIterator Begin() const
Definition: itkNarrowBand.h:90