Commit 01250843 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

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.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3462 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 1256c976
2009-03-03 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.
2009-03-03 Thierry Geraud <thierry.geraud@lrde.epita.fr>
 
Print dimension in op<<(win::ball).
......@@ -56,7 +56,6 @@ namespace mln
}
# include <mln/morpho/closing.hh>
# include <mln/morpho/complementation.hh>
# include <mln/morpho/contrast.hh>
# include <mln/morpho/dilation.hh>
......@@ -69,7 +68,6 @@ namespace mln
# 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>
......
// 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
// 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_CLOSING_STRUCTURAL_HH
# define MLN_MORPHO_CLOSING_STRUCTURAL_HH
/// \file mln/morpho/opening.hh
/// \file mln/morpho/closing/structural.hh
///
/// Morphological opening.
/// Morphological structural closing.
# include <mln/morpho/includes.hh>
......@@ -42,37 +42,48 @@ namespace mln
namespace morpho
{
/// Morphological 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);
namespace closing
{
/// Morphological structural closing.
///
/// This operator is e_{-B} o d_B.
///
template <typename I, typename W>
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)
{
trace::entering("morpho::opening");
mln_precondition(exact(input).is_valid());
mln_precondition(! exact(win).is_empty());
mln_concrete(I) output = dilation(erosion(input, win), win::sym(win));
template <typename I, typename W>
inline
mln_concrete(I)
structural(const Image<I>& input, const Window<W>& win)
{
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::structural");
return output;
}
// FIXME: Is this postcondition always true, even if the
// structuring element is not centered?
mln_postcondition(output <= input);
trace::exiting("morpho::opening");
return output;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::morpho::closing
} // end of namespace mln::morpho
} // end of namespace mln
#endif // ! MLN_MORPHO_OPENING_HH
#endif // ! MLN_MORPHO_CLOSING_STRUCTURAL_HH
......@@ -49,6 +49,7 @@ namespace mln
/// 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 @@ namespace mln
mln_concrete(I) output = erosion(dilation(input, nbh), nbh);
mln_postcondition(output >= input);
trace::exiting("morpho::elementary::closing");
return output;
}
......
......@@ -49,6 +49,7 @@ namespace mln
/// 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 @@ namespace mln
mln_concrete(I) output = dilation(erosion(input, nbh), nbh);
mln_postcondition(output <= input);
trace::exiting("morpho::elementary::opening");
return output;
}
......
......@@ -49,31 +49,31 @@ namespace mln
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 @@ namespace mln
# 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
......
// 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
// 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_OPENING_STRUCTURAL_HH
# define MLN_MORPHO_OPENING_STRUCTURAL_HH
/// \file mln/morpho/closing.hh
/// \file mln/morpho/opening/structural.hh
///
/// Morphological closing.
/// Morphological structural opening.
# include <mln/morpho/includes.hh>
......@@ -42,36 +42,47 @@ namespace mln
namespace morpho
{
/// Morphological 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);
namespace opening
{
/// Morphological structural opening.
///
/// This operator is d_{-B} o e_B.
template <typename I, typename W>
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)
{
trace::entering("morpho::closing");
mln_precondition(exact(input).is_valid());
mln_precondition(! exact(win).is_empty());
mln_concrete(I) output = erosion(dilation(input, win), win::sym(win));
template <typename I, typename W>
inline
mln_concrete(I)
structural(const Image<I>& input, const Window<W>& win)
{
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));
mln_postcondition(output <= input);
trace::exiting("morpho::opening::structural");
return output;
}
mln_postcondition(output >= input);
trace::exiting("morpho::closing");
return output;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::morpho::opening
} // end of namespace mln::morpho
} // end of namespace mln
#endif // ! MLN_MORPHO_CLOSING_HH
#endif // ! MLN_MORPHO_OPENING_STRUCTURAL_HH
// 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 mln
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);
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);
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);
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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment