26 #ifndef MLN_MAKE_P_EDGES_WITH_MASS_CENTERS_HH
27 # define MLN_MAKE_P_EDGES_WITH_MASS_CENTERS_HH
38 # include <mln/core/concept/image.hh>
39 # include <mln/core/concept/graph.hh>
40 # include <mln/core/site_set/p_edges.hh>
42 # include <mln/labeling/compute.hh>
44 # include <mln/accu/center.hh>
46 # include <mln/fun/i2v/array.hh>
48 # include <mln/util/site_pair.hh>
68 template <
typename W,
typename G>
70 p_edges<G, fun::i2v::array<util::site_pair<mln_site(W)> > >
75 # ifndef MLN_INCLUDE_ONLY
78 template <
typename W,
typename G>
80 p_edges<G, fun::i2v::array<util::site_pair<mln_site(W)> > >
84 mln_trace(
"make::p_edges_with_mass_centers");
86 const W& wst =
exact(wst_);
87 const G& g =
exact(g_);
88 mln_precondition(wst.is_valid());
89 mln_precondition(g.is_valid());
91 typedef mln_site(W) P;
94 mln_value(W) nbasins = g.v_nmax() - 1;
95 util::array<mln_vec(P)>
98 typedef fun::i2v::array< util::site_pair<P> > edge_sites_t;
99 edge_sites_t edge_sites(g.e_nmax());
101 mln_edge_iter(G) e(g);
103 edge_sites(e.
id()) = util::site_pair<P>(mass_centers[e.v1()],
104 mass_centers[e.v2()]);
106 p_edges<G, edge_sites_t> pe(g, edge_sites);
111 # endif // ! MLN_INCLUDE_ONLY
117 #endif // ! MLN_MAKE_P_EDGES_WITH_MASS_CENTERS_HH