30 #include <mln/core/alias/point2d.hh>
33 #include <mln/core/image/vertex_image.hh>
34 #include <mln/pw/all.hh>
35 #include <mln/fun/i2v/array.hh>
36 #include <mln/util/graph.hh>
37 #include <mln/util/line_graph.hh>
38 #include <mln/util/site_pair.hh>
39 #include <mln/make/vertex_image.hh>
41 #include <mln/morpho/watershed/flooding.hh>
43 static const unsigned ima_ref[] = { 0, 10, 5, 2, 4, 6, 0, 3, 5, 2 };
44 static const unsigned ima_wst[] = { 2, 0, 1, 2, 2, 1, 1, 2, 0, 1 };
92 typedef fun::i2v::array<P> fsite_t;
106 typedef fun::i2v::array<unsigned> edge_values_t;
107 edge_values_t edge_values(10);
109 static const unsigned values[] = { 0, 10, 5, 2, 4, 6, 0, 3, 5, 2 };
110 for (
unsigned i = 0; i < edge_values.size(); ++i)
111 edge_values(i) = values[i];
124 mln_piter_(ima_t) p(ima.domain());
126 mln_assertion(ima_ref[i++] == ima(p));
128 typedef ima_t::nbh_t nbh_t;
131 typedef mln_ch_value_(ima_t,
unsigned) wshed_t;
132 wshed_t wshed = morpho::watershed::flooding(ima, nbh, nbasins);
133 mln_assertion(nbasins == 2);
137 mln_piter_(wshed_t) pw(wshed.domain());
139 mln_assertion(ima_wst[i++] == wshed(pw));