27 #ifndef SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_LEFT_LINKS_HH
28 # define SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_LEFT_LINKS_HH
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/neighborhood.hh>
37 # include <mln/util/array.hh>
39 # include <scribo/primitive/link/with_single_left_link.hh>
40 # include <scribo/core/object_links.hh>
41 # include <scribo/core/component_set.hh>
42 # include <scribo/core/macros.hh>
64 unsigned neighb_max_distance);
74 # ifndef MLN_INCLUDE_ONLY
80 unsigned neighb_max_distance)
82 mln_trace(
"scribo::primitive::link::with_several_left_links");
95 internal::single_left_functor<L>
96 functor(comps, neighb_max_distance);
97 object_links<L> link_center =
compute(functor, anchor::Center);
98 object_links<L> link_top =
compute(functor, anchor::Top);
99 object_links<L> link_bot =
compute(functor, anchor::Bottom);
102 object_links<L> final_link(comps);
104 for_all_comps(i, comps)
106 if (link_center.is_linked(i))
107 final_link.update((i), link_center(i));
108 else if (link_top(i) == link_bot(i))
109 final_link.update(i, link_top(i));
110 else if (link_top.is_linked(i) && ! link_bot.is_linked(i))
111 final_link.update(i, link_top(i));
112 else if (link_bot.is_linked(i) && ! link_top.is_linked(i))
113 final_link.update(i, link_bot(i));
124 template <
typename L>
132 # endif // ! MLN_INCLUDE_ONLY
140 #endif // ! SCRIBO_PRIMITIVE_LINK_WITH_SEVERAL_LEFT_LINKS_HH