* milena/mln/morpho/closing.hh,
* milena/mln/morpho/closing_area_on_vertices.hh,
* milena/mln/morpho/opening.hh,
* milena/mln/morpho/opening_area.hh,
* milena/mln/morpho/opening_area_on_vertices.hh,
* milena/mln/morpho/opening_attribute.hh,
* milena/mln/morpho/opening_height.hh,
* milena/mln/morpho/opening_volume.hh: return an image instead of
taking the output by argument.
* milena/tests/morpho/opening_area.cc,
* milena/tests/morpho/opening_height.cc,
* milena/tests/morpho/opening_volume.cc: update tests.
---
milena/ChangeLog | 18 +++++++++++++
milena/mln/morpho/closing.hh | 18 +++++++-------
milena/mln/morpho/closing_area_on_vertices.hh | 30 ++++++++++++++--------
milena/mln/morpho/opening.hh | 17 ++++++-------
milena/mln/morpho/opening_area.hh | 33 +++++++++++++++----------
milena/mln/morpho/opening_area_on_vertices.hh | 27 +++++++++++++-------
milena/mln/morpho/opening_attribute.hh | 28 ++++++++++++++-------
milena/mln/morpho/opening_height.hh | 28 +++++++++++++-------
milena/mln/morpho/opening_volume.hh | 28 +++++++++++++-------
milena/tests/morpho/opening_area.cc | 9 +++----
milena/tests/morpho/opening_height.cc | 5 ++-
milena/tests/morpho/opening_volume.cc | 5 ++-
12 files changed, 156 insertions(+), 90 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 114753f..a4bb060 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,21 @@
+2008-12-16 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Cleanup morpho.
+
+ * milena/mln/morpho/closing.hh,
+ * milena/mln/morpho/closing_area_on_vertices.hh,
+ * milena/mln/morpho/opening.hh,
+ * milena/mln/morpho/opening_area.hh,
+ * milena/mln/morpho/opening_area_on_vertices.hh,
+ * milena/mln/morpho/opening_attribute.hh,
+ * milena/mln/morpho/opening_height.hh,
+ * milena/mln/morpho/opening_volume.hh: return an image instead of
+ taking the output by argument.
+
+ * milena/tests/morpho/opening_area.cc,
+ * milena/tests/morpho/opening_height.cc,
+ * milena/tests/morpho/opening_volume.cc: update tests.
+
2008-12-15 Alexandre Abraham <abraham(a)lrde.epita.fr>
Add missing concept for bijective functions.
diff --git a/milena/mln/morpho/closing.hh b/milena/mln/morpho/closing.hh
index 932186c..e275760 100644
--- a/milena/mln/morpho/closing.hh
+++ b/milena/mln/morpho/closing.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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,10 +29,9 @@
#ifndef MLN_MORPHO_CLOSING_HH
# define MLN_MORPHO_CLOSING_HH
-/*! \file mln/morpho/closing.hh
- *
- * \brief Morphological closing.
- */
+/// \file mln/morpho/closing.hh
+///
+/// Morphological closing.
# include <mln/morpho/includes.hh>
@@ -42,10 +42,10 @@ namespace mln
namespace morpho
{
- /*! Morphological closing.
- *
- * This operator is e_{-B} o d_B.
- */
+ /// 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);
diff --git a/milena/mln/morpho/closing_area_on_vertices.hh
b/milena/mln/morpho/closing_area_on_vertices.hh
index 7af8e6e..cfaf955 100644
--- a/milena/mln/morpho/closing_area_on_vertices.hh
+++ b/milena/mln/morpho/closing_area_on_vertices.hh
@@ -47,25 +47,33 @@ namespace mln
/// Morphological area closing on a mln::line_graph_image computing
/// the area in terms of adjacent vertices.
- template <typename P2V, typename G, typename V2P, typename N, typename O>
- void closing_area_on_vertices(const pw::image<P2V, p_edges<G, V2P> >&
input,
- const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output);
+ template <typename P2V, typename G, typename V2P, typename N>
+ pw::image<P2V, p_edges<G, V2P> >
+ closing_area_on_vertices(const pw::image<P2V, p_edges<G, V2P> >&
input,
+ const Neighborhood<N>& nbh,
+ unsigned lambda);
# ifndef MLN_INCLUDE_ONLY
- template <typename P2V, typename G, typename V2P, typename N, typename O>
+ template <typename P2V, typename G, typename V2P, typename N>
inline
- void closing_area_on_vertices(const pw::image<P2V, p_edges<G, V2P> >&
input,
- const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output)
+ pw::image<P2V, p_edges<G, V2P> >
+ closing_area_on_vertices(const pw::image<P2V, p_edges<G, V2P> >&
input,
+ const Neighborhood<N>& nbh,
+ unsigned lambda)
{
- mln_precondition(exact(output).domain() == exact(input).domain());
+ trace::entering("morpho::closing_area_on_vertices");
+ mln_precondition(exact(input).has_data());
+
typedef p_edges<G, V2P> pe_t;
typedef accu::count_adjacent_vertices<P2V, pe_t> attribute_t;
- // FIXME: Change sig of closing_attribute!
- closing_attribute<attribute_t>(input, nbh, lambda, output);
+
+ pw::image<P2V, p_edges<G, V2P> > output;
+ output = closing_attribute<attribute_t>(input, nbh, lambda);
+
+ trace::exiting("morpho::closing_area_on_vertices");
+ return output;
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/opening.hh b/milena/mln/morpho/opening.hh
index d3204ff..7691f4a 100644
--- a/milena/mln/morpho/opening.hh
+++ b/milena/mln/morpho/opening.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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,10 +29,9 @@
#ifndef MLN_MORPHO_OPENING_HH
# define MLN_MORPHO_OPENING_HH
-/*! \file mln/morpho/opening.hh
- *
- * \brief Morphological opening.
- */
+/// \file mln/morpho/opening.hh
+///
+/// Morphological opening.
# include <mln/morpho/includes.hh>
@@ -42,10 +42,9 @@ namespace mln
namespace morpho
{
- /*! Morphological opening.
- *
- * This operator is d_{-B} o e_B.
- */
+ /// 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);
diff --git a/milena/mln/morpho/opening_area.hh b/milena/mln/morpho/opening_area.hh
index d400b22..211af4c 100644
--- a/milena/mln/morpho/opening_area.hh
+++ b/milena/mln/morpho/opening_area.hh
@@ -29,10 +29,9 @@
#ifndef MLN_MORPHO_OPENING_AREA_HH
# define MLN_MORPHO_OPENING_AREA_HH
-/*! \file mln/morpho/opening_area.hh
- *
- * \brief Morphological area opening.
- */
+/// \file mln/morpho/opening_area.hh
+///
+/// Morphological area opening.
# include <mln/morpho/opening_attribute.hh>
# include <mln/accu/count.hh>
@@ -45,22 +44,30 @@ namespace mln
{
/// Morphological area opening.
- template <typename I, typename N, typename O>
- void opening_area(const Image<I>& input, const Neighborhood<N>&
nbh,
- unsigned lambda, Image<O>& output);
+ template <typename I, typename N>
+ mln_concrete(I)
+ opening_area(const Image<I>& input, const Neighborhood<N>& nbh,
+ unsigned lambda);
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename N, typename O>
+ template <typename I, typename N>
inline
- void opening_area(const Image<I>& input, const Neighborhood<N>&
nbh,
- unsigned lambda, Image<O>& output)
+ mln_concrete(I)
+ opening_area(const Image<I>& input, const Neighborhood<N>& nbh,
+ unsigned lambda)
{
- mln_precondition(exact(output).domain() == exact(input).domain());
+ trace::entering("morpho::opening_area");
typedef util::pix<I> pix_t;
- // FIXME: Change sig of opening_attribute!
- opening_attribute< accu::count<pix_t> >(input, nbh, lambda, output);
+
+ mln_precondition(exact(input).has_data());
+
+ mln_concrete(I) output;
+ output= opening_attribute< accu::count<pix_t> >(input, nbh, lambda);
+
+ trace::exiting("morpho::opening_area");
+ return output;
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/opening_area_on_vertices.hh
b/milena/mln/morpho/opening_area_on_vertices.hh
index b8e420e..5b080e7 100644
--- a/milena/mln/morpho/opening_area_on_vertices.hh
+++ b/milena/mln/morpho/opening_area_on_vertices.hh
@@ -48,25 +48,32 @@ namespace mln
/// Morphological area opening on a mln::line_graph_image computing
/// the area in terms of adjacent vertices.
- template <typename P2V, typename G, typename V2P, typename N, typename O>
- void opening_area_on_vertices(const pw::image<P2V, p_edges<G, V2P> >&
input,
- const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output);
+ template <typename P2V, typename G, typename V2P, typename N>
+ pw::image<P2V, p_edges<G, V2P> >
+ opening_area_on_vertices(const pw::image<P2V, p_edges<G, V2P> >&
input,
+ const Neighborhood<N>& nbh);
# ifndef MLN_INCLUDE_ONLY
- template <typename P2V, typename G, typename V2P, typename N, typename O>
- inline
+ template <typename P2V, typename G, typename V2P, typename N>
+ pw::image<P2V, p_edges<G, V2P> >
void opening_area_on_vertices(const pw::image<P2V, p_edges<G, V2P> >&
input,
const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output)
+ unsigned lambda)
{
- mln_precondition(exact(output).domain() == exact(input).domain());
+ trace::entering("morpho::opening_area_on_vertices");
+
+ mln_precondition(exact(input).has_data());
+
typedef p_edges<G, V2P> pe_t;
typedef accu::count_adjacent_vertices<P2V, pe_t> attribute_t;
- // FIXME: Change sig of opening_attribute!
- opening_attribute<attribute_t>(input, nbh, lambda, output);
+
+ pw::image<P2V, p_edges<G, V2P> > output;
+ output = opening_attribute<attribute_t>(input, nbh, lambda);
+
+ trace::exiting("morpho::opening_area_on_vertices");
+ return output;
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/opening_attribute.hh
b/milena/mln/morpho/opening_attribute.hh
index 7d9daa5..97dc514 100644
--- a/milena/mln/morpho/opening_attribute.hh
+++ b/milena/mln/morpho/opening_attribute.hh
@@ -30,7 +30,8 @@
# define MLN_MORPHO_OPENING_ATTRIBUTE_HH
/// \file mln/morpho/opening_attribute.hh
-/// \brief Morphological attribute opening.
+///
+/// Morphological attribute opening.
# include <mln/morpho/includes.hh>
# include <mln/canvas/morpho/algebraic_union_find.hh>
@@ -46,9 +47,10 @@ namespace mln
/// Morphological attribute opening.
template <typename A,
- typename I, typename N, typename O>
- void opening_attribute(const Image<I>& input, const
Neighborhood<N>& nbh,
- mln_result(A) lambda, Image<O>& output);
+ typename I, typename N>
+ mln_concrete(I)
+ opening_attribute(const Image<I>& input, const Neighborhood<N>&
nbh,
+ mln_result(A) lambda);
# ifndef MLN_INCLUDE_ONLY
@@ -100,18 +102,26 @@ namespace mln
} // end of namespace mln::morpho::impl
- template <typename A,
- typename I, typename N, typename O>
+ template <typename A, typename I, typename N>
inline
- void opening_attribute(const Image<I>& input,
- const Neighborhood<N>& nbh, mln_result(A) lambda,
- Image<O>& output)
+ mln_concrete(I)
+ opening_attribute(const Image<I>& input,
+ const Neighborhood<N>& nbh, mln_result(A) lambda)
{
+ trace::entering("morpho::opening_attribute");
+
+ mln_precondition(exact(input).has_data());
+
+ mln_concrete(I) output;
+ initialize(output, input);
+
typedef impl::opening_attribute_t<I, A> F;
F f(input, lambda);
canvas::morpho::algebraic_union_find(input, nbh, f, output);
mln_postcondition(output <= input);
+ trace::exiting("morpho::opening_attribute");
+ return output;
}
diff --git a/milena/mln/morpho/opening_height.hh b/milena/mln/morpho/opening_height.hh
index 726547e..36ace8f 100644
--- a/milena/mln/morpho/opening_height.hh
+++ b/milena/mln/morpho/opening_height.hh
@@ -30,7 +30,8 @@
# define MLN_MORPHO_OPENING_HEIGHT_HH
/// \file mln/morpho/opening_height.hh
-/// \brief Morphological height opening.
+///
+/// Morphological height opening.
# include <mln/morpho/opening_attribute.hh>
# include <mln/accu/height.hh>
@@ -43,21 +44,28 @@ namespace mln
{
/// Morphological height opening.
- template <typename I, typename N, typename O>
- void opening_height(const Image<I>& input, const Neighborhood<N>&
nbh,
- unsigned lambda, Image<O>& output);
+ template <typename I, typename N>
+ mln_concrete(I)
+ opening_height(const Image<I>& input, const Neighborhood<N>&
nbh,
+ unsigned lambda);
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename N, typename O>
+ template <typename I, typename N>
inline
- void opening_height(const Image<I>& input, const Neighborhood<N>&
nbh,
- unsigned lambda, Image<O>& output)
+ mln_concrete(I)
+ opening_height(const Image<I>& input, const Neighborhood<N>&
nbh,
+ unsigned lambda)
{
- mln_precondition(exact(output).domain() == exact(input).domain());
- // FIXME: Change sig of opening_attribute!
- opening_attribute< accu::height<I> >(input, nbh, lambda, output);
+ trace::entering("morpho::opening_height");
+ mln_precondition(exact(input).has_data());
+
+ mln_concrete(I) output;
+ output = opening_attribute< accu::height<I> >(input, nbh, lambda);
+
+ trace::exiting("morpho::opening_height");
+ return output;
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/opening_volume.hh b/milena/mln/morpho/opening_volume.hh
index e6ad080..127ae2c 100644
--- a/milena/mln/morpho/opening_volume.hh
+++ b/milena/mln/morpho/opening_volume.hh
@@ -30,7 +30,8 @@
# define MLN_MORPHO_OPENING_VOLUME_HH
/// \file mln/morpho/opening_volume.hh
-/// \brief Morphological volume opening.
+///
+/// Morphological volume opening.
# include <mln/morpho/opening_attribute.hh>
# include <mln/accu/volume.hh>
@@ -43,21 +44,28 @@ namespace mln
{
/// Morphological volume opening.
- template <typename I, typename N, typename O>
- void opening_volume(const Image<I>& input, const Neighborhood<N>&
nbh,
- unsigned lambda, Image<O>& output);
+ template <typename I, typename N>
+ mln_concrete(I)
+ opening_volume(const Image<I>& input, const Neighborhood<N>&
nbh,
+ unsigned lambda);
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename N, typename O>
+ template <typename I, typename N>
inline
- void opening_volume(const Image<I>& input, const Neighborhood<N>&
nbh,
- unsigned lambda, Image<O>& output)
+ mln_concrete(I)
+ opening_volume(const Image<I>& input, const Neighborhood<N>&
nbh,
+ unsigned lambda)
{
- mln_precondition(exact(output).domain() == exact(input).domain());
- // FIXME: Change sig of opening_attribute!
- opening_attribute< accu::volume<I> >(input, nbh, lambda, output);
+ trace::entering("morpho::opening_volume");
+ mln_precondition(exact(input).has_data());
+
+ mln_concrete(I) output;
+ output = opening_attribute< accu::volume<I> >(input, nbh, lambda);
+
+ trace::exiting("morpho::opening_volume");
+ return output;
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/tests/morpho/opening_area.cc b/milena/tests/morpho/opening_area.cc
index 13a3955..9ae0e56 100644
--- a/milena/tests/morpho/opening_area.cc
+++ b/milena/tests/morpho/opening_area.cc
@@ -25,10 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/morpho/opening_area.cc
- *
- * \brief Test on mln::morpho::opening_area.
- */
+/// \file tests/morpho/opening_area.cc
+///
+/// Test on mln::morpho::opening_area.
#include <mln/core/image/image2d.hh>
#include <mln/value/int_u8.hh>
@@ -52,6 +51,6 @@ int main()
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
image2d<int_u8> out(lena.domain());
- morpho::opening_area(lena, c4(), 510, out);
+ out = morpho::opening_area(lena, c4(), 510);
io::pgm::save(out, "out.pgm");
}
diff --git a/milena/tests/morpho/opening_height.cc
b/milena/tests/morpho/opening_height.cc
index c834fea..8080425 100644
--- a/milena/tests/morpho/opening_height.cc
+++ b/milena/tests/morpho/opening_height.cc
@@ -26,7 +26,8 @@
// Public License.
/// \file tests/morpho/opening_height.cc
-/// \brief Test on mln::morpho::opening_height.
+///
+/// Test on mln::morpho::opening_height.
#include <mln/core/image/image2d.hh>
#include <mln/value/int_u8.hh>
@@ -48,6 +49,6 @@ int main()
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
image2d<int_u8> out(lena.domain());
- morpho::opening_height(lena, c4(), 20, out);
+ out = morpho::opening_height(lena, c4(), 20);
io::pgm::save(out, "out.pgm");
}
diff --git a/milena/tests/morpho/opening_volume.cc
b/milena/tests/morpho/opening_volume.cc
index 75d03e0..0ccae72 100644
--- a/milena/tests/morpho/opening_volume.cc
+++ b/milena/tests/morpho/opening_volume.cc
@@ -26,7 +26,8 @@
// Public License.
/// \file tests/morpho/opening_volume.cc
-/// \brief Test on mln::morpho::opening_volume.
+///
+/// Test on mln::morpho::opening_volume.
#include <mln/core/image/image2d.hh>
#include <mln/value/int_u8.hh>
@@ -48,6 +49,6 @@ int main()
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
image2d<int_u8> out(lena.domain());
- morpho::opening_volume(lena, c4(), 10000, out);
+ out = morpho::opening_volume(lena, c4(), 10000);
io::pgm::save(out, "out.pgm");
}
--
1.5.6.5