https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix wrong update in morpho attribute card.
* mln/morpho/attribute/card.hh: Fix wrong update.
* mln/canvas/morpho/attribute_filter.hh: Layout.
* tests/morpho/closing/area.cc: Make it quiet.
* tests/morpho/closing/algebraic.cc: Likewise.
mln/morpho/attribute/card.hh | 15 +++++++++------
tests/morpho/closing/algebraic.cc | 2 +-
tests/morpho/closing/area.cc | 16 ++++++++++++----
3 files changed, 22 insertions(+), 11 deletions(-)
Index: mln/morpho/attribute/card.hh
--- mln/morpho/attribute/card.hh (revision 3737)
+++ mln/morpho/attribute/card.hh (working copy)
@@ -32,6 +32,9 @@
///
/// Define an accumulator that computes the cardinality of a
/// component.
+///
+/// \todo Add a static check in the accumulator concept so that
+/// when_pix::use_none => take_as_init() is provided.
# include <mln/accu/internal/base.hh>
# include <mln/util/pix.hh>
@@ -94,9 +97,9 @@
void take(const util::pix<I>& px);
void take(const card<I>& other);
- void take_as_init_();
- void take_as_init_(const util::pix<I>& px);
- using super_::take_as_init_;
+ using super_::take_as_init;
+ void take_as_init(); // Extra version.
+ void take_as_init_(const util::pix<I>& px); // Overload.
/// \}
/// Get the value of the accumulator.
@@ -164,12 +167,12 @@
c_ += other.c_;
}
- // take_as_init_.
+ // take_as_init.
template <typename I>
inline
void
- card<I>::take_as_init_()
+ card<I>::take_as_init()
{
init();
take();
@@ -180,7 +183,7 @@
void
card<I>::take_as_init_(const util::pix<I>&)
{
- take_as_init_();
+ take_as_init();
}
template <typename I>
Index: mln/canvas/morpho/attribute_filter.hh
Index: tests/morpho/closing/area.cc
--- tests/morpho/closing/area.cc (revision 3737)
+++ tests/morpho/closing/area.cc (working copy)
@@ -31,11 +31,16 @@
/// Test on mln::morpho::closing::area.
#include <mln/core/image/image2d.hh>
-#include <mln/value/int_u8.hh>
#include <mln/core/alias/neighb2d.hh>
+#include <mln/value/int_u8.hh>
#include <mln/io/pgm/load.hh>
-#include <mln/io/pgm/save.hh>
+
+#include <mln/accu/max.hh>
+#include <mln/level/compute.hh>
+#include <mln/level/compare.hh>
+#include <mln/pw/cst.hh>
+#include <mln/pw/image.hh>
#include <mln/morpho/closing/area.hh>
@@ -48,7 +53,10 @@
using namespace mln;
using value::int_u8;
- image2d<int_u8> lena;
+ image2d<int_u8> lena, clo;
io::pgm::load(lena, MLN_IMG_DIR "/tiny.pgm");
- io::pgm::save(morpho::closing::area(lena, c4(), 510), "out.pgm");
+ clo = morpho::closing::area(lena, c4(), lena.nrows() * lena.ncols());
+
+ int_u8 m = level::compute(accu::max<int_u8>(), lena);
+ mln_assertion(clo == (pw::cst(m) | lena.domain()));
}
Index: tests/morpho/closing/algebraic.cc
--- tests/morpho/closing/algebraic.cc (revision 3737)
+++ tests/morpho/closing/algebraic.cc (working copy)
@@ -48,7 +48,7 @@
using namespace mln;
using value::int_u8;
- trace::quiet = false;
+ trace::quiet = true;
typedef image2d<int_u8> I;
I lena;