$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
with_single_right_link_dmax_ratio_aligned.hh
1 // Copyright (C) 2009, 2010, 2011 EPITA Research and Development
2 // Laboratory (LRDE)
3 //
4 // This file is part of Olena.
5 //
6 // Olena is free software: you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation, version 2 of the License.
9 //
10 // Olena is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // As a special exception, you may use this file as part of a free
19 // software project without restriction. Specifically, if other files
20 // instantiate templates or use macros or inline functions from this
21 // file, or you compile this file and link it with other files to produce
22 // an executable, this file does not by itself cause the resulting
23 // executable to be covered by the GNU General Public License. This
24 // exception does not however invalidate any other reasons why the
25 // executable file might be covered by the GNU General Public License.
26 
27 #ifndef SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_RIGHT_LINK_DMAX_RATIO_ALIGNED_HH
28 # define SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_RIGHT_LINK_DMAX_RATIO_ALIGNED_HH
29 
34 
35 # include <mln/core/concept/image.hh>
36 # include <mln/core/concept/neighborhood.hh>
37 
38 # include <mln/accu/center.hh>
39 # include <mln/labeling/compute.hh>
40 # include <mln/math/abs.hh>
41 # include <mln/util/array.hh>
42 
43 # include <scribo/core/macros.hh>
44 # include <scribo/core/component_set.hh>
45 # include <scribo/core/object_links.hh>
46 
47 # include <scribo/primitive/link/internal/dmax_default.hh>
48 # include <scribo/primitive/link/internal/find_link.hh>
49 # include <scribo/primitive/link/internal/link_single_dmax_ratio_aligned_base.hh>
50 
51 # include <scribo/primitive/link/compute.hh>
52 
53 # include <scribo/filter/internal/component_aligned.hh>
54 
55 
56 namespace scribo
57 {
58 
59  namespace primitive
60  {
61 
62  namespace link
63  {
64 
86  template <typename L>
87  inline
88  object_links<L>
90  const component_set<L>& components,
91  float dmax_ratio,
92  float min_angle, float max_angle,
93  anchor::Type anchor);
94 
97  template <typename L>
98  inline
99  object_links<L>
101  const component_set<L>& components,
102  float dmax_ratio,
103  float min_angle, float max_angle);
104 
105 
109  template <typename L>
110  inline
111  object_links<L>
113  const component_set<L>& components);
114 
115 
116 
117 # ifndef MLN_INCLUDE_ONLY
118 
119 
120  namespace internal
121  {
122 
123  // Functor
124 
125 
126  template <typename L, typename F>
127  class single_right_dmax_ratio_aligned_functor
128  : public link_single_dmax_ratio_aligned_base<L, F, single_right_dmax_ratio_aligned_functor<L,F> >
129  {
130  typedef single_right_dmax_ratio_aligned_functor<L,F> self_t;
131  typedef link_single_dmax_ratio_aligned_base<L, F, self_t> super_;
132 
133  public:
134  typedef mln_site(L) P;
135 
136  single_right_dmax_ratio_aligned_functor(
137  const component_set<L>& components,
138  const DMax_Functor<F>& dmax_f,
139  float min_angle,
140  float max_angle,
141  anchor::Type anchor)
142  : super_(components, dmax_f, min_angle,
143  max_angle, anchor)
144  {
145  }
146 
147  void compute_next_site_(P& p)
148  {
149  ++p.col();
150  }
151 
152  };
153 
154  } // end of namespace scribo::primitive::link::internal
155 
156 
157 
158  // Facades
159 
160 
161  template <typename L, typename F>
162  inline
163  object_links<L>
165  const component_set<L>& components,
166  const DMax_Functor<F>& dmax_f,
167  float min_angle, float max_angle,
168  anchor::Type anchor)
169  {
170  mln_trace("scribo::primitive::link::with_single_right_link_dmax_ratio_aligned");
171 
172  mln_precondition(components.is_valid());
173 
174  internal::single_right_dmax_ratio_aligned_functor<L,F>
175  functor(components, dmax_f, min_angle, max_angle, anchor);
176 
177  object_links<L> output = compute(functor, anchor);
178 
179  return output;
180  }
181 
182 
183 
184  template <typename L>
185  inline
186  object_links<L>
188  const component_set<L>& components,
189  float dmax_ratio,
190  float min_angle, float max_angle)
191  {
192  return
194  internal::dmax_default(dmax_ratio),
195  min_angle,
196  max_angle,
197  anchor::MassCenter);
198  }
199 
200 
201  template <typename L>
202  inline
203  object_links<L>
205  const component_set<L>& components)
206  {
207  return
208  with_single_right_link_dmax_ratio_aligned(components, 3, 3, 10);
209  }
210 
211 
212 # endif // ! MLN_INCLUDE_ONLY
213 
214  } // end of namespace scribo::primitive::link
215 
216  } // end of namespace scribo::primitive
217 
218 } // end of namespace scribo
219 
220 #endif // ! SCRIBO_PRIMITIVE_LINK_WITH_SINGLE_RIGHT_LINK_DMAX_RATIO_ALIGNED_HH