https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add activity to morphology algebraic canvas.
* mln/canvas/morpho/algebraic_union_find.hh (activity): New.
This allows for accumulators that cannot properly implement
set_value to work with algebraic filters and levelings.
* mln/test/predicate.hh: Fix signature.
canvas/morpho/algebraic_union_find.hh | 10 +++++++++-
test/predicate.hh | 12 ++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
Index: mln/test/predicate.hh
--- mln/test/predicate.hh (revision 3174)
+++ mln/test/predicate.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// 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,9 @@
#ifndef MLN_TEST_PREDICATE_HH
# define MLN_TEST_PREDICATE_HH
-/*! \file mln/test/predicate.hh
- *
- * \brief Test a predicate on the pixel values of an image.
- */
+/// \file mln/test/predicate.hh
+///
+/// Test a predicate on the pixel values of an image.
# include <mln/core/concept/image.hh>
# include <mln/core/concept/function.hh>
@@ -62,7 +62,7 @@
* \param[in] f The predicate.
*/
template <typename I, typename J, typename F>
- bool predicate(const Image<I>& lhs, const Image<J>& rhs, const
Function_v2b<F>& f);
+ bool predicate(const Image<I>& lhs, const Image<J>& rhs, const
Function_vv2b<F>& f);
/*! Test if all points of \p pset verify the predicate \p f.
Index: mln/canvas/morpho/algebraic_union_find.hh
--- mln/canvas/morpho/algebraic_union_find.hh (revision 3174)
+++ mln/canvas/morpho/algebraic_union_find.hh (working copy)
@@ -98,6 +98,7 @@
// Auxiliary data.
mln_ch_value(O, bool) deja_vu;
+ mln_ch_value(I, bool) activity;
mln_ch_value(O, P) parent;
mln_ch_value(O, A) data;
@@ -105,6 +106,8 @@
{
initialize(deja_vu, input);
mln::data::fill(deja_vu, false);
+ initialize(activity, input);
+ mln::data::fill(activity, true);
initialize(parent, input);
initialize(data, input);
f.init(); // init required.
@@ -151,7 +154,7 @@
P r = find_root(parent, n);
if (r != p)
{
- if (input(r) == input(p) || f.is_active(data(r))) // Equiv(r, p)
+ if (input(r) == input(p) || (activity(r) && f.is_active(data(r)))) //
Equiv(r, p)
// Either a flat zone or the component of r is still growing.
{
/* FIXME: Same remark as above concerning the
@@ -168,11 +171,16 @@
template parameter A is not bound). */
data(p).take(data(r));
parent(r) = p;
+ if (activity(r) == false)
+ activity(p) = false;
}
else
+ {
+ activity(p) = false;
f.inactivate(data(p));
}
}
+ }
deja_vu(p) = true;
}
}