$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
world/inter_pixel/neighb2d.hh
1 // Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
2 //
3 // This file is part of Olena.
4 //
5 // Olena is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation, version 2 of the License.
8 //
9 // Olena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // As a special exception, you may use this file as part of a free
18 // software project without restriction. Specifically, if other files
19 // instantiate templates or use macros or inline functions from this
20 // file, or you compile this file and link it with other files to produce
21 // an executable, this file does not by itself cause the resulting
22 // executable to be covered by the GNU General Public License. This
23 // exception does not however invalidate any other reasons why the
24 // executable file might be covered by the GNU General Public License.
25 
26 #ifndef MLN_WORLD_INTER_PIXEL_NEIGHB2D_HH
27 # define MLN_WORLD_INTER_PIXEL_NEIGHB2D_HH
28 
31 
32 # include <mln/core/alias/neighb2d.hh>
33 # include <mln/make/double_neighb2d.hh>
34 # include <mln/world/inter_pixel/dim2/is_row_odd.hh>
35 
36 
37 namespace mln
38 {
39 
40  namespace world
41  {
42 
43  namespace inter_pixel
44  {
45 
48 
51 
52 
54  const neighb2d& v2v();
55 
57  const neighb2d& v2e();
58 
60  const dbl_neighb2d& e2v();
61 
63  const dbl_neighb2d& e2e();
64 
65 
66 
67 # ifndef MLN_INCLUDE_ONLY
68 
69  const neighb2d& v2v()
70  {
71  static neighb2d it;
72  if (it.size() == 0)
73  {
74  static const bool vals[] = { 0, 0, 1, 0, 0,
75  0, 0, 0, 0, 0,
76  1, 0, 0, 0, 1,
77  0, 0, 0, 0, 0,
78  0, 0, 1, 0, 0 };
79  convert::from_to(vals, it);
80  }
81  return it;
82  }
83 
84  const neighb2d& v2e()
85  {
86  return c4();
87  }
88 
89  const dbl_neighb2d& e2v()
90  {
91  static const bool e2v_h[] = { 0, 1, 0,
92  0, 0, 0,
93  0, 1, 0 };
94 
95  static const bool e2v_v[] = { 0, 0, 0,
96  1, 0, 1,
97  0, 0, 0 };
98 
99  static dbl_neighb2d nbh =
100  make::double_neighb2d(dim2::is_row_odd(), e2v_h, e2v_v);
101  return nbh;
102  }
103 
104 
105 
106  const dbl_neighb2d& e2e()
107  {
108  static const bool e2e_h[] = { 0, 0, 1, 0, 0,
109  0, 1, 0, 1, 0,
110  0, 0, 0, 0, 0,
111  0, 1, 0, 1, 0,
112  0, 0, 1, 0, 0 };
113 
114  static const bool e2e_v[] = { 0, 0, 0, 0, 0,
115  0, 1, 0, 1, 0,
116  1, 0, 0, 0, 1,
117  0, 1, 0, 1, 0,
118  0, 0, 0, 0, 0 };
119 
120  static dbl_neighb2d nbh =
121  make::double_neighb2d(dim2::is_row_odd(), e2e_h, e2e_v);
122  return nbh;
123  }
124 
125 # endif // ! MLN_INCLUDE_ONLY
126 
127 
128  } // end of namespace mln::world::inter_pixel
129 
130  } // end of namespace mln::world
131 
132 } // end of namespace mln
133 
134 #endif // ! MLN_WORLD_INTER_PIXEL_NEIGHB2D_HH