27 #ifndef SCRIBO_AFP_REGROUP_HH
28 # define SCRIBO_AFP_REGROUP_HH
34 #include <mln/geom/ncols.hh>
35 #include <mln/geom/nrows.hh>
36 #include <mln/util/couple.hh>
38 #include <scribo/core/object_groups.hh>
39 #include <scribo/core/component_set.hh>
40 #include <scribo/core/macros.hh>
60 mln_trace(
"scribo::primitive::group::regroup_left");
62 mln_precondition(groups.is_valid());
65 new_groups(components, static_cast<unsigned>(components.nlabels()) + 1, 0);
68 for_all_comps(i, components)
75 if (new_groups[i] == 0)
76 new_groups[i] = ++ngroups;
78 const mln_site(L) c = components.mass_center(i);
81 midcol = (components.bbox(i).pmax().col()
82 - components.bbox(i).pmin().col()) / 2;
85 nleft =
std::min(static_cast<unsigned>(nleftima), midcol + dmax);
91 *pstop =
p - nleft - 1;
93 for (;
p != pstop; --
p)
95 if (*
p != literal::zero
100 if (new_groups[*
p] == 0)
101 new_groups[*
p] = ngroups;
104 new_groups[i] = new_groups[*
p];
123 #endif // ! SCRIBO_AFP_REGROUP_HH