31 #include <mln/core/alias/point2d.hh>
33 #include <mln/util/graph.hh>
34 #include <mln/fun/i2v/array.hh>
35 #include <mln/util/site_pair.hh>
36 #include <mln/core/image/edge_image.hh>
38 #include <mln/morpho/watershed/flooding.hh>
100 edge_values_t edge_values(10);
102 static const unsigned values[] = { 0, 10, 5, 2, 4, 6, 0, 3, 5, 2 };
103 for (
unsigned i = 0; i < edge_values.size(); ++i)
104 edge_values(i) = values[i];
107 ima_t ima(g, sites, edge_values);
115 const unsigned ima_ref[] = { 0, 10, 5, 2, 4, 6, 0, 3, 5, 2 };
116 const unsigned ima_wst[] = { 2, 0, 1, 2, 2, 1, 1, 2, 0, 1 };
121 mln_piter_(ima_t)
p(ima.domain());
123 mln_assertion(ima_ref[i++] == ima(
p));
126 typedef ima_t::nbh_t nbh_t;
130 typedef mln_ch_value_(ima_t,
unsigned) wshed_t;
131 wshed_t wshed = morpho::watershed::
flooding(ima, nbh, nbasins);
132 mln_assertion(nbasins == 2);
136 mln_piter_(wshed_t) pw(wshed.domain());
138 mln_assertion(ima_wst[i++] == wshed(pw));