r3440: Add leveling/algebraic morpho tests

URL: https://svn.lrde.epita.fr/svn/oln/trunk ChangeLog: 2009-02-28 Edwin Carlinet <carlinet@lrde.epita.fr> Add leveling/algebraic morpho tests. * configure.ac: Add opening/closing subdirs to generate Makefile. * milena/mln/morpho/closing/leveling.hh: Missing file from last commit. * milena/mln/morpho/opening/leveling.hh: Missing file from last commit. * milena/tests/morpho/closing/Makefile.am: New. * milena/tests/morpho/closing/algebraic.cc: Test file for algebraic closing filter. * milena/tests/morpho/closing/leveling.cc: Test file for leveling closing filter. * milena/tests/morpho/opening/Makefile.am: New. * milena/tests/morpho/opening/algebraic.cc: Test file for algebraic opening filter. * milena/tests/morpho/opening/leveling.cc: Test file for leveling opening filter. --- configure.ac | 2 milena/mln/morpho/closing/leveling.hh | 86 +++++++++++++++++++++++++++++++ milena/mln/morpho/opening/leveling.hh | 86 +++++++++++++++++++++++++++++++ milena/tests/morpho/closing/Makefile.am | 20 +++++++ milena/tests/morpho/closing/algebraic.cc | 10 +-- milena/tests/morpho/closing/leveling.cc | 67 ++++++++++++++++++++++++ milena/tests/morpho/opening/Makefile.am | 20 +++++++ milena/tests/morpho/opening/algebraic.cc | 67 ++++++++++++++++++++++++ milena/tests/morpho/opening/leveling.cc | 67 ++++++++++++++++++++++++ 9 files changed, 420 insertions(+), 5 deletions(-) Index: trunk/configure.ac =================================================================== --- trunk/configure.ac (revision 3439) +++ trunk/configure.ac (revision 3440) @@ -244,6 +244,8 @@ milena/tests/morpho/elementary/Makefile milena/tests/morpho/tree/Makefile milena/tests/morpho/watershed/Makefile + milena/tests/morpho/closing/Makefile + milena/tests/morpho/opening/Makefile milena/tests/norm/Makefile milena/tests/opt/Makefile milena/tests/pw/Makefile Index: trunk/milena/tests/morpho/closing/Makefile.am =================================================================== --- trunk/milena/tests/morpho/closing/Makefile.am (revision 0) +++ trunk/milena/tests/morpho/closing/Makefile.am (revision 3440) @@ -0,0 +1,20 @@ +## Process this file through Automake to create Makefile.in -*- Makefile -*- + +include $(top_srcdir)/milena/tests/tests.mk + +check_PROGRAMS = + leveling \ + algebraic \ + height \ + card \ + volume \ + sum + +leveling_SOURCES = leveling.cc +algebraic_SOURCES = algebraic.cc +height_SOURCES = height.cc +card_SOURCES = card.cc +volume_SOURCES = volume.cc +sum_SOURCES = sum.cc + +TESTS = $(check_PROGRAMS) \ No newline at end of file Index: trunk/milena/tests/morpho/closing/leveling.cc =================================================================== --- trunk/milena/tests/morpho/closing/leveling.cc (revision 0) +++ trunk/milena/tests/morpho/closing/leveling.cc (revision 3440) @@ -0,0 +1,67 @@ +// Copyright (C) 2009 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/// \file tests/morpho/closing/leveling.cc +/// +/// Test on mln::morpho::closing::leveling. + +#include <mln/core/image/image2d.hh> +#include <mln/value/int_u8.hh> +#include <mln/core/alias/neighb2d.hh> + +#include <mln/io/pgm/load.hh> +#include <mln/io/pgm/save.hh> + +#include <mln/morpho/closing/leveling.hh> +#include <mln/morpho/attribute/volume.hh> +#include <mln/accu/count.hh> + +#include "tests/data.hh" + + + +int main() +{ + using namespace mln; + using value::int_u8; + + trace::quiet = false; + + typedef image2d<int_u8> I; + I lena; + io::pgm::load(lena, MLN_IMG_DIR "/tiny.pgm"); + { + accu::count<point2d> a; + io::pgm::save(morpho::closing::leveling(lena, c4(), a, 10), + "ref.pgm"); + } + { + morpho::attribute::volume<I> a; + io::pgm::save(morpho::closing::leveling(lena, c4(), a, 10), + "out.pgm"); + } +} Property changes on: trunk/milena/tests/morpho/closing/leveling.cc ___________________________________________________________________ Name: svn:mergeinfo + Index: trunk/milena/tests/morpho/closing/algebraic.cc =================================================================== --- trunk/milena/tests/morpho/closing/algebraic.cc (revision 3439) +++ trunk/milena/tests/morpho/closing/algebraic.cc (revision 3440) @@ -25,9 +25,9 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/// \file tests/morpho/closing_algebraic.cc +/// \file tests/morpho/closing/algebraic.cc /// -/// Test on mln::morpho::closing_algebraic. +/// Test on mln::morpho::closing::algebraic. #include <mln/core/image/image2d.hh> #include <mln/value/int_u8.hh> @@ -36,7 +36,7 @@ #include <mln/io/pgm/load.hh> #include <mln/io/pgm/save.hh> -#include <mln/morpho/closing_algebraic.hh> +#include <mln/morpho/closing/algebraic.hh> #include <mln/morpho/attribute/card.hh> #include <mln/accu/count.hh> @@ -56,12 +56,12 @@ io::pgm::load(lena, MLN_IMG_DIR "/tiny.pgm"); { accu::count<point2d> a; - io::pgm::save(morpho::closing_algebraic(lena, c4(), a, 10), + io::pgm::save(morpho::closing::algebraic(lena, c4(), a, 10), "ref.pgm"); } { morpho::attribute::card<I> a; - io::pgm::save(morpho::closing_algebraic(lena, c4(), a, 10), + io::pgm::save(morpho::closing::algebraic(lena, c4(), a, 10), "out.pgm"); } } Index: trunk/milena/tests/morpho/opening/Makefile.am =================================================================== --- trunk/milena/tests/morpho/opening/Makefile.am (revision 0) +++ trunk/milena/tests/morpho/opening/Makefile.am (revision 3440) @@ -0,0 +1,20 @@ +## Process this file through Automake to create Makefile.in -*- Makefile -*- + +include $(top_srcdir)/milena/tests/tests.mk + +check_PROGRAMS = + leveling \ + algebraic \ + height \ + card \ + volume \ + sum + +leveling_SOURCES = leveling.cc +algebraic_SOURCES = algebraic.cc +height_SOURCES = height.cc +card_SOURCES = card.cc +volume_SOURCES = volume.cc +sum_SOURCES = sum.cc + +TESTS = $(check_PROGRAMS) \ No newline at end of file Index: trunk/milena/tests/morpho/opening/leveling.cc =================================================================== --- trunk/milena/tests/morpho/opening/leveling.cc (revision 0) +++ trunk/milena/tests/morpho/opening/leveling.cc (revision 3440) @@ -0,0 +1,67 @@ +// Copyright (C) 2009 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/// \file tests/morpho/opening/leveling.cc +/// +/// Test on mln::morpho::opening::leveling. + +#include <mln/core/image/image2d.hh> +#include <mln/value/int_u8.hh> +#include <mln/core/alias/neighb2d.hh> + +#include <mln/io/pgm/load.hh> +#include <mln/io/pgm/save.hh> + +#include <mln/morpho/opening/leveling.hh> +#include <mln/morpho/attribute/volume.hh> +#include <mln/accu/count.hh> + +#include "tests/data.hh" + + + +int main() +{ + using namespace mln; + using value::int_u8; + + trace::quiet = false; + + typedef image2d<int_u8> I; + I lena; + io::pgm::load(lena, MLN_IMG_DIR "/tiny.pgm"); + { + accu::count<point2d> a; + io::pgm::save(morpho::opening::leveling(lena, c4(), a, 10), + "ref.pgm"); + } + { + morpho::attribute::volume<I> a; + io::pgm::save(morpho::opening::leveling(lena, c4(), a, 10), + "out.pgm"); + } +} Index: trunk/milena/tests/morpho/opening/algebraic.cc =================================================================== --- trunk/milena/tests/morpho/opening/algebraic.cc (revision 0) +++ trunk/milena/tests/morpho/opening/algebraic.cc (revision 3440) @@ -0,0 +1,67 @@ +// Copyright (C) 2009 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/// \file tests/morpho/opening/algebraic.cc +/// +/// Test on mln::morpho::opening::algebraic. + +#include <mln/core/image/image2d.hh> +#include <mln/value/int_u8.hh> +#include <mln/core/alias/neighb2d.hh> + +#include <mln/io/pgm/load.hh> +#include <mln/io/pgm/save.hh> + +#include <mln/morpho/opening/algebraic.hh> +#include <mln/morpho/attribute/card.hh> +#include <mln/accu/count.hh> + +#include "tests/data.hh" + + + +int main() +{ + using namespace mln; + using value::int_u8; + + trace::quiet = false; + + typedef image2d<int_u8> I; + I lena; + io::pgm::load(lena, MLN_IMG_DIR "/tiny.pgm"); + { + accu::count<point2d> a; + io::pgm::save(morpho::opening::algebraic(lena, c4(), a, 10), + "ref.pgm"); + } + { + morpho::attribute::card<I> a; + io::pgm::save(morpho::opening::algebraic(lena, c4(), a, 10), + "out.pgm"); + } +} Property changes on: trunk/milena/tests/morpho/opening/algebraic.cc ___________________________________________________________________ Name: svn:mergeinfo + Index: trunk/milena/mln/morpho/closing/leveling.hh =================================================================== --- trunk/milena/mln/morpho/closing/leveling.hh (revision 0) +++ trunk/milena/mln/morpho/closing/leveling.hh (revision 3440) @@ -0,0 +1,86 @@ +// Copyright (C) 2007, 2008, 2009 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MORPHO_OPENING_LEVELING_HH +# define MLN_MORPHO_CLOSING_LEVELING_HH + +/// \file mln/morpho/closing/leveling.hh +/// +/// Morphological leveling closing. + +# include <mln/morpho/includes.hh> +# include <mln/morpho/leveling_filter.hh> + + +namespace mln { + namespace morpho { + namespace closing { + + /// Morphological leveling closing. + template <typename I, typename N, typename A> + mln_concrete(I) + leveling(const Image<I>& input, const Neighborhood<N>& nbh, + const Accumulator<A>& accu, const mln_result(A)& lambda); + + + + +# ifndef MLN_INCLUDE_ONLY + + + template <typename I, typename N, typename A> + inline + mln_concrete(I) + leveling(const Image<I>& input, const Neighborhood<N>& nbh, + const Accumulator<A>& accu, const mln_result(A)& lambda) + { + trace::entering("morpho::closing::leveling"); + + mln_precondition(exact(input).is_valid()); + mln_precondition(mlc_equal(mln_trait_accumulator_when_pix(A), + trait::accumulator::when_pix::not_ok)::value) + + mln_concrete(I) output; + output = leveling_filter(input, nbh, accu, lambda, + /* increasing = */ true); + + mln_postcondition(output >= input); + + trace::exiting("morpho::closing::leveling"); + return output; + } + + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::morpho::closing + } // end of namespace mln::morpho +} // end of namespace mln + + +#endif // ! MLN_MORPHO_CLOSING_LEVELING_HH Index: trunk/milena/mln/morpho/opening/leveling.hh =================================================================== --- trunk/milena/mln/morpho/opening/leveling.hh (revision 0) +++ trunk/milena/mln/morpho/opening/leveling.hh (revision 3440) @@ -0,0 +1,86 @@ +// Copyright (C) 2007, 2008, 2009 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 +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MORPHO_OPENING_LEVELING_HH +# define MLN_MORPHO_OPENING_LEVELING_HH + +/// \file mln/morpho/opening/leveling.hh +/// +/// Morphological leveling opening. + +# include <mln/morpho/includes.hh> +# include <mln/morpho/leveling_filter.hh> + + +namespace mln { + namespace morpho { + namespace opening { + + /// Morphological leveling opening. + template <typename I, typename N, typename A> + mln_concrete(I) + leveling(const Image<I>& input, const Neighborhood<N>& nbh, + const Accumulator<A>& accu, const mln_result(A)& lambda); + + + + +# ifndef MLN_INCLUDE_ONLY + + + template <typename I, typename N, typename A> + inline + mln_concrete(I) + leveling(const Image<I>& input, const Neighborhood<N>& nbh, + const Accumulator<A>& accu, const mln_result(A)& lambda) + { + trace::entering("morpho::opening::leveling"); + + mln_precondition(exact(input).is_valid()); + mln_precondition(mlc_equal(mln_trait_accumulator_when_pix(A), + trait::accumulator::when_pix::not_ok)::value) + + mln_concrete(I) output; + output = leveling_filter(input, nbh, accu, lambda, + /* increasing = */ false); + + mln_postcondition(output <= input); + + trace::exiting("morpho::opening::leveling"); + return output; + } + + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::morpho::opening + } // end of namespace mln::morpho +} // end of namespace mln + + +#endif // ! MLN_MORPHO_OPENING_LEVELING_HH
participants (1)
-
Edwin Carlinet