3462: Disambiguate morphological structural opening and closing.

https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Disambiguate morphological structural opening and closing. * mln/morpho/closing.hh: Move and rename as... * mln/morpho/closing/structural.hh: ...this. (closing): Rename as... (closing::structural): ...this. Layout. * mln/morpho/closing/all.hh: Update. * mln/morpho/opening.hh: Move and rename as... * mln/morpho/opening/structural.hh: ...this. (opening): Rename as... (opening::structural): ...this. Layout. * mln/morpho/opening/all.hh: Update. * mln/morpho/all.hh: Update. * mln/morpho/elementary/closing.hh, * mln/morpho/elementary/opening.hh: Layout. * mln/morpho/elementary/top_hat.hh: Update doc style. Layout. (top_hat_white, top_hat_black, top_hat_self_complementary): Make calls to elementary closing (resp. opening) explicit. * mln/morpho/top_hat.hh: Update doc style. (top_hat_white, top_hat_black, top_hat_self_complementary): Make calls to structural closing (resp. opening) explicit. all.hh | 2 - closing/all.hh | 14 +++++---- closing/structural.hh | 36 ++++++++++++++++--------- elementary/closing.hh | 2 + elementary/opening.hh | 2 + elementary/top_hat.hh | 56 +++++++++++++++++++++------------------ opening/all.hh | 14 +++++---- opening/structural.hh | 38 ++++++++++++++++---------- top_hat.hh | 71 +++++++++++++++++++++++++++++--------------------- 9 files changed, 141 insertions(+), 94 deletions(-) Index: mln/morpho/closing/all.hh --- mln/morpho/closing/all.hh (revision 3461) +++ mln/morpho/closing/all.hh (working copy) @@ -1,5 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory -// (LRDE) +// 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 @@ -31,14 +30,17 @@ /// \file mln/morpho/closing/all.hh /// -/// File that includes all closing attributes. +/// File that includes all closing operators. + #include <mln/morpho/closing/algebraic.hh> -#include <mln/morpho/closing/leveling.hh> -#include <mln/morpho/closing/area_on_vertices.hh> #include <mln/morpho/closing/area.hh> -#include <mln/morpho/closing/volume.hh> +#include <mln/morpho/closing/area_on_vertices.hh> #include <mln/morpho/closing/height.hh> +#include <mln/morpho/closing/leveling.hh> +#include <mln/morpho/closing/structural.hh> +#include <mln/morpho/closing/volume.hh> + #endif // ! MLN_MORPHO_CLOSING_ALL_HH Index: mln/morpho/closing/structural.hh --- mln/morpho/closing/structural.hh (revision 3461) +++ mln/morpho/closing/structural.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// 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 @@ -26,12 +26,12 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_MORPHO_CLOSING_HH -# define MLN_MORPHO_CLOSING_HH +#ifndef MLN_MORPHO_CLOSING_STRUCTURAL_HH +# define MLN_MORPHO_CLOSING_STRUCTURAL_HH -/// \file mln/morpho/closing.hh +/// \file mln/morpho/closing/structural.hh /// -/// Morphological closing. +/// Morphological structural closing. # include <mln/morpho/includes.hh> @@ -42,36 +42,48 @@ namespace morpho { - /// Morphological closing. + namespace closing + { + + /// Morphological structural closing. /// /// This operator is e_{-B} o d_B. /// template <typename I, typename W> - mln_concrete(I) closing(const Image<I>& input, const Window<W>& win); + mln_concrete(I) + structural(const Image<I>& input, const Window<W>& win); + # ifndef MLN_INCLUDE_ONLY + template <typename I, typename W> inline - mln_concrete(I) closing(const Image<I>& input, const Window<W>& win) + mln_concrete(I) + structural(const Image<I>& input, const Window<W>& win) { - trace::entering("morpho::closing"); + trace::entering("morpho::closing::structural"); + mln_precondition(exact(input).is_valid()); mln_precondition(! exact(win).is_empty()); mln_concrete(I) output = erosion(dilation(input, win), win::sym(win)); mln_postcondition(output >= input); - trace::exiting("morpho::closing"); + + trace::exiting("morpho::closing::structural"); 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_HH +#endif // ! MLN_MORPHO_CLOSING_STRUCTURAL_HH Property changes on: mln/morpho/closing/structural.hh ___________________________________________________________________ Added: svn:mergeinfo Index: mln/morpho/elementary/closing.hh --- mln/morpho/elementary/closing.hh (revision 3461) +++ mln/morpho/elementary/closing.hh (working copy) @@ -49,6 +49,7 @@ /// Morphological elementary closing. /// /// This operator is e o d. + // template <typename I, typename N> mln_concrete(I) closing(const Image<I>& input, const Neighborhood<N>& nbh); @@ -67,6 +68,7 @@ mln_concrete(I) output = erosion(dilation(input, nbh), nbh); mln_postcondition(output >= input); + trace::exiting("morpho::elementary::closing"); return output; } Index: mln/morpho/elementary/top_hat.hh --- mln/morpho/elementary/top_hat.hh (revision 3461) +++ mln/morpho/elementary/top_hat.hh (working copy) @@ -49,31 +49,31 @@ namespace elementary { - /*! Morphological elementary white top-hat (for object / light objects). - * - * This operator is Id - ope. - */ + /// Morphological elementary white top-hat (for object / light objects). + /// + /// This operator is Id - ope. + // template <typename I, typename N> mln_concrete(I) top_hat_white(const Image<I>& input, const Neighborhood<N>& nbh); - /*! Morphological elementary black top-hat (for background / dark objects). - * - * This operator is clo - Id. - */ + /// Morphological elementary black top-hat (for background / dark objects). + /// + /// This operator is clo - Id. + // template <typename I, typename N> mln_concrete(I) top_hat_black(const Image<I>& input, const Neighborhood<N>& nbh); - /*! Morphological elementary self-complementary top-hat. - * - * This operator is \n - * = top_hat_white + top_hat_black \n - * = (Id - opening) + (closing - Id) \n - * = closing - opening. \n - */ + /// Morphological elementary self-complementary top-hat. + /// + /// This operator is \n + /// = top_hat_white + top_hat_black \n + /// = (Id - opening) + (closing - Id) \n + /// = closing - opening. \n + // template <typename I, typename N> mln_concrete(I) top_hat_self_complementary(const Image<I>& input, const Neighborhood<N>& nbh); @@ -81,61 +81,67 @@ # ifndef MLN_INCLUDE_ONLY + template <typename I, typename N> inline mln_concrete(I) - top_hat_white(const Image<I>& input, - const Neighborhood<N>& nbh) + top_hat_white(const Image<I>& input, const Neighborhood<N>& nbh) { trace::entering("morpho::elementary::top_hat_white"); + mln_precondition(exact(input).is_valid()); mln_precondition(exact(nbh).is_valid()); mln_concrete(I) output = morpho::minus(input, - opening(input, nbh)); + elementary::opening(input, nbh)); mln_postcondition(test::positive(output)); + trace::exiting("morpho::elementary::top_hat_white"); return output; } + template <typename I, typename N> inline mln_concrete(I) - top_hat_black(const Image<I>& input, - const Neighborhood<N>& nbh) + top_hat_black(const Image<I>& input, const Neighborhood<N>& nbh) { trace::entering("morpho::elementary::top_hat_black"); + mln_precondition(exact(input).is_valid()); mln_precondition(exact(nbh).is_valid()); - mln_concrete(I) output = morpho::minus(closing(input, nbh), + mln_concrete(I) output = morpho::minus(elementary::closing(input, nbh), input); mln_postcondition(test::positive(output)); + trace::exiting("morpho::elementary::top_hat_black"); return output; } + template <typename I, typename N> inline mln_concrete(I) - top_hat_self_complementary(const Image<I>& input, - const Neighborhood<N>& nbh) + top_hat_self_complementary(const Image<I>& input, const Neighborhood<N>& nbh) { trace::entering("morpho::elementary::top_hat_self_complementary"); mln_precondition(exact(input).is_valid()); mln_precondition(exact(nbh).is_valid()); - mln_concrete(I) output = morpho::minus(closing(input, nbh), - opening(input, nbh)); + mln_concrete(I) output = morpho::minus(elementary::closing(input, nbh), + elementary::opening(input, nbh)); mln_postcondition(test::positive(output)); // mln_postcondition(output == white + black); + trace::exiting("morpho::elementary::top_hat_self_complementary"); return output; } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::morpho::elementary Index: mln/morpho/elementary/opening.hh --- mln/morpho/elementary/opening.hh (revision 3461) +++ mln/morpho/elementary/opening.hh (working copy) @@ -49,6 +49,7 @@ /// Morphological elementary opening. /// /// This operator is d o e. + // template <typename I, typename N> mln_concrete(I) opening(const Image<I>& input, const Neighborhood<N>& nbh); @@ -67,6 +68,7 @@ mln_concrete(I) output = dilation(erosion(input, nbh), nbh); mln_postcondition(output <= input); + trace::exiting("morpho::elementary::opening"); return output; } Index: mln/morpho/all.hh --- mln/morpho/all.hh (revision 3461) +++ mln/morpho/all.hh (working copy) @@ -56,7 +56,6 @@ } -# include <mln/morpho/closing.hh> # include <mln/morpho/complementation.hh> # include <mln/morpho/contrast.hh> # include <mln/morpho/dilation.hh> @@ -69,7 +68,6 @@ # include <mln/morpho/meyer_wst.hh> # include <mln/morpho/min.hh> # include <mln/morpho/minus.hh> -# include <mln/morpho/opening.hh> # include <mln/morpho/plus.hh> # include <mln/morpho/Rd.hh> # include <mln/morpho/rank_filter.hh> Index: mln/morpho/top_hat.hh --- mln/morpho/top_hat.hh (revision 3461) +++ mln/morpho/top_hat.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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 @@ -28,15 +29,14 @@ #ifndef MLN_MORPHO_TOP_HAT_HH # define MLN_MORPHO_TOP_HAT_HH -/*! \file mln/morpho/top_hat.hh - * - * \brief Morphological top-hats. - * - * \todo Save memory. - */ +/// \file mln/morpho/top_hat.hh +/// +/// Morphological top-hats. +/// +/// \todo Save memory. -# include <mln/morpho/opening.hh> -# include <mln/morpho/closing.hh> +# include <mln/morpho/opening/structural.hh> +# include <mln/morpho/closing/structural.hh> namespace mln @@ -45,86 +45,99 @@ namespace morpho { - /*! Morphological white top-hat (for object / light objects). - * - * This operator is Id - ope_B. - */ + + /// Morphological white top-hat (for object / light objects). + /// + /// This operator is Id - ope_B. + // template <typename I, typename W> mln_concrete(I) top_hat_white(const Image<I>& input, const Window<W>& win); - /*! Morphological black top-hat (for background / dark objects). - * - * This operator is clo_B - Id. - */ + /// Morphological black top-hat (for background / dark objects). + /// + /// This operator is clo_B - Id. + // template <typename I, typename W> mln_concrete(I) top_hat_black(const Image<I>& input, const Window<W>& win); - /*! Morphological self-complementary top-hat. - * - * This operator is \n - * = top_hat_white + top_hat_black \n - * = (input - opening) + (closing - input) \n - * = closing - opening. \n - */ + /// Morphological self-complementary top-hat. + /// + /// This operator is \n + /// = top_hat_white + top_hat_black \n + /// = (input - opening) + (closing - input) \n + /// = closing - opening. \n + // template <typename I, typename W> mln_concrete(I) top_hat_self_complementary(const Image<I>& input, const Window<W>& win); + # ifndef MLN_INCLUDE_ONLY + template <typename I, typename W> inline - mln_concrete(I) top_hat_white(const Image<I>& input, const Window<W>& win) + mln_concrete(I) + top_hat_white(const Image<I>& input, const Window<W>& win) { trace::entering("morpho::top_hat_white"); + mln_precondition(exact(input).is_valid()); mln_precondition(! exact(win).is_empty()); mln_concrete(I) output = morpho::minus(input, - opening(input, win)); + opening::structural(input, win)); mln_postcondition(test::positive(output)); + trace::exiting("morpho::top_hat_white"); return output; } + template <typename I, typename W> inline mln_concrete(I) top_hat_black(const Image<I>& input, const Window<W>& win) { trace::entering("morpho::top_hat_black"); + mln_precondition(exact(input).is_valid()); mln_precondition(! exact(win).is_empty()); - mln_concrete(I) output = morpho::minus(closing(input, win), + mln_concrete(I) output = morpho::minus(closing::structural(input, win), input); mln_postcondition(test::positive(output)); + trace::exiting("morpho::top_hat_black"); return output; } + template <typename I, typename W> inline mln_concrete(I) top_hat_self_complementary(const Image<I>& input, const Window<W>& win) { trace::entering("morpho::top_hat_self_complementary"); + mln_precondition(exact(input).is_valid()); mln_precondition(! exact(win).is_empty()); - mln_concrete(I) output = morpho::minus(closing(input, win), - opening(input, win)); + mln_concrete(I) output = morpho::minus(closing::structural(input, win), + opening::structural(input, win)); mln_postcondition(test::positive(output)); + trace::exiting("morpho::top_hat_self_complementary"); return output; } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::morpho Index: mln/morpho/opening/all.hh --- mln/morpho/opening/all.hh (revision 3461) +++ mln/morpho/opening/all.hh (working copy) @@ -1,5 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory -// (LRDE) +// 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 @@ -31,14 +30,17 @@ /// \file mln/morpho/opening/all.hh /// -/// File that includes all opening attributes. +/// File that includes all opening operators. + #include <mln/morpho/opening/algebraic.hh> -#include <mln/morpho/opening/leveling.hh> -#include <mln/morpho/opening/area_on_vertices.hh> #include <mln/morpho/opening/area.hh> -#include <mln/morpho/opening/volume.hh> +#include <mln/morpho/opening/area_on_vertices.hh> #include <mln/morpho/opening/height.hh> +#include <mln/morpho/opening/leveling.hh> +#include <mln/morpho/opening/structural.hh> +#include <mln/morpho/opening/volume.hh> + #endif // ! MLN_MORPHO_OPENING_ALL_HH Index: mln/morpho/opening/structural.hh --- mln/morpho/opening/structural.hh (revision 3461) +++ mln/morpho/opening/structural.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// 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 @@ -26,12 +26,12 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_MORPHO_OPENING_HH -# define MLN_MORPHO_OPENING_HH +#ifndef MLN_MORPHO_OPENING_STRUCTURAL_HH +# define MLN_MORPHO_OPENING_STRUCTURAL_HH -/// \file mln/morpho/opening.hh +/// \file mln/morpho/opening/structural.hh /// -/// Morphological opening. +/// Morphological structural opening. # include <mln/morpho/includes.hh> @@ -42,37 +42,47 @@ namespace morpho { - /// Morphological opening. + namespace opening + { + + /// Morphological structural opening. /// /// This operator is d_{-B} o e_B. template <typename I, typename W> - mln_concrete(I) opening(const Image<I>& input, const Window<W>& win); + mln_concrete(I) + structural(const Image<I>& input, const Window<W>& win); + # ifndef MLN_INCLUDE_ONLY + template <typename I, typename W> inline - mln_concrete(I) opening(const Image<I>& input, const Window<W>& win) + mln_concrete(I) + structural(const Image<I>& input, const Window<W>& win) { - trace::entering("morpho::opening"); + trace::entering("morpho::opening::structural"); + mln_precondition(exact(input).is_valid()); mln_precondition(! exact(win).is_empty()); mln_concrete(I) output = dilation(erosion(input, win), win::sym(win)); - // FIXME: Is this postcondition always true, even if the - // structuring element is not centered? mln_postcondition(output <= input); - trace::exiting("morpho::opening"); + + trace::exiting("morpho::opening::structural"); 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_HH +#endif // ! MLN_MORPHO_OPENING_STRUCTURAL_HH Property changes on: mln/morpho/opening/structural.hh ___________________________________________________________________ Added: svn:mergeinfo
participants (1)
-
Thierry Geraud