1804: Have Meyer's WST depend less on the old code base.

https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Have Meyer's WST depend less on the old code base. * mln/morpho/meyer_wst.hh: Use labeling::regional_minima instead of morpho::minima_components. * mln/morpho/extrema_components.hh, * mln/morpho/level_components.hh: Remove. * mln/canvas/labeling.hh: s/point/psite/. canvas/labeling.hh | 35 +++++++++++++++++++++++------------ morpho/meyer_wst.hh | 15 ++++++++------- 2 files changed, 31 insertions(+), 19 deletions(-) Index: mln/morpho/meyer_wst.hh --- mln/morpho/meyer_wst.hh (revision 1803) +++ mln/morpho/meyer_wst.hh (working copy) @@ -43,11 +43,10 @@ # include <mln/trait/ch_value.hh> +// FIXME: See below. # include <mln/util/greater_psite.hh> # include <mln/morpho/includes.hh> -// FIXME: See below. -// # include <mln/labeling/regional_minima.hh> -# include <mln/morpho/extrema_components.hh> +# include <mln/labeling/regional_minima.hh> @@ -120,13 +119,15 @@ limitation. As soon as labeling::regional_minima work, get rid of - mln/morpho/level_components.hh, and - mln/morpho/extrema_components.hh. */ -// mln_ch_value(I, marker) markers = -// labeling::regional_minima (input, nbh, nbasins); mln_ch_value(I, marker) markers = - minima_components(input, convert::to_window(nbh), nbasins); + labeling::regional_minima (input, nbh, nbasins); - // Ordered queue. typedef mln_psite(I) psite; + + // Ordered queue. + /* FIXME: Milena probably already provides an ordered queue + facility via the mln::p_priority_queue class. Try to use it + instead, and get rid of mln/util/greater_psite.hh. */ typedef std::priority_queue< psite, std::vector<psite>, util::greater_psite<I> > ordered_queue_type; Index: mln/canvas/labeling.hh --- mln/canvas/labeling.hh (revision 1803) +++ mln/canvas/labeling.hh (working copy) @@ -59,11 +59,11 @@ typedef typename F::S S; // Local type. - typedef mln_psite(I) point; + typedef mln_psite(I) psite; // Auxiliary data. mln_ch_value(I, bool) deja_vu; - mln_ch_value(I, point) parent; + mln_ch_value(I, psite) parent; // Output. mln_ch_value(I, L) output; @@ -82,17 +82,19 @@ // Auxiliary methods. - void make_set(const point& p); + void make_set(const psite& p); - bool is_root(const point& p) const; + bool is_root(const psite& p) const; - point find_root(const point& x); + psite find_root(const psite& x); - void do_union(const point& n, const point& p); + void do_union(const psite& n, const psite& p); }; + // Fastest version. + template <typename F> struct labeling_fastest { @@ -132,6 +134,10 @@ # ifndef MLN_INCLUDE_ONLY + /*-------------------. + | canvas::labeling. | + `-------------------*/ + template <typename F> labeling<F>::labeling(F& f) : f(f) @@ -204,7 +210,7 @@ template <typename F> void - labeling<F>::make_set(const point& p) + labeling<F>::make_set(const psite& p) { parent(p) = p; f.init_attr(p); @@ -212,14 +218,14 @@ template <typename F> bool - labeling<F>::is_root(const point& p) const + labeling<F>::is_root(const psite& p) const { return parent(p) == p; } template <typename F> - typename labeling<F>::point - labeling<F>::find_root(const point& x) + typename labeling<F>::psite + labeling<F>::find_root(const psite& x) { if (parent(x) == x) return x; @@ -229,9 +235,9 @@ template <typename F> void - labeling<F>::do_union(const point& n, const point& p) + labeling<F>::do_union(const psite& n, const psite& p) { - point r = find_root(n); + psite r = find_root(n); if (r != p) { parent(r) = p; @@ -239,6 +245,11 @@ } } + + /*---------------------------. + | canvas::labeling_fastest. | + `---------------------------*/ + template <typename F> labeling_fastest<F>::labeling_fastest(F& f) : f(f)
participants (1)
-
Roland Levillain