ITK  4.4.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 <vector>
24 
25 namespace itk
26 {
33 template< class TIndexType, class TDataType >
34 class BandNode
35 {
36 public:
37  TDataType m_Data;
38  TIndexType m_Index;
39  signed char m_NodeState;
40  BandNode() : m_NodeState( 0 ) {}
41 };
42 
47 template< class NodeType >
48 class ITK_EXPORT NarrowBand:public LightObject
49 {
50 public:
52  typedef NarrowBand Self;
56 
58  itkNewMacro(Self);
59 
61  itkTypeMacro(NarrowBand, LightObject);
62 
63  typedef std::vector< NodeType > NodeContainerType;
64  typedef typename NodeContainerType::size_type SizeType;
65  typedef typename NodeContainerType::const_iterator ConstIterator;
66  typedef typename NodeContainerType::iterator Iterator;
67 
70  typedef struct RegionStruct {
73  } RegionType;
74 
77 #if !defined( CABLE_CONFIGURATION )
78  std::vector< RegionType > SplitBand(const SizeType&);
79 
80 #endif
81 
82  Iterator Begin()
83  {
84  return m_NodeContainer.begin();
85  }
86 
87  ConstIterator Begin() const
88  {
89  return m_NodeContainer.begin();
90  }
91 
92  Iterator End()
93  {
94  return m_NodeContainer.end();
95  }
96 
97  ConstIterator End() const
98  {
99  return m_NodeContainer.end();
100  }
101 
102  SizeType Size() const
103  {
104  return m_NodeContainer.size();
105  }
106 
107  bool Empty() const
108  {
109  return m_NodeContainer.empty();
110  }
111 
113  void Clear()
114  {
115  m_NodeContainer.clear();
116  }
117 
118  void Reserve(SizeType n)
119  {
120  m_NodeContainer.reserve(n);
121  }
122 
123  void PushBack(const NodeType & n)
124  {
125  m_NodeContainer.push_back(n);
126  }
127 
128  void PopBack()
129  {
130  m_NodeContainer.pop_back();
131  }
132 
133  void Resize(SizeType n)
134  {
135  m_NodeContainer.resize(n);
136  }
137 
138  NodeType & operator[](SizeType n)
139  {
140  return m_NodeContainer[n];
141  }
142 
143  const NodeType & operator[](SizeType n) const
144  {
145  return m_NodeContainer[n];
146  }
147 
151  void SetTotalRadius(const float& val) { m_TotalRadius = val; }
152 
153  float GetTotalRadius() const { return m_TotalRadius; }
154 
157  void SetInnerRadius(const float& val) { m_InnerRadius = val; }
158 
159  float GetInnerRadius() const { return m_InnerRadius; }
160 
161 protected:
162  NarrowBand() : m_TotalRadius( 0.0 ), m_InnerRadius( 0.0 ) {}
163 
166 
167 private:
168  NarrowBand(const Self &); //purposely not implemented
169  void operator=(const Self &); //purposely not implemented
170 
172 };
173 } // end namespace itk
174 
175 #ifndef ITK_MANUAL_INSTANTIATION
176 #include "itkNarrowBand.hxx"
177 #endif
178 
179 #endif
180