
https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Add morpho approximate dil, ero, clo and ope. * mln/morpho/approx: New directory. * mln/morpho/approx/dilation.hh: New. * mln/morpho/approx/erosion.hh: New. * mln/morpho/approx/all.hh: New. * mln/morpho/closing/approx: New directory. * mln/morpho/closing/approx/all.hh: New. * mln/morpho/closing/approx/structural.hh: New. * mln/morpho/opening/approx: New directory. * mln/morpho/opening/approx/structural.hh: New. * mln/morpho/opening/approx/all.hh: New. * mln/morpho/all.hh: Update. * tests/morpho/approx: New directory. * tests/morpho/approx/erosion.cc: New. * tests/morpho/approx/dilation.cc: New. * tests/morpho/approx/Makefile.am: New. * tests/morpho/closing/approx: New directory. * tests/morpho/closing/approx/structural.cc: New. * tests/morpho/closing/approx/Makefile.am: New. * tests/morpho/closing/Makefile.am: Update. * tests/morpho/opening/approx: New directory. * tests/morpho/opening/approx/structural.cc: New. * tests/morpho/opening/approx/Makefile.am: New. * tests/morpho/opening/Makefile.am: Update. * tests/morpho/Makefile.am: Update. mln/morpho/all.hh | 1 mln/morpho/approx/all.hh | 57 +++++++ mln/morpho/approx/dilation.hh | 229 ++++++++++++++++++++++++++++++ mln/morpho/approx/erosion.hh | 219 ++++++++++++++++++++++++++++ mln/morpho/closing/approx/all.hh | 56 +++++++ mln/morpho/closing/approx/structural.hh | 31 ++-- mln/morpho/opening/approx/all.hh | 56 +++++++ mln/morpho/opening/approx/structural.hh | 31 ++-- tests/morpho/Makefile.am | 1 tests/morpho/approx/Makefile.am | 12 + tests/morpho/approx/dilation.cc | 63 ++++++++ tests/morpho/approx/erosion.cc | 63 ++++++++ tests/morpho/closing/Makefile.am | 3 tests/morpho/closing/approx/Makefile.am | 10 + tests/morpho/closing/approx/structural.cc | 62 ++++++++ tests/morpho/opening/Makefile.am | 3 tests/morpho/opening/approx/Makefile.am | 10 + tests/morpho/opening/approx/structural.cc | 62 ++++++++ 18 files changed, 949 insertions(+), 20 deletions(-) Index: mln/morpho/closing/approx/all.hh --- mln/morpho/closing/approx/all.hh (revision 0) +++ mln/morpho/closing/approx/all.hh (revision 0) @@ -0,0 +1,56 @@ +// 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. + +#ifndef MLN_MORPHO_CLOSING_APPROX_ALL_HH +# define MLN_MORPHO_CLOSING_APPROX_ALL_HH + +/// \file mln/morpho/closing/approx/all.hh +/// +/// File that includes all approximate mathematical morphology closing +/// routines. + + +namespace mln +{ + namespace morpho + { + namespace closing + { + + /// Namespace of approximate mathematical morphology closing + /// routines. + namespace approx {} + + } + } +} + + +# include <mln/morpho/closing/approx/structural.hh> + + +#endif // ! MLN_MORPHO_CLOSING_APPROX_ALL_HH Index: mln/morpho/closing/approx/structural.hh --- mln/morpho/closing/approx/structural.hh (revision 0) +++ mln/morpho/closing/approx/structural.hh (working copy) @@ -26,14 +26,15 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_MORPHO_CLOSING_STRUCTURAL_HH -# define MLN_MORPHO_CLOSING_STRUCTURAL_HH +#ifndef MLN_MORPHO_CLOSING_APPROX_STRUCTURAL_HH +# define MLN_MORPHO_CLOSING_APPROX_STRUCTURAL_HH -/// \file mln/morpho/closing/structural.hh +/// \file mln/morpho/closing/approx/structural.hh /// -/// Morphological structural closing. +/// Approximate of morphological structural closing. -# include <mln/morpho/includes.hh> +# include <mln/morpho/approx/dilation.hh> +# include <mln/morpho/approx/erosion.hh> namespace mln @@ -45,7 +46,10 @@ namespace closing { - /// Morphological structural closing. + namespace approx + { + + /// Approximate of morphological structural closing. /// /// This operator is e_{-B} o d_B. /// @@ -63,22 +67,29 @@ mln_concrete(I) structural(const Image<I>& input, const Window<W>& win) { - trace::entering("morpho::closing::structural"); + trace::entering("morpho::closing::approx::structural"); mln_precondition(exact(input).is_valid()); mln_precondition(! exact(win).is_empty()); - mln_concrete(I) output = erosion(dilation(input, win), win::sym(win)); + using mln::morpho::approx::dilation; + using mln::morpho::approx::erosion; + + mln_concrete(I) output = erosion(dilation(input, + win), + win::sym(win)); mln_postcondition(output >= input); - trace::exiting("morpho::closing::structural"); + trace::exiting("morpho::closing::approx::structural"); return output; } # endif // ! MLN_INCLUDE_ONLY + } // end of namespace mln::morpho::closing::approx + } // end of namespace mln::morpho::closing } // end of namespace mln::morpho @@ -86,4 +97,4 @@ } // end of namespace mln -#endif // ! MLN_MORPHO_CLOSING_STRUCTURAL_HH +#endif // ! MLN_MORPHO_CLOSING_APPROX_STRUCTURAL_HH Index: mln/morpho/all.hh --- mln/morpho/all.hh (revision 3483) +++ mln/morpho/all.hh (working copy) @@ -80,6 +80,7 @@ // Sub-directories. +# include <mln/morpho/approx/all.hh> # include <mln/morpho/attribute/all.hh> # include <mln/morpho/closing/all.hh> # include <mln/morpho/elementary/all.hh> Index: mln/morpho/approx/dilation.hh --- mln/morpho/approx/dilation.hh (revision 0) +++ mln/morpho/approx/dilation.hh (revision 0) @@ -0,0 +1,229 @@ +// 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. + +#ifndef MLN_MORPHO_APPROX_DILATION_HH +# define MLN_MORPHO_APPROX_DILATION_HH + +/// \file mln/morpho/approx/dilation.hh +/// +/// Approximate mathematical morphology dilation. + +# include <mln/core/concept/image.hh> + +# include <mln/core/routine/duplicate.hh> +# include <mln/level/compare.hh> + +# include <mln/transform/distance_front.hh> +# include <mln/pw/all.hh> + +# include <mln/core/alias/neighb2d.hh> +# include <mln/make/w_window2d_int.hh> +# include <mln/win/disk2d.hh> + +# include <mln/core/alias/neighb3d.hh> +# include <mln/make/w_window3d_int.hh> +# include <mln/win/sphere3d.hh> + + + +namespace mln +{ + + namespace morpho + { + + namespace approx + { + + + template <typename I, typename W> + mln_concrete(I) + dilation(const Image<I>& input, const Window<W>& win); + + + +# ifndef MLN_INCLUDE_ONLY + + + // Implementations. + + namespace impl + { + + + // By distance thresholding. + + template <typename I> + mln_concrete(I) + dilation_by_distance_thresholding_2d(const Image<I>& input_, + const Window< win::disk2d >& win_) + { + trace::entering("morpho::approx::impl::dilation_by_distance_thresholding_2d"); + + const I& input = exact(input_); + const win::disk2d& win = exact(win_); + + mln_precondition(input.is_valid()); + mln_precondition(win.is_valid()); + + int ws[] = { 00, 11, 0, 11, 0, + 11, 7, 5, 7, 11, + 00, 5, 0, 5, 0, + 11, 7, 5, 7, 11, + 00, 11, 0, 11, 0 }; + const unsigned coef = 5; + + unsigned + radius = coef * win.diameter() / 2, + dmax = radius + 1; + + mln_ch_value(I, unsigned) dmap = transform::distance_front(input, + c4(), make::w_window2d_int(ws), + dmax); + mln_concrete(I) output; + output = duplicate((pw::value(dmap) <= pw::cst(radius)) | input.domain()); + + trace::exiting("morpho::approx::impl::dilation_by_distance_thresholding_2d"); + return output; + } + + + + template <typename I> + mln_concrete(I) + dilation_by_distance_thresholding_3d(const Image<I>& input_, + const Window< win::sphere3d >& win_) + { + trace::entering("morpho::approx::impl::dilation_by_distance_thresholding_3d"); + + const I& input = exact(input_); + const win::sphere3d& win = exact(win_); + + mln_precondition(input.is_valid()); + mln_precondition(win.is_valid()); + + int ws[] = { 00, 21, 00, + 21, 17, 21, + 00, 21, 00, + + 17, 12, 17, + 12, 00, 12, + 17, 12, 17, + + 00, 21, 00, + 21, 17, 21, + 00, 21, 00 }; + const unsigned coef = 12; + + unsigned + radius = coef * win.diameter() / 2, + dmax = radius + 1; + + mln_ch_value(I, unsigned) dmap = transform::distance_front(input, + c6(), make::w_window3d_int(ws), + dmax); + mln_concrete(I) output; + output = duplicate((pw::value(dmap) <= pw::cst(radius)) | input.domain()); + + trace::exiting("morpho::approx::impl::dilation_by_distance_thresholding_3d"); + return output; + } + + + } // end of namespace mln::morpho::approx::impl + + + + // Dispatch. + + namespace internal + { + + template <typename I> + mln_concrete(I) + dilation_dispatch(trait::image::kind::logic, + const I& input, + const win::disk2d& win) + { + return impl::dilation_by_distance_thresholding_2d(input, win); + } + + template <typename I> + mln_concrete(I) + dilation_dispatch(trait::image::kind::logic, + const I& input, + const win::sphere3d& win) + { + return impl::dilation_by_distance_thresholding_3d(input, win); + } + + // Entry point. + + template <typename I, typename W> + mln_concrete(I) + dilation_dispatch(const I& input, const W& win) + { + return dilation_dispatch(mln_trait_image_kind(I)(), + input, win); + } + + } // end of namespace mln::morpho::approx::internal + + + // Facade. + + template <typename I, typename W> + inline + mln_concrete(I) + dilation(const Image<I>& input, const Window<W>& win) + { + trace::entering("morpho::approx::dilation"); + + mln_precondition(exact(input).is_valid()); + mln_precondition(exact(win).is_valid()); + + mln_concrete(I) output; + output = internal::dilation_dispatch(exact(input), exact(win)); + + if (exact(win).is_centered()) + mln_postcondition(output >= input); + + trace::exiting("morpho::approx::dilation"); + return output; + } + + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::morpho::approx + + } // end of namespace mln::morpho + +} // end of namespace mln + + +#endif // ! MLN_MORPHO_APPROX_DILATION_HH Index: mln/morpho/approx/all.hh --- mln/morpho/approx/all.hh (revision 0) +++ mln/morpho/approx/all.hh (revision 0) @@ -0,0 +1,57 @@ +// 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. + +#ifndef MLN_MORPHO_APPROX_ALL_HH +# define MLN_MORPHO_APPROX_ALL_HH + +/// \file mln/morpho/approx/all.hh +/// +/// File that includes all approximate mathematical morphology +/// routines. + + +namespace mln +{ + namespace morpho + { + + /// Namespace of approximate mathematical morphology routines. + namespace approx {} + + } +} + + +# include <mln/morpho/approx/dilation.hh> +# include <mln/morpho/approx/erosion.hh> + +// Sub-directories. +# include <mln/morpho/closing/approx/all.hh> +# include <mln/morpho/opening/approx/all.hh> + + +#endif // ! MLN_MORPHO_APPROX_ALL_HH Index: mln/morpho/approx/erosion.hh --- mln/morpho/approx/erosion.hh (revision 0) +++ mln/morpho/approx/erosion.hh (revision 0) @@ -0,0 +1,219 @@ +// 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. + +#ifndef MLN_MORPHO_APPROX_EROSION_HH +# define MLN_MORPHO_APPROX_EROSION_HH + +/// \file mln/morpho/approx/erosion.hh +/// +/// Approximate mathematical morphology erosion. + +# include <mln/morpho/approx/dilation.hh> +# include <mln/logical/not.hh> + + + +namespace mln +{ + + namespace morpho + { + + namespace approx + { + + + template <typename I, typename W> + mln_concrete(I) + erosion(const Image<I>& input, const Window<W>& win); + + + +# ifndef MLN_INCLUDE_ONLY + + + // Implementations. + + namespace impl + { + + + // By distance thresholding. + + template <typename I> + mln_concrete(I) + erosion_by_distance_thresholding_2d(const Image<I>& input_, + const Window< win::disk2d >& win_) + { + trace::entering("morpho::approx::impl::erosion_by_distance_thresholding_2d"); + + const I& input = exact(input_); + const win::disk2d& win = exact(win_); + + mln_precondition(input.is_valid()); + mln_precondition(win.is_valid()); + + int ws[] = { 00, 11, 0, 11, 0, + 11, 7, 5, 7, 11, + 00, 5, 0, 5, 0, + 11, 7, 5, 7, 11, + 00, 11, 0, 11, 0 }; + const unsigned coef = 5; + + unsigned + radius = coef * win.diameter() / 2, + dmax = radius + 1; + + + mln_concrete(I) background = logical::not_(input); + mln_ch_value(I, unsigned) dmap = transform::distance_front(background, + c4(), make::w_window2d_int(ws), + dmax); + mln_concrete(I) output; + output = duplicate((pw::value(dmap) > pw::cst(radius)) | input.domain()); + + trace::exiting("morpho::approx::impl::erosion_by_distance_thresholding_2d"); + return output; + } + + + + template <typename I> + mln_concrete(I) + erosion_by_distance_thresholding_3d(const Image<I>& input_, + const Window< win::sphere3d >& win_) + { + trace::entering("morpho::approx::impl::erosion_by_distance_thresholding_3d"); + + const I& input = exact(input_); + const win::sphere3d& win = exact(win_); + + mln_precondition(input.is_valid()); + mln_precondition(win.is_valid()); + + int ws[] = { 00, 21, 00, + 21, 17, 21, + 00, 21, 00, + + 17, 12, 17, + 12, 00, 12, + 17, 12, 17, + + 00, 21, 00, + 21, 17, 21, + 00, 21, 00 }; + const unsigned coef = 12; + + unsigned + radius = coef * win.diameter() / 2, + dmax = radius + 1; + + mln_concrete(I) background = logical::not_(input); + mln_ch_value(I, unsigned) dmap = transform::distance_front(background, + c6(), make::w_window3d_int(ws), + dmax); + mln_concrete(I) output; + output = duplicate((pw::value(dmap) > pw::cst(radius)) | input.domain()); + + trace::exiting("morpho::approx::impl::erosion_by_distance_thresholding_3d"); + return output; + } + + + } // end of namespace mln::morpho::approx::impl + + + + // Dispatch. + + namespace internal + { + + template <typename I> + mln_concrete(I) + erosion_dispatch(trait::image::kind::logic, + const I& input, + const win::disk2d& win) + { + return impl::erosion_by_distance_thresholding_2d(input, win); + } + + template <typename I> + mln_concrete(I) + erosion_dispatch(trait::image::kind::logic, + const I& input, + const win::sphere3d& win) + { + return impl::erosion_by_distance_thresholding_3d(input, win); + } + + // Entry point. + + template <typename I, typename W> + mln_concrete(I) + erosion_dispatch(const I& input, const W& win) + { + return erosion_dispatch(mln_trait_image_kind(I)(), + input, win); + } + + } // end of namespace mln::morpho::approx::internal + + + // Facade. + + template <typename I, typename W> + inline + mln_concrete(I) + erosion(const Image<I>& input, const Window<W>& win) + { + trace::entering("morpho::approx::erosion"); + + mln_precondition(exact(input).is_valid()); + mln_precondition(exact(win).is_valid()); + + mln_concrete(I) output; + output = internal::erosion_dispatch(exact(input), exact(win)); + + if (exact(win).is_centered()) + mln_postcondition(output <= input); + + trace::exiting("morpho::approx::erosion"); + return output; + } + + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::morpho::approx + + } // end of namespace mln::morpho + +} // end of namespace mln + + +#endif // ! MLN_MORPHO_APPROX_EROSION_HH Index: mln/morpho/opening/approx/all.hh --- mln/morpho/opening/approx/all.hh (revision 0) +++ mln/morpho/opening/approx/all.hh (revision 0) @@ -0,0 +1,56 @@ +// 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. + +#ifndef MLN_MORPHO_OPENING_APPROX_ALL_HH +# define MLN_MORPHO_OPENING_APPROX_ALL_HH + +/// \file mln/morpho/opening/approx/all.hh +/// +/// File that includes all approximate mathematical morphology opening +/// routines. + + +namespace mln +{ + namespace morpho + { + namespace opening + { + + /// Namespace of approximate mathematical morphology opening + /// routines. + namespace approx {} + + } + } +} + + +# include <mln/morpho/opening/approx/structural.hh> + + +#endif // ! MLN_MORPHO_OPENING_APPROX_ALL_HH Index: mln/morpho/opening/approx/structural.hh --- mln/morpho/opening/approx/structural.hh (revision 0) +++ mln/morpho/opening/approx/structural.hh (working copy) @@ -26,14 +26,15 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_MORPHO_OPENING_STRUCTURAL_HH -# define MLN_MORPHO_OPENING_STRUCTURAL_HH +#ifndef MLN_MORPHO_OPENING_APPROX_STRUCTURAL_HH +# define MLN_MORPHO_OPENING_APPROX_STRUCTURAL_HH -/// \file mln/morpho/opening/structural.hh +/// \file mln/morpho/opening/approx/structural.hh /// -/// Morphological structural opening. +/// Approximate of morphological structural opening. -# include <mln/morpho/includes.hh> +# include <mln/morpho/approx/dilation.hh> +# include <mln/morpho/approx/erosion.hh> namespace mln @@ -45,7 +46,10 @@ namespace opening { - /// Morphological structural opening. + namespace approx + { + + /// Approximate of morphological structural opening. /// /// This operator is d_{-B} o e_B. template <typename I, typename W> @@ -62,22 +66,29 @@ mln_concrete(I) structural(const Image<I>& input, const Window<W>& win) { - trace::entering("morpho::opening::structural"); + trace::entering("morpho::opening::approx::structural"); mln_precondition(exact(input).is_valid()); mln_precondition(! exact(win).is_empty()); - mln_concrete(I) output = dilation(erosion(input, win), win::sym(win)); + using mln::morpho::approx::dilation; + using mln::morpho::approx::erosion; + + mln_concrete(I) output = dilation(erosion(input, + win), + win::sym(win)); mln_postcondition(output <= input); - trace::exiting("morpho::opening::structural"); + trace::exiting("morpho::opening::approx::structural"); return output; } # endif // ! MLN_INCLUDE_ONLY + } // end of namespace mln::morpho::closing::approx + } // end of namespace mln::morpho::opening } // end of namespace mln::morpho @@ -85,4 +96,4 @@ } // end of namespace mln -#endif // ! MLN_MORPHO_OPENING_STRUCTURAL_HH +#endif // ! MLN_MORPHO_OPENING_APPROX_STRUCTURAL_HH Index: tests/morpho/closing/Makefile.am --- tests/morpho/closing/Makefile.am (revision 3483) +++ tests/morpho/closing/Makefile.am (working copy) @@ -2,6 +2,9 @@ include $(top_srcdir)/milena/tests/tests.mk +SUBDIRS = \ + approx + check_PROGRAMS = \ leveling \ algebraic \ Index: tests/morpho/closing/approx/Makefile.am --- tests/morpho/closing/approx/Makefile.am (revision 0) +++ tests/morpho/closing/approx/Makefile.am (revision 0) @@ -0,0 +1,10 @@ +## Process this file through Automake to create Makefile.in -*- Makefile -*- + +include $(top_srcdir)/milena/tests/tests.mk + +check_PROGRAMS = \ + structural + +structural_SOURCES = structural.cc + +TESTS = $(check_PROGRAMS) Index: tests/morpho/closing/approx/structural.cc --- tests/morpho/closing/approx/structural.cc (revision 0) +++ tests/morpho/closing/approx/structural.cc (revision 0) @@ -0,0 +1,62 @@ +// 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/approx/structural.cc +/// +/// Test on mln::morpho::closing::approx::structural. + +#include <mln/core/image/image2d.hh> + +#include <mln/io/pbm/load.hh> +#include <mln/io/pbm/save.hh> + +#include <mln/morpho/closing/approx/structural.hh> +#include <mln/morpho/closing/structural.hh> + +#include "tests/data.hh" + + +int main() +{ + using namespace mln; + + image2d<bool> lena, out, ref; + io::pbm::load(lena, MLN_IMG_DIR "/lena.pbm"); + + win::disk2d dsk(51); + + { + ref = morpho::closing::structural(lena, dsk); + io::pbm::save(ref, "ref.pbm"); + } + + { + out = morpho::closing::approx::structural(lena, dsk); + io::pbm::save(out, "out.pbm"); + } + +} Index: tests/morpho/approx/erosion.cc --- tests/morpho/approx/erosion.cc (revision 0) +++ tests/morpho/approx/erosion.cc (revision 0) @@ -0,0 +1,63 @@ +// 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/approx/erosion.cc +/// +/// Test on mln::morpho::approx::erosion. + +#include <mln/core/image/image2d.hh> +#include <mln/win/disk2d.hh> + +#include <mln/io/pbm/load.hh> +#include <mln/io/pbm/save.hh> + +#include <mln/morpho/approx/erosion.hh> +#include <mln/morpho/erosion.hh> + +#include "tests/data.hh" + + +int main() +{ + using namespace mln; + + image2d<bool> lena; + io::pbm::load(lena, MLN_IMG_DIR "/lena.pbm"); + + win::disk2d dsk(51); + + { + image2d<bool> ref = morpho::erosion(lena, dsk); + io::pbm::save(ref, "ref.pbm"); + } + + { + image2d<bool> out = morpho::approx::erosion(lena, dsk); + io::pbm::save(out, "out.pbm"); + } + +} Index: tests/morpho/approx/dilation.cc --- tests/morpho/approx/dilation.cc (revision 0) +++ tests/morpho/approx/dilation.cc (revision 0) @@ -0,0 +1,63 @@ +// 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/approx/dilation.cc +/// +/// Test on mln::morpho::approx::dilation. + +#include <mln/core/image/image2d.hh> +#include <mln/win/disk2d.hh> + +#include <mln/io/pbm/load.hh> +#include <mln/io/pbm/save.hh> + +#include <mln/morpho/approx/dilation.hh> +#include <mln/morpho/dilation.hh> + +#include "tests/data.hh" + + +int main() +{ + using namespace mln; + + image2d<bool> lena; + io::pbm::load(lena, MLN_IMG_DIR "/lena.pbm"); + + win::disk2d dsk(51); + + { + image2d<bool> ref = morpho::dilation(lena, dsk); + io::pbm::save(ref, "ref.pbm"); + } + + { + image2d<bool> out = morpho::approx::dilation(lena, dsk); + io::pbm::save(out, "out.pbm"); + } + +} Index: tests/morpho/approx/Makefile.am --- tests/morpho/approx/Makefile.am (revision 0) +++ tests/morpho/approx/Makefile.am (revision 0) @@ -0,0 +1,12 @@ +## Process this file through Automake to create Makefile.in -*- Makefile -*- + +include $(top_srcdir)/milena/tests/tests.mk + +check_PROGRAMS = \ + dilation \ + erosion + +dilation_SOURCES = dilation.cc +erosion_SOURCES = erosion.cc + +TESTS = $(check_PROGRAMS) Index: tests/morpho/opening/Makefile.am --- tests/morpho/opening/Makefile.am (revision 3483) +++ tests/morpho/opening/Makefile.am (working copy) @@ -2,6 +2,9 @@ include $(top_srcdir)/milena/tests/tests.mk +SUBDIRS = \ + approx + check_PROGRAMS = \ leveling \ algebraic \ Index: tests/morpho/opening/approx/Makefile.am --- tests/morpho/opening/approx/Makefile.am (revision 0) +++ tests/morpho/opening/approx/Makefile.am (revision 0) @@ -0,0 +1,10 @@ +## Process this file through Automake to create Makefile.in -*- Makefile -*- + +include $(top_srcdir)/milena/tests/tests.mk + +check_PROGRAMS = \ + structural + +structural_SOURCES = structural.cc + +TESTS = $(check_PROGRAMS) Index: tests/morpho/opening/approx/structural.cc --- tests/morpho/opening/approx/structural.cc (revision 0) +++ tests/morpho/opening/approx/structural.cc (revision 0) @@ -0,0 +1,62 @@ +// 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/approx/structural.cc +/// +/// Test on mln::morpho::opening::approx::structural. + +#include <mln/core/image/image2d.hh> + +#include <mln/io/pbm/load.hh> +#include <mln/io/pbm/save.hh> + +#include <mln/morpho/opening/approx/structural.hh> +#include <mln/morpho/opening/structural.hh> + +#include "tests/data.hh" + + +int main() +{ + using namespace mln; + + image2d<bool> lena, out, ref; + io::pbm::load(lena, MLN_IMG_DIR "/lena.pbm"); + + win::disk2d dsk(51); + + { + ref = morpho::opening::structural(lena, dsk); + io::pbm::save(ref, "ref.pbm"); + } + + { + out = morpho::opening::approx::structural(lena, dsk); + io::pbm::save(out, "out.pbm"); + } + +} Index: tests/morpho/Makefile.am --- tests/morpho/Makefile.am (revision 3483) +++ tests/morpho/Makefile.am (working copy) @@ -3,6 +3,7 @@ include $(top_srcdir)/milena/tests/tests.mk SUBDIRS = \ + approx \ attribute \ closing \ elementary \