[PATCH 10/19] Add impl::combine for mln::bin_1complex_image2d.

* apps/graph-morpho/morpho.hh (combine(const bin_1complex_image2d&, const bin_1complex_image2d&)): New function. --- milena/ChangeLog | 8 ++++++++ milena/apps/graph-morpho/morpho.hh | 31 ++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 68b7d0c..667b4bc 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,13 @@ 2009-09-21 Roland Levillain <roland@lrde.epita.fr> + Add impl::combine for mln::bin_1complex_image2d. + + * apps/graph-morpho/morpho.hh + (combine(const bin_1complex_image2d&, const bin_1complex_image2d&)): + New function. + +2009-09-21 Roland Levillain <roland@lrde.epita.fr> + Deconstruction of image2d-based complex images. * apps/graph-morpho/make_complex2d.hh (unmake_complex2d): diff --git a/milena/apps/graph-morpho/morpho.hh b/milena/apps/graph-morpho/morpho.hh index ee21814..f23fc59 100644 --- a/milena/apps/graph-morpho/morpho.hh +++ b/milena/apps/graph-morpho/morpho.hh @@ -36,7 +36,7 @@ International Symposium on Mathematical Morphology (ISMM), 2009, Groningen, The Netherlands. */ -# include <mln/core/concept/image.hh> +# include <mln/core/alias/complex_image.hh> # include <mln/core/routine/duplicate.hh> @@ -49,6 +49,35 @@ | Vertices-edges combinator. | `----------------------------*/ +namespace impl +{ + // ------------------------------------------ // + // Implementations on (general) 2-complexes. // + // ------------------------------------------ // + + /// Combine the vertices and the edges of two + /// mln::bin_1complex_image2d images to create a new graph image + /// (``operator'' \f$\ovee\f$) + inline + mln::bin_1complex_image2d + combine(const mln::bin_1complex_image2d& vertices, + const mln::bin_1complex_image2d& edges) + { + mln_precondition(vertices.domain() == edges.domain()); + + mln::bin_1complex_image2d output; + mln::initialize(output, vertices); + typedef mln_geom_(mln::bin_1complex_image2d) geom_t; + mln::p_n_faces_fwd_piter<1, geom_t> v(output.domain(), 0); + for_all(v) + output(v) = vertices(v); + mln::p_n_faces_fwd_piter<1, geom_t> e(output.domain(), 1); + for_all(e) + output(e) = edges(e); + return output; + } +} + /// Combine the vertices and the edges of two images to create a new /// graph image (``operator'' \f$\ovee\f$). template <typename I> -- 1.6.4.2
participants (1)
-
Roland Levillain