iRoCS Toolbox  1.1.0
Neighborhood.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2015 Thorsten Falk
4  *
5  * Image Analysis Lab, University of Freiburg, Germany
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  **************************************************************************/
22 
23 /*======================================================================*/
28 /*======================================================================*/
29 
30 #ifndef ATBNEIGHBORHOOD_HH
31 #define ATBNEIGHBORHOOD_HH
32 
33 #ifdef HAVE_CONFIG_H
34 #include <config.hh>
35 #endif
36 
38 
39 #include <blitz/array.h>
40 #include <set>
41 #include <vector>
42 
43 namespace atb
44 {
45 
46 /*======================================================================*/
55 /*======================================================================*/
56  template<typename DataT, int Dim>
58  {
59 
60 /*======================================================================*/
70 /*======================================================================*/
71  bool operator()(
72  blitz::TinyVector<DataT,Dim> const &v1,
73  blitz::TinyVector<DataT,Dim> const &v2) const;
74 
75  };
76 
77 /*======================================================================*/
90 /*======================================================================*/
91  template<int Dim>
93  {
94 
95  public:
96 
97 /*======================================================================*/
114 /*======================================================================*/
115  enum Type { Simple, Complex, User };
116 
117  typedef std::set<
118  blitz::TinyVector<BlitzIndexT,Dim>, TinyVectorLessThan<BlitzIndexT,Dim> >
120 
121  typedef typename NeighborSet::const_iterator const_iterator;
122 
123 
124 /*======================================================================*/
131 /*======================================================================*/
132  Neighborhood(Type nhoodType = Simple);
133 
134 /*======================================================================*/
142 /*======================================================================*/
143  Neighborhood(NeighborSet const &neighbors);
144 
145 /*======================================================================*/
154 /*======================================================================*/
155  Neighborhood(
156  std::vector< blitz::TinyVector<BlitzIndexT,Dim> > const &neighbors);
157 
158 /*======================================================================*/
164 /*======================================================================*/
165  Neighborhood(Neighborhood<Dim> const &nhood);
166 
167 /*======================================================================*/
171 /*======================================================================*/
172  ~Neighborhood();
173 
174 /*======================================================================*/
183 /*======================================================================*/
184  Neighborhood<Dim> &operator=(Neighborhood<Dim> const &nhood);
185 
186 /*======================================================================*/
195 /*======================================================================*/
196  Type type() const;
197 
198 /*======================================================================*/
204 /*======================================================================*/
205  size_t size() const;
206 
207 /*======================================================================*/
213 /*======================================================================*/
214  NeighborSet const &neighbors() const;
215 
216 /*======================================================================*/
220 /*======================================================================*/
221  void clear();
222 
223 /*======================================================================*/
230 /*======================================================================*/
231  void insert(blitz::TinyVector<BlitzIndexT,Dim> const &neighbor);
232 
233 /*======================================================================*/
240 /*======================================================================*/
241  void erase(blitz::TinyVector<BlitzIndexT,Dim> const &neighbor);
242 
243 /*======================================================================*/
249 /*======================================================================*/
250  void setNeighbors(NeighborSet const &nhood);
251 
252 /*======================================================================*/
259 /*======================================================================*/
260  void setNeighbors(
261  std::vector< blitz::TinyVector<BlitzIndexT,Dim> > const &nhood);
262 
263 /*======================================================================*/
270 /*======================================================================*/
271  const_iterator begin() const;
272 
273 /*======================================================================*/
280 /*======================================================================*/
281  const_iterator end() const;
282 
283  private:
284 
285  Type _type;
286  NeighborSet _neighbors;
287 
288  };
289 
290 }
291 
292 #include "Neighborhood.icc"
293 
294 #endif
NeighborSet::const_iterator const_iterator
The TinyVectorLessThan struct provides an operator for comparing TinyVectors defining a strict weak o...
Definition: Neighborhood.hh:57
The Neighborhood class specifies local pixel/voxel neighborhoods.
Definition: Neighborhood.hh:92
bool operator()(blitz::TinyVector< DataT, Dim > const &v1, blitz::TinyVector< DataT, Dim > const &v2) const
Strict weak ordering function for TinyVectors.
Query specific information about different data types.
Type
Neighborhood.hh "libArrayToolbox/Neighborhood.hh".
std::set< blitz::TinyVector< BlitzIndexT, Dim >, TinyVectorLessThan< BlitzIndexT, Dim > > NeighborSet