26 #ifndef SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_RIGHT_LINKS_HH
27 # define SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_RIGHT_LINKS_HH
35 # include <mln/core/concept/image.hh>
36 # include <mln/core/concept/neighborhood.hh>
38 # include <mln/util/array.hh>
40 # include <scribo/primitive/link/with_single_right_link.hh>
41 # include <scribo/core/object_links.hh>
42 # include <scribo/core/component_set.hh>
43 # include <scribo/core/macros.hh>
67 unsigned neighb_max_distance);
76 # ifndef MLN_INCLUDE_ONLY
83 unsigned neighb_max_distance)
85 mln_trace(
"scribo::primitive::link::with_several_right_links");
98 internal::single_right_functor<L>
99 functor(comps, neighb_max_distance);
100 object_links<L> link_center =
compute(functor, anchor::Center);
101 object_links<L> link_top =
compute(functor, anchor::Top);
102 object_links<L> link_bot =
compute(functor, anchor::Bottom);
105 object_links<L> final_link(comps);
107 for_all_comps(i, comps)
109 if (link_center.is_linked(i))
110 final_link.update(i, link_center(i));
111 else if (link_top(i) == link_bot(i))
112 final_link.update(i, link_top(i));
113 else if (link_top.is_linked(i) && ! link_bot.is_linked(i))
114 final_link.update(i, link_top(i));
115 else if (link_bot.is_linked(i) && ! link_top.is_linked(i))
116 final_link.update(i, link_bot(i));
125 template <
typename L>
134 # endif // ! MLN_INCLUDE_ONLY
142 #endif // ! SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_RIGHT_LINKS_HH