
* tests/morpho/rank_filter.cc: Do not include mln/io/pgm/save.hh. * tests/morpho/skeleton_constrained.cc: Likewise. (mln::show_connectivity_numbers): Move this function into the global namespace to avoid the pollution of the `mln' namespace. Aesthetic changes. --- milena/ChangeLog | 10 +++ milena/tests/morpho/rank_filter.cc | 5 +- milena/tests/morpho/skeleton_constrained.cc | 83 +++++++++++++-------------- 3 files changed, 53 insertions(+), 45 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 929c182..9080034 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,15 @@ 2010-06-03 Roland Levillain <roland@lrde.epita.fr> + Clean up some tests in tests/morpho/. + + * tests/morpho/rank_filter.cc: Do not include mln/io/pgm/save.hh. + * tests/morpho/skeleton_constrained.cc: Likewise. + (mln::show_connectivity_numbers): Move this function into the + global namespace to avoid the pollution of the `mln' namespace. + Aesthetic changes. + +2010-06-03 Roland Levillain <roland@lrde.epita.fr> + Clean up a bit Milena's Makefiles. * Makefile.am, diff --git a/milena/tests/morpho/rank_filter.cc b/milena/tests/morpho/rank_filter.cc index d08f866..23598b0 100644 --- a/milena/tests/morpho/rank_filter.cc +++ b/milena/tests/morpho/rank_filter.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -28,7 +29,6 @@ #include <mln/core/alias/window2d.hh> #include <mln/io/pgm/load.hh> -#include <mln/io/pgm/save.hh> #include <mln/value/int_u8.hh> #include <mln/data/fill.hh> @@ -37,7 +37,6 @@ #include <mln/morpho/rank_filter.hh> #include <mln/morpho/dilation.hh> - #include <mln/pw/value.hh> #include <mln/pw/cst.hh> #include <mln/fun/ops.hh> diff --git a/milena/tests/morpho/skeleton_constrained.cc b/milena/tests/morpho/skeleton_constrained.cc index a39ac76..9138911 100644 --- a/milena/tests/morpho/skeleton_constrained.cc +++ b/milena/tests/morpho/skeleton_constrained.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -33,7 +34,6 @@ #include <mln/morpho/skeleton_constrained.hh> #include <mln/io/pbm/load.hh> -#include <mln/io/pbm/save.hh> #include <mln/data/fill.hh> #include <mln/pw/value.hh> @@ -49,49 +49,46 @@ #include "tests/data.hh" -namespace mln +template <typename N> +void +show_connectivity_numbers(const mln::image2d<bool>& ima, const N& nbh) { + mln::extension::adjust_duplicate(ima, nbh); - template <typename N> - void show_connectivity_numbers(const image2d<bool>& ima, - const N& nbh) + mln::image2d<unsigned> when_true(ima.domain()), when_false(ima.domain()); + mln_piter(mln::box2d) p(ima.domain()); + for_all(p) { - extension::adjust_duplicate(ima, nbh); - - image2d<unsigned> when_true(ima.domain()), when_false(ima.domain()); - mln_piter(box2d) p(ima.domain()); - for_all(p) - { - when_true(p) = connectivity_number_2d(ima, nbh.foreground(), p, true); - when_false(p) = connectivity_number_2d(ima, nbh.background(), p, false); - } + when_true(p) = connectivity_number_2d(ima, nbh.foreground(), p, true); + when_false(p) = connectivity_number_2d(ima, nbh.background(), p, false); } +} + + +bool skl_ref_[22][18] = + { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },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 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 } }; int main() { @@ -103,8 +100,10 @@ int main() image2d<bool> pic; io::pbm::load(pic, MLN_IMG_DIR "/tiny.pbm"); - typedef neighb<win::multiple_size<2u, window<dpoint<grid::square, short int> >, - pw::value_<image2d<bool> > > > nbh_t; + typedef + neighb<win::multiple_size<2u, window<dpoint<grid::square, short int> >, + pw::value_<image2d<bool> > > > + nbh_t; nbh_t nbh = make::dual_neighb(pic, c4(), c8()); show_connectivity_numbers(pic, nbh); -- 1.5.6.5