cleanup-2008 2835: De-activate fastest labeling level.

https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> De-activate fastest labeling level. * tests/labeling/level.cc: Update. * mln/canvas/labeling.hh (todo): New. (init): Fix warning with g++-4.3. Some updates. * mln/labeling/level.hh: Upgrade doc style. Fix copyright. * mln/labeling/level.spe.hh: Likewise. (todo): New. (level_): De-activate fastest dispatch; the underlying code cannot work! E.g., p is a pixter on input, yet used in accessing output. (level_fastest_functor): Update. mln/canvas/labeling.hh | 23 +++++++++++++---------- mln/labeling/level.hh | 12 ++++++------ mln/labeling/level.spe.hh | 32 +++++++++++++++++--------------- tests/labeling/level.cc | 13 +++++++------ 4 files changed, 43 insertions(+), 37 deletions(-) Index: tests/labeling/level.cc --- tests/labeling/level.cc (revision 2834) +++ tests/labeling/level.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -25,10 +26,9 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/*! \file tests/labeling/level.cc - * - * \brief Test on mln::labeling::level. - */ +/// \file tests/labeling/level.cc +/// +/// Test on mln::labeling::level. #include <mln/core/image/image2d.hh> #include <mln/core/alias/neighb2d.hh> @@ -60,7 +60,8 @@ { image2d<unsigned> labels = labeling::level(lena, l, c4(), n); unsigned npix = - accu::compute<accu::count>(labels | (pw::value(labels) != pw::cst(0u))); + accu::compute(accu::meta::count(), + labels | (pw::value(labels) != pw::cst(0u))); npixels += npix; } mln_assertion(npixels == lena.nsites()); Index: mln/canvas/labeling.hh --- mln/canvas/labeling.hh (revision 2834) +++ mln/canvas/labeling.hh (working copy) @@ -1,4 +1,5 @@ // Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -29,8 +30,10 @@ # define MLN_CANVAS_LABELING_HH /// \file mln/canvas/labeling.hh -/// \brief Connected component labeling of the object part in a binary -/// image. +/// +/// Connected component labeling of the object part in a binary image. +/// +/// \todo Make the fastest version work. # include <mln/core/concept/image.hh> # include <mln/level/fill.hh> @@ -159,7 +162,7 @@ mln::level::fill(deja_vu, false); initialize(parent, f.input); initialize(output, f.input); - mln::level::fill(output, literal::zero); + mln::level::fill(output, L(literal::zero)); nlabels = 0; } @@ -271,7 +274,7 @@ { initialize(parent, f.input); for (unsigned p = 0; p < parent.nelements(); ++p) - parent[p] = p; // make_set + parent.element(p) = p; // make_set initialize(output, f.input); mln::level::fill(output, 0); // FIXME: Use literal::zero. nlabels = 0; @@ -315,11 +318,11 @@ status = false; return; } - output[p] = ++nlabels; + output(p) = ++nlabels; } } else - output[p] = output[parent[p]]; + output(p) = output(parent.element(p)); } status = true; } @@ -328,17 +331,17 @@ bool labeling_fastest<F>::is_root(unsigned p) const { - return parent[p] == p; + return parent.element(p) == p; } template <typename F> unsigned labeling_fastest<F>::find_root(unsigned x) { - if (parent[x] == x) + if (parent.element(x) == x) return x; else - return parent[x] = find_root(parent[x]); + return parent.element(x) = find_root(parent.element(x)); } template <typename F> @@ -348,7 +351,7 @@ unsigned r = find_root(n); if (r != p) { - parent[r] = p; + parent.element(r) = p; f.merge_attr(r, p); } } Index: mln/labeling/level.hh --- mln/labeling/level.hh (revision 2834) +++ mln/labeling/level.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -28,11 +29,10 @@ #ifndef MLN_LABELING_LEVEL_HH # define MLN_LABELING_LEVEL_HH -/*! \file mln/labeling/level.hh - * - * \brief Connected component labeling of the image objects at a given - * level. - */ +/// \file mln/labeling/level.hh +/// +/// Connected component labeling of the image objects at a given +/// level. # include <mln/core/concept/image.hh> # include <mln/core/concept/neighborhood.hh> Index: mln/labeling/level.spe.hh --- mln/labeling/level.spe.hh (revision 2834) +++ mln/labeling/level.spe.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -28,10 +29,11 @@ #ifndef MLN_LABELING_LEVEL_SPE_HH # define MLN_LABELING_LEVEL_SPE_HH -/*! \file mln/labeling/level.spe.hh - * - * \brief Specialization for mln::labeling::level. - */ +/// \file mln/labeling/level.spe.hh +/// +/// Specialization for mln::labeling::level. +/// +/// \todo Re-activate the fastest version in dispatch... # ifndef MLN_LABELING_LEVEL_HH # error "Forbidden inclusion of *.spe.hh" @@ -99,8 +101,8 @@ const N& nbh; const S& s; - bool handles(unsigned p) const { return input[p] == val; } - bool equiv(unsigned n, unsigned) const { return input[n] == val; } + bool handles(unsigned p) const { return input.element(p) == val; } + bool equiv(unsigned n, unsigned) const { return input.element(n) == val; } void init() {} bool labels(unsigned) const { return true; } @@ -157,14 +159,14 @@ return generic::level_(input, val, nbh, nlabels); } - template <typename I, typename N, typename L> - mln_ch_value(I, L) - level_(trait::image::speed::fastest, - const I& input, const mln_value(I)& val, const N& nbh, - L& nlabels) - { - return level_fastest_(input, val, nbh, nlabels); - } +// template <typename I, typename N, typename L> +// mln_ch_value(I, L) +// level_(trait::image::speed::fastest, +// const I& input, const mln_value(I)& val, const N& nbh, +// L& nlabels) +// { +// return level_fastest_(input, val, nbh, nlabels); +// } } // end of namespace mln::labeling::impl
participants (1)
-
Thierry Geraud