Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
* mln/accu/count_adjacent_vertices.hh: make it work with the
new graph images.
* mln/accu/median_alt.hh: fix compilation issue.
* mln/util/multi_site.hh,
* mln/util/vertex.hh,
* mln/util/internal/graph_nbh_iter.hh,
* mln/core/internal/pixel_impl.hh,
* mln/core/internal/set_of.hh,
* mln/core/site_set/box_piter.hh,
* mln/core/site_set/p_centered.hh,
* mln/fun/p2b/has.hh,
* mln/fun/x2p/closest_point.hh,
* mln/geom/seeds2tiling_roundness.hh,
* mln/io/txt/save.hh,
* mln/metal/vec.hh,
* mln/morpho/internal/elementary.hh,
* mln/morpho/tree/data.hh,
* mln/registration/get_rot.hh,
* mln/registration/get_rtransf.hh,
* mln/registration/multiscale.hh,
* mln/topo/face.hh,
* mln/topo/face_iter.hh,
* mln/topo/n_face.hh,
* mln/trait/op/ord.hh,
* mln/util/edge.hh,
* mln/core/dpoints_pixter.hh,
* mln/core/internal/check/image_all.hh,
* mln/core/internal/check/image_fastest.hh,
* mln/core/internal/graph_neighborhood_base.hh,
* mln/core/internal/graph_window_base.hh,
* mln/core/concept/graph.hh,
* mln/canvas/browsing/snake_generic.hh,
* mln/accu/rank_high_quant.hh: fix includes.
* mln/border/resize.hh: avoid a warning.
* mln/core/internal/image_if_base.hh: removed since it is unused and
not updated.
* mln/util/internal/graph_edge_impl.hh: rename as...
* mln/util/internal/edge_impl.hh: ... this.
* mln/util/internal/graph_vertex_impl.hh: rename as...
* mln/util/internal/vertex_impl.hh: ... this.
* tests/morpho/Makefile.am: disable more tests.
* tests/unit_test/build_unit_test.sh: do not include mln/core/doc
headers.
---
milena/ChangeLog | 57 ++++++
milena/mln/accu/count_adjacent_vertices.hh | 56 +++---
milena/mln/accu/median_alt.hh | 12 +-
milena/mln/accu/rank_high_quant.hh | 2 +-
milena/mln/border/resize.hh | 2 +
milena/mln/canvas/browsing/snake_generic.hh | 1 +
milena/mln/core/concept/graph.hh | 2 +
milena/mln/core/dpoints_pixter.hh | 1 +
milena/mln/core/internal/check/image_all.hh | 10 +-
milena/mln/core/internal/check/image_fastest.hh | 45 +++--
.../mln/core/internal/graph_neighborhood_base.hh | 3 +
milena/mln/core/internal/graph_window_base.hh | 1 +
milena/mln/core/internal/image_if_base.hh | 202 --------------------
milena/mln/core/internal/pixel_impl.hh | 24 +--
milena/mln/core/internal/set_of.hh | 10 +-
milena/mln/core/site_set/box_piter.hh | 49 +++---
milena/mln/core/site_set/p_centered.hh | 1 +
milena/mln/fun/p2b/has.hh | 10 +-
milena/mln/fun/x2p/closest_point.hh | 3 +-
milena/mln/geom/seeds2tiling_roundness.hh | 10 +-
milena/mln/io/txt/save.hh | 25 +--
milena/mln/metal/vec.hh | 12 +-
milena/mln/morpho/internal/elementary.hh | 1 +
milena/mln/morpho/tree/data.hh | 2 +-
milena/mln/registration/get_rot.hh | 3 +
milena/mln/registration/get_rtransf.hh | 3 +
milena/mln/registration/multiscale.hh | 4 +
milena/mln/topo/face.hh | 9 +-
milena/mln/topo/face_iter.hh | 1 +
milena/mln/topo/n_face.hh | 10 +-
milena/mln/trait/op/ord.hh | 2 +-
milena/mln/util/edge.hh | 4 +-
.../internal/{graph_edge_impl.hh => edge_impl.hh} | 8 +-
milena/mln/util/internal/graph_nbh_iter.hh | 2 +
.../{graph_vertex_impl.hh => vertex_impl.hh} | 8 +-
milena/mln/util/multi_site.hh | 1 +
milena/mln/util/vertex.hh | 5 +-
milena/tests/morpho/Makefile.am | 8 +-
milena/tests/unit_test/build_unit_test.sh | 2 +-
39 files changed, 247 insertions(+), 364 deletions(-)
delete mode 100644 milena/mln/core/internal/image_if_base.hh
rename milena/mln/util/internal/{graph_edge_impl.hh => edge_impl.hh} (91%)
rename milena/mln/util/internal/{graph_vertex_impl.hh => vertex_impl.hh} (91%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 3b7e923..7416910 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,60 @@
+2008-11-28 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix more tests.
+
+ * mln/accu/count_adjacent_vertices.hh: make it work with the
+new graph images.
+
+ * mln/accu/median_alt.hh: fix compilation issue.
+
+ * mln/util/multi_site.hh,
+ * mln/util/vertex.hh,
+ * mln/util/internal/graph_nbh_iter.hh,
+ * mln/core/internal/pixel_impl.hh,
+ * mln/core/internal/set_of.hh,
+ * mln/core/site_set/box_piter.hh,
+ * mln/core/site_set/p_centered.hh,
+ * mln/fun/p2b/has.hh,
+ * mln/fun/x2p/closest_point.hh,
+ * mln/geom/seeds2tiling_roundness.hh,
+ * mln/io/txt/save.hh,
+ * mln/metal/vec.hh,
+ * mln/morpho/internal/elementary.hh,
+ * mln/morpho/tree/data.hh,
+ * mln/registration/get_rot.hh,
+ * mln/registration/get_rtransf.hh,
+ * mln/registration/multiscale.hh,
+ * mln/topo/face.hh,
+ * mln/topo/face_iter.hh,
+ * mln/topo/n_face.hh,
+ * mln/trait/op/ord.hh,
+ * mln/util/edge.hh,
+ * mln/core/dpoints_pixter.hh,
+ * mln/core/internal/check/image_all.hh,
+ * mln/core/internal/check/image_fastest.hh,
+ * mln/core/internal/graph_neighborhood_base.hh,
+ * mln/core/internal/graph_window_base.hh,
+ * mln/core/concept/graph.hh,
+ * mln/canvas/browsing/snake_generic.hh,
+ * mln/accu/rank_high_quant.hh: fix includes.
+
+ * mln/border/resize.hh: avoid a warning.
+
+ * mln/core/internal/image_if_base.hh: removed since it is unused and
+ not updated.
+
+ * mln/util/internal/graph_edge_impl.hh: rename as...
+ * mln/util/internal/edge_impl.hh: ... this.
+
+ * mln/util/internal/graph_vertex_impl.hh: rename as...
+ * mln/util/internal/vertex_impl.hh: ... this.
+
+ * tests/morpho/Makefile.am: disable more tests.
+
+ * tests/unit_test/build_unit_test.sh: do not include mln/core/doc
+ headers.
+
+
2008-11-28 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make morpho erosion rely on a general code.
diff --git a/milena/mln/accu/count_adjacent_vertices.hh b/milena/mln/accu/count_adjacent_vertices.hh
index 6d32509..164a150 100644
--- a/milena/mln/accu/count_adjacent_vertices.hh
+++ b/milena/mln/accu/count_adjacent_vertices.hh
@@ -31,11 +31,11 @@
/// \file mln/accu/count_adjacent_vertices.hh
/// Define an accumulator that counts the vertices adjacent to a
-/// set of line graph psite.
+/// set of p_edges psites.
# include <mln/accu/internal/base.hh>
# include <mln/core/concept/meta_accumulator.hh>
-# include <mln/core/image/line_graph_image.hh>
+# include <mln/pw/image.hh>
# include <mln/util/pix.hh>
namespace mln
@@ -45,20 +45,20 @@ namespace mln
{
/// Accumulator class counting the number of vertices
- /// adjacent to a set of mln::line_graph_psite (i.e., a set of
+ /// adjacent to a set of mln::p_edges_psite (i.e., a set of
/// edges).
///
- /// The type to be count is mln::util::pix< mln::line_graph_image<P, V> >
- /// where \p P and \p V are the parameters of this class.
+ /// The type to be count is mln::util::pix< pw::image<F, S> >
+ /// where \p F and \p S are the parameters of this class.
///
/// This accumulator is used by mln::closing_area_on_vertices and
/// mln::opening_area_on_vertices.
- template <typename P, typename V>
+ template <typename F, typename S>
struct count_adjacent_vertices
: public mln::accu::internal::base< unsigned,
- count_adjacent_vertices<P, V> >
+ count_adjacent_vertices<F,S> >
{
- typedef mln::util::pix< mln::line_graph_image<P, V> > argument;
+ typedef mln::util::pix< pw::image<F,S> > argument;
count_adjacent_vertices();
@@ -66,7 +66,7 @@ namespace mln
/// \{
void init();
void take(const argument& arg);
- void take(const count_adjacent_vertices<P, V>& other);
+ void take(const count_adjacent_vertices<F,S>& other);
/// Force the value of the counter to \a c.
void set_value(unsigned c);
@@ -83,7 +83,7 @@ namespace mln
/// The value of the counter.
unsigned count__;
/// The set of adjacent vertices.
- std::set<util::vertex_id> vertices_;
+ std::set<unsigned> vertices_;
};
@@ -94,10 +94,10 @@ namespace mln
struct count_adjacent_vertices
: public Meta_Accumulator< count_adjacent_vertices >
{
- template <typename P, typename V>
+ template <typename F, typename S>
struct with
{
- typedef accu::count_adjacent_vertices<P, V> ret;
+ typedef accu::count_adjacent_vertices<F,S> ret;
};
};
@@ -106,63 +106,63 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- template <typename P, typename V>
+ template <typename F, typename S>
inline
- count_adjacent_vertices<P, V>::count_adjacent_vertices()
+ count_adjacent_vertices<F,S>::count_adjacent_vertices()
{
init();
}
- template <typename P, typename V>
+ template <typename F, typename S>
inline
void
- count_adjacent_vertices<P, V>::init()
+ count_adjacent_vertices<F,S>::init()
{
vertices_.clear();
update_();
}
- template <typename P, typename V>
+ template <typename F, typename S>
inline
void
- count_adjacent_vertices<P, V>::take(const argument& arg)
+ count_adjacent_vertices<F,S>::take(const argument& arg)
{
- vertices_.insert(arg.p().first_id());
- vertices_.insert(arg.p().second_id());
+ vertices_.insert(arg.p().v1());
+ vertices_.insert(arg.p().v2());
update_();
}
- template <typename P, typename V>
+ template <typename F, typename S>
inline
void
- count_adjacent_vertices<P, V>::take(const count_adjacent_vertices<P, V>& other)
+ count_adjacent_vertices<F,S>::take(const count_adjacent_vertices<F,S>& other)
{
vertices_.insert (other.vertices_.begin(), other.vertices_.end());
update_();
}
- template <typename P, typename V>
+ template <typename F, typename S>
inline
unsigned
- count_adjacent_vertices<P, V>::to_result() const
+ count_adjacent_vertices<F,S>::to_result() const
{
return count__;
}
- template <typename P, typename V>
+ template <typename F, typename S>
inline
void
- count_adjacent_vertices<P, V>::set_value(unsigned c)
+ count_adjacent_vertices<F,S>::set_value(unsigned c)
{
count__ = c;
/// Reset the other member.
vertices_.clear();
}
- template <typename P, typename V>
+ template <typename F, typename S>
inline
void
- count_adjacent_vertices<P, V>::update_()
+ count_adjacent_vertices<F,S>::update_()
{
count__ = vertices_.size();
}
diff --git a/milena/mln/accu/median_alt.hh b/milena/mln/accu/median_alt.hh
index 98d0cac..7815c95 100644
--- a/milena/mln/accu/median_alt.hh
+++ b/milena/mln/accu/median_alt.hh
@@ -99,24 +99,24 @@ namespace mln
/// Meta accumulator for median_alt.
- struct median_alt : public Meta_Accumulator< median_alt >
+ template <typename T>
+ struct median_alt : public Meta_Accumulator< median_alt<T> >
{
- median_alt(const Value_Set<S>& s_) : s(s_) {}
+ median_alt(const Value_Set<T>& s_) : s(s_) {}
- template <typename V>
struct with
{
- typedef accu::median_alt<V> ret;
+ typedef accu::median_alt<T> ret;
};
- Value_Set<S> s;
+ Value_Set<T> s;
};
} // end of namespace mln::accu::meta
template <typename T>
- median_alt<T> unmeta(const meta::median_alt& m, T)
+ median_alt<T> unmeta(const meta::median_alt<T>& m, T)
{
median_alt<T> a(m.s);
return a;
diff --git a/milena/mln/accu/rank_high_quant.hh b/milena/mln/accu/rank_high_quant.hh
index 0f002cd..5c91f99 100644
--- a/milena/mln/accu/rank_high_quant.hh
+++ b/milena/mln/accu/rank_high_quant.hh
@@ -204,6 +204,6 @@ namespace mln
} // end of namespace mln
-#include <mln/accu/rankbool.hh>
+#include <mln/accu/rank_bool.hh>
#endif // ! MLN_ACCU_RANK_HH
diff --git a/milena/mln/border/resize.hh b/milena/mln/border/resize.hh
index b7bdba5..02cbbc5 100644
--- a/milena/mln/border/resize.hh
+++ b/milena/mln/border/resize.hh
@@ -98,6 +98,8 @@ namespace mln
const Image<I>& ima, unsigned thickness)
{
// No-op.
+ (void) ima;
+ (void) thickness;
}
template <typename I>
diff --git a/milena/mln/canvas/browsing/snake_generic.hh b/milena/mln/canvas/browsing/snake_generic.hh
index 540c2e4..0bc951d 100644
--- a/milena/mln/canvas/browsing/snake_generic.hh
+++ b/milena/mln/canvas/browsing/snake_generic.hh
@@ -33,6 +33,7 @@
///
/// Browsing in a snake-way, forward.
+# include <vector>
# include <mln/core/concept/browsing.hh>
diff --git a/milena/mln/core/concept/graph.hh b/milena/mln/core/concept/graph.hh
index 80c2ae2..81f4f3c 100644
--- a/milena/mln/core/concept/graph.hh
+++ b/milena/mln/core/concept/graph.hh
@@ -32,6 +32,8 @@
///
/// Definition of the concept of mln::Graph.
+# include <mln/core/concept/object.hh>
+
namespace mln
{
diff --git a/milena/mln/core/dpoints_pixter.hh b/milena/mln/core/dpoints_pixter.hh
index 4d4e4d2..7b570d2 100644
--- a/milena/mln/core/dpoints_pixter.hh
+++ b/milena/mln/core/dpoints_pixter.hh
@@ -37,6 +37,7 @@
# include <cassert>
# include <vector>
+# include <mln/core/concept/proxy.hh>
# include <mln/core/concept/pixel_iterator.hh>
# include <mln/core/internal/pixel_impl.hh>
# include <mln/metal/converts_to.hh>
diff --git a/milena/mln/core/internal/check/image_all.hh b/milena/mln/core/internal/check/image_all.hh
index e389b06..6430046 100644
--- a/milena/mln/core/internal/check/image_all.hh
+++ b/milena/mln/core/internal/check/image_all.hh
@@ -1,4 +1,5 @@
// 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,12 +29,11 @@
#ifndef MLN_CORE_INTERNAL_CHECK_IMAGE_ALL_HH
# define MLN_CORE_INTERNAL_CHECK_IMAGE_ALL_HH
-/*! \file mln/core/internal/check/image_all.hh
- *
- * \brief File that includes all image-related internal checks.
- */
-
+/// \file mln/core/internal/check/image_all.hh
+///
+/// File that includes all image-related internal checks.
+# include <mln/trait/images.hh>
# include <mln/core/internal/check/image_fastest.hh>
// ...
diff --git a/milena/mln/core/internal/check/image_fastest.hh b/milena/mln/core/internal/check/image_fastest.hh
index 44f5611..f225c1e 100644
--- a/milena/mln/core/internal/check/image_fastest.hh
+++ b/milena/mln/core/internal/check/image_fastest.hh
@@ -1,4 +1,5 @@
// 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,14 +29,18 @@
#ifndef MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
# define MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
-/*! \file mln/core/internal/check/image_fastest.hh
- *
- * \brief Class that statically checks the interface of fastest
- * images.
- *
- * \todo Check and convert p in index_of_point towards E::psite.
- */
+/// \file mln/core/internal/check/image_fastest.hh
+///
+/// Class that statically checks the interface of fastest
+/// images.
+///
+/// \todo Check and convert p in index_of_point towards E::psite.
+
+# include <mln/metal/bool.hh>
+# include <mln/core/macros.hh>
+# include <mln/core/trait/pixter.hh>
+# include <mln/core/trait/qlf_value.hh>
# include <mln/core/internal/force_exact.hh>
namespace mln
@@ -47,21 +52,20 @@ namespace mln
namespace check
{
- /*! FIXME
- */
+ /// FIXME
template < typename E, typename B = metal::true_ >
struct image_fastest_
{
- /*! \brief Give the offset of the site \p p.
- *
- * \param[in] p A site.
- *
- * \warning This method is final.
- *
- * \pre The image has to be initialized and to own the point \p p.
- * \post p == point_at_index(result)
- */
+ /// \brief Give the offset of the site \p p.
+ ///
+ /// \param[in] p A site.
+ ///
+ /// \warning This method is final.
+ ///
+ /// \pre The image has to be initialized and to own the point \p p.
+ /// \post p == point_at_index(result)
+ ///
template <typename P>
unsigned
index_of_point(const P& p) const;
@@ -71,7 +75,6 @@ namespace mln
};
- ///
template <typename E>
struct image_fastest_< E, metal::false_ >
{
@@ -86,8 +89,8 @@ namespace mln
image_fastest_<E,B>::image_fastest_()
{
typedef mln_site(E) site;
- typedef mln_psite(E) psite;
- typedef mln_delta(psite) dpsite;
+ typedef mln_psite(E) psite;
+ typedef mln_delta(psite) dpsite;
typedef mln_fwd_pixter(E) fwd_pixter;
diff --git a/milena/mln/core/internal/graph_neighborhood_base.hh b/milena/mln/core/internal/graph_neighborhood_base.hh
index 0e39cce..451e527 100644
--- a/milena/mln/core/internal/graph_neighborhood_base.hh
+++ b/milena/mln/core/internal/graph_neighborhood_base.hh
@@ -32,6 +32,9 @@
///
/// FIXME: doc
+# include <set>
+# include <mln/core/concept/neighborhood.hh>
+
namespace mln
{
diff --git a/milena/mln/core/internal/graph_window_base.hh b/milena/mln/core/internal/graph_window_base.hh
index 3c91448..0ea95ec 100644
--- a/milena/mln/core/internal/graph_window_base.hh
+++ b/milena/mln/core/internal/graph_window_base.hh
@@ -29,6 +29,7 @@
# define MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
# include <set>
+# include <mln/core/concept/window.hh>
/// \file mln/internal/graph_window_base.hh
///
diff --git a/milena/mln/core/internal/image_if_base.hh b/milena/mln/core/internal/image_if_base.hh
deleted file mode 100644
index 35fb2ae..0000000
--- a/milena/mln/core/internal/image_if_base.hh
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
-//
-// 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_CORE_INTERNAL_IMAGE_IF_BASE_HH
-# define MLN_CORE_INTERNAL_IMAGE_IF_BASE_HH
-
-/*! \file mln/core/internal/image_if_base.hh
- *
- * \brief Definition of a image_if_base image.
- */
-
-# include <mln/core/internal/image_domain_morpher.hh>
-# include <mln/core/site_set/p_if.hh>
-# include <mln/pw/all.hh>
-# include <mln/value/interval.hh>
-
-
-namespace mln
-{
-
-
- namespace internal
- {
-
- // Fwd decl.
- template <typename I, typename F, typename E> struct image_if_base_;
-
- // data_.
-
- template <typename I, typename F, typename E>
- struct data< image_if_base_<I,F,E> >
- {
- data(I& ima, const F& f);
-
- I ima_;
- p_if<mln_pset(I), F> pset_;
- };
-
- } // end of namespace mln::internal
-
-
-
- namespace trait
- {
-
- template <typename I, typename F, typename E>
- struct image_< mln::internal::image_if_base_<I,F,E> > : default_image_morpher< I, mln_value(I), E >
- {
- private:
- typedef mln_trait_image_data(I) I_data_;
- typedef mlc_equal(I_data_, trait::image::data::linear) I_data_are_linear_;
- public:
-
- typedef trait::image::category::domain_morpher category;
-
- typedef mlc_if( mlc_is_const(I),
- trait::image::io::read_only, // I const => read_only
- mln_trait_image_io(I) ) io; // otherwise like I
-
- typedef mlc_if( I_data_are_linear_,
- trait::image::data::stored, // if linear then just stored
- I_data_ ) data; // otherwise like I
-
- typedef mln_trait_image_border(I) border;
- };
-
- } // end of namespace mln::trait
-
-
-
- namespace internal
- {
-
- /*! An base image class for image_if_'something.
- *
- */
- template <typename I, typename F, typename E>
- struct image_if_base_ : public internal::image_domain_morpher< I, p_if<mln_pset(I),F>, E >
- {
-
- /// Give the definition domain.
- const p_if<mln_pset(I), F>& domain() const;
-
- void init_(I& ima, const F& f);
-
- /// Test if the image owns the point site \p p.
- /// The result is the same than over the underlying image.
- bool has(const mln_psite(I)& p) const;
-
- protected:
-
- /// Constructor from an image \p ima and a predicate \p f.
- image_if_base_(I& ima, const F& f);
-
- /// Constructor without argument.
- image_if_base_();
- };
-
-
-# ifndef MLN_INCLUDE_ONLY
-
-// // init_
-
-// template <typename I, typename F, typename E>
-// void init_(tag::function_t, F& f, const image_if_base_<I,F,E>& model)
-// {
-// f = model.domain().predicate();
-// }
-
-// template <typename I, typename F, typename E, typename J>
-// void init_(tag::image_t, image_if_base_<I,F,E>& target, const J& model)
-// {
-// I ima;
-// init_(tag::image, ima, exact(model));
-// F f;
-// init_(tag::function, f, exact(model));
-// target.init_(ima, f);
-// }
-
- // internal::data< image_if_base_<I,S> >
-
- template <typename I, typename F, typename E>
- inline
- data< image_if_base_<I,F,E> >::data(I& ima, const F& f)
- : ima_(ima),
- pset_(ima.domain() | f)
- {
- }
-
- // image_if_base_<I,F,E>
-
- template <typename I, typename F, typename E>
- inline
- image_if_base_<I,F,E>::image_if_base_()
- {
- }
-
- template <typename I, typename F, typename E>
- inline
- image_if_base_<I,F,E>::image_if_base_(I& ima, const F& f)
- {
- init_(ima, f);
- }
-
- template <typename I, typename F, typename E>
- inline
- bool
- image_if_base_<I,F,E>::has(const mln_psite(I)& p) const
- {
- mln_precondition(this->has_data());
- return this->data_->ima_.has(p);
- }
-
- template <typename I, typename F, typename E>
- inline
- void
- image_if_base_<I,F,E>::init_(I& ima, const F& f)
- {
- mln_precondition(! this->has_data());
- this->data_ = new internal::data<E>(ima, f);
- }
-
- template <typename I, typename F, typename E>
- inline
- const p_if<mln_pset(I), F>&
- image_if_base_<I,F,E>::domain() const
- {
- return this->data_->pset_;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::internal
-
-} // end of namespace mln
-
-
-#endif // ! MLN_CORE_INTERNAL_IMAGE_IF_BASE_HH
diff --git a/milena/mln/core/internal/pixel_impl.hh b/milena/mln/core/internal/pixel_impl.hh
index e7bdc0b..5ab9509 100644
--- a/milena/mln/core/internal/pixel_impl.hh
+++ b/milena/mln/core/internal/pixel_impl.hh
@@ -1,4 +1,4 @@
-// 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,12 +28,12 @@
#ifndef MLN_CORE_INTERNAL_PIXEL_IMPL_HH
# define MLN_CORE_INTERNAL_PIXEL_IMPL_HH
-/*! \file mln/core/internal/pixel_impl.hh
- *
- * \brief Define a couple of implementation classes to provide methods
- * to classes of generalized pixels.
- */
+/// \file mln/core/internal/pixel_impl.hh
+///
+/// Define a couple of implementation classes to provide methods
+/// to classes of generalized pixels.
+# include <mln/core/concept/image.hh>
# include <mln/core/internal/force_exact.hh>
@@ -43,10 +43,8 @@ namespace mln
namespace internal
{
- /*! Implementation class to equip generalized pixel
- * classes based on mutable images.
- *
- */
+ /// Implementation class to equip generalized pixel
+ /// classes based on mutable images.
template <typename I, typename E>
class pixel_impl_
{
@@ -95,10 +93,8 @@ namespace mln
};
- /*! Implementation class to equip generalized pixel
- * classes based on constant images.
- *
- */
+ /// Implementation class to equip generalized pixel
+ /// classes based on constant images.
template <typename I, typename E>
class pixel_impl_< const I, E >
{
diff --git a/milena/mln/core/internal/set_of.hh b/milena/mln/core/internal/set_of.hh
index b7f16bf..4058e0d 100644
--- a/milena/mln/core/internal/set_of.hh
+++ b/milena/mln/core/internal/set_of.hh
@@ -1,4 +1,4 @@
-// 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,16 +28,16 @@
#ifndef MLN_CORE_INTERNAL_SET_OF_HH
# define MLN_CORE_INTERNAL_SET_OF_HH
-/*! \file mln/core/internal/set_of.hh
- *
- * \brief Definition of mln::set_of_ for internal use only.
- */
+/// \file mln/core/internal/set_of.hh
+///
+/// \brief Definition of mln::set_of_ for internal use only.
# include <vector>
# include <set>
# include <iterator>
# include <algorithm>
+# include <mln/core/contract.hh>
# include <mln/core/internal/force_exact.hh>
diff --git a/milena/mln/core/site_set/box_piter.hh b/milena/mln/core/site_set/box_piter.hh
index 3ec1aeb..cce30d6 100644
--- a/milena/mln/core/site_set/box_piter.hh
+++ b/milena/mln/core/site_set/box_piter.hh
@@ -1,4 +1,5 @@
// 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,24 +29,24 @@
#ifndef MLN_CORE_SITE_SET_BOX_PITER_HH
# define MLN_CORE_SITE_SET_BOX_PITER_HH
-/*! \file mln/core/site_set/box_piter.hh
- *
- * \brief Definition of iterators on points of boxes.
- */
+/// \file mln/core/site_set/box_piter.hh
+///
+/// Definition of iterators on points of boxes.
# include <mln/core/internal/site_set_iterator_base.hh>
# include <mln/core/concept/box.hh>
+# include <mln/core/site_set/box.hh>
namespace mln
{
- /*! \brief A generic forward iterator on points of boxes.
- *
- * The parameter \c P is the type of points.
- *
- * \see mln::box_
- */
+ /// \brief A generic forward iterator on points of boxes.
+ ///
+ /// The parameter \c P is the type of points.
+ ///
+ /// \see mln::box
+ ///
template <typename P>
class box_fwd_piter_ : public internal::site_set_iterator_base< box<P>,
box_fwd_piter_<P> >
@@ -61,10 +62,10 @@ namespace mln
/// Constructor without argument.
box_fwd_piter_();
- /*! \brief Constructor.
- *
- * \param[in] b A box.
- */
+ /// Constructor.
+ ///
+ /// \param[in] b A box.
+ ///
box_fwd_piter_(const box<P>& b);
/// Test the iterator validity.
@@ -86,12 +87,12 @@ namespace mln
- /*! \brief A generic backward iterator on points of boxes.
- *
- * The parameter \c P is the type of points.
- *
- * \see mln::box_
- */
+ /// A generic backward iterator on points of boxes.
+ ///
+ /// The parameter \c P is the type of points.
+ ///
+ /// \see mln::box
+ ///
template <typename P>
class box_bkd_piter_ : public internal::site_set_iterator_base< box<P>,
box_bkd_piter_<P> >
@@ -107,10 +108,10 @@ namespace mln
/// Constructor without argument.
box_bkd_piter_();
- /*! \brief Constructor.
- *
- * \param[in] b A box.
- */
+ /// Constructor.
+ ///
+ /// \param[in] b A box.
+ ///
box_bkd_piter_(const box<P>& b);
/// Test the iterator validity.
diff --git a/milena/mln/core/site_set/p_centered.hh b/milena/mln/core/site_set/p_centered.hh
index ca961c5..ec75518 100644
--- a/milena/mln/core/site_set/p_centered.hh
+++ b/milena/mln/core/site_set/p_centered.hh
@@ -38,6 +38,7 @@
*/
# include <mln/core/internal/site_set_base.hh>
+# include <mln/core/internal/site_set_iterator_base.hh>
namespace mln
diff --git a/milena/mln/fun/p2b/has.hh b/milena/mln/fun/p2b/has.hh
index 142beb1..4e70840 100644
--- a/milena/mln/fun/p2b/has.hh
+++ b/milena/mln/fun/p2b/has.hh
@@ -1,4 +1,5 @@
// Copyright (C) 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,11 +29,12 @@
#ifndef MLN_FUN_P2B_HAS_HH
# define MLN_FUN_P2B_HAS_HH
-/*! \file mln/fun/p2b/has.hh
- *
- * \brief Function "psite-> bool" that maps the call "ima.has(p)".
- */
+/// \file mln/fun/p2b/has.hh
+///
+/// Function "psite-> bool" that maps the call "ima.has(p)".
+
+# include <mln/core/concept/image.hh>
# include <mln/core/concept/function.hh>
# include <mln/metal/const.hh>
# include <mln/metal/unconst.hh>
diff --git a/milena/mln/fun/x2p/closest_point.hh b/milena/mln/fun/x2p/closest_point.hh
index 8614cac..7fe3429 100644
--- a/milena/mln/fun/x2p/closest_point.hh
+++ b/milena/mln/fun/x2p/closest_point.hh
@@ -30,7 +30,8 @@
# include <mln/algebra/vec.hh>
# include <mln/norm/l2.hh>
-
+# include <mln/core/site_set/p_array.hh>
+# include <mln/core/site_set/box.hh>
namespace mln
{
diff --git a/milena/mln/geom/seeds2tiling_roundness.hh b/milena/mln/geom/seeds2tiling_roundness.hh
index 2da16b1..eb6c5a7 100644
--- a/milena/mln/geom/seeds2tiling_roundness.hh
+++ b/milena/mln/geom/seeds2tiling_roundness.hh
@@ -29,15 +29,15 @@
#ifndef MLN_GEOM_SEEDS2TILING_ROUNDNESS_HH
# define MLN_GEOM_SEEDS2TILING_ROUNDNESS_HH
-/*! \file mln/geom/seeds2tiling_roundness.hh
- *
- * \brief seeds2tiling with a method which makes tiles more roundness.
- */
+/// \file mln/geom/seeds2tiling_roundness.hh
+///
+/// seeds2tiling with a method which makes tiles more roundness.
# include <map>
-
+# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
+# include <mln/core/alias/w_window2d_int.hh>
# include <mln/core/site_set/p_priority.hh>
# include <mln/core/site_set/p_queue_fast.hh>
# include <mln/core/routine/clone.hh>
diff --git a/milena/mln/io/txt/save.hh b/milena/mln/io/txt/save.hh
index ad5713b..597e07c 100644
--- a/milena/mln/io/txt/save.hh
+++ b/milena/mln/io/txt/save.hh
@@ -1,5 +1,5 @@
-// Copyright (C) 2008 EPITA
-// Research and Development Laboratory
+// Copyright (C) 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
@@ -29,18 +29,14 @@
#ifndef MLN_IO_TXT_SAVE_HH
# define MLN_IO_TXT_SAVE_HH
-/*!
- * \file mln/io/txt/save.hh
- *
- * \brief Define a function which saves an image of kind TXT into
- * given path.
- *
- */
+/// \file mln/io/txt/save.hh
+///
+/// \brief Save an image as txt file.
# include <iostream>
# include <fstream>
-# include <mln/core/concept/image.hh>
+# include <mln/core/image/image2d.hh>
# include <mln/metal/is.hh>
@@ -54,11 +50,10 @@ namespace mln
namespace txt
{
- /*! Save a Milena image as a txt image.
- *
- * \param[in] ima_ The image to save. Must be an image of char.
- * \param[in] filename the destination.
- */
+ /// Save an image as txt file.
+ ///
+ /// \param[in] ima_ The image to save. Must be an image of char.
+ /// \param[in] filename the destination.
void
save(const image2d<char>& ima, const std::string& filename);
diff --git a/milena/mln/metal/vec.hh b/milena/mln/metal/vec.hh
index 4c7bdc5..36f00ab 100644
--- a/milena/mln/metal/vec.hh
+++ b/milena/mln/metal/vec.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 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,16 +29,15 @@
#ifndef MLN_METAL_VEC_HH
# define MLN_METAL_VEC_HH
-/*!
- * \file mln/metal/vec.hh
- *
- * \brief Definition of a generic vector class.
- */
+/// \file mln/metal/vec.hh
+///
+/// Definition of a generic vector class.
# include <iostream>
# include <cmath>
# include <mln/core/concept/object.hh>
+# include <mln/algebra/h_vec.hh>
# include <mln/trait/all.hh>
# include <mln/trait/value_.hh>
diff --git a/milena/mln/morpho/internal/elementary.hh b/milena/mln/morpho/internal/elementary.hh
index 8c08fc5..0136097 100644
--- a/milena/mln/morpho/internal/elementary.hh
+++ b/milena/mln/morpho/internal/elementary.hh
@@ -36,6 +36,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/concept/accumulator.hh>
+# include <mln/core/concept/meta_accumulator.hh>
namespace mln
diff --git a/milena/mln/morpho/tree/data.hh b/milena/mln/morpho/tree/data.hh
index bafd3ea..2f91351 100644
--- a/milena/mln/morpho/tree/data.hh
+++ b/milena/mln/morpho/tree/data.hh
@@ -34,7 +34,7 @@
# include <mln/morpho/tree/compute_parent.hh>
# include <mln/core/image/sub_image.hh>
-
+# include <mln/core/site_set/p_array.hh>
namespace mln
diff --git a/milena/mln/registration/get_rot.hh b/milena/mln/registration/get_rot.hh
index 916f29f..6742abc 100644
--- a/milena/mln/registration/get_rot.hh
+++ b/milena/mln/registration/get_rot.hh
@@ -1,4 +1,5 @@
// Copyright (C) 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,8 +29,10 @@
#ifndef MLN_REGISTRATION_GET_ROT_HH
# define MLN_REGISTRATION_GET_ROT_HH
+# include <mln/core/site_set/p_array.hh>
# include <mln/fun/x2x/all.hh>
# include <mln/algebra/quat.hh>
+# include <mln/algebra/vec.hh>
# include <mln/math/jacobi.hh>
namespace mln
diff --git a/milena/mln/registration/get_rtransf.hh b/milena/mln/registration/get_rtransf.hh
index 3170acb..b380f30 100644
--- a/milena/mln/registration/get_rtransf.hh
+++ b/milena/mln/registration/get_rtransf.hh
@@ -1,4 +1,5 @@
// Copyright (C) 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,8 +29,10 @@
#ifndef MLN_REGISTRATION_GET_RTRANSF_HH
# define MLN_REGISTRATION_GET_RTRANSF_HH
+# include <mln/core/site_set/p_array.hh>
# include <mln/fun/x2x/all.hh>
# include <mln/algebra/quat.hh>
+# include <mln/algebra/vec.hh>
# include <mln/math/jacobi.hh>
# include <mln/registration/get_rot.hh>
diff --git a/milena/mln/registration/multiscale.hh b/milena/mln/registration/multiscale.hh
index 3a202f7..f54a759 100644
--- a/milena/mln/registration/multiscale.hh
+++ b/milena/mln/registration/multiscale.hh
@@ -28,7 +28,11 @@
#ifndef MLN_REGISTRATION_MULTISCALE_HH
# define MLN_REGISTRATION_MULTISCALE_HH
+# include <mln/core/concept/image.hh>
+# include <mln/core/image/lazy_image.hh>
+# include <mln/core/site_set/p_array.hh>
# include <mln/registration/icp.hh>
+# include <mln/registration/registration.hh>
# include <mln/fun/x2p/closest_point.hh>
namespace mln
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 53b5ad3..3d25954 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -31,11 +31,12 @@
/// \file mln/topo/face.hh
/// \brief Face of a complex.
-#include <limits>
-#include <vector>
+# include <iostream>
+# include <limits>
+# include <vector>
-#include <mln/core/contract.hh>
-#include <mln/metal/bool.hh>
+# include <mln/core/contract.hh>
+# include <mln/metal/bool.hh>
namespace mln
diff --git a/milena/mln/topo/face_iter.hh b/milena/mln/topo/face_iter.hh
index 2c0df92..4030594 100644
--- a/milena/mln/topo/face_iter.hh
+++ b/milena/mln/topo/face_iter.hh
@@ -34,6 +34,7 @@
# include <mln/topo/internal/complex_set_iterator_base.hh>
# include <mln/topo/face.hh>
+# include <mln/topo/face_iter.hh>
// FIXME: Factor a bit more? (Using complex_set_iterator_base.)
diff --git a/milena/mln/topo/n_face.hh b/milena/mln/topo/n_face.hh
index ef1aad8..e7a6475 100644
--- a/milena/mln/topo/n_face.hh
+++ b/milena/mln/topo/n_face.hh
@@ -29,13 +29,15 @@
# define MLN_TOPO_N_FACE_HH
/// \file mln/topo/n_face.hh
+///
/// \brief n-face of a complex.
-#include <limits>
-#include <vector>
-
-#include <mln/core/contract.hh>
+# include <iostream>
+# include <limits>
+# include <vector>
+# include <mln/core/contract.hh>
+# include <mln/metal/bool.hh>
namespace mln
{
diff --git a/milena/mln/trait/op/ord.hh b/milena/mln/trait/op/ord.hh
index c1b49ee..85fcd3d 100644
--- a/milena/mln/trait/op/ord.hh
+++ b/milena/mln/trait/op/ord.hh
@@ -33,7 +33,7 @@
/// Declaration of an ordering operator trait.
# include <mln/trait/op/decl.hh>
-
+# include <mln/trait/solve.hh>
namespace mln
diff --git a/milena/mln/util/edge.hh b/milena/mln/util/edge.hh
index f0895c5..57d4e49 100644
--- a/milena/mln/util/edge.hh
+++ b/milena/mln/util/edge.hh
@@ -33,8 +33,8 @@
/// Definition of a graph edge.
# include <iostream>
-# include <mln/util/internal/graph_edge_impl.hh>
-
+# include <mln/util/internal/edge_impl.hh>
+# include <mln/core/concept/proxy.hh>
namespace mln
{
diff --git a/milena/mln/util/internal/graph_edge_impl.hh b/milena/mln/util/internal/edge_impl.hh
similarity index 91%
rename from milena/mln/util/internal/graph_edge_impl.hh
rename to milena/mln/util/internal/edge_impl.hh
index 3b75086..5a2b59c 100644
--- a/milena/mln/util/internal/graph_edge_impl.hh
+++ b/milena/mln/util/internal/edge_impl.hh
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_INTERNAL_GRAPH_EDGE_IMPL_HH
-# define MLN_CORE_INTERNAL_GRAPH_EDGE_IMPL_HH
+#ifndef MLN_CORE_INTERNAL_EDGE_IMPL_HH
+# define MLN_CORE_INTERNAL_EDGE_IMPL_HH
-/// \file mln/util/internal/graph_edge_impl.hh
+/// \file mln/util/internal/edge_impl.hh
///
/// Define a couple of implementation classes to provide methods
/// to classes of generalized edges.
@@ -85,4 +85,4 @@ namespace mln
#endif // ! MLN_INCLUDE_ONLY
-#endif // ! MLN_CORE_INTERNAL_GRAPH_EDGE_IMPL_HH
+#endif // ! MLN_CORE_INTERNAL_EDGE_IMPL_HH
diff --git a/milena/mln/util/internal/graph_nbh_iter.hh b/milena/mln/util/internal/graph_nbh_iter.hh
index e43c5ea..0780cab 100644
--- a/milena/mln/util/internal/graph_nbh_iter.hh
+++ b/milena/mln/util/internal/graph_nbh_iter.hh
@@ -30,6 +30,8 @@
# include <mln/core/concept/proxy.hh>
# include <mln/util/internal/graph_nbh_iter_base.hh>
+# include <mln/util/vertex.hh>
+# include <mln/util/edge.hh>
/// \file mln/util/internal/graph_nbh_iter.hh
/// \brief Implementation for graph vertex iterators centered to a vertex.
diff --git a/milena/mln/util/internal/graph_vertex_impl.hh b/milena/mln/util/internal/vertex_impl.hh
similarity index 91%
rename from milena/mln/util/internal/graph_vertex_impl.hh
rename to milena/mln/util/internal/vertex_impl.hh
index bfe6360..74c6f3c 100644
--- a/milena/mln/util/internal/graph_vertex_impl.hh
+++ b/milena/mln/util/internal/vertex_impl.hh
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_INTERNAL_GRAPH_VERTEX_IMPL_HH
-# define MLN_CORE_INTERNAL_GRAPH_VERTEX_IMPL_HH
+#ifndef MLN_CORE_INTERNAL_VERTEX_IMPL_HH
+# define MLN_CORE_INTERNAL_VERTEX_IMPL_HH
-/// \file mln/util/internal/graph_vertex_impl.hh
+/// \file mln/util/internal/vertex_impl.hh
///
/// Define a couple of implementation classes to provide methods
/// to classes of generalized vertexs.
@@ -85,4 +85,4 @@ namespace mln
#endif // ! MLN_INCLUDE_ONLY
-#endif // ! MLN_CORE_INTERNAL_GRAPH_VERTEX_IMPL_HH
+#endif // ! MLN_CORE_INTERNAL_VERTEX_IMPL_HH
diff --git a/milena/mln/util/multi_site.hh b/milena/mln/util/multi_site.hh
index 2480369..3962751 100644
--- a/milena/mln/util/multi_site.hh
+++ b/milena/mln/util/multi_site.hh
@@ -35,6 +35,7 @@
# include <vector>
+# include <mln/core/concept/object.hh>
namespace mln
{
diff --git a/milena/mln/util/vertex.hh b/milena/mln/util/vertex.hh
index 9787c03..b1242e6 100644
--- a/milena/mln/util/vertex.hh
+++ b/milena/mln/util/vertex.hh
@@ -29,7 +29,8 @@
# define MLN_UTIL_VERTEX_HH
# include <iostream>
-# include <mln/util/internal/graph_vertex_impl.hh>
+# include <mln/util/internal/vertex_impl.hh>
+# include <mln/core/concept/proxy.hh>
/// \file mln/util/vertex.hh
///
@@ -52,7 +53,7 @@ namespace mln
/// Graph associated type.
typedef G graph_t;
-
+
/// Constructors.
/// \{
vertex();
diff --git a/milena/tests/morpho/Makefile.am b/milena/tests/morpho/Makefile.am
index 5c88623..631a2fd 100644
--- a/milena/tests/morpho/Makefile.am
+++ b/milena/tests/morpho/Makefile.am
@@ -8,7 +8,7 @@ SUBDIRS = \
tree
check_PROGRAMS = \
- artificial_line_graph_image_wst \
+## artificial_line_graph_image_wst \
closing_area \
closing_height \
closing_volume \
@@ -21,7 +21,7 @@ check_PROGRAMS = \
erosion \
## erosion_min_h \
gradient \
- graph_image_morpho \
+## graph_image_morpho \
## graph_image_wst \
hit_or_miss \
laplacian \
@@ -82,8 +82,8 @@ combined_SOURCES = combined.cc
# Complex tests. #
# --------------- #
-artificial_line_graph_image_wst_SOURCES = artificial_line_graph_image_wst.cc
-artificial_line_graph_image_wst_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
+##artificial_line_graph_image_wst_SOURCES = artificial_line_graph_image_wst.cc
+##artificial_line_graph_image_wst_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
dilation_SOURCES = dilation.cc
dilation_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
diff --git a/milena/tests/unit_test/build_unit_test.sh b/milena/tests/unit_test/build_unit_test.sh
index 6a6006e..495d332 100755
--- a/milena/tests/unit_test/build_unit_test.sh
+++ b/milena/tests/unit_test/build_unit_test.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-HEADERS=`find ../../mln -name "*.hh" | grep -vE "*.spe.hh" | sed s/"\.\.\/\.\.\/"//g`
+HEADERS=`find ../../mln -name "*.hh" | grep -vE "*.spe.hh" | grep -v "mln/core/doc" | sed s/"\.\.\/\.\.\/"//g`
rm -f Makefile.am
rm -f *.hh *.cc
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make morpho erosion rely on a general code.
* mln/morpho/erosion.spe.hh
(erosion_on_set, erosion_on_set_fastest): Rename as...
* mln/morpho/erosion.hh
(general_on_set, general_on_set_fastest): ...these.
(erosion_op): New.
(erosion): Call the general facade.
* mln/morpho/erosion.spe.hh: Rename as...
* mln/morpho/general.spe.hh: ...this new file.
(*erosion*): Rename routines as...
(*general*):... these.
(general_dispatch_for_generic): New overload for logic and
fastest. Now _on_set_fastest routines can be accessible!
* mln/accu/land_basic.hh (todo): New.
(land_basic): New meta version.
* mln/accu/land.hh: Likewise.
* mln/morpho/general.hh: New.
* tests/morpho/erosion.cc: Copy to...
* tests/morpho/general.cc: ...this new file.
Update.
* tests/morpho/erosion.cc: Update.
mln/accu/land.hh | 22 ++
mln/accu/land_basic.hh | 20 ++
mln/morpho/erosion.hh | 117 +++++++++------
mln/morpho/general.hh | 95 ++++++++----
mln/morpho/general.spe.hh | 339 ++++++++++++++++++++--------------------------
tests/morpho/erosion.cc | 65 +-------
tests/morpho/general.cc | 160 ++++++++-------------
7 files changed, 403 insertions(+), 415 deletions(-)
Index: tests/morpho/general.cc
--- tests/morpho/general.cc (revision 2970)
+++ tests/morpho/general.cc (working copy)
@@ -26,19 +26,16 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/morpho/erosion.cc
+/// \file tests/morpho/general.cc
///
-/// Test on mln::morpho::erosion.
+/// Test on mln::morpho::general.
#include <mln/core/image/image2d.hh>
-#include <mln/win/all.hh>
-
-#include <mln/debug/iota.hh>
-
+#include <mln/value/int_u8.hh>
#include <mln/io/pgm/load.hh>
-#include <mln/io/pgm/save.hh>
+#include <mln/io/pbm/load.hh>
-#include <mln/value/int_u8.hh>
+#include <mln/win/all.hh>
#include <mln/morpho/erosion.hh>
#include "tests/data.hh"
@@ -49,130 +46,101 @@
using namespace mln;
using value::int_u8;
- border::thickness = 0;
- image2d<int_u8> lena;
- io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
+ // Windows.
+ win::rectangle2d rec(5, 5);
+ win::hline2d hline(7);
+ win::vline2d vline(7);
+ win::diag2d diag2d(7);
+ win::backdiag2d backdiag2d(7);
+ win::octagon2d oct(2 * 3 + 1);
- win::rectangle2d rec(21, 21);
- win::hline2d hline(31);
- win::vline2d vline(31);
- win::diag2d diag2d(31);
- win::backdiag2d backdiag2d(31);
- win::octagon2d oct(6 * 3 + 1);
- image2d<int_u8> out;
- image2d<int_u8> ref;
-
-// trace::quiet = false;
+ morpho::erosion_op ero;
+ {
+ image2d<int_u8> lena, out, ref;
+ io::pgm::load(lena, MLN_IMG_DIR "/tiny.pgm");
- // Rectangle
- {
- ref = morpho::impl::generic::erosion_on_function(lena, rec);
- }
+ // Rectangle.
- {
- out = morpho::erosion(lena, rec);
- bool test = out == ref;
- mln_assertion(test);
- }
+ ref = morpho::impl::generic::general_on_function(ero, lena, rec);
- {
- out = morpho::impl::erosion_arbitrary_2d(lena, rec);
- bool test = out == ref;
- mln_assertion(test);
- }
+ out = morpho::impl::general_rectangle2d(ero, lena, rec);
+ mln_assertion(out == ref);
+ out = morpho::impl::general_arbitrary_2d(ero, lena, rec);
+ mln_assertion(out == ref);
- // Hline
+ out = morpho::impl::general_directional(ero, lena, rec, 0);
+ mln_assertion(out == ref);
- {
- ref = morpho::impl::generic::erosion_on_function(lena, hline);
- }
+ out = morpho::impl::general_directional(ero, lena, rec, 1);
+ mln_assertion(out == ref);
- {
- out = morpho::erosion(lena, hline);
- bool test = out == ref;
- mln_assertion(test);
- }
+ /*
- {
- out = morpho::impl::erosion_arbitrary_2d(lena, hline);
- bool test = out == ref;
- mln_assertion(test);
- }
+ // Hline.
+ ref = morpho::impl::generic::general_on_function(ero, lena, hline);
+ // Vline.
+ ref = morpho::impl::generic::general_on_function(ero, lena, vline);
- // Vline
+ // Diag2d.
+ ref = morpho::impl::generic::erosion_on_function(lena, diag2d);
- {
- ref = morpho::impl::generic::erosion_on_function(lena, vline);
- }
+ // Backdiag2d.
+ ref = morpho::impl::generic::erosion_on_function(lena, backdiag2d);
- {
- out = morpho::erosion(lena, vline);
- bool test = out == ref;
- mln_assertion(test);
- }
+ // Octagon
+ ref = morpho::impl::generic::erosion_on_function(lena, oct);
+ // io::pgm::save(ref, "out_oct_ref.pgm");
- {
- out = morpho::impl::erosion_arbitrary_2d(lena, vline);
- bool test = out == ref;
- mln_assertion(test);
+ */
}
- // Diag2d
+ /*
{
- ref = morpho::impl::generic::erosion_on_function(lena, diag2d);
- }
+ trace::quiet = false;
- {
- out = morpho::erosion(lena, diag2d);
- bool test = out == ref;
- mln_assertion(test);
- }
+ image2d<bool> pic;
+ io::pbm::load(pic, MLN_IMG_DIR "/tiny.pbm");
- {
- out = morpho::impl::erosion_arbitrary_2d(lena, diag2d);
- bool test = out == ref;
- mln_assertion(test);
+ morpho::general(ero, pic, win::rectangle2d(3,3));
+
+ trace::quiet = true;
}
+ */
- // Backdiag2d
{
- ref = morpho::impl::generic::erosion_on_function(lena, backdiag2d);
- }
+ image2d<bool> pic, out, ref;
+ io::pbm::load(pic, MLN_IMG_DIR "/tiny.pbm");
- {
- out = morpho::erosion(lena, backdiag2d);
- bool test = out == ref;
- mln_assertion(test);
- }
+ // Rectangle.
- {
- out = morpho::impl::erosion_arbitrary_2d(lena, backdiag2d);
- bool test = out == ref;
- mln_assertion(test);
- }
+ ref = morpho::impl::generic::general_on_set(ero, pic, rec);
+ out = morpho::impl::general_on_set_centered(ero, pic, rec);
+ mln_assertion(out == ref);
+ out = morpho::impl::general_on_set_centered_fastest(ero, pic, rec);
+ mln_assertion(out == ref);
- // Octagon
+ out = morpho::impl::general_rectangle2d(ero, pic, rec);
+ mln_assertion(out == ref);
- {
- ref = morpho::impl::generic::erosion_on_function(lena, oct);
- io::pgm::save(ref, "out_oct_ref.pgm");
- }
+ out = morpho::impl::general_arbitrary_2d(ero, pic, rec);
+ mln_assertion(out == ref);
- {
- out = morpho::erosion(lena, oct);
- bool test = out == ref;
- mln_assertion(test);
+ out = morpho::impl::general_directional(ero, pic, rec, 0);
+ mln_assertion(out == ref);
+
+ out = morpho::impl::general_directional(ero, pic, rec, 1);
+ mln_assertion(out == ref);
}
}
Index: tests/morpho/erosion.cc
--- tests/morpho/erosion.cc (revision 2971)
+++ tests/morpho/erosion.cc (working copy)
@@ -32,13 +32,9 @@
#include <mln/core/image/image2d.hh>
#include <mln/win/all.hh>
-
-#include <mln/debug/iota.hh>
-
#include <mln/io/pgm/load.hh>
-#include <mln/io/pgm/save.hh>
-
#include <mln/value/int_u8.hh>
+
#include <mln/morpho/erosion.hh>
#include "tests/data.hh"
@@ -63,6 +59,7 @@
image2d<int_u8> out;
image2d<int_u8> ref;
+
// trace::quiet = false;
@@ -70,18 +67,12 @@
{
ref = morpho::impl::generic::erosion_on_function(lena, rec);
- }
- {
out = morpho::erosion(lena, rec);
- bool test = out == ref;
- mln_assertion(test);
- }
+ mln_assertion(out == ref);
- {
out = morpho::impl::erosion_arbitrary_2d(lena, rec);
- bool test = out == ref;
- mln_assertion(test);
+ mln_assertion(out == ref);
}
@@ -89,18 +80,12 @@
{
ref = morpho::impl::generic::erosion_on_function(lena, hline);
- }
- {
out = morpho::erosion(lena, hline);
- bool test = out == ref;
- mln_assertion(test);
- }
+ mln_assertion(out == ref);
- {
out = morpho::impl::erosion_arbitrary_2d(lena, hline);
- bool test = out == ref;
- mln_assertion(test);
+ mln_assertion(out == ref);
}
@@ -108,18 +93,12 @@
{
ref = morpho::impl::generic::erosion_on_function(lena, vline);
- }
- {
out = morpho::erosion(lena, vline);
- bool test = out == ref;
- mln_assertion(test);
- }
+ mln_assertion(out == ref);
- {
out = morpho::impl::erosion_arbitrary_2d(lena, vline);
- bool test = out == ref;
- mln_assertion(test);
+ mln_assertion(out == ref);
}
@@ -127,18 +106,12 @@
{
ref = morpho::impl::generic::erosion_on_function(lena, diag2d);
- }
- {
out = morpho::erosion(lena, diag2d);
- bool test = out == ref;
- mln_assertion(test);
- }
+ mln_assertion(out == ref);
- {
out = morpho::impl::erosion_arbitrary_2d(lena, diag2d);
- bool test = out == ref;
- mln_assertion(test);
+ mln_assertion(out == ref);
}
@@ -146,18 +119,12 @@
{
ref = morpho::impl::generic::erosion_on_function(lena, backdiag2d);
- }
- {
out = morpho::erosion(lena, backdiag2d);
- bool test = out == ref;
- mln_assertion(test);
- }
+ mln_assertion(out == ref);
- {
out = morpho::impl::erosion_arbitrary_2d(lena, backdiag2d);
- bool test = out == ref;
- mln_assertion(test);
+ mln_assertion(out == ref);
}
@@ -166,13 +133,9 @@
{
ref = morpho::impl::generic::erosion_on_function(lena, oct);
- io::pgm::save(ref, "out_oct_ref.pgm");
- }
-
- {
+ // io::pgm::save(ref, "out_oct_ref.pgm");
out = morpho::erosion(lena, oct);
- bool test = out == ref;
- mln_assertion(test);
+ mln_assertion(out == ref);
}
}
Index: mln/accu/land_basic.hh
--- mln/accu/land_basic.hh (revision 2971)
+++ mln/accu/land_basic.hh (working copy)
@@ -32,6 +32,8 @@
/// \file mln/accu/land_basic.hh
///
/// Define a basic 'logical-and' accumulator.
+///
+/// \todo Have land_basic be parameterized.
# include <mln/accu/internal/base.hh>
@@ -77,6 +79,24 @@
};
+ namespace meta
+ {
+
+ /// Meta accumulator for land_basic.
+
+ struct land_basic : public Meta_Accumulator< land_basic >
+ {
+ template <typename T>
+ struct with
+ {
+ typedef accu::land_basic ret;
+ };
+ };
+
+ } // end of namespace mln::accu::meta
+
+
+
# ifndef MLN_INCLUDE_ONLY
inline
Index: mln/accu/land.hh
--- mln/accu/land.hh (revision 2971)
+++ mln/accu/land.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// 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
@@ -32,6 +33,7 @@
///
/// Define a 'logical-and' accumulator.
///
+/// \todo Have land_basic be parameterized.
# include <mln/accu/internal/base.hh>
@@ -73,6 +75,24 @@
};
+ namespace meta
+ {
+
+ /// Meta accumulator for land.
+
+ struct land : public Meta_Accumulator< land >
+ {
+ template <typename T>
+ struct with
+ {
+ typedef accu::land ret;
+ };
+ };
+
+ } // end of namespace mln::accu::meta
+
+
+
# ifndef MLN_INCLUDE_ONLY
inline
Index: mln/morpho/erosion.hh
--- mln/morpho/erosion.hh (revision 2971)
+++ mln/morpho/erosion.hh (working copy)
@@ -31,12 +31,10 @@
/// \file mln/morpho/erosion.hh
///
-/// \brief Morphological erosion.
+/// Morphological erosion.
# include <mln/morpho/includes.hh>
-
-// Specializations are in:
-# include <mln/morpho/erosion.spe.hh>
+# include <mln/morpho/general.hh>
namespace mln
@@ -45,8 +43,7 @@
namespace morpho
{
- /*! Morphological erosion.
- */
+ /// Morphological erosion.
template <typename I, typename W>
mln_concrete(I)
erosion(const Image<I>& input, const Window<W>& win);
@@ -55,80 +52,106 @@
# ifndef MLN_INCLUDE_ONLY
- namespace internal
+ struct erosion_op
{
- template <typename I, typename W>
- inline
- void
- erosion_tests(const Image<I>& input_, const Window<W>& win_)
+ template <typename I>
+ mln_morpho_select_accu(I, land_basic, min)
+ accu(const Image<I>&) const
{
- const I& input = exact(input_);
- const W& win = exact(win_);
+ mln_morpho_select_accu(I, land_basic, min) tmp;
+ return tmp;
+ }
- mln_precondition(input.has_data());
- mln_precondition(! win.is_empty());
- // mln_precondition(win.is_valid());
+ template <typename I>
+ mln_morpho_select_accu(I, land, min_h)
+ accu_incr(const Image<I>&) const
+ {
+ mln_morpho_select_accu(I, land, min_h) tmp;
+ return tmp;
+ }
- (void) input;
- (void) win;
+ template <typename I>
+ mln_value(I) neutral(const Image<I>&) const
+ {
+ return internal::neutral<I>::supremum();
}
- } // end of mln::morpho::internal
+ };
namespace impl
{
- namespace generic
- {
-
- // On function.
+ // On set with centered window (overloads).
template <typename I, typename W>
- inline
mln_concrete(I)
- erosion_on_function(const Image<I>& input, const Window<W>& win)
+ general_on_set_centered(const erosion_op&,
+ const Image<I>& input_, const Window<W>& win_)
{
- trace::entering("morpho::impl::generic::erosion_on_function");
+ trace::entering("morpho::impl::general_on_set_centered__erosion");
+
+ typedef mln_concrete(I) O;
+ const I& input = exact(input_);
+ const W& win = exact(win_);
- internal::erosion_tests(input, win);
+ extension::adjust_fill(input, win, true);
+
+ O output;
+ output = clone(input);
- extension::adjust_fill(input, win, mln_max(mln_value(I)));
- mln_concrete(I) output;
- output = accu::transform(input, accu::meta::min(), win);
+ mln_piter(I) p(input.domain());
+ mln_qiter(W) q(win, p);
+ for_all(p)
+ if (input(p) == true)
+ for_all(q) if (input.has(q))
+ if (input(q) == false)
+ {
+ output(p) = false;
+ break;
+ }
- trace::exiting("morpho::impl::generic::erosion_on_function");
+ trace::exiting("morpho::impl::general_on_set_centered__erosion");
return output;
}
- // On set.
template <typename I, typename W>
- inline
mln_concrete(I)
- erosion_on_set(const Image<I>& input, const Window<W>& win)
+ general_on_set_centered_fastest(const erosion_op&,
+ const Image<I>& input_, const Window<W>& win_)
{
- trace::entering("morpho::impl::generic::erosion_on_set");
+ trace::entering("morpho::impl::general_on_set_centered_fastest__erosion");
- internal::erosion_tests(input, win);
+ typedef mln_concrete(I) O;
+ const I& input = exact(input_);
+ const W& win = exact(win_);
extension::adjust_fill(input, win, true);
- mln_concrete(I) output;
- output = accu::transform_stop(input, accu::land_basic(), win);
- trace::exiting("morpho::impl::generic::erosion_on_set");
- return output;
- }
-
- } // end of namespace mln::morpho::impl::generic
+ O output;
+ output = clone(input);
- } // end of namespace mln::morpho::impl
+ mln_pixter(const I) p(input);
+ mln_qixter(const I, W) q(p, win);
+ mln_pixter(O) p_out(output);
+ for_all_2(p, p_out)
+ if (p.val() == true)
+ for_all(q)
+ if (q.val() == false)
+ {
+ p_out.val() = false;
+ break;
+ }
+ trace::exiting("morpho::impl::general_on_set_centered_fastest__erosion");
+ return output;
+ }
+ } // end of namespace morpho::impl
- // Facades.
template <typename I, typename W>
inline
@@ -139,11 +162,11 @@
mln_precondition(exact(input).has_data());
mln_precondition(! exact(win).is_empty());
- internal::erosion_tests(input, win);
- mln_concrete(I) output = internal::erosion_dispatch(input, win);
+ mln_concrete(I) output = general(erosion_op(), input, win);
if (exact(win).is_centered())
mln_postcondition(output <= input);
+
trace::exiting("morpho::erosion");
return output;
}
Index: mln/morpho/general.spe.hh
--- mln/morpho/general.spe.hh (revision 2970)
+++ mln/morpho/general.spe.hh (working copy)
@@ -26,12 +26,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_MORPHO_EROSION_SPE_HH
-# define MLN_MORPHO_EROSION_SPE_HH
+#ifndef MLN_MORPHO_GENERAL_SPE_HH
+# define MLN_MORPHO_GENERAL_SPE_HH
-# ifndef MLN_MORPHO_EROSION_HH
+# ifndef MLN_MORPHO_GENERAL_HH
# error "Forbidden inclusion of *.spe.hh"
-# endif // ! MLN_MORPHO_EROSION_HH
+# endif // ! MLN_MORPHO_GENERAL_HH
# include <mln/core/alias/window2d.hh>
# include <mln/core/alias/dpoint2d.hh>
@@ -43,14 +43,18 @@
# include <mln/accu/line.hh>
-/// \file mln/morpho/erosion.spe.hh
+/// \file mln/morpho/general.spe.hh
///
-/// Specialization for mln::morpho::erosion.
+/// Specialization for mln::morpho::general.
///
/// \todo Warning: we should also have the "arbitrary" versions working
/// on sets (not only on functions!)
///
/// \todo HERE Factor dispatch for lines...
+///
+/// \todo Re-activate impl::line_on_function.
+///
+/// \todo Re-activate special code for centered window on sets.
# ifndef MLN_INCLUDE_ONLY
@@ -62,9 +66,9 @@
{
// Fwd decl of the facade.
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion(const Image<I>& input, const Window<W>& win);
+ general(const Op& op, const Image<I>& input, const Window<W>& win);
namespace impl
@@ -73,94 +77,49 @@
namespace generic
{
- // Fwd decl.
- // Implementation is in mln/morpho/erosion.hh.
- template <typename I, typename W>
+ // Forward declaration.
+ // Implementation is in mln/morpho/general.hh.
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_on_function(const Image<I>& input_, const Window<W>& win_);
+ general_on_function(const Op& op, const Image<I>& input_, const Window<W>& win_);
- // Fwd decl.
- // Implementation is in mln/morpho/erosion.hh.
- template <typename I, typename W>
+ // Forward declaration.
+ // Implementation is in mln/morpho/general.hh.
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_on_set(const Image<I>& input_, const Window<W>& win_);
+ general_on_set(const Op& op, const Image<I>& input_, const Window<W>& win_);
}
+
// On set with centered window.
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_on_set_centered(const Image<I>& input_, const Window<W>& win_)
- {
- trace::entering("morpho::impl::erosion_on_set_centered");
-
- typedef mln_concrete(I) O;
- const I& input = exact(input_);
- const W& win = exact(win_);
-
- extension::adjust_fill(input, win, true);
-
- O output;
- output = clone(input);
-
- mln_piter(I) p(input.domain());
- mln_qiter(W) q(win, p);
- for_all(p)
- if (input(p) == true)
- for_all(q) if (input.has(q))
- if (input(q) == false)
+ general_on_set_centered(const Op& op, const Image<I>& input, const Window<W>& win)
{
- output(p) = false;
- break;
+ return generic::general_on_set(op, input, win);
}
- trace::exiting("morpho::impl::erosion_on_set_centered");
- return output;
- }
-
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_on_set_centered_fastest(const Image<I>& input_, const Window<W>& win_)
- {
- trace::entering("morpho::impl::erosion_on_set_centered_fastest");
-
- typedef mln_concrete(I) O;
- const I& input = exact(input_);
- const W& win = exact(win_);
-
- extension::adjust_fill(input, win, true);
-
- O output;
- output = clone(input);
-
- mln_pixter(const I) p(input);
- mln_qixter(const I, W) q(p, win);
- mln_pixter(O) p_out(output);
- for_all_2(p, p_out)
- if (p.val() == true)
- for_all(q)
- if (q.val() == false)
+ general_on_set_centered_fastest(const Op& op, const Image<I>& input, const Window<W>& win)
{
- p_out.val() = false;
- break;
- }
- trace::exiting("morpho::impl::erosion_on_set_centered_fastest");
-
- return output;
+ return generic::general_on_set(op, input, win);
}
+/*
// Line case.
- template <typename I, typename G, unsigned Dir, typename C>
+ template <typename Op, typename I, typename G, unsigned Dir, typename C>
inline
mln_concrete(I)
- erosion_line_on_function(const Image<I>& input_, const win::line<G,Dir,C>& win)
+ general_line_on_function(const Op& op, const Image<I>& input_, const win::line<G,Dir,C>& win)
{
- trace::entering("morpho::impl::erosion_line");
+ trace::entering("morpho::impl::general_line");
typedef mln_site(I) P;
enum { dim = P::dim };
@@ -199,108 +158,100 @@
}
while (p != pmin);
- trace::exiting("morpho::impl::erosion_line");
+ trace::exiting("morpho::impl::general_line");
return output;
}
+*/
// Particular windows.
- template <typename I>
+ template <typename Op, typename I>
inline
mln_concrete(I)
- erosion_rectangle2d(const Image<I>& input_, const win::rectangle2d& win)
+ general_rectangle2d(const Op& op, const Image<I>& input_, const win::rectangle2d& win)
{
- trace::entering("morpho::impl::erosion_rectangle2d");
+ trace::entering("morpho::impl::general_rectangle2d");
const I& input = exact(input_);
mln_concrete(I) temp, output;
- temp = morpho::erosion(input, win::hline2d(win.width()));
- output = morpho::erosion(temp, win::vline2d(win.height()));
+ temp = morpho::general(op, input, win::hline2d(win.width()));
+ output = morpho::general(op, temp, win::vline2d(win.height()));
- trace::exiting("morpho::impl::erosion_rectangle2d");
+ trace::exiting("morpho::impl::general_rectangle2d");
return output;
}
- template <typename I>
+ template <typename Op, typename I>
inline
mln_concrete(I)
- erosion_octagon2d(const Image<I>& input_, const win::octagon2d& win)
+ general_octagon2d(const Op& op, const Image<I>& input_, const win::octagon2d& win)
{
- trace::entering("morpho::impl::erosion_octagon2d");
+ trace::entering("morpho::impl::general_octagon2d");
const I& input = exact(input_);
const unsigned len = (win.length() + 2) / 3;
mln_concrete(I) output;
- output = morpho::erosion(input, win::hline2d(len));
- output = morpho::erosion(output, win::vline2d(len));
- output = morpho::erosion(output, win::diag2d(len));
- output = morpho::erosion(output, win::backdiag2d(len));
+ output = morpho::general(op, input, win::hline2d(len));
+ output = morpho::general(op, output, win::vline2d(len));
+ output = morpho::general(op, output, win::diag2d(len));
+ output = morpho::general(op, output, win::backdiag2d(len));
- trace::exiting("morpho::impl::erosion_(win::octagon2d)");
+ trace::exiting("morpho::impl::general_(win::octagon2d)");
return output;
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
inline
mln_concrete(I)
- erosion_arbitrary_2d(const Image<I>& input, const Window<W>& win)
+ general_arbitrary_2d(const Op& op, const Image<I>& input, const Window<W>& win)
{
- trace::entering("morpho::impl:erosion_arbitrary_2d");
+ trace::entering("morpho::impl:general_arbitrary_2d");
- typedef mlc_is(mln_trait_image_kind(I), trait::image::kind::binary) is_binary;
- typedef mlc_if(is_binary, accu::land, accu::min_h<mln_value(I)>) A;
- A a;
-
- extension::adjust_fill(input, geom::delta(win) + 1, a);
- mln_concrete(I) output = accu::transform_snake(a, input, win);
+ extension::adjust_fill(input, geom::delta(win) + 1, op.neutral(input));
+ mln_concrete(I) output;
+ output = accu::transform_snake(op.accu_incr(input), input, win);
- trace::exiting("morpho::impl:erosion_arbitrary_2d");
+ trace::exiting("morpho::impl:general_arbitrary_2d");
return output;
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
inline
mln_concrete(I)
- erosion_directional(const Image<I>& input, const Window<W>& win, unsigned dir)
+ general_directional(const Op& op, const Image<I>& input, const Window<W>& win, unsigned dir)
{
- trace::entering("morpho::impl:erosion_directional");
+ trace::entering("morpho::impl:general_directional");
- typedef mlc_is(mln_trait_image_kind(I), trait::image::kind::binary) is_binary;
- typedef mlc_if(is_binary, accu::land, accu::min_h<mln_value(I)>) A;
- A a;
-
- extension::adjust_fill(input, geom::delta(win) + 1, a);
- mln_concrete(I) output = accu::transform_directional(a, input, win, dir);
+ extension::adjust_fill(input, geom::delta(win) + 1, op.neutral(input));
+ mln_concrete(I) output;
+ output = accu::transform_directional(op.accu_incr(input), input, win, dir);
- trace::exiting("morpho::impl:erosion_directional");
+ trace::exiting("morpho::impl:general_directional");
return output;
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
inline
mln_concrete(I)
- erosion_diagonal_2d(const Image<I>& input, const Window<W>& win)
+ general_diagonal_2d(const Op& op, const Image<I>& input, const Window<W>& win)
{
- trace::entering("morpho::impl:erosion_diagonal_2d");
-
- typedef mlc_is(mln_trait_image_kind(I), trait::image::kind::binary) is_binary;
- typedef mlc_if(is_binary, accu::land, accu::min_h<mln_value(I)>) A;
- A a;
+ trace::entering("morpho::impl:general_diagonal_2d");
- extension::adjust_fill(input, geom::delta(win) + 1, a);
- mln_concrete(I) output = accu::transform_diagonal(a, input, win);
+ extension::adjust_fill(input, geom::delta(win) + 1, op.neutral(input));
+ mln_concrete(I) output;
+ output = accu::transform_diagonal(op.accu_incr(input), input, win);
- trace::exiting("morpho::impl:erosion_diagonal_2d");
+ trace::exiting("morpho::impl:general_diagonal_2d");
return output;
}
@@ -317,37 +268,49 @@
namespace internal
{
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_for_generic(trait::image::kind::logic, // On sets.
- trait::image::speed::any,
- const I& input, const W& win)
+ general_dispatch_for_generic(trait::image::kind::logic, // On sets.
+ trait::image::speed::any, // Any speed.
+ const Op& op, const I& input, const W& win)
{
if (win.is_centered())
- return impl::erosion_on_set_centered(input, win);
+ return impl::general_on_set_centered(op, input, win);
else
- return impl::generic::erosion_on_set(input, win);
+ return impl::generic::general_on_set(op, input, win);
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_for_generic(trait::image::kind::any, // On functions.
+ general_dispatch_for_generic(trait::image::kind::logic, // On sets.
+ trait::image::speed::fastest, // Fastest.
+ const Op& op, const I& input, const W& win)
+ {
+ if (win.is_centered())
+ return impl::general_on_set_centered_fastest(op, input, win);
+ else
+ return impl::generic::general_on_set(op, input, win);
+ }
+
+ template <typename Op, typename I, typename W>
+ mln_concrete(I)
+ general_dispatch_for_generic(trait::image::kind::any, // On functions.
trait::image::speed::any,
- const I& input, const W& win)
+ const Op& op, const I& input, const W& win)
{
- return impl::generic::erosion_on_function(input, win);
+ return impl::generic::general_on_function(op, input, win);
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_for_generic(const I& input, const W& win) // Entry point.
+ general_dispatch_for_generic(const Op& op, const I& input, const W& win) // Entry point.
{
- trace::entering("morpho::erosion_dispatch_for_generic");
+ trace::entering("morpho::general_dispatch_for_generic");
mln_concrete(I) ima =
- erosion_dispatch_for_generic(mln_trait_image_kind(I)(),
+ general_dispatch_for_generic(mln_trait_image_kind(I)(),
mln_trait_image_speed(I)(),
- input, win);
- trace::entering("morpho::erosion_dispatch_for_generic");
+ op, input, win);
+ trace::entering("morpho::general_dispatch_for_generic");
return ima;
}
@@ -357,25 +320,25 @@
// dispatch w.r.t. win
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_wrt_arbitrary_win(metal::true_,
- const I& input, const W& win)
+ general_dispatch_wrt_arbitrary_win(metal::true_,
+ const Op& op, const I& input, const W& win)
{
- return morpho::impl::erosion_arbitrary_2d(input, win);
+ return morpho::impl::general_arbitrary_2d(op, input, win);
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_wrt_arbitrary_win(metal::false_,
- const I& input, const W& win)
+ general_dispatch_wrt_arbitrary_win(metal::false_,
+ const Op& op, const I& input, const W& win)
{
- return erosion_dispatch_for_generic(input, win);
+ return general_dispatch_for_generic(op, input, win);
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_wrt_win(const I& input, const W& win)
+ general_dispatch_wrt_win(const I& input, const W& win)
{
// FIXME:
// The test "win.size() >= 10" (size is not too small) has been
@@ -389,32 +352,32 @@
&&
mlc_not_equal(mln_trait_image_value_storage(I),
trait::image::value_storage::disrupted)::value };
- return erosion_dispatch_wrt_arbitrary_win(metal::bool_<test>(),
+ return general_dispatch_wrt_arbitrary_win(metal::bool_<test>(),
input, win);
}
- template <typename I>
+ template <typename Op, typename I>
mln_concrete(I)
- erosion_dispatch_wrt_win(const I& input, const win::rectangle2d& win)
+ general_dispatch_wrt_win(const Op& op, const I& input, const win::rectangle2d& win)
{
if (win.size() == 1)
return clone(input);
if (win.size() <= 9) // FIXME: Hard-coded!
- return erosion_dispatch_for_generic(input, win);
- return impl::erosion_rectangle2d(input, win);
+ return general_dispatch_for_generic(op, input, win);
+ return impl::general_rectangle2d(op, input, win);
}
- template <typename I>
+ template <typename Op, typename I>
mln_concrete(I)
- erosion_dispatch_wrt_win(const I& input, const win::octagon2d& win)
+ general_dispatch_wrt_win(const Op& op, const I& input, const win::octagon2d& win)
{
if (win.length() < 5)
- return impl::erosion_arbitrary_2d(input, win);
+ return impl::general_arbitrary_2d(op, input, win);
else
- return impl::erosion_octagon2d(input, win);
+ return impl::general_octagon2d(op, input, win);
}
@@ -422,37 +385,37 @@
/// Handling win::line(s).
/// \{
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_line(metal::true_,
- const I& input, const W& win)
+ general_dispatch_line(metal::true_,
+ const Op& op, const I& input, const W& win)
{
- return impl::erosion_directional(input, win, W::dir);
+ return impl::general_directional(op, input, win, W::dir);
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_line(metal::false_,
- const I& input, const W& win)
+ general_dispatch_line(metal::false_,
+ const Op& op, const I& input, const W& win)
{
- return erosion_dispatch_for_generic(input, win);
+ return general_dispatch_for_generic(op, input, win);
}
- template <typename I, typename M, unsigned i, typename C>
+ template <typename Op, typename I, typename M, unsigned i, typename C>
mln_concrete(I)
- erosion_dispatch_wrt_win(const I& input, const win::line<M,i,C>& win)
+ general_dispatch_wrt_win(const Op& op, const I& input, const win::line<M,i,C>& win)
{
if (win.size() == 1)
return clone(input);
else if (win.size() == 3)
- return erosion_dispatch_for_generic(input, win);
+ return general_dispatch_for_generic(op, input, win);
else
{
enum { test = mlc_is_a(mln_pset(I), Box)::value
&& mlc_equal(mln_trait_image_quant(I),
mln::trait::image::quant::low)::value };
- return erosion_dispatch_line(metal::bool_<test>(),
- input, win);
+ return general_dispatch_line(metal::bool_<test>(),
+ op, input, win);
}
}
@@ -464,53 +427,53 @@
/// Handling diagonals.
/// \{
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_diagonal(metal::true_,
- const I& input, const W& win)
+ general_dispatch_diagonal(metal::true_,
+ const Op& op, const I& input, const W& win)
{
- return impl::erosion_diagonal_2d(input, win);
+ return impl::general_diagonal_2d(op, input, win);
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_diagonal(metal::false_,
- const I& input, const W& win)
+ general_dispatch_diagonal(metal::false_,
+ const Op& op, const I& input, const W& win)
{
- return erosion_dispatch_for_generic(input, win);
+ return general_dispatch_for_generic(op, input, win);
}
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch_diagonal(const I& input, const W& win)
+ general_dispatch_diagonal(const Op& op, const I& input, const W& win)
{
if (win.size() == 1)
return clone(input);
else if (win.size() == 3)
- return erosion_dispatch_for_generic(input, win);
+ return general_dispatch_for_generic(op, input, win);
else
{
enum { test = mlc_is_a(mln_pset(I), Box)::value
&& mlc_equal(mln_trait_image_quant(I),
mln::trait::image::quant::low)::value };
- return erosion_dispatch_diagonal(metal::bool_<test>(),
- input, win);
+ return general_dispatch_diagonal(metal::bool_<test>(),
+ op, input, win);
}
}
- template <typename I>
+ template <typename Op, typename I>
mln_concrete(I)
- erosion_dispatch_wrt_win(const I& input, const win::diag2d& win)
+ general_dispatch_wrt_win(const Op& op, const I& input, const win::diag2d& win)
{
- return erosion_dispatch_diagonal(input, win);
+ return general_dispatch_diagonal(op, input, win);
}
- template <typename I>
+ template <typename Op, typename I>
mln_concrete(I)
- erosion_dispatch_wrt_win(const I& input, const win::backdiag2d& win)
+ general_dispatch_wrt_win(const Op& op, const I& input, const win::backdiag2d& win)
{
- return erosion_dispatch_diagonal(input, win);
+ return general_dispatch_diagonal(op, input, win);
}
/// \}
@@ -519,11 +482,11 @@
// The dispatch entry point.
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion_dispatch(const Image<I>& input, const Window<W>& win)
+ general_dispatch(const Op& op, const Image<I>& input, const Window<W>& win)
{
- return erosion_dispatch_wrt_win(exact(input), exact(win));
+ return general_dispatch_wrt_win(op, exact(input), exact(win));
}
} // end of namespace mln::morpho::internal
@@ -535,4 +498,4 @@
# endif // ! MLN_INCLUDE_ONLY
-#endif // ! MLN_MORPHO_EROSION_SPE_HH
+#endif // ! MLN_MORPHO_GENERAL_SPE_HH
Index: mln/morpho/general.hh
--- mln/morpho/general.hh (revision 2970)
+++ mln/morpho/general.hh (working copy)
@@ -26,17 +26,28 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_MORPHO_EROSION_HH
-# define MLN_MORPHO_EROSION_HH
+#ifndef MLN_MORPHO_GENERAL_HH
+# define MLN_MORPHO_GENERAL_HH
-/// \file mln/morpho/erosion.hh
+/// \file mln/morpho/general.hh
///
-/// \brief Morphological erosion.
+/// Morphological general routine with dispatch.
+///
+/// \todo Have infimum and supremum for value types, apart from
+/// morphology!
# include <mln/morpho/includes.hh>
// Specializations are in:
-# include <mln/morpho/erosion.spe.hh>
+# include <mln/morpho/general.spe.hh>
+
+
+
+# define mln_morpho_select_accu(I, S, F) \
+typename mln::metal::if_< mln::metal::is< mln_trait_image_kind(I), \
+ trait::image::kind::binary >, \
+ mln::accu::meta::S, \
+ mln::accu::meta::F >::ret
namespace mln
@@ -45,11 +56,10 @@
namespace morpho
{
- /*! Morphological erosion.
- */
- template <typename I, typename W>
+ /// Morphological general routine.
+ template <typename Op, typename I, typename W>
mln_concrete(I)
- erosion(const Image<I>& input, const Window<W>& win);
+ general(const Op& op, const Image<I>& input, const Window<W>& win);
# ifndef MLN_INCLUDE_ONLY
@@ -58,10 +68,10 @@
namespace internal
{
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
inline
void
- erosion_tests(const Image<I>& input_, const Window<W>& win_)
+ general_tests(const Op& op, const Image<I>& input_, const Window<W>& win_)
{
const I& input = exact(input_);
const W& win = exact(win_);
@@ -70,10 +80,31 @@
mln_precondition(! win.is_empty());
// mln_precondition(win.is_valid());
+ (void) op;
(void) input;
(void) win;
}
+
+ // Temporary code; see 'todo' above.
+ template <typename I, bool is_binary> // true
+ struct neutral_impl
+ {
+ static mln_value(I) infimum() { return false; }
+ static mln_value(I) supremum() { return true; }
+ };
+ template <typename I>
+ struct neutral_impl< I, false >
+ {
+ static mln_value(I) infimum() { return mln_min(mln_value(I)); }
+ static mln_value(I) supremum() { return mln_max(mln_value(I)); }
+ };
+ template <typename I>
+ struct neutral : neutral_impl< I, mlc_is(mln_trait_image_kind(I),
+ trait::image::kind::binary)::value >
+ {
+ };
+
} // end of mln::morpho::internal
@@ -86,39 +117,39 @@
// On function.
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
inline
mln_concrete(I)
- erosion_on_function(const Image<I>& input, const Window<W>& win)
+ general_on_function(const Op& op, const Image<I>& input, const Window<W>& win)
{
- trace::entering("morpho::impl::generic::erosion_on_function");
+ trace::entering("morpho::impl::generic::general_on_function");
- internal::erosion_tests(input, win);
+ internal::general_tests(op, input, win);
- extension::adjust_fill(input, win, mln_max(mln_value(I)));
+ extension::adjust_fill(input, win, op.neutral(input));
mln_concrete(I) output;
- output = accu::transform(input, accu::meta::min(), win);
+ output = accu::transform(input, op.accu(input), win);
- trace::exiting("morpho::impl::generic::erosion_on_function");
+ trace::exiting("morpho::impl::generic::general_on_function");
return output;
}
// On set.
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
inline
mln_concrete(I)
- erosion_on_set(const Image<I>& input, const Window<W>& win)
+ general_on_set(const Op& op, const Image<I>& input, const Window<W>& win)
{
- trace::entering("morpho::impl::generic::erosion_on_set");
+ trace::entering("morpho::impl::generic::general_on_set");
- internal::erosion_tests(input, win);
+ internal::general_tests(op, input, win);
- extension::adjust_fill(input, win, true);
+ extension::adjust_fill(input, win, op.neutral(input));
mln_concrete(I) output;
- output = accu::transform_stop(input, accu::land_basic(), win);
+ output = accu::transform_stop(input, op.accu(input), win);
- trace::exiting("morpho::impl::generic::erosion_on_set");
+ trace::exiting("morpho::impl::generic::general_on_set");
return output;
}
@@ -130,21 +161,21 @@
// Facades.
- template <typename I, typename W>
+ template <typename Op, typename I, typename W>
inline
mln_concrete(I)
- erosion(const Image<I>& input, const Window<W>& win)
+ general(const Op& op, const Image<I>& input, const Window<W>& win)
{
- trace::entering("morpho::erosion");
+ trace::entering("morpho::general");
mln_precondition(exact(input).has_data());
mln_precondition(! exact(win).is_empty());
- internal::erosion_tests(input, win);
- mln_concrete(I) output = internal::erosion_dispatch(input, win);
+ internal::general_tests(op, input, win);
+ mln_concrete(I) output = internal::general_dispatch(op, input, win);
if (exact(win).is_centered())
mln_postcondition(output <= input);
- trace::exiting("morpho::erosion");
+ trace::exiting("morpho::general");
return output;
}
@@ -155,4 +186,4 @@
} // end of namespace mln
-#endif // ! MLN_MORPHO_EROSION_HH
+#endif // ! MLN_MORPHO_GENERAL_HH
1
0
* doc/Makefile.am: Fix tutorial compilation.
* mln/convert/to_p_set.hh: Fix a test.
* mln/convert/to_window.hh: Get dpsite type correctly.
* tests/canvas/browsing/fwd.cc,
* tests/canvas/browsing/hyper_directional.cc,
* tests/canvas/browsing/snake_fwd.cc,
* tests/canvas/browsing/snake_vert.cc,
* mln/util/edge.hh,
* mln/util/vertex.hh,
* mln/trait/value_.hh,
* mln/trait/neighborhood.hh,
* mln/geom/all.hh,
* mln/core/internal/graph_window_base.hh,
* mln/core/image/translate_image.hh,
* mln/core/concept/generalized_pixel.hh,
* mln/core/clock_neighb2d.hh,
* mln/core/clock_neighb.hh: fix a compilation error and update doc
style.
* mln/geom/chamfer.hh: revamp.
* mln/morpho/elementary/gradient.hh,
* mln/geom/delta.hh: avoid a warning.
* tests/geom/resize.cc,
* tests/level/stretch.cc,
* tests/fun/x2x/rotation.cc,
* tests/convert/to_p_set.cc,
* tests/convert/to_window.cc,
* mln/value/set.hh,
* mln/set/inter.hh,
* mln/topo/face.hh: update doc style.
* tests/win/Makefile.am,
* tests/morpho/Makefile.am,
* tests/fun/x2x/Makefile.am,
* tests/core/other/Makefile.am,
* tests/core/image/Makefile.am,
* tests/convert/Makefile.am,
* tests/Makefile.am: comment known non working tests.
* tests/core/image/flat_image.cc,
* tests/convert/to_p_array.cc: write test.
* tests/core/other/graph_elt_neighborhood.cc,
* tests/core/other/graph_elt_window.cc,
* tests/core/other/line_graph_elt_neighborhood.cc,
* tests/core/other/line_graph_elt_window.cc,
* tests/draw/graph.cc,
* tests/fun/x2x/composed.cc,
* tests/fun/x2x/translation.cc,
* tests/morpho/graph_image_morpho.cc: Fix tests.
* tests/set/inter.cc: split and move to...
* tests/win/inter.cc: ...here.
---
milena/ChangeLog | 63 +++++++++++++++
milena/doc/Makefile.am | 1 +
milena/mln/convert/to_p_set.hh | 12 ++--
milena/mln/convert/to_window.hh | 27 ++++---
milena/mln/core/clock_neighb.hh | 70 ++++++++--------
milena/mln/core/clock_neighb2d.hh | 82 ++++++++++----------
milena/mln/core/concept/generalized_pixel.hh | 34 ++++----
milena/mln/core/image/translate_image.hh | 38 ++++-----
milena/mln/core/internal/graph_window_base.hh | 2 +
milena/mln/geom/all.hh | 15 ++--
milena/mln/geom/chamfer.hh | 50 +++++-------
milena/mln/geom/delta.hh | 13 ++-
milena/mln/morpho/elementary/gradient.hh | 3 +
milena/mln/set/diff.hh | 24 +++---
milena/mln/set/inter.hh | 17 ++--
milena/mln/topo/face.hh | 1 +
milena/mln/trait/neighborhood.hh | 3 +
milena/mln/trait/value_.hh | 12 ++--
milena/mln/util/edge.hh | 1 +
milena/mln/util/vertex.hh | 1 +
milena/mln/value/set.hh | 19 ++---
milena/tests/Makefile.am | 3 +-
milena/tests/canvas/browsing/fwd.cc | 14 +--
milena/tests/canvas/browsing/hyper_directional.cc | 21 ++---
milena/tests/canvas/browsing/snake_fwd.cc | 14 +--
milena/tests/canvas/browsing/snake_vert.cc | 19 ++---
milena/tests/convert/Makefile.am | 3 +-
milena/tests/convert/to_p_array.cc | 28 ++++---
milena/tests/convert/to_p_set.cc | 8 +-
milena/tests/convert/to_window.cc | 8 +-
milena/tests/core/image/Makefile.am | 11 ++-
milena/tests/core/image/flat_image.cc | 25 ++++--
milena/tests/core/other/Makefile.am | 9 +-
milena/tests/core/other/graph_elt_neighborhood.cc | 27 ++++---
milena/tests/core/other/graph_elt_window.cc | 27 ++++---
.../core/other/line_graph_elt_neighborhood.cc | 27 ++++---
milena/tests/core/other/line_graph_elt_window.cc | 27 ++++---
milena/tests/draw/graph.cc | 75 +++++++++---------
milena/tests/fun/x2x/Makefile.am | 4 +-
milena/tests/fun/x2x/composed.cc | 15 ++--
milena/tests/fun/x2x/rotation.cc | 18 +++--
milena/tests/fun/x2x/translation.cc | 10 +-
milena/tests/geom/resize.cc | 9 +-
milena/tests/level/stretch.cc | 2 +-
milena/tests/morpho/Makefile.am | 35 ++++----
milena/tests/morpho/graph_image_morpho.cc | 71 +++++++++++-------
milena/tests/set/inter.cc | 81 +++++++-------------
milena/tests/win/Makefile.am | 2 +
milena/tests/{set => win}/inter.cc | 38 ++--------
49 files changed, 591 insertions(+), 528 deletions(-)
copy milena/tests/{set => win}/inter.cc (68%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 013cb36..5c63c93 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,66 @@
+2008-11-28 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix various tests.
+
+ * doc/Makefile.am: Fix tutorial compilation.
+
+ * mln/convert/to_p_set.hh: Fix a test.
+
+ * mln/convert/to_window.hh: Get dpsite type correctly.
+
+ * tests/canvas/browsing/fwd.cc,
+ * tests/canvas/browsing/hyper_directional.cc,
+ * tests/canvas/browsing/snake_fwd.cc,
+ * tests/canvas/browsing/snake_vert.cc,
+ * mln/util/edge.hh,
+ * mln/util/vertex.hh,
+ * mln/trait/value_.hh,
+ * mln/trait/neighborhood.hh,
+ * mln/geom/all.hh,
+ * mln/core/internal/graph_window_base.hh,
+ * mln/core/image/translate_image.hh,
+ * mln/core/concept/generalized_pixel.hh,
+ * mln/core/clock_neighb2d.hh,
+ * mln/core/clock_neighb.hh: fix a compilation error and update doc
+ style.
+
+ * mln/geom/chamfer.hh: revamp.
+
+ * mln/morpho/elementary/gradient.hh,
+ * mln/geom/delta.hh: avoid a warning.
+
+ * tests/geom/resize.cc,
+ * tests/level/stretch.cc,
+ * tests/fun/x2x/rotation.cc,
+ * tests/convert/to_p_set.cc,
+ * tests/convert/to_window.cc,
+ * mln/value/set.hh,
+ * mln/set/inter.hh,
+ * mln/topo/face.hh: update doc style.
+
+ * tests/win/Makefile.am,
+ * tests/morpho/Makefile.am,
+ * tests/fun/x2x/Makefile.am,
+ * tests/core/other/Makefile.am,
+ * tests/core/image/Makefile.am,
+ * tests/convert/Makefile.am,
+ * tests/Makefile.am: comment known non working tests.
+
+ * tests/core/image/flat_image.cc,
+ * tests/convert/to_p_array.cc: write test.
+
+ * tests/core/other/graph_elt_neighborhood.cc,
+ * tests/core/other/graph_elt_window.cc,
+ * tests/core/other/line_graph_elt_neighborhood.cc,
+ * tests/core/other/line_graph_elt_window.cc,
+ * tests/draw/graph.cc,
+ * tests/fun/x2x/composed.cc,
+ * tests/fun/x2x/translation.cc,
+ * tests/morpho/graph_image_morpho.cc: Fix tests.
+
+ * tests/set/inter.cc: split and move to...
+ * tests/win/inter.cc: ...here.
+
2008-11-28 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix minor bugs.
diff --git a/milena/doc/Makefile.am b/milena/doc/Makefile.am
index a0a71f8..91a9700 100644
--- a/milena/doc/Makefile.am
+++ b/milena/doc/Makefile.am
@@ -21,6 +21,7 @@ html_user: Doxyfile tuto_html
$(DOXYGEN) Doxyfile_user
tuto_html:
+ $(MAKE) -C tutorial tuto_html
tuto: all
$(MAKE) -C tutorial tuto
diff --git a/milena/mln/convert/to_p_set.hh b/milena/mln/convert/to_p_set.hh
index 0e4bc30..0c08d03 100644
--- a/milena/mln/convert/to_p_set.hh
+++ b/milena/mln/convert/to_p_set.hh
@@ -1,4 +1,5 @@
// 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,13 +29,12 @@
#ifndef MLN_CONVERT_TO_P_SET_HH
# define MLN_CONVERT_TO_P_SET_HH
-/*! \file mln/convert/to_p_set.hh
- *
- * \brief Conversions to mln::p_set.
- */
+/// \file mln/convert/to_p_set.hh
+///
+/// Conversions to mln::p_set.
# include <set>
-
+
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/concept/window.hh>
# include <mln/core/concept/point_site.hh>
@@ -133,7 +133,7 @@ namespace mln
to_p_set(const std::set<P, C>& s)
{
P titi;
- mln::metal::is_a<P, Point_Site>::check();
+ mln::metal::is_a<P, Site>::check();
p_set<P> pset;
for (typename std::set<P, C>::const_iterator i = s.begin();
i != s.end(); ++i)
diff --git a/milena/mln/convert/to_window.hh b/milena/mln/convert/to_window.hh
index 666d071..95cdf2b 100644
--- a/milena/mln/convert/to_window.hh
+++ b/milena/mln/convert/to_window.hh
@@ -29,14 +29,13 @@
#ifndef MLN_CONVERT_TO_WINDOW_HH
# define MLN_CONVERT_TO_WINDOW_HH
-/*! \file mln/convert/to_window.hh
- *
- * \brief Conversions to mln::window.
- */
+/// \file mln/convert/to_window.hh
+///
+/// Conversions to mln::window.
# include <set>
-
-# include <mln/core/concept/delta_point_site.hh>
+
+# include <mln/core/concept/gdpoint.hh>
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/window.hh>
# include <mln/pw/image.hh>
@@ -56,11 +55,11 @@ namespace mln
/// Convert a binary image \p ima into a window.
template <typename I>
- window<mln_dpsite(I)> to_window(const Image<I>& ima);
+ window<mln_site(I)::dpsite> to_window(const Image<I>& ima);
/// Convert a site set \p pset into a window.
template <typename S>
- window<mln_dpsite(S)> to_window(const Site_Set<S>& pset);
+ window<mln_site(S)::dpsite> to_window(const Site_Set<S>& pset);
/// Convert an std::set \p s of delta-sites into a window.
template <typename D, typename C>
@@ -95,13 +94,13 @@ namespace mln
depth in milena/core/concepts/README. */
template <typename I>
inline
- window<mln_dpsite(I)> to_window(const Image<I>& ima_)
+ window<mln_site(I)::dpsite> to_window(const Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
// FIXME: Check that ima is binary!
- typedef mln_dpsite(I) D;
- typedef mln_site(D) P;
+ typedef mln_site(I) P;
+ typedef mln_dpsite(P) D;
window<D> win;
mln_piter(I) p(ima.domain());
@@ -111,13 +110,14 @@ namespace mln
return win;
}
+
/*----------------------------------.
| Point set-to-window conversions. |
`----------------------------------*/
template <typename S>
inline
- window<mln_dpsite(S)> to_window(const Site_Set<S>& pset)
+ window<mln_site(S)::dpsite> to_window(const Site_Set<S>& pset)
{
return to_window(pw::cst(true) | pset);
}
@@ -131,7 +131,8 @@ namespace mln
window<D> to_window(const std::set<D, C>& s)
{
// FIXME: Was: mln::metal::is_a<D, Dpoint>::check();
- mln::metal::is_a<D, Delta_Point_Site>::check();
+ // OR mln::metal::is_a<D, Delta_Point_Site>::check();
+ mln::metal::is_a<D, Gdpoint>::check();
window<D> win;
for (typename std::set<D, C>::const_iterator i = s.begin();
i != s.end(); ++i)
diff --git a/milena/mln/core/clock_neighb.hh b/milena/mln/core/clock_neighb.hh
index a7e0348..1e18a8c 100644
--- a/milena/mln/core/clock_neighb.hh
+++ b/milena/mln/core/clock_neighb.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,10 @@
#ifndef MLN_CORE_CLOCK_NEIGHB_HH
# define MLN_CORE_CLOCK_NEIGHB_HH
-/*! \file mln/core/clock_neighb.hh
- *
- * \brief Definition of the generic neighborhood class mln::clock_neighb.
- */
+/// \file mln/core/clock_neighb.hh
+///
+/// Definition of the generic neighborhood class mln::clock_neighb.
+
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/dpoint.hh>
@@ -45,11 +46,11 @@ namespace mln
template <typename D> class dpsites_bkd_piter;
- /*! \brief Generic neighborhood class.
- *
- * This neighborhood of window is just like a set of delta-psites.
- * The parameter is \c D, type of delta-psite.
- */
+ /// Generic neighborhood class.
+ ///
+ /// This neighborhood of window is just like a set of delta-psites.
+ /// The parameter is \c D, type of delta-psite.
+ ///
template <typename D>
struct clock_neighb : public Neighborhood< clock_neighb <D> >
{
@@ -57,40 +58,39 @@ namespace mln
typedef D dpsite;
/// Site associated type.
- typedef mln_psite(D) point;
+ typedef mln_psite(D) site;
- /*! \brief Site_Iterator type to browse the psites of a generic
- * neighborhood w.r.t. the ordering of delta-psites.
- */
+ /// Site_Iterator type to browse the psites of a generic
+ /// neighborhood w.r.t. the ordering of delta-psites.
+ ///
typedef dpsites_fwd_piter<D> fwd_niter;
- /*! \brief Site_Iterator type to browse the psites of a generic
- * neighborhood w.r.t. the reverse ordering of delta-psites.
- *
- * !!! Be careful the start delta psite become the last now.
- */
+ /// Site_Iterator type to browse the psites of a generic
+ /// neighborhood w.r.t. the reverse ordering of delta-psites.
+ ///
+ /// !!! Be careful the start delta psite become the last now.
+ ///
typedef dpsites_bkd_piter<D> bkd_niter;
- /*! \brief Same as fwd_niter.
- */
+ /// Same as fwd_niter.
typedef fwd_niter niter;
- /*! \brief Constructor without argument.
- *
- * The constructed neighborhood is empty. You have to use insert()
- * to proceed to the neighborhood definition.
- */
+ /// Constructor without argument.
+ ///
+ /// The constructed neighborhood is empty. You have to use insert()
+ /// to proceed to the neighborhood definition.
+ ///
clock_neighb();
- /*! \brief Insert a delta-psite \p dp in the neighborhood
- * definition.
- *
- * \param[in] dp The delta-psite to insert.
- *
- * This method also insert the symmetrical delta-psite, - \p dp,
- * in the neighborhood definition; thus the client has not to
- * ensure the symmetry property; that is automatic.
- */
+ /// Insert a delta-psite \p dp in the neighborhood
+ /// definition.
+ ///
+ /// \param[in] dp The delta-psite to insert.
+ ///
+ /// This method also insert the symmetrical delta-psite, - \p dp,
+ /// in the neighborhood definition; thus the client has not to
+ /// ensure the symmetry property; that is automatic.
+ ///
clock_neighb<D>& append(const D& dp);
/// \}
const std::vector<D>& vect() const
diff --git a/milena/mln/core/clock_neighb2d.hh b/milena/mln/core/clock_neighb2d.hh
index 5f48d7b..0d7876b 100644
--- a/milena/mln/core/clock_neighb2d.hh
+++ b/milena/mln/core/clock_neighb2d.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,11 +29,10 @@
#ifndef MLN_CORE_CLOCK_NEIGHB2D_HH
# define MLN_CORE_CLOCK_NEIGHB2D_HH
-/*! \file mln/core/clock_neighb2d.hh
- *
- * \brief Definition of the mln::clock_neighb2d alias and of some classical
- * 2D clock_neighborhoods.
- */
+/// \file mln/core/clock_neighb2d.hh
+///
+/// Definition of the mln::clock_neighb2d alias and of some classical
+/// 2D clock_neighborhoods.
# include <cmath>
# include <mln/core/clock_neighb.hh>
@@ -42,53 +42,51 @@
namespace mln
{
- /*! \brief Type alias for a clock_neighborhood defined on the 2D square
- * grid with integer coordinates.
- */
- typedef clock_neighb_<dpoint2d> clock_neighb2d;
+ /// Type alias for a clock_neighborhood defined on the 2D square
+ /// grid with integer coordinates.
+ ///
+ typedef clock_neighb<dpoint2d> clock_neighb2d;
- /*! \brief 4-connectivity clock_neighborhood on the 2D grid.
- *
- * - o -
- * o x o
- * - o -
- *
- * \return A clock_neighb2d.
- */
+ /// 4-connectivity clock_neighborhood on the 2D grid.
+ ///
+ /// - o -
+ /// o x o
+ /// - o -
+ ///
+ /// \return A clock_neighb2d.
const clock_neighb2d cc4(dpoint2d& dp);
- /*! \brief 8-connectivity clock_neighborhood on the 2D grid.
- *
- * o o o
- * o x o
- * o o o
- *
- * \return A clock_neighb2d.
- */
+ /// 8-connectivity clock_neighborhood on the 2D grid.
+ ///
+ /// o o o
+ /// o x o
+ /// o o o
+ ///
+ /// \return A clock_neighb2d.
const clock_neighb2d cc8(dpoint2d& dp);
-// /*! \brief Horizontal 2-connectivity clock_neighborhood on the 2D grid.
-// *
-// * - - -
-// * o x o
-// * - - -
-// *
-// * \return A clock_neighb2d.
-// */
+// /// Horizontal 2-connectivity clock_neighborhood on the 2D grid.
+// ///
+// /// - - -
+// /// o x o
+// /// - - -
+// ///
+// /// \return A clock_neighb2d.
+// ///
// const clock_neighb2d& c2_row();
-// /*! \brief Vertical 2-connectivity clock_neighborhood on the 2D grid.
-// *
-// * - o -
-// * - x -
-// * - o -
-// *
-// * \return A clock_neighb2d.
-// */
+// /// Vertical 2-connectivity clock_neighborhood on the 2D grid.
+// ///
+// /// - o -
+// /// - x -
+// /// - o -
+// ///
+// /// \return A clock_neighb2d.
+// ///
// const clock_neighb2d& c2_col();
diff --git a/milena/mln/core/concept/generalized_pixel.hh b/milena/mln/core/concept/generalized_pixel.hh
index 10c75bc..fbbff12 100644
--- a/milena/mln/core/concept/generalized_pixel.hh
+++ b/milena/mln/core/concept/generalized_pixel.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_CORE_CONCEPT_GENERALIZED_PIXEL_HH
# define MLN_CORE_CONCEPT_GENERALIZED_PIXEL_HH
-/*! \file mln/core/concept/generalized_pixel.hh
- *
- * \brief Definition of the concept of mln::Generalized_Pixel.
- */
+/// \file mln/core/concept/generalized_pixel.hh
+///
+/// Definition of the concept of mln::Generalized_Pixel.
# include <mln/core/concept/object.hh>
# include <mln/core/internal/force_exact.hh>
@@ -41,17 +41,17 @@
namespace mln
{
- /*! \brief Base class for implementation classes that are pixels or that
- * have the behavior of pixels.
- *
- * \warning This class does \em not derive from mln::Object; it is
- * for use as a parallel hierarchy.
- *
- * \see mln::doc::Generalized_Pixel for a complete documentation of this
- * class contents.
- *
- * \todo (later) Add an access to the targetted image.
- */
+ /// Base class for implementation classes that are pixels or that
+ /// have the behavior of pixels.
+ ///
+ /// \warning This class does \em not derive from mln::Object; it is
+ /// for use as a parallel hierarchy.
+ ///
+ /// \see mln::doc::Generalized_Pixel for a complete documentation of this
+ /// class contents.
+ ///
+ /// \todo (later) Add an access to the targetted image.
+ ///
template <typename E>
struct Generalized_Pixel
{
@@ -68,7 +68,7 @@ namespace mln
operator unsigned() const // FIXME: Change to std::size_t
{
const E& it_ = internal::force_exact<E>(*this);
- return & it_.val() - & it_.ima()[0];
+ return & it_.val() - & it_.ima().buffer()[0];
}
protected:
diff --git a/milena/mln/core/image/translate_image.hh b/milena/mln/core/image/translate_image.hh
index d3aa4d3..39a990c 100644
--- a/milena/mln/core/image/translate_image.hh
+++ b/milena/mln/core/image/translate_image.hh
@@ -1,4 +1,5 @@
// 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_CORE_IMAGE_TRANSLATE_IMAGE_HH
# define MLN_CORE_IMAGE_TRANSLATE_IMAGE_HH
-/*! \file mln/core/image/translate_image.hh
- *
- * \brief Definition of an image which be translated by a delta point.
- */
+/// \file mln/core/image/translate_image.hh
+///
+/// Definition of an image which be translated by a delta point.
# include <cmath>
@@ -53,7 +53,7 @@ namespace mln
template <typename I>
struct data< translate_image<I> >
{
- data(I& ima, const mln_dpsite(I) dp);
+ data(I& ima, const mln_site(I)::dpsite dp);
I ima_;
@@ -61,7 +61,7 @@ namespace mln
box2d bb_;
/// Delta point of translation.
- const mln_dpsite(I) dp_;
+ const mln_site(I)::dpsite dp_;
};
} // end of namespace mln::internal
@@ -77,29 +77,27 @@ namespace mln
{
typedef trait::image::category::domain_morpher category;
- typedef mln_trait_image_value_access(I) access;
- typedef mln_trait_image_localization(I) space;
- typedef mln_trait_image_size(I) size;
+ typedef mln_trait_image_value_access(I) value_access;
+ typedef mln_trait_image_localization(I) localization;
+ typedef mln_trait_image_size(I) size;
//typedef mln_trait_image_io_from_(I) io;
//typedef mln_trait_image_data_from_(I) data;
-
};
} // end of namespace mln::trait
- /*! \brief Translate image class.
- *
- * The parameter \c I is the type of image. This image class
- * makes a translation of a delta point.
- *
- */
+ /// \brief Translate image class.
+ ///
+ /// The parameter \c I is the type of image. This image class
+ /// makes a translation of a delta point.
+ ///
template <typename I>
struct translate_image : public mln::internal::image_identity< I, mln_pset(I), translate_image<I> >
{
- typedef mln::internal::image_morpher< I, mln_value(I), mln_pset(I), translate_image<I> > super_;
+ typedef mln::internal::image_identity< I, mln_pset(I), translate_image<I> > super_;
/// Return type of read-write access.
typedef mln_morpher_lvalue(I) lvalue;
@@ -111,7 +109,7 @@ namespace mln
using super_::has_data;
/// Constructors.
- translate_image(I& ima, const mln_dpsite(I) dp);
+ translate_image(I& ima, const mln_site(I)::dpsite dp);
translate_image();
/// Return domain of translated_image.
@@ -138,7 +136,7 @@ namespace mln
template <typename I>
inline
- data< translate_image<I> >::data(I& ima, const mln_dpsite(I) dp)
+ data< translate_image<I> >::data(I& ima, const mln_site(I)::dpsite dp)
: ima_ (ima),
dp_ (dp)
{
@@ -156,7 +154,7 @@ namespace mln
template <typename I>
inline
- translate_image<I>::translate_image(I& ima, const mln_dpsite(I) dp)
+ translate_image<I>::translate_image(I& ima, const mln_site(I)::dpsite dp)
{
mln_precondition(ima.has_data());
this->data_ = new internal::data< translate_image<I> >(ima, dp);
diff --git a/milena/mln/core/internal/graph_window_base.hh b/milena/mln/core/internal/graph_window_base.hh
index ff4bfc0..3c91448 100644
--- a/milena/mln/core/internal/graph_window_base.hh
+++ b/milena/mln/core/internal/graph_window_base.hh
@@ -28,6 +28,8 @@
#ifndef MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
# define MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
+# include <set>
+
/// \file mln/internal/graph_window_base.hh
///
/// FIXME: doc
diff --git a/milena/mln/geom/all.hh b/milena/mln/geom/all.hh
index 8d419e4..8fb786f 100644
--- a/milena/mln/geom/all.hh
+++ b/milena/mln/geom/all.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 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 +28,9 @@
#ifndef MLN_GEOM_ALL_HH
# define MLN_GEOM_ALL_HH
-/*! \file mln/geom/all.hh
- *
- * \brief File that includes all geometry related things.
- */
+/// \file mln/geom/all.hh
+///
+/// File that includes all geometry related things.
namespace mln
@@ -48,6 +47,8 @@ namespace mln
# include <mln/geom/bbox.hh>
# include <mln/geom/chamfer.hh>
+# include <mln/geom/complex_geometry.hh>
+# include <mln/geom/delta.hh>
# include <mln/geom/max_col.hh>
# include <mln/geom/max_ind.hh>
# include <mln/geom/max_row.hh>
@@ -59,6 +60,7 @@ namespace mln
# include <mln/geom/ncols.hh>
# include <mln/geom/ninds.hh>
# include <mln/geom/nrows.hh>
+# include <mln/geom/nsites.hh>
# include <mln/geom/nslis.hh>
# include <mln/geom/pmin_pmax.hh>
# include <mln/geom/resize.hh>
@@ -67,8 +69,5 @@ namespace mln
# include <mln/geom/size1d.hh>
# include <mln/geom/size2d.hh>
# include <mln/geom/size3d.hh>
-# include <mln/geom/complex_geometry.hh>
-# include <mln/geom/nsites.hh>
-# include <mln/geom/delta.hh>
#endif // ! MLN_GEOM_ALL_HH
diff --git a/milena/mln/geom/chamfer.hh b/milena/mln/geom/chamfer.hh
index df3b515..a47116e 100644
--- a/milena/mln/geom/chamfer.hh
+++ b/milena/mln/geom/chamfer.hh
@@ -33,17 +33,8 @@
///
/// Connected component chamfer of the image objects.
-# include <mln/level/fill.hh>
-# include <mln/core/alias/w_window2d_int.hh>
-# include <mln/core/alias/w_window2d_float.hh>
-# include <mln/core/image/sub_image.hh>
-
-# include <mln/core/image/image_if.hh>
# include <mln/canvas/chamfer.hh>
-//FIXME: to be removed when ima | bool will be supported.
-// See init().
-# include <mln/pw/all.hh>
namespace mln
{
@@ -54,8 +45,8 @@ namespace mln
/// Apply chamfer algorithm to a binary image.
template <typename I, typename W>
mln_ch_value(I, unsigned)
- chamfer(const Image<I>& input_, const W& w_win_,
- unsigned max = mln_max(unsigned));
+ chamfer(const Image<I>& input_, const W& w_win_,
+ unsigned max = mln_max(unsigned));
# ifndef MLN_INCLUDE_ONLY
@@ -114,37 +105,36 @@ namespace mln
{}
};
- /// Routines.
-
- template <typename I, typename W>
- inline
- mln_ch_value(I, unsigned)
- chamfer_(const Image<I>& input_, const W& w_win_,
- unsigned max = mln_max(unsigned))
- {
- typedef chamfer_t<I, W> F;
+ } // end of namespace mln::geom::impl
- F f(exact(input_), exact(w_win_), max);
- canvas::chamfer<F> run(f);
- return f.output;
- }
- } // end of namespace mln::geom::impl
// Facade.
template <typename I, typename W>
mln_ch_value(I, unsigned)
- chamfer(const Image<I>& input_, const W& w_win_,
- unsigned max = mln_max(unsigned))
+ chamfer(const Image<I>& input_, const W& w_win_,
+ unsigned max = mln_max(unsigned))
{
- return impl::chamfer_t<I, W>(exact (input_), exact(w_win_), max);
+ trace::entering("mln::geom::chamfer");
+ // FIXME: check that input_ is binary.
+
+ const I& input = exact(input_);
+ const W& w_win = exact(w_win_);
+
+ typedef impl::chamfer_t<I, W> F;
+
+ F f(input, w_win, max);
+ canvas::chamfer<F> run(f);
+
+ trace::exiting("mln::geom::chamfer");
+ return f.output;
}
-#endif // !MLN_INCLUDE_ONLY
+#endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::geom
} // end of namespace mln
-#endif // !MLN_GEOM_CHAMFER_HH
+#endif // ! MLN_GEOM_CHAMFER_HH
diff --git a/milena/mln/geom/delta.hh b/milena/mln/geom/delta.hh
index 1ffb94a..dd7dac4 100644
--- a/milena/mln/geom/delta.hh
+++ b/milena/mln/geom/delta.hh
@@ -1,4 +1,5 @@
// Copyright (C) 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,10 @@
#ifndef MLN_GEOM_DELTA_HH
# define MLN_GEOM_DELTA_HH
-/*! \file mln/geom/delta.hh
- *
- * \todo Add doc.
- */
+/// \file mln/geom/delta.hh
+///
+/// \todo Add doc.
+
# include <mln/core/concept/window.hh>
# include <mln/core/concept/weighted_window.hh>
@@ -68,14 +69,16 @@ namespace mln
trait::window::definition::any,
const W& win)
{
+ (void) win;
return 0;
}
template <typename W>
unsigned delta_dispatch(trait::window::support::regular,
trait::window::definition::varying,
- const W&)
+ const W& win)
{
+ (void) win;
return 0;
}
diff --git a/milena/mln/morpho/elementary/gradient.hh b/milena/mln/morpho/elementary/gradient.hh
index f4e7843..2f273ad 100644
--- a/milena/mln/morpho/elementary/gradient.hh
+++ b/milena/mln/morpho/elementary/gradient.hh
@@ -1,4 +1,5 @@
// Copyright (C) 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
@@ -62,6 +63,8 @@ namespace mln
{
mln_precondition(exact(input).has_data());
// mln_precondition(exact(nbh).is_valid());
+ (void) input;
+ (void) nbh;
}
} // end of namespace mln::morpho::elementary::tests
diff --git a/milena/mln/set/diff.hh b/milena/mln/set/diff.hh
index af86485..250781b 100644
--- a/milena/mln/set/diff.hh
+++ b/milena/mln/set/diff.hh
@@ -1,4 +1,5 @@
// 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,13 +29,14 @@
#ifndef MLN_SET_DIFF_HH
# define MLN_SET_DIFF_HH
-/*! \file mln/set/diff.hh
- *
- * \brief Set theoretic difference (non-symmetrical) of a couple of
- * sets.
- *
- * \todo Add a diff(Site_Set& in_place, Function_p2b).
- */
+/// \file mln/set/diff.hh
+///
+/// Set theoretic difference (non-symmetrical) of a couple of
+/// sets.
+///
+/// \todo Add a diff(Site_Set& in_place, Function_p2b).
+/// \todo Fix this function!
+
# include <mln/convert/to_std_set.hh>
# include <mln/convert/to_p_set.hh>
@@ -48,10 +50,10 @@ namespace mln
namespace set
{
- /*! \brief Set theoretic difference of \p lhs and \p rhs.
- *
- * \relates mln::Site_Set
- */
+ /// Set theoretic difference of \p lhs and \p rhs.
+ ///
+ /// \relates mln::Site_Set
+ ///
template <typename Wl, typename Wr>
p_set<mln_psite(Wl)>
diff(const Site_Set<Wl>& lhs, const Site_Set<Wr>& rhs);
diff --git a/milena/mln/set/inter.hh b/milena/mln/set/inter.hh
index fce3cdf..ff65402 100644
--- a/milena/mln/set/inter.hh
+++ b/milena/mln/set/inter.hh
@@ -29,11 +29,10 @@
#ifndef MLN_SET_INTER_HH
# define MLN_SET_INTER_HH
-/*! \file mln/set/inter.hh
- *
- * \brief Several routines to compute the intersection between a
- * couple of site sets.
- */
+/// \file mln/set/inter.hh
+///
+/// Several routines to compute the intersection between a
+/// couple of site sets.
# include <mln/convert/to_std_set.hh>
# include <mln/convert/to_p_set.hh>
@@ -48,10 +47,10 @@ namespace mln
namespace set
{
- /*! \brief Intersection between a couple of point sets.
- *
- * \relates mln::Site_Set
- */
+ /// Intersection between a couple of point sets.
+ ///
+ /// \relates mln::Site_Set
+ ///
template <typename Wl, typename Wr>
p_set<mln_psite(Wl)>
inter(const Site_Set<Wl>& lhs, const Site_Set<Wr>& rhs);
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 4ace2ab..53b5ad3 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -35,6 +35,7 @@
#include <vector>
#include <mln/core/contract.hh>
+#include <mln/metal/bool.hh>
namespace mln
diff --git a/milena/mln/trait/neighborhood.hh b/milena/mln/trait/neighborhood.hh
index 5065671..56db0c9 100644
--- a/milena/mln/trait/neighborhood.hh
+++ b/milena/mln/trait/neighborhood.hh
@@ -49,6 +49,9 @@ namespace mln
namespace trait
{
+ // Forward declaration.
+ struct undef;
+
struct undefined_neighborhood
{
typedef undef kind;
diff --git a/milena/mln/trait/value_.hh b/milena/mln/trait/value_.hh
index 92503dc..9c41ee8 100644
--- a/milena/mln/trait/value_.hh
+++ b/milena/mln/trait/value_.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_TRAIT_VALUE__HH
# define MLN_TRAIT_VALUE__HH
-/*! \file mln/trait/value_.hh
- *
- * \brief Some base trait types for value types.
- */
+/// \file mln/trait/value_.hh
+///
+/// Some base trait types for value types.
# include <iostream>
# include <string>
@@ -49,7 +49,7 @@
# define mln_trait_value_kind(V) typename mln::trait::value_< V >::kind
# define mln_trait_value_kind_(V) mln::trait::value_< V >::kind
# define mln_trait_value_quant(V) typename mln::trait::value_< V >::quant
-# define mln_trait_value_quant_(V) mln::trait::bvalue_< V >::quant
+# define mln_trait_value_quant_(V) mln::trait::value_< V >::quant
# define mln_nbits(V) mln::trait::value_< V >::nbits
diff --git a/milena/mln/util/edge.hh b/milena/mln/util/edge.hh
index 0390be4..f0895c5 100644
--- a/milena/mln/util/edge.hh
+++ b/milena/mln/util/edge.hh
@@ -32,6 +32,7 @@
///
/// Definition of a graph edge.
+# include <iostream>
# include <mln/util/internal/graph_edge_impl.hh>
diff --git a/milena/mln/util/vertex.hh b/milena/mln/util/vertex.hh
index 32ac667..9787c03 100644
--- a/milena/mln/util/vertex.hh
+++ b/milena/mln/util/vertex.hh
@@ -28,6 +28,7 @@
#ifndef MLN_UTIL_VERTEX_HH
# define MLN_UTIL_VERTEX_HH
+# include <iostream>
# include <mln/util/internal/graph_vertex_impl.hh>
/// \file mln/util/vertex.hh
diff --git a/milena/mln/value/set.hh b/milena/mln/value/set.hh
index 4f71a00..cc653fc 100644
--- a/milena/mln/value/set.hh
+++ b/milena/mln/value/set.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_VALUE_SET_HH
# define MLN_VALUE_SET_HH
-/*! \file mln/value/set.hh
- *
- * \brief Define some basic sets of values from value types.
- */
+/// \file mln/value/set.hh
+///
+/// Define some basic sets of values from value types.
# include <mln/value/internal/iterable_set.hh>
# include <mln/trait/value_.hh>
@@ -60,10 +60,10 @@ namespace mln
- /*! \brief Class that defines the set of values of type \c T.
- *
- * This is the exhaustive set of values obtainable from type \c T.
- */
+ /// Class that defines the set of values of type \c T.
+ ///
+ /// This is the exhaustive set of values obtainable from type \c T.
+ ///
template <typename T>
struct set : public internal::set_selector_< T, set<T>,
mlc_equal( mln_trait_value_quant(T),
@@ -75,7 +75,6 @@ namespace mln
};
-
# ifndef MLN_INCLUDE_ONLY
template <typename T>
diff --git a/milena/tests/Makefile.am b/milena/tests/Makefile.am
index b60fcd8..f7a71d1 100644
--- a/milena/tests/Makefile.am
+++ b/milena/tests/Makefile.am
@@ -2,6 +2,7 @@
include $(top_srcdir)/milena/tests/tests.mk
+##FIXME: re-enable all tests
SUBDIRS = \
accu \
algebra \
@@ -12,7 +13,7 @@ SUBDIRS = \
convert \
core \
debug \
- display \
+## display \
draw \
estim \
extension \
diff --git a/milena/tests/canvas/browsing/fwd.cc b/milena/tests/canvas/browsing/fwd.cc
index 5da96e6..402c2e1 100644
--- a/milena/tests/canvas/browsing/fwd.cc
+++ b/milena/tests/canvas/browsing/fwd.cc
@@ -1,4 +1,4 @@
-// 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
@@ -25,18 +25,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/canvas/browsing/fwd.cc
- *
- * \brief Tests on mln::canvas::browsing::fwd.hh
- */
+/// \file tests/canvas/browsing/fwd.cc
+///
+/// Tests on mln::canvas::browsing::fwd.hh
#include <mln/core/image/image2d.hh>
#include <mln/canvas/browsing/fwd.hh>
#include <mln/fun/p2v/iota.hh>
#include <mln/debug/println.hh>
-// FIXME: Move code below into mln/canvas/browsing/iota.hh.
-
template <typename I_, typename F>
struct assign_browsing_functor
@@ -88,6 +85,5 @@ int main()
using namespace mln;
image2d<unsigned> ima2(3, 3);
- my_test(ima2, fun::p2v::iota, canvas::browsing::fwd);
- debug::println(ima2);
+ my_test(ima2, fun::p2v::iota(), canvas::browsing::fwd);
}
diff --git a/milena/tests/canvas/browsing/hyper_directional.cc b/milena/tests/canvas/browsing/hyper_directional.cc
index d02ee9a..5595db0 100644
--- a/milena/tests/canvas/browsing/hyper_directional.cc
+++ b/milena/tests/canvas/browsing/hyper_directional.cc
@@ -1,4 +1,4 @@
-// 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
@@ -25,10 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/canvas/browsing/hyper_directional.cc
- *
- * \brief Tests on mln::canvas::browsing::hyper_directional.
- */
+/// \file tests/canvas/browsing/hyper_directional.cc
+///
+/// Tests on mln::canvas::browsing::hyper_directional.
#include <mln/core/image/image2d.hh>
#include <mln/core/image/image3d.hh>
@@ -37,8 +36,6 @@
#include <mln/debug/println.hh>
#include <mln/level/fill.hh>
-// FIXME: Move code below into mln/canvas/browsing/iota.hh.
-
template <typename I_, typename F>
struct assign_browsing_functor
@@ -99,23 +96,23 @@ int main()
image3d<unsigned> ima3(3, 3, 3);
level::fill(ima2, 0);
- my_test(ima2, fun::p2v::iota, canvas::browsing::hyper_directional, 0);
+ my_test(ima2, fun::p2v::iota(), canvas::browsing::hyper_directional, 0);
debug::println(ima2);
level::fill(ima2, 0);
- my_test(ima2, fun::p2v::iota, canvas::browsing::hyper_directional, 1);
+ my_test(ima2, fun::p2v::iota(), canvas::browsing::hyper_directional, 1);
debug::println(ima2);
level::fill(ima3, 0);
- my_test(ima3, fun::p2v::iota, canvas::browsing::hyper_directional, 0);
+ my_test(ima3, fun::p2v::iota(), canvas::browsing::hyper_directional, 0);
debug::println(ima3);
level::fill(ima3, 0);
- my_test(ima3, fun::p2v::iota, canvas::browsing::hyper_directional, 1);
+ my_test(ima3, fun::p2v::iota(), canvas::browsing::hyper_directional, 1);
debug::println(ima3);
level::fill(ima3, 0);
- my_test(ima3, fun::p2v::iota, canvas::browsing::hyper_directional, 2);
+ my_test(ima3, fun::p2v::iota(), canvas::browsing::hyper_directional, 2);
debug::println(ima3);
}
diff --git a/milena/tests/canvas/browsing/snake_fwd.cc b/milena/tests/canvas/browsing/snake_fwd.cc
index e5ce4c9..e054855 100644
--- a/milena/tests/canvas/browsing/snake_fwd.cc
+++ b/milena/tests/canvas/browsing/snake_fwd.cc
@@ -1,4 +1,4 @@
-// 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
@@ -25,18 +25,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/canvas/browsing/snake_fwd.cc
- *
- * \brief Tests on mln::canvas::browsing::snake_fwd.
- */
+/// \file tests/canvas/browsing/snake_fwd.cc
+///
+/// Tests on mln::canvas::browsing::snake_fwd.
#include <mln/core/image/image2d.hh>
#include <mln/canvas/browsing/snake_fwd.hh>
#include <mln/fun/p2v/iota.hh>
#include <mln/debug/println.hh>
-// FIXME: Move code below into mln/canvas/browsing/iota.hh.
-
template <typename I, typename F>
struct assign_browsing_functor
@@ -91,6 +88,5 @@ int main()
using namespace mln;
image2d<unsigned> ima2(3, 3);
- my_test(ima2, fun::p2v::iota, canvas::browsing::snake_fwd);
- debug::println(ima2);
+ my_test(ima2, fun::p2v::iota(), canvas::browsing::snake_fwd);
}
diff --git a/milena/tests/canvas/browsing/snake_vert.cc b/milena/tests/canvas/browsing/snake_vert.cc
index 23a49e4..85a5517 100644
--- a/milena/tests/canvas/browsing/snake_vert.cc
+++ b/milena/tests/canvas/browsing/snake_vert.cc
@@ -1,4 +1,4 @@
-// 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
@@ -25,18 +25,17 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/canvas/browsing/snake_vert.cc
- *
- * \brief Tests on mln::canvas::browsing::snake_vert.
- */
+/// \file tests/canvas/browsing/snake_vert.cc
+///
+/// Tests on mln::canvas::browsing::snake_vert.
#include <mln/core/image/image2d.hh>
#include <mln/canvas/browsing/snake_vert.hh>
#include <mln/fun/p2v/iota.hh>
#include <mln/debug/println.hh>
-// FIXME: Move code below into mln/canvas/browsing/iota.hh.
-
+unsigned res[2][7] = { { 1, 4, 5, 8, 9, 12, 13 },
+ { 2, 3, 6, 7, 10, 11, 14 } };
template <typename I, typename F>
struct assign_browsing_functor
@@ -59,8 +58,7 @@ struct assign_browsing_functor
void next()
{
input(p) = f(p);
-// mln_assertion(input(p) - 1 == p[0] * input.domain().ncols()
-// + ( (p[0] % 2) ? input.domain().ncols() - 1 - p[1] : p[1]));
+ mln_assertion(input(p) == res[p.row()][p.col()]);
}
void fwd() { next(); }
void up() { next(); }
@@ -91,6 +89,5 @@ int main()
using namespace mln;
image2d<unsigned> ima2(2, 7);
- my_test(ima2, fun::p2v::iota, canvas::browsing::snake_vert);
- debug::println(ima2);
+ my_test(ima2, fun::p2v::iota(), canvas::browsing::snake_vert);
}
diff --git a/milena/tests/convert/Makefile.am b/milena/tests/convert/Makefile.am
index 1af204c..252e377 100644
--- a/milena/tests/convert/Makefile.am
+++ b/milena/tests/convert/Makefile.am
@@ -2,11 +2,12 @@
include $(top_srcdir)/milena/tests/tests.mk
+##FIXME: re-enable all tests
check_PROGRAMS = \
to_image \
to_p_array \
to_p_set \
- to_tiles \
+## to_tiles \
to_window
to_image_SOURCES = to_image.cc
diff --git a/milena/tests/convert/to_p_array.cc b/milena/tests/convert/to_p_array.cc
index 8cc2818..a4b2835 100644
--- a/milena/tests/convert/to_p_array.cc
+++ b/milena/tests/convert/to_p_array.cc
@@ -1,4 +1,4 @@
-// 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
@@ -25,10 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/convert/to_p_array.cc
- *
- * \brief Tests on mln::convert::to_p_array.
- */
+/// \file tests/convert/to_p_array.cc
+///
+/// Tests on mln::convert::to_p_array.
#include <mln/core/alias/point1d.hh>
#include <mln/core/alias/point2d.hh>
@@ -48,17 +47,22 @@ int main()
win::segment1d win1d(5);
vec1d v1(convert::to_p_array(win1d, p1));
- for (size_t i=0; i < v1.nsites(); i++)
- std::cout << (v1[i]);
-
- std::cout << "\n";
+ {
+ unsigned col = 4;
+ for (size_t i=0; i < v1.nsites(); i++)
+ mln_assertion(v1[i] == point1d(col++));
+ }
typedef p_array<point2d> vec2d;
point2d p2 = point2d(10,10);
win::rectangle2d win2d(3, 3);
vec2d v2(convert::to_p_array(win2d, p2));
- for (size_t i=0; i < v2.nsites(); i++)
- std::cout << (v2[i]);
-
+ unsigned row = 9;
+ for (unsigned col = 0; col < v2.nsites(); ++col)
+ {
+ if (col > 0 && !(col%3))
+ ++row;
+ mln_assertion(v2[col] == point2d(row, 9 + (col%3)));
+ }
}
diff --git a/milena/tests/convert/to_p_set.cc b/milena/tests/convert/to_p_set.cc
index 67b2a68..df39cdf 100644
--- a/milena/tests/convert/to_p_set.cc
+++ b/milena/tests/convert/to_p_set.cc
@@ -1,4 +1,5 @@
// 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
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/convert/to_p_set.cc
- *
- * \brief Tests on mln::convert::to_p_set.
- */
+/// \file tests/convert/to_p_set.cc
+///
+/// Tests on mln::convert::to_p_set.
#include <mln/core/alias/point2d.hh>
#include <mln/core/image/image2d.hh>
diff --git a/milena/tests/convert/to_window.cc b/milena/tests/convert/to_window.cc
index 541d909..388cffc 100644
--- a/milena/tests/convert/to_window.cc
+++ b/milena/tests/convert/to_window.cc
@@ -1,4 +1,5 @@
// 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
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/convert/to_window.cc
- *
- * \brief Tests on mln::convert::to_window.
- */
+/// \file tests/convert/to_window.cc
+///
+/// Tests on mln::convert::to_window.
#include <mln/core/alias/dpoint2d.hh>
#include <mln/core/image/image2d.hh>
diff --git a/milena/tests/core/image/Makefile.am b/milena/tests/core/image/Makefile.am
index 8fc94a5..ed5cebc 100644
--- a/milena/tests/core/image/Makefile.am
+++ b/milena/tests/core/image/Makefile.am
@@ -2,6 +2,7 @@
include $(top_srcdir)/milena/tests/tests.mk
+##FIXME: re-enable tests
check_PROGRAMS = \
## bgraph_image \
cast_image \
@@ -26,9 +27,9 @@ check_PROGRAMS = \
## sparse_image \
sub_image \
t_image \
- tr_image \
- translate_image \
- value_enc_image
+ tr_image
+## translate_image \
+## value_enc_image
##bgraph_image_SOURCES = bgraph_image.cc
cast_image_SOURCES = cast_image.cc
@@ -54,8 +55,8 @@ safe_image_SOURCES = safe_image.cc
sub_image_SOURCES = sub_image.cc
t_image_SOURCES = t_image.cc
tr_image_SOURCES = tr_image.cc
-translate_image_SOURCES = translate_image.cc
-value_enc_image_SOURCES = value_enc_image.cc
+##translate_image_SOURCES = translate_image.cc
+##value_enc_image_SOURCES = value_enc_image.cc
# Tests depending on the FreeImagePlus library.
if FREEIMAGEPLUS
diff --git a/milena/tests/core/image/flat_image.cc b/milena/tests/core/image/flat_image.cc
index 09efda0..9a23cde 100644
--- a/milena/tests/core/image/flat_image.cc
+++ b/milena/tests/core/image/flat_image.cc
@@ -1,4 +1,5 @@
// 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
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/image/flat_image.cc
- *
- * \brief Tests on mln::flat_image.
- */
+/// \file tests/core/image/flat_image.cc
+///
+/// Tests on mln::flat_image.
#include <mln/core/image/flat_image.hh>
#include <mln/core/alias/box2d.hh>
@@ -39,14 +39,21 @@ int main()
{
using namespace mln;
+ short val = 6;
+ typedef flat_image<short, box2d> I;
+ I test(val, box2d(3, 4));
+
{
- flat_image<short, box2d> test;
- std::cout << test.values_eligible() << std::endl;
- std::cout << test.values_space() << std::endl;
+ mln_piter_(I) p(test.domain());
+ for_all(p)
+ mln_assertion(test(p) == val);
}
{
- flat_image<value::sign, box2d> test;
- std::cout << test.values_eligible() << std::endl;
+ val = 9;
+ test.val() = 9;
+ mln_piter_(I) p(test.domain());
+ for_all(p)
+ mln_assertion(test(p) == val);
}
}
diff --git a/milena/tests/core/other/Makefile.am b/milena/tests/core/other/Makefile.am
index 54c924a..e6f3633 100644
--- a/milena/tests/core/other/Makefile.am
+++ b/milena/tests/core/other/Makefile.am
@@ -2,11 +2,12 @@
include $(top_srcdir)/milena/tests/tests.mk
+##FIXME: re-enable tests
check_PROGRAMS = \
box_runstart_piter \
category \
- clock_neighb2d \
- clock_test \
+## clock_neighb2d \
+## clock_test \
dpoints_pixter \
graph_elt_neighborhood \
graph_elt_window \
@@ -25,8 +26,8 @@ check_PROGRAMS = \
box_runstart_piter_SOURCES = box_runstart_piter.cc
category_SOURCES = category.cc
-clock_neighb2d_SOURCES = clock_neighb2d.cc
-clock_test_SOURCES = clock_test.cc
+##clock_neighb2d_SOURCES = clock_neighb2d.cc
+##clock_test_SOURCES = clock_test.cc
dpoints_pixter_SOURCES = dpoints_pixter.cc
graph_elt_neighborhood_SOURCES = graph_elt_neighborhood.cc
graph_elt_window_SOURCES = graph_elt_window.cc
diff --git a/milena/tests/core/other/graph_elt_neighborhood.cc b/milena/tests/core/other/graph_elt_neighborhood.cc
index 6ba92a7..54d6b94 100644
--- a/milena/tests/core/other/graph_elt_neighborhood.cc
+++ b/milena/tests/core/other/graph_elt_neighborhood.cc
@@ -34,6 +34,9 @@
#include <mln/core/alias/point2d.hh>
#include <mln/core/image/graph_elt_neighborhood.hh>
+#include <mln/core/site_set/p_vertices.hh>
+
+#include <mln/util/graph.hh>
#include <mln/debug/iota.hh>
#include <mln/debug/println.hh>
@@ -63,18 +66,20 @@ int main()
*/
// Points associated to vertices.
- std::vector<p_t> points;
- points.push_back(point2d(0,0)); // Point associated to vertex 0.
- points.push_back(point2d(2,2)); // Point associated to vertex 1.
- points.push_back(point2d(0,4)); // Point associated to vertex 2.
- points.push_back(point2d(4,3)); // Point associated to vertex 3.
- points.push_back(point2d(4,4)); // Point associated to vertex 4.
+ typedef fun::i2v::array<p_t> F;
+ F points(5);
+ points(0) = point2d(0,0); // Point associated to vertex 0.
+ points(1) = point2d(2,2); // Point associated to vertex 1.
+ points(2) = point2d(0,4); // Point associated to vertex 2.
+ points(3) = point2d(4,3); // Point associated to vertex 3.
+ points(4) = point2d(4,4); // Point associated to vertex 4.
// Edges.
- mln::util::graph<p_t> g;
+ typedef mln::util::graph G;
+ G g;
// Populate the graph with vertices.
for (unsigned i = 0; i < points.size(); ++i)
- g.add_vertex (points[i]);
+ g.add_vertex ();
// Populate the graph with edges.
g.add_edge(0, 1);
g.add_edge(1, 2);
@@ -87,11 +92,11 @@ int main()
`-------------------------*/
// Graph psite set.
- p_graph<p_t> pg(g);
+ p_vertices<G, F> pg(g, points);
// Graph point site.
- graph_psite<p_t> p(pg, 1);
+ p_vertices_psite<G, F> p(pg, 1);
// ``Sliding'' neighborhood of a psite of PG.
- typedef graph_elt_neighborhood<p_t> nbh_t;
+ typedef graph_elt_neighborhood<G, F> nbh_t;
nbh_t nbh;
mln_fwd_niter_(nbh_t) fq(nbh, p);
diff --git a/milena/tests/core/other/graph_elt_window.cc b/milena/tests/core/other/graph_elt_window.cc
index c20ef07..a006543 100644
--- a/milena/tests/core/other/graph_elt_window.cc
+++ b/milena/tests/core/other/graph_elt_window.cc
@@ -34,6 +34,9 @@
#include <mln/core/alias/point2d.hh>
#include <mln/core/image/graph_elt_window.hh>
+#include <mln/core/site_set/p_vertices.hh>
+
+#include <mln/util/graph.hh>
#include <mln/debug/iota.hh>
#include <mln/debug/println.hh>
@@ -63,18 +66,20 @@ int main()
*/
// Points associated to vertices.
- std::vector<p_t> points;
- points.push_back(point2d(0,0)); // Point associated to vertex 0.
- points.push_back(point2d(2,2)); // Point associated to vertex 1.
- points.push_back(point2d(0,4)); // Point associated to vertex 2.
- points.push_back(point2d(4,3)); // Point associated to vertex 3.
- points.push_back(point2d(4,4)); // Point associated to vertex 4.
+ typedef fun::i2v::array<p_t> F;
+ F points(5);
+ points(0) = point2d(0,0); // Point associated to vertex 0.
+ points(1) = point2d(2,2); // Point associated to vertex 1.
+ points(2) = point2d(0,4); // Point associated to vertex 2.
+ points(3) = point2d(4,3); // Point associated to vertex 3.
+ points(4) = point2d(4,4); // Point associated to vertex 4.
// Edges.
- mln::util::graph<p_t> g;
+ typedef mln::util::graph G;
+ G g;
// Populate the graph with vertices.
for (unsigned i = 0; i < points.size(); ++i)
- g.add_vertex (points[i]);
+ g.add_vertex ();
// Populate the graph with edges.
g.add_edge(0, 1);
g.add_edge(1, 2);
@@ -87,11 +92,11 @@ int main()
`------------------*/
// Graph psite set.
- p_graph<p_t> pg(g);
+ p_vertices<G, F> pg(g, points);
// Graph point site.
- graph_psite<p_t> p(pg, 1);
+ p_vertices_psite<G, F> p(pg, 1);
// ``Sliding'' window of a psite of PG.
- typedef graph_elt_window<p_t> win_t;
+ typedef graph_elt_window<G, F> win_t;
win_t win;
mln_fwd_qiter_(win_t) fq(win, p);
diff --git a/milena/tests/core/other/line_graph_elt_neighborhood.cc b/milena/tests/core/other/line_graph_elt_neighborhood.cc
index efb0fa7..0b70ae8 100644
--- a/milena/tests/core/other/line_graph_elt_neighborhood.cc
+++ b/milena/tests/core/other/line_graph_elt_neighborhood.cc
@@ -32,6 +32,9 @@
#include <mln/core/alias/point2d.hh>
#include <mln/core/image/line_graph_elt_neighborhood.hh>
+#include <mln/core/site_set/p_edges.hh>
+
+#include <mln/util/graph.hh>
#include <mln/debug/iota.hh>
#include <mln/debug/println.hh>
@@ -61,18 +64,20 @@ int main()
*/
// Points associated to vertices.
- std::vector<p_t> points;
- points.push_back(point2d(0,0)); // Point associated to vertex 0.
- points.push_back(point2d(2,2)); // Point associated to vertex 1.
- points.push_back(point2d(0,4)); // Point associated to vertex 2.
- points.push_back(point2d(4,3)); // Point associated to vertex 3.
- points.push_back(point2d(4,4)); // Point associated to vertex 4.
+ typedef fun::i2v::array<p_t> F;
+ F points(5);
+ points(0) = point2d(0,0); // Point associated to vertex 0.
+ points(1) = point2d(2,2); // Point associated to vertex 1.
+ points(2) = point2d(0,4); // Point associated to vertex 2.
+ points(3) = point2d(4,3); // Point associated to vertex 3.
+ points(4) = point2d(4,4); // Point associated to vertex 4.
// Edges.
- mln::util::graph<p_t> g;
+ typedef mln::util::graph G;
+ G g;
// Populate the graph with vertices.
for (unsigned i = 0; i < points.size(); ++i)
- g.add_vertex (points[i]);
+ g.add_vertex ();
// Populate the graph with edges.
g.add_edge(0, 1);
g.add_edge(1, 2);
@@ -85,11 +90,11 @@ int main()
`-------------------------*/
// Line graph psite set.
- p_line_graph<p_t> plg(g);
+ p_edges<G, F> pe(g, points);
// Line graph point site.
- line_graph_psite<p_t> p(plg, 1);
+ p_edges_psite<G, F> p(pe, 1);
// ``Sliding'' neighborhood of a psite of PLG.
- typedef line_graph_elt_neighborhood<p_t> nbh_t;
+ typedef line_graph_elt_neighborhood<G, F> nbh_t;
nbh_t nbh;
mln_fwd_niter_(nbh_t) fq(nbh, p);
diff --git a/milena/tests/core/other/line_graph_elt_window.cc b/milena/tests/core/other/line_graph_elt_window.cc
index 2e780c0..81a0fa5 100644
--- a/milena/tests/core/other/line_graph_elt_window.cc
+++ b/milena/tests/core/other/line_graph_elt_window.cc
@@ -32,6 +32,9 @@
#include <mln/core/alias/point2d.hh>
#include <mln/core/image/line_graph_elt_window.hh>
+#include <mln/core/site_set/p_edges.hh>
+
+#include <mln/util/graph.hh>
#include <mln/debug/iota.hh>
#include <mln/debug/println.hh>
@@ -61,18 +64,20 @@ int main()
*/
// Points associated to vertices.
- std::vector<p_t> points;
- points.push_back(point2d(0,0)); // Point associated to vertex 0.
- points.push_back(point2d(2,2)); // Point associated to vertex 1.
- points.push_back(point2d(0,4)); // Point associated to vertex 2.
- points.push_back(point2d(4,3)); // Point associated to vertex 3.
- points.push_back(point2d(4,4)); // Point associated to vertex 4.
+ typedef fun::i2v::array<p_t> F;
+ F points(5);
+ points(0) = point2d(0,0); // Point associated to vertex 0.
+ points(1) = point2d(2,2); // Point associated to vertex 1.
+ points(2) = point2d(0,4); // Point associated to vertex 2.
+ points(3) = point2d(4,3); // Point associated to vertex 3.
+ points(4) = point2d(4,4); // Point associated to vertex 4.
// Edges.
- mln::util::graph<p_t> g;
+ typedef mln::util::graph G;
+ G g;
// Populate the graph with vertices.
for (unsigned i = 0; i < points.size(); ++i)
- g.add_vertex (points[i]);
+ g.add_vertex ();
// Populate the graph with edges.
g.add_edge(0, 1);
g.add_edge(1, 2);
@@ -85,11 +90,11 @@ int main()
`------------------*/
// Line graph psite set.
- p_line_graph<p_t> plg(g);
+ p_edges<G, F> pe(g, points);
// Line graph point site.
- line_graph_psite<p_t> p(plg, 1);
+ p_edges_psite<G, F> p(pe, 1);
// ``Sliding'' window of a psite of PLG.
- typedef line_graph_elt_window<p_t> win_t;
+ typedef line_graph_elt_window<G, F> win_t;
win_t win;
mln_fwd_qiter_(win_t) fq(win, p);
diff --git a/milena/tests/draw/graph.cc b/milena/tests/draw/graph.cc
index cc77525..8abb94a 100644
--- a/milena/tests/draw/graph.cc
+++ b/milena/tests/draw/graph.cc
@@ -25,13 +25,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/draw/graph.cc
- *
- * \brief Tests on mln::draw::graph.
- *
- * Build a graph, convert it to an image, and compare it with a
- * reference images.
- */
+/// \file tests/draw/graph.cc
+///
+/// Tests on mln::draw::graph.
+///
+/// Build a graph, convert it to an image, and compare it with a
+/// reference images.
#include <vector>
#include <utility>
@@ -40,10 +39,9 @@
#include <mln/core/alias/point2d.hh>
#include <mln/debug/println.hh>
#include <mln/util/graph.hh>
-#include <mln/core/site_set/p_graph.hh>
-#include <mln/core/image/graph_psite.hh>
-#include <mln/draw/graph.hh>
-#include <mln/core/image/graph_image.hh>
+#include <mln/core/site_set/p_vertices.hh>
+#include <mln/core/site_set/p_vertices_psite.hh>
+#include <mln/debug/draw_graph.hh>
#include <mln/level/compare.hh>
@@ -57,27 +55,32 @@ using namespace mln;
// FIXME: We might want to extract NROWS and NCOLS from REF instead of
// getting them from the caller.
void
-test (points_type& points, const edges_type& edges,
+test(points_type& points, const edges_type& edges,
unsigned nrows, unsigned ncols, const mln::image2d<int>& ref)
{
// Graph.
- util::graph<mln::point2d> g;
+ typedef util::graph G;
+ G g;
// Populate the graph with nodes.
- for (unsigned i = 0; i < points.size(); ++i)
- g.add_vertex(points[i]);
+ g.add_vertices(points.size());
// Populate the graph with edges.
for (edges_type::const_iterator i = edges.begin(); i != edges.end(); ++i)
g.add_edge(i->first, i->second);
- mln::p_graph<point2d> pg(g);
+ // Associate vertices to sites.
+ typedef fun::i2v::array<mln::point2d> F;
+ F fpoints(points);
+
+ mln::p_vertices<G, F> pg(g, fpoints);
image2d<int> ima(nrows, ncols);
- draw::graph (ima, pg, 2, 1);
- mln_assertion (ima == ref);
+ level::fill(ima, literal::zero);
+ debug::draw_graph(ima, pg, 2, 1);
+ mln_assertion(ima == ref);
}
int
-main ()
+main()
{
/*---------.
| Test 1. |
@@ -90,18 +93,18 @@ main ()
{0, 1, 0},
{0, 0, 2}
};
- image2d<int> ref (make::image(vs));
+ image2d<int> ref(make::image(vs));
// Points associated to nodes.
points_type points;
- points.push_back (point2d (0,0)); // Point associated to node 0.
- points.push_back (point2d (2,2)); // Point associated to node 1.
+ points.push_back(point2d(0,0)); // Point associated to node 0.
+ points.push_back(point2d(2,2)); // Point associated to node 1.
// Edges.
edges_type edges;
- edges.push_back (std::make_pair (0, 1));
+ edges.push_back(std::make_pair(0, 1));
- test (points, edges, 3, 3, ref);
+ test(points, edges, 3, 3, ref);
}
@@ -117,24 +120,24 @@ main ()
{0, 0, 0, 1, 1},
{0, 0, 0, 2, 2},
};
- image2d<int> ref (make::image(vs));
+ image2d<int> ref(make::image(vs));
// Points associated to nodes.
points_type points;
- points.push_back (point2d (0,0)); // Point associated to node 0.
- points.push_back (point2d (2,2)); // Point associated to node 1.
- points.push_back (point2d (0,4)); // Point associated to node 2.
- points.push_back (point2d (4,3)); // Point associated to node 3.
- points.push_back (point2d (4,4)); // Point associated to node 4.
+ points.push_back(point2d(0,0)); // Point associated to node 0.
+ points.push_back(point2d(2,2)); // Point associated to node 1.
+ points.push_back(point2d(0,4)); // Point associated to node 2.
+ points.push_back(point2d(4,3)); // Point associated to node 3.
+ points.push_back(point2d(4,4)); // Point associated to node 4.
// Edges.
edges_type edges;
- edges.push_back (std::make_pair (0, 1));
- edges.push_back (std::make_pair (1, 2));
- edges.push_back (std::make_pair (1, 3));
- edges.push_back (std::make_pair (3, 4));
- edges.push_back (std::make_pair (4, 2));
+ edges.push_back(std::make_pair(0, 1));
+ edges.push_back(std::make_pair(1, 2));
+ edges.push_back(std::make_pair(1, 3));
+ edges.push_back(std::make_pair(3, 4));
+ edges.push_back(std::make_pair(4, 2));
- test (points, edges, 5, 5, ref);
+ test(points, edges, 5, 5, ref);
}
}
diff --git a/milena/tests/fun/x2x/Makefile.am b/milena/tests/fun/x2x/Makefile.am
index a56a762..84d915e 100644
--- a/milena/tests/fun/x2x/Makefile.am
+++ b/milena/tests/fun/x2x/Makefile.am
@@ -4,11 +4,11 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
composed \
- rotation \
+## rotation \
translation
composed_SOURCES = composed.cc
-rotation_SOURCES = rotation.cc
+##rotation_SOURCES = rotation.cc
translation_SOURCES = translation.cc
TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/fun/x2x/composed.cc b/milena/tests/fun/x2x/composed.cc
index b6a4da0..36fc3b4 100644
--- a/milena/tests/fun/x2x/composed.cc
+++ b/milena/tests/fun/x2x/composed.cc
@@ -1,4 +1,4 @@
-// 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
@@ -25,10 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/fun/x2x/composed.cc
- *
- * \brief Tests on mln::fun::x2x::composed.
- */
+/// \file tests/fun/x2x/composed.cc
+///
+/// Tests on mln::fun::x2x::composed.
#include <iostream>
@@ -50,7 +49,11 @@ int main()
algebra::vec<3,float> vec1 = make::vec(a, b, c);
fun::x2x::translation<3,float> tr(all_to(1.6));
- fun::x2x::rotation<3,float> rot(0.3, 1);
+ algebra::vec<3,float> axis;
+ axis[0] = 0;
+ axis[1] = 1;
+ axis[0] = 0;
+ fun::x2x::rotation<3,float> rot(0.3, axis);
std::cout << "vec : " << vec1 << std::endl;
std::cout << "tr(vec) : " << tr(vec1) << std::endl;
diff --git a/milena/tests/fun/x2x/rotation.cc b/milena/tests/fun/x2x/rotation.cc
index dc557c7..900bb96 100644
--- a/milena/tests/fun/x2x/rotation.cc
+++ b/milena/tests/fun/x2x/rotation.cc
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/fun/x2x/rotation.cc
- *
- * \brief Tests on mln::fun::x2x::rotation.
- */
+/// \file tests/fun/x2x/rotation.cc
+///
+/// Tests on mln::fun::x2x::rotation.
+///
#include <iostream>
#include <mln/fun/x2x/rotation.hh>
@@ -47,16 +47,20 @@ int main()
using namespace mln;
using value::int_u8;
+ algebra::vec<2,float> axis;
+ axis[0] = 0;
+ axis[1] = 1;
+
image2d<int_u8> lena;
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
image2d<int_u8> out(lena.domain());
interpolated<image2d<int_u8> > inter(lena);
- fun::x2x::rotation<2,float> rot1(0.1);
+ fun::x2x::rotation<2,float> rot1(0.1, axis);
image2d<int_u8>::fwd_piter p(out.domain());
-
+
for_all(p)
{
algebra::vec<2,float> v = rot1.inv()((point2d::vec_t)(point2d)p);
@@ -67,7 +71,7 @@ int main()
}
io::pgm::save(out, "out.pgm");
- fun::x2x::rotation<2,float> rot2(3.14116);
+ fun::x2x::rotation<2,float> rot2(3.14116, axis);
mln_assertion(fabs(rot2(make::vec(0.0, 1.0))[0] -
make::vec(0.0, -1.0)[0]) <= 0.125);
mln_assertion(fabs(rot2(make::vec(0.0, 1.0))[1] -
diff --git a/milena/tests/fun/x2x/translation.cc b/milena/tests/fun/x2x/translation.cc
index 77ecd0b..40a5d4a 100644
--- a/milena/tests/fun/x2x/translation.cc
+++ b/milena/tests/fun/x2x/translation.cc
@@ -1,4 +1,4 @@
-// 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
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/fun/x2x/translation.cc
- *
- * \brief Tests on mln::fun::x2x::translation.
- */
+/// \file tests/fun/x2x/translation.cc
+///
+/// Tests on mln::fun::x2x::translation.
+
#include <cmath>
#include <iostream>
diff --git a/milena/tests/geom/resize.cc b/milena/tests/geom/resize.cc
index 884ed92..aa577c8 100644
--- a/milena/tests/geom/resize.cc
+++ b/milena/tests/geom/resize.cc
@@ -1,4 +1,5 @@
// 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
@@ -26,11 +27,9 @@
// Public License.
-/*!
- * \file tests/geom/resize.cc
- *
- * \brief Tests on mln::geom::resize.
- */
+/// \file tests/geom/resize.cc
+///
+/// Tests on mln::geom::resize.
#include <mln/core/image/image1d.hh>
#include <mln/core/image/image2d.hh>
diff --git a/milena/tests/level/stretch.cc b/milena/tests/level/stretch.cc
index 12660fd..02547d9 100644
--- a/milena/tests/level/stretch.cc
+++ b/milena/tests/level/stretch.cc
@@ -55,7 +55,7 @@ int main()
{ 0, 127, 255 }
};
image2d<int_u8> ref = make::image(ws);
-
+
box_fwd_piter_<point2d> p(out.domain());
for_all(p)
mln_assertion(out(p) == ref(p));
diff --git a/milena/tests/morpho/Makefile.am b/milena/tests/morpho/Makefile.am
index fd5cc00..5c88623 100644
--- a/milena/tests/morpho/Makefile.am
+++ b/milena/tests/morpho/Makefile.am
@@ -2,6 +2,7 @@
include $(top_srcdir)/milena/tests/tests.mk
+##FIXME: re-enable all tests
SUBDIRS = \
elementary \
tree
@@ -16,18 +17,18 @@ check_PROGRAMS = \
complex_image_wst \
contrast \
dilation \
- dilation_max_h \
+## dilation_max_h \
erosion \
- erosion_min_h \
+## erosion_min_h \
gradient \
graph_image_morpho \
- graph_image_wst \
+## graph_image_wst \
hit_or_miss \
laplacian \
- lena_line_graph_image_wst1 \
- lena_line_graph_image_wst2 \
- line_graph_image_wst \
- line_graph_image_morpho \
+## lena_line_graph_image_wst1 \
+## lena_line_graph_image_wst2 \
+## line_graph_image_wst \
+## line_graph_image_morpho \
meyer_wst \
meyer_wst_long \
opening_area \
@@ -44,8 +45,8 @@ check_PROGRAMS = \
# FIXME: Have erosion and dilation perform symmetric tests.
erosion_SOURCES = erosion.cc
-dilation_max_h_SOURCES = dilation_max_h.cc
-erosion_min_h_SOURCES = erosion_min_h.cc
+##dilation_max_h_SOURCES = dilation_max_h.cc
+##erosion_min_h_SOURCES = erosion_min_h.cc
opening_area_SOURCES = opening_area.cc
closing_area_SOURCES = closing_area.cc
@@ -60,11 +61,11 @@ hit_or_miss_SOURCES = hit_or_miss.cc
laplacian_SOURCES = laplacian.cc
thinning_SOURCES = thinning.cc
-graph_image_morpho_SOURCES = graph_image_morpho.cc
-graph_image_wst_SOURCES = graph_image_wst.cc
+##graph_image_morpho_SOURCES = graph_image_morpho.cc
+##graph_image_wst_SOURCES = graph_image_wst.cc
-line_graph_image_morpho_SOURCES = line_graph_image_morpho.cc
-line_graph_image_wst_SOURCES = line_graph_image_wst.cc
+##line_graph_image_morpho_SOURCES = line_graph_image_morpho.cc
+##line_graph_image_wst_SOURCES = line_graph_image_wst.cc
complex_image_morpho_SOURCES = complex_image_morpho.cc
complex_image_wst_SOURCES = complex_image_wst.cc
@@ -87,11 +88,11 @@ artificial_line_graph_image_wst_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
dilation_SOURCES = dilation.cc
dilation_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
-lena_line_graph_image_wst1_SOURCES = lena_line_graph_image_wst1.cc
-lena_line_graph_image_wst1_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
+##lena_line_graph_image_wst1_SOURCES = lena_line_graph_image_wst1.cc
+##lena_line_graph_image_wst1_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
-lena_line_graph_image_wst2_SOURCES = lena_line_graph_image_wst2.cc
-lena_line_graph_image_wst2_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
+##lena_line_graph_image_wst2_SOURCES = lena_line_graph_image_wst2.cc
+##lena_line_graph_image_wst2_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
meyer_wst_long_SOURCES = meyer_wst_long.cc
meyer_wst_long_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED)
diff --git a/milena/tests/morpho/graph_image_morpho.cc b/milena/tests/morpho/graph_image_morpho.cc
index 0653953..664533c 100644
--- a/milena/tests/morpho/graph_image_morpho.cc
+++ b/milena/tests/morpho/graph_image_morpho.cc
@@ -33,18 +33,38 @@
#include <mln/accu/bbox.hh>
#include <mln/core/alias/box2d.hh>
#include <mln/core/alias/point2d.hh>
-#include <mln/core/image/graph_image.hh>
#include <mln/core/image/graph_elt_window.hh>
#include <mln/core/image/graph_window_piter.hh>
+#include <mln/core/var.hh>
#include <mln/morpho/dilation.hh>
#include <mln/morpho/erosion.hh>
-#include <mln/draw/graph.hh>
+#include <mln/util/graph.hh>
+
+#include <mln/pw/all.hh>
+
+#include <mln/debug/draw_graph.hh>
#include <mln/debug/iota.hh>
#include <mln/debug/println.hh>
+template <typename S>
+struct vertex_site_value_t : public mln::Function_p2v< vertex_site_value_t<S> >
+{
+ typedef unsigned result;
+
+ unsigned
+ operator()(const mln_psite(S)& p) const
+ {
+ return v_[p.v().id()];
+ }
+
+ protected:
+ std::vector<result> v_;
+};
+
+
int main()
{
using namespace mln;
@@ -67,18 +87,20 @@ int main()
*/
// Points associated to vertices.
- std::vector<point2d> points;
- points.push_back(point2d(0,0)); // Point associated to vertex 0.
- points.push_back(point2d(2,2)); // Point associated to vertex 1.
- points.push_back(point2d(0,4)); // Point associated to vertex 2.
- points.push_back(point2d(4,3)); // Point associated to vertex 3.
- points.push_back(point2d(4,4)); // Point associated to vertex 4.
+ typedef fun::i2v::array<point2d> F;
+ F points(5);
+ points(0) = point2d(0,0); // Point associated to vertex 0.
+ points(1) = point2d(2,2); // Point associated to vertex 1.
+ points(2) = point2d(0,4); // Point associated to vertex 2.
+ points(3) = point2d(4,3); // Point associated to vertex 3.
+ points(4) = point2d(4,4); // Point associated to vertex 4.
// Edges.
- util::graph<point2d> g;
+ typedef mln::util::graph G;
+ G g;
// Populate the graph with vertices.
for (unsigned i = 0; i < points.size(); ++i)
- g.add_vertex (points[i]);
+ g.add_vertex ();
// Populate the graph with edges.
g.add_edge(0, 1);
g.add_edge(1, 2);
@@ -86,23 +108,19 @@ int main()
g.add_edge(3, 4);
g.add_edge(4, 2);
- g.print_debug(std::cout);
-
/*----------------------.
| Graph image support. |
`----------------------*/
- p_graph<point2d> pg(g);
+ p_vertices<G, F> pg(g, points);
/*--------------.
| Graph image. |
`--------------*/
- // Values ("empty" vector).
- std::vector<int> values(5);
+ vertex_site_value_t< p_vertices<G, F> > values;
// Graph image.
- typedef graph_image<point2d, int> ima_t;
- ima_t ima(pg, values);
+ mln_VAR(ima, (values | pg));
// Initialize values.
debug::iota(ima);
@@ -114,9 +132,8 @@ int main()
/* FIXME: mln::graph_image should automatically feature a bbox when
its parameter P is akin to a point. */
accu::bbox<point2d> a;
- for (std::vector<point2d>::const_iterator i = points.begin();
- i != points.end(); ++i)
- a.take(*i);
+ for (unsigned i = 0; i < points.size(); ++i)
+ a.take(points(i));
box2d bbox = a.to_result();
// Print the image.
/* FIXME: Unfortunately, displaying graph images is not easy right
@@ -142,14 +159,14 @@ int main()
| Processing graph images. |
`--------------------------*/
- typedef graph_elt_window<point2d> win_t;
+ typedef graph_elt_window<G, F> win_t;
win_t win;
- graph_image<point2d, int> ima_dil = morpho::dilation(ima, win);
- draw::graph(ima_rep, ima_dil, 9);
- debug::println(ima_rep);
+ image2d<unsigned> ima_dil = morpho::dilation(ima, win);
+// debug::draw_graph(ima_rep, ima_dil, 9);
+// debug::println(ima_rep);
- graph_image<point2d, int> ima_ero = morpho::erosion(ima, win);
- draw::graph(ima_rep, ima_ero, 9);
- debug::println(ima_rep);
+ image2d<unsigned> ima_ero = morpho::erosion(ima, win);
+// draw::graph(ima_rep, ima_ero, 9);
+// debug::println(ima_rep);
}
diff --git a/milena/tests/set/inter.cc b/milena/tests/set/inter.cc
index b5d4166..eef6da5 100644
--- a/milena/tests/set/inter.cc
+++ b/milena/tests/set/inter.cc
@@ -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
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/set/inter.cc
- *
- * \brief Tests on mln::set::inter.
- */
+/// \file tests/set/inter.cc
+///
+/// Tests on mln::set::inter.
#include <mln/set/inter.hh>
#include <mln/core/alias/dpoint2d.hh>
@@ -39,53 +39,26 @@ int main()
{
using namespace mln;
- {
- window2d win1;
- win1.insert( 2, 7);
- win1.insert( 2, 1);
- win1.insert(-4, 0);
- win1.insert( 0, 0);
- win1.insert( 1, 1);
- win1.insert( 6, 5);
- window2d win2;
- win2.insert( 2, 7);
- win2.insert(-2, 1);
- win2.insert(-4, 0);
- win2.insert( 1,-1);
- win2.insert( 6, 5);
- window2d win3 = set::inter(win1, win2);
- mln_assertion(!win3.has(dpoint2d( 2, 1)));
- mln_assertion(!win3.has(dpoint2d( 0, 0)));
- mln_assertion(!win3.has(dpoint2d( 1, 1)));
- mln_assertion(win3.has(dpoint2d( 2, 7)));
- mln_assertion(!win3.has(dpoint2d(-2, 1)));
- mln_assertion(win3.has(dpoint2d(-4, 0)));
- mln_assertion(!win3.has(dpoint2d( 1,-1)));
- mln_assertion(win3.has(dpoint2d( 6, 5)));
- }
-
- {
- p_set<point2d> pst1;
- pst1.insert(point2d( 2, 7));
- pst1.insert(point2d( 2, 1));
- pst1.insert(point2d(-4, 0));
- pst1.insert(point2d( 0, 0));
- pst1.insert(point2d( 1, 1));
- pst1.insert(point2d( 6, 5));
- p_set<point2d> pst2;
- pst2.insert(point2d( 2, 7));
- pst2.insert(point2d(-2, 1));
- pst2.insert(point2d(-4, 0));
- pst2.insert(point2d( 1,-1));
- pst2.insert(point2d( 6, 5));
- p_set<point2d> pst3 = set::inter(pst1, pst2);
- mln_assertion(!pst3.has(point2d( 2, 1)));
- mln_assertion(!pst3.has(point2d( 0, 0)));
- mln_assertion(!pst3.has(point2d( 1, 1)));
- mln_assertion(pst3.has(point2d( 2, 7)));
- mln_assertion(!pst3.has(point2d(-2, 1)));
- mln_assertion(pst3.has(point2d(-4, 0)));
- mln_assertion(!pst3.has(point2d( 1,-1)));
- mln_assertion(pst3.has(point2d( 6, 5)));
- }
+ p_set<point2d> pst1;
+ pst1.insert(point2d( 2, 7));
+ pst1.insert(point2d( 2, 1));
+ pst1.insert(point2d(-4, 0));
+ pst1.insert(point2d( 0, 0));
+ pst1.insert(point2d( 1, 1));
+ pst1.insert(point2d( 6, 5));
+ p_set<point2d> pst2;
+ pst2.insert(point2d( 2, 7));
+ pst2.insert(point2d(-2, 1));
+ pst2.insert(point2d(-4, 0));
+ pst2.insert(point2d( 1,-1));
+ pst2.insert(point2d( 6, 5));
+ p_set<point2d> pst3 = set::inter(pst1, pst2);
+ mln_assertion(!pst3.has(point2d( 2, 1)));
+ mln_assertion(!pst3.has(point2d( 0, 0)));
+ mln_assertion(!pst3.has(point2d( 1, 1)));
+ mln_assertion(pst3.has(point2d( 2, 7)));
+ mln_assertion(!pst3.has(point2d(-2, 1)));
+ mln_assertion(pst3.has(point2d(-4, 0)));
+ mln_assertion(!pst3.has(point2d( 1,-1)));
+ mln_assertion(pst3.has(point2d( 6, 5)));
}
diff --git a/milena/tests/win/Makefile.am b/milena/tests/win/Makefile.am
index a4758cb..d68f18b 100644
--- a/milena/tests/win/Makefile.am
+++ b/milena/tests/win/Makefile.am
@@ -10,6 +10,7 @@ check_PROGRAMS = \
diff \
disk2d \
hline2d \
+ inter \
octagon2d \
rectangle2d \
segment1d \
@@ -24,6 +25,7 @@ diag2d_SOURCES = diag2d.cc
diff_SOURCES = diff.cc
disk2d_SOURCES = disk2d.cc
hline2d_SOURCES = hline2d.cc
+inter_SOURCES = inter.cc
octagon2d_SOURCES = octagon2d.cc
rectangle2d_SOURCES = rectangle2d.cc
segment1d_SOURCES = segment1d.cc
diff --git a/milena/tests/set/inter.cc b/milena/tests/win/inter.cc
similarity index 68%
copy from milena/tests/set/inter.cc
copy to milena/tests/win/inter.cc
index b5d4166..82b8ed2 100644
--- a/milena/tests/set/inter.cc
+++ b/milena/tests/win/inter.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 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
@@ -25,12 +26,11 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/set/inter.cc
- *
- * \brief Tests on mln::set::inter.
- */
+/// \file tests/win/inter.cc
+///
+/// Tests on mln::set::inter.
-#include <mln/set/inter.hh>
+#include <mln/win/inter.hh>
#include <mln/core/alias/dpoint2d.hh>
#include <mln/core/alias/window2d.hh>
@@ -63,29 +63,5 @@ int main()
mln_assertion(!win3.has(dpoint2d( 1,-1)));
mln_assertion(win3.has(dpoint2d( 6, 5)));
}
-
- {
- p_set<point2d> pst1;
- pst1.insert(point2d( 2, 7));
- pst1.insert(point2d( 2, 1));
- pst1.insert(point2d(-4, 0));
- pst1.insert(point2d( 0, 0));
- pst1.insert(point2d( 1, 1));
- pst1.insert(point2d( 6, 5));
- p_set<point2d> pst2;
- pst2.insert(point2d( 2, 7));
- pst2.insert(point2d(-2, 1));
- pst2.insert(point2d(-4, 0));
- pst2.insert(point2d( 1,-1));
- pst2.insert(point2d( 6, 5));
- p_set<point2d> pst3 = set::inter(pst1, pst2);
- mln_assertion(!pst3.has(point2d( 2, 1)));
- mln_assertion(!pst3.has(point2d( 0, 0)));
- mln_assertion(!pst3.has(point2d( 1, 1)));
- mln_assertion(pst3.has(point2d( 2, 7)));
- mln_assertion(!pst3.has(point2d(-2, 1)));
- mln_assertion(pst3.has(point2d(-4, 0)));
- mln_assertion(!pst3.has(point2d( 1,-1)));
- mln_assertion(pst3.has(point2d( 6, 5)));
- }
}
+
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix minor bugs.
* doc/examples/tuto_bis.cc
(fill, gradient, dilation): Remove dedicated code; instead use
library routines. Their proper arg is nbh.win().
(ima): Ensure there is no outer border.
(include): Update.
* mln/core/image/extended.hh: Upgrade doc style.
* mln/core/image/extension_ima.hh: Likewise.
(ext_io): Fix wrong definition.
(todo): New.
* mln/core/routine/primary.hh: Upgrade doc style.
* mln/math/diff_abs.hh: Fix doc.
* mln/accu/transform.hh (transform): Fix missing test.
* mln/accu/transform_stop.hh: Likewise.
* mln/accu/volume.hh: Use diff_abs instead of abs.
Remember that (1u - 2u) is not equal to -1 in C.
* mln/border/resize.hh: Revamp.
(todo): Done.
(todo): New.
* mln/border/adjust.hh: Remove erroneous post-condition.
* mln/morpho/tree/utils.hh: Fix guard.
* mln/canvas/labeling.hh: Fix warning.
* mln/extension/fill.hh: Upgrade doc style.
doc/examples/tuto_bis.cc | 100 +++-------------------------------------
mln/accu/transform.hh | 2
mln/accu/transform_stop.hh | 2
mln/accu/volume.hh | 7 +-
mln/border/adjust.hh | 3 -
mln/border/resize.hh | 87 ++++++++++++----------------------
mln/canvas/labeling.hh | 2
mln/core/image/extended.hh | 18 +++----
mln/core/image/extension_ima.hh | 22 ++++----
mln/core/routine/primary.hh | 14 ++---
mln/extension/fill.hh | 15 ++----
mln/math/diff_abs.hh | 2
mln/morpho/tree/utils.hh | 2
13 files changed, 84 insertions(+), 192 deletions(-)
Index: doc/examples/tuto_bis.cc
--- doc/examples/tuto_bis.cc (revision 2969)
+++ doc/examples/tuto_bis.cc (working copy)
@@ -2,6 +2,7 @@
# include <mln/core/image/image2d.hh>
# include <mln/core/image/image_if.hh>
+# include <mln/core/image/sub_image.hh>
# include <mln/core/image/extended.hh>
# include <mln/core/routine/extend.hh>
@@ -23,6 +24,8 @@
# include <mln/extension/fill.hh>
# include <mln/morpho/meyer_wst.hh>
+# include <mln/morpho/gradient.hh>
+# include <mln/morpho/dilation.hh>
# include <mln/debug/println.hh>
@@ -31,29 +34,6 @@
namespace mln
{
- namespace border
- {
-
- template <typename I>
- void
- fill(I& ima, const mln_value(I)& v)
- {
- const int nrows = ima.nrows();
- const int ncols = ima.ncols();
- for (int r = -1; r <= nrows; ++r)
- {
- ima.at(r, -1) = v;
- ima.at(r, ncols) = v;
- }
- for (int c = -1; c <= ncols; ++c)
- {
- ima.at(-1, c) = v;
- ima.at(nrows, c) = v;
- }
- }
-
- } // mln::border
-
namespace accu
{
@@ -86,54 +66,6 @@
} // mln::accu
- namespace morpho
- {
-
- template <typename I, typename N>
- mln_concrete(I)
- gradient(const I& input, const N& nbh)
- {
- mln_concrete(I) output;
- initialize(output, input);
- accu::min_max<mln_value(I)> mm;
-
- mln_piter(I) p(input.domain());
- mln_niter(N) n(nbh, p);
- for_all(p)
- {
- mm.init();
- for_all(n) if (input.has(n))
- mm.take(input(n));
- output(p) = mm.second() - mm.first();
- }
- return output;
- }
-
- template <typename I, typename N>
- mln_concrete(I)
- dilation(const I& input, const N& nbh)
- {
- typedef mln_value(I) V;
- // FIXME: extension::fill(input, mln_min(V));
-
- mln_concrete(I) output;
- initialize(output, input);
- accu::max<V> m;
-
- mln_piter(I) p(input.domain());
- mln_niter(N) n(nbh, p);
- for_all(p)
- {
- m.init();
- for_all(n) if (input.has(n))
- m.take(input(n));
- output(p) = m;
- }
- return output;
- }
-
- } // mln::morpho
-
} // mln
@@ -208,19 +140,8 @@
-// {
-// p_centered<e2e_t::window> wc(e2e.to_window(), literal::origin);
-// std::cout << wc << std::endl;
-
-// p_set<point2d> s;
-// s += wc;
-// std::cout << s << std::endl;
-// }
-
-
- border::thickness = 0;
-
- image2d<int> ima(3, 5);
+ image2d<unsigned> ima_(3, 5);
+ mln_VAR(ima, ima_ | ima_.domain());
mln_VAR(cell, ima | is_cell);
level::fill(cell, fun::p2v::iota());
@@ -229,11 +150,9 @@
//
// 4 5 6
+ mln_VAR(edge, extend((ima | is_edge).rw(), ima));
-
- mln_VAR(edge, extend((ima | is_edge).rw(),
- pw::value(ima)));
- level::paste(morpho::gradient(edge, e2c), edge);
+ level::paste(morpho::gradient(edge, e2c.win()), edge);
// ^^^
// edge -> neighboring cells
debug::println(edge);
@@ -241,7 +160,6 @@
// 3 3 3
// 1 1
-
image2d<unsigned> label(ima.bbox(), 0);
level::fill(label, 9);
debug::println(label);
@@ -313,7 +231,7 @@
level::paste(morpho::dilation(extend(lab, label),
- c4()),
+ c4().win()),
label);
debug::println(label);
@@ -351,6 +269,6 @@
// //
// // 5 5 5
-
// DONE!
+
}
Index: mln/core/image/extended.hh
--- mln/core/image/extended.hh (revision 2969)
+++ mln/core/image/extended.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 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,15 +28,13 @@
#ifndef MLN_CORE_IMAGE_EXTENDED_HH
# define MLN_CORE_IMAGE_EXTENDED_HH
-/*!
- * \file mln/core/image/extended.hh
- *
- * \brief Definition of morpher that makes an image become restricted
- * given by a point set.
- *
- * \todo Add a special case for "ima | box"; think about some other
- * special cases...
- */
+/// \file mln/core/image/extended.hh
+///
+/// Definition of morpher that makes an image become restricted
+/// given by a point set.
+///
+/// \todo Add a special case for "ima | box"; think about some other
+/// special cases...
# include <mln/core/internal/image_domain_morpher.hh>
# include <mln/core/site_set/box.hh>
Index: mln/core/image/extension_ima.hh
--- mln/core/image/extension_ima.hh (revision 2969)
+++ mln/core/image/extension_ima.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 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,15 +28,15 @@
#ifndef MLN_CORE_IMAGE_EXTENSION_IMA_HH
# define MLN_CORE_IMAGE_EXTENSION_IMA_HH
-/*!
- * \file mln/core/image/extension_ima.hh
- *
- * \brief Definition of a morpher that extends the domain of an image
- * with a function.
- *
- * \todo Use the 'instant' mechanism.
- * \todo Use an envelop as lvalue to test extension writing.
- */
+/// \file mln/core/image/extension_ima.hh
+///
+/// Definition of a morpher that extends the domain of an image
+/// with a function.
+///
+/// \todo Use an envelop as lvalue to test extension writing.
+///
+/// \todo Handle the couple of cases: either J is value_io::read_write
+/// or value_io::read_only; then ext_io can be read_write...
# include <mln/core/internal/image_identity.hh>
# include <mln/level/fill_with_value.hh>
@@ -80,7 +80,7 @@
// extended domain
typedef trait::image::ext_domain::extendable ext_domain;
typedef trait::image::ext_value::multiple ext_value;
- typedef mln_trait_image_value_io(J) ext_io;
+ typedef trait::image::ext_io::read_only ext_io; // FIXME: Too restrictive?
};
template <typename I, typename J, typename V>
Index: mln/core/routine/primary.hh
--- mln/core/routine/primary.hh (revision 2969)
+++ mln/core/routine/primary.hh (working copy)
@@ -28,13 +28,12 @@
#ifndef MLN_CORE_ROUTINE_PRIMARY_HH
# define MLN_CORE_ROUTINE_PRIMARY_HH
-/*! \file mln/core/routine/primary.hh
- *
- * \brief FIXME
- *
- * \todo We also need to get the extension image to handle border
- * routines.
- */
+/// \file mln/core/routine/primary.hh
+///
+/// Get the primary image behind any image.
+///
+/// \todo We also need to get the extension image to handle border
+/// routines.
# include <mln/core/concept/image.hh>
@@ -55,6 +54,7 @@
primary(const Image<I>& input);
+
# ifndef MLN_INCLUDE_ONLY
Index: mln/math/diff_abs.hh
--- mln/math/diff_abs.hh (revision 2969)
+++ mln/math/diff_abs.hh (working copy)
@@ -31,7 +31,7 @@
/// \file mln/math/diff_abs.hh
///
-/// \brief Define diff_abs routine.
+/// Define diff_abs routine.
namespace mln
Index: mln/accu/transform.hh
--- mln/accu/transform.hh (revision 2969)
+++ mln/accu/transform.hh (working copy)
@@ -95,7 +95,7 @@
for_all(p)
{
a.init();
- for_all(q)
+ for_all(q) if (input.has(q))
a.take(input(q));
output(p) = a.to_result();
}
Index: mln/accu/transform_stop.hh
--- mln/accu/transform_stop.hh (revision 2969)
+++ mln/accu/transform_stop.hh (working copy)
@@ -91,7 +91,7 @@
for_all(p)
{
a.init();
- for_all(q)
+ for_all(q) if (input.has(q))
{
a.take(input(q));
if (a.can_stop())
Index: mln/accu/volume.hh
--- mln/accu/volume.hh (revision 2969)
+++ mln/accu/volume.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// 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
@@ -43,7 +44,7 @@
# include <mln/accu/internal/base.hh>
# include <mln/core/concept/meta_accumulator.hh>
-# include <mln/math/abs.hh>
+# include <mln/math/diff_abs.hh>
# include <mln/util/pix.hh>
# include <mln/literal/zero.hh>
@@ -171,7 +172,7 @@
the former. */
volume_ +=
other.volume_ +
- other.area__ * math::abs(other.ref_level__ - ref_level__);
+ other.area__ * math::diff_abs(other.ref_level__, ref_level__);
// Member ref_level__ is not touched.
}
Index: mln/border/resize.hh
--- mln/border/resize.hh (revision 2969)
+++ mln/border/resize.hh (working copy)
@@ -29,17 +29,18 @@
#ifndef MLN_BORDER_RESIZE_HH
# define MLN_BORDER_RESIZE_HH
-/*! \file mln/border/resize.hh
- *
- * \brief Define a function that resizes the virtual border of an
- * image.
- *
- * \todo Test with a primary image with no notion of border; I guess
- * it does not work.
- */
+/// \file mln/border/resize.hh
+///
+/// Define a function that resizes the virtual border of an
+/// image.
+///
+/// \todo This code is not complete: an image can be composed of
+/// several images whose multiple borders have to be resized! For
+/// instance an image extended by an image, or a stack of images.
# include <mln/core/concept/image.hh>
# include <mln/core/routine/clone.hh>
+# include <mln/core/routine/primary.hh>
# include <mln/border/get.hh>
# include <mln/level/fill.hh>
@@ -71,94 +72,66 @@
namespace impl
{
- // Effective resizing.
-
template <typename I>
inline
- void resize_(trait::image::category::morpher,
- const I& ima, unsigned thickness)
+ void resize(I& ima, unsigned thickness)
{
- return resize(*ima.delegatee_(), thickness);
- }
-
- template <typename I>
- inline
- void resize_(trait::image::category::primary,
- const I& ima_, unsigned thickness)
- {
- I& ima = const_cast<I&>(ima_);
+ if (border::get(ima) == thickness)
+ return; // No-op.
mln_concrete(I) memo = clone(ima);
ima.resize_(thickness);
level::fill(ima, memo);
+
+ mln_postcondition(border::get(ima) == thickness);
}
-// ext_domain: /any/
-// |
-// + -- none
-// |
-// + -- /some/
-// |
-// + -- fixed
-// | |
-// | + -- infinite
-// |
-// + -- extendable
+ } // end of namespace mln::border::impl
- template <typename I>
- inline
- void resize_(trait::image::ext_domain::none,
- const I&, unsigned)
+
+ namespace internal
{
- // No-op.
- }
template <typename I>
inline
- void resize_(trait::image::ext_domain::fixed,
- const I&, unsigned)
+ void resize_dispatch(trait::image::ext_domain::any,
+ const Image<I>& ima, unsigned thickness)
{
// No-op.
}
template <typename I>
inline
- void resize_(trait::image::ext_domain::extendable,
- const I& ima, unsigned thickness)
+ void resize_dispatch(trait::image::ext_domain::extendable,
+ const Image<I>& ima, unsigned thickness)
{
- if (border::get(ima) == thickness)
- return; // No-op.
- resize_(mln_trait_image_category(I)(),
- ima, thickness);
- mln_postcondition(border::get(ima) == thickness);
+ // Effective resizing.
+ impl::resize(const_cast<I&>(exact(ima)), thickness);
}
-
- // Selector.
-
template <typename I>
inline
- void resize_(const I& ima, unsigned thickness)
+ void resize_dispatch(const Image<I>& ima, unsigned thickness)
{
- resize_(mln_trait_image_ext_domain(I)(),
+ resize_dispatch(mln_trait_image_ext_domain(I)(),
ima, thickness);
}
- } // end of namespace mln::border::resize
+ } // end of namespace mln::border::internal
/// Facade.
template <typename I>
inline
- void resize(const Image<I>& ima_, unsigned thickness)
+ void resize(const Image<I>& ima, unsigned thickness)
{
trace::entering("border::resize");
- const I& ima = exact(ima_);
- mln_precondition(ima.has_data());
+ mln_precondition(exact(ima).has_data());
- impl::resize_(ima, thickness);
+ // Try to resize the primary image behind ima.
+ internal::resize_dispatch(primary(ima), thickness);
trace::exiting("border::resize");
}
Index: mln/border/adjust.hh
--- mln/border/adjust.hh (revision 2969)
+++ mln/border/adjust.hh (working copy)
@@ -71,7 +71,8 @@
if (border::get(ima) < min_thickness)
border::resize(ima, min_thickness);
- mln_postcondition(border::get(ima) >= min_thickness);
+ // We cannot run here a postcondition since we do not know if
+ // ima (or an underlying image) has a border or not.
trace::exiting("border::adjust");
}
Index: mln/morpho/tree/utils.hh
--- mln/morpho/tree/utils.hh (revision 2969)
+++ mln/morpho/tree/utils.hh (working copy)
@@ -140,4 +140,4 @@
} // end of namespace mln
-#endif // ! MLN_MORPHO_TREE_MAX_HH
+#endif // ! MLN_MORPHO_TREE_UTILS_HH
Index: mln/canvas/labeling.hh
--- mln/canvas/labeling.hh (revision 2969)
+++ mln/canvas/labeling.hh (working copy)
@@ -74,6 +74,8 @@
(void) input;
(void) nbh;
+ (void) f;
+ (void) nlabels;
}
} // end of namespace mln::canvas::internal
Index: mln/extension/fill.hh
--- mln/extension/fill.hh (revision 2969)
+++ mln/extension/fill.hh (working copy)
@@ -1,4 +1,5 @@
// 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,14 +29,12 @@
#ifndef MLN_CORE_EXTENSION_FILL_HH
# define MLN_CORE_EXTENSION_FILL_HH
-/*! \file mln/extension/fill.hh
- *
- * \brief Define function that fills domain extension.
- *
- *
- * \todo Test the compatibility between val and mln_value(I) because,
- * while unmorphing, this type can change...
- */
+/// \file mln/extension/fill.hh
+///
+/// Define function that fills domain extension.
+///
+/// \todo Test the compatibility between val and mln_value(I) because,
+/// while unmorphing, this type can change...
# include <mln/core/concept/image.hh>
# include <mln/trait/image/props.hh>
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update some routines so that they return output.
* mln/morpho/closing_volume.hh,
* mln/morpho/closing_area.hh,
* mln/morpho/closing_height.hh,
* mln/morpho/closing_attribute.hh,
* tests/morpho/closing_volume.cc,
* tests/morpho/closing_height.cc,
* tests/morpho/closing_area.cc,
* mln/level/saturate.hh,
* tests/level/saturate.cc,
* tests/level/saturate_full.cc: Update to current style, i.e.,
with 'output' as return.
* mln/morpho/tree/compute_attribute_image.hh: Add commentaries.
mln/level/saturate.hh | 60 +++++++++++++----------------
mln/morpho/closing_area.hh | 37 +++++++----------
mln/morpho/closing_attribute.hh | 53 +++++++++++++++----------
mln/morpho/closing_height.hh | 31 ++++++++++----
mln/morpho/closing_volume.hh | 33 ++++++---------
mln/morpho/tree/compute_attribute_image.hh | 20 ++++++++-
tests/level/saturate.cc | 12 ++---
tests/level/saturate_full.cc | 19 ++++++---
tests/morpho/closing_area.cc | 15 ++-----
tests/morpho/closing_height.cc | 11 ++---
tests/morpho/closing_volume.cc | 11 ++---
11 files changed, 161 insertions(+), 141 deletions(-)
Index: tests/level/saturate_full.cc
--- tests/level/saturate_full.cc (revision 2968)
+++ tests/level/saturate_full.cc (working copy)
@@ -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
@@ -25,11 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/level/saturate_full.cc
- *
- * \brief Tests on mln::level::saturate.
- */
-
+/// \file tests/level/saturate_full.cc
+///
+/// Tests on mln::level::saturate.
#include <mln/core/image/image1d.hh>
#include <mln/core/image/image2d.hh>
@@ -50,6 +49,9 @@
namespace mln
{
+
+ /*
+
template <typename I, typename J>
void
chck(I& ref, J& out, mln_value(I) min, mln_value(I) max)
@@ -127,6 +129,8 @@
chck(ima, out, min, max);
}
+ */
+
}
@@ -134,6 +138,8 @@
{
using namespace mln;
+ /*
+
unsigned slis_start = 1;
unsigned slis_end = 3;
@@ -237,5 +243,6 @@
}
std::cerr << "OK" << std::endl;
+ */
}
Index: tests/level/saturate.cc
--- tests/level/saturate.cc (revision 2968)
+++ tests/level/saturate.cc (working copy)
@@ -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
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/level/saturate.cc
- *
- * \brief Tests on mln::level::saturate.
- */
+/// \file tests/level/saturate.cc
+///
+/// Tests on mln::level::saturate.
#include <mln/core/image/image2d.hh>
@@ -47,7 +47,7 @@
{ 6, 6, 6 }
};
- image2d<int> ref(make::image(vs));
+ image2d<int> ref = make::image(vs);
debug::iota(ima);
level::saturate_inplace(ima, 2, 6);
box_fwd_piter_<point2d> p(ima.domain());
Index: tests/morpho/closing_volume.cc
--- tests/morpho/closing_volume.cc (revision 2968)
+++ tests/morpho/closing_volume.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// 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
@@ -26,7 +27,8 @@
// Public License.
/// \file tests/morpho/closing_volume.cc
-/// \brief Test on mln::morpho::closing_volume.
+///
+/// Test on mln::morpho::closing_volume.
#include <mln/core/image/image2d.hh>
#include <mln/value/int_u8.hh>
@@ -46,8 +48,5 @@
image2d<int_u8> lena;
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
- image2d<int_u8> out(lena.domain());
-
- morpho::closing_volume(lena, c4(), 10000, out);
- io::pgm::save(out, "out.pgm");
+ io::pgm::save(morpho::closing_volume(lena, c4(), 10000), "out.pgm");
}
Index: tests/morpho/closing_height.cc
--- tests/morpho/closing_height.cc (revision 2968)
+++ tests/morpho/closing_height.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// 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
@@ -26,7 +27,8 @@
// Public License.
/// \file tests/morpho/closing_height.cc
-/// \brief Test on mln::morpho::closing_height.
+///
+/// Test on mln::morpho::closing_height.
#include <mln/core/image/image2d.hh>
#include <mln/value/int_u8.hh>
@@ -46,8 +48,5 @@
image2d<int_u8> lena;
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
- image2d<int_u8> out(lena.domain());
-
- morpho::closing_height(lena, c4(), 20, out);
- io::pgm::save(out, "out.pgm");
+ io::pgm::save(morpho::closing_height(lena, c4(), 20), "out.pgm");
}
Index: tests/morpho/closing_area.cc
--- tests/morpho/closing_area.cc (revision 2968)
+++ tests/morpho/closing_area.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// 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
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/morpho/closing_area.cc
- *
- * \brief Test on mln::morpho::closing_area.
- */
+/// \file tests/morpho/closing_area.cc
+///
+/// Test on mln::morpho::closing_area.
#include <mln/core/image/image2d.hh>
#include <mln/value/int_u8.hh>
@@ -50,8 +50,5 @@
image2d<int_u8> lena;
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
- image2d<int_u8> out(lena.domain());
-
- morpho::closing_area(lena, c4(), 510, out);
- io::pgm::save(out, "out.pgm");
+ io::pgm::save(morpho::closing_area(lena, c4(), 510), "out.pgm");
}
Index: mln/level/saturate.hh
--- mln/level/saturate.hh (revision 2968)
+++ mln/level/saturate.hh (working copy)
@@ -1,4 +1,5 @@
// 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_LEVEL_SATURATE_HH
# define MLN_LEVEL_SATURATE_HH
-/*! \file mln/level/saturate.hh
- *
- * \brief Apply a saturation function to image pixel values.
- */
+/// \file mln/level/saturate.hh
+///
+/// Apply a saturation function to image pixel values.
# include <mln/fun/v2v/saturate.hh>
# include <mln/level/apply.hh>
@@ -47,18 +47,16 @@
/*! Apply the saturate function to image pixel values.
*
+ * \param[in] v A value of the output type.
* \param[in] input The input image.
- * \param[out] output The output image.
*
* The saturation is based on the min and max values of the output
* value type. This assumes that the range of values in the input
* image is larger than the one of the output image.
- *
- * \pre \p input and \p output have to own the same domain.
- *
*/
- template <typename I, typename O>
- void saturate(const Image<I>& input, Image<O>& output);
+ template <typename V, typename I>
+ mln_ch_value(I, V)
+ saturate(V v, const Image<I>& input);
/*! Apply the saturate function to image pixel values.
@@ -66,15 +64,11 @@
* \param[in] input The input image.
* \param[in] min The minimum output value.
* \param[in] max The maximum output value.
- * \param[out] output The output image.
- *
- * \pre \p input and \p output have to own the same domain.
- *
*/
- template <typename I, typename O>
- void saturate(const Image<I>& input,
- const mln_value(O)& min, const mln_value(O)& max,
- Image<O>& output);
+ template <typename I, typename V>
+ mln_ch_value(I, V)
+ saturate(const Image<I>& input,
+ const V& min, const V& max);
/*! Apply the saturate function to image pixel values.
@@ -82,9 +76,6 @@
* \param[in,out] input The input image.
* \param[in] min The minimum output value.
* \param[in] max The maximum output value
- *
- * \pre \p input has to be initialized.
- *
*/
template <typename I>
void saturate_inplace(Image<I>& input,
@@ -93,34 +84,37 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename O>
+ template <typename V, typename I>
inline
- void saturate(const Image<I>& input, Image<O>& output)
+ mln_ch_value(I, V)
+ saturate(V, const Image<I>& input)
{
trace::entering("level::saturate");
- mln_precondition(exact(input).domain() == exact(output).domain());
+ mln_precondition(exact(input).has_data());
- fun::v2v::saturate<mln_value(O)> f;
- output = level::transform(input, f);
+ fun::v2v::saturate<V> f;
+ mln_ch_value(I, V) output = level::transform(input, f);
trace::exiting("level::saturate");
+ return output;
}
- template <typename I, typename O>
+ template <typename I, typename V>
inline
- void saturate(const Image<I>& input,
- const mln_value(O)& min, const mln_value(O)& max,
- Image<O>& output)
+ mln_ch_value(I, V)
+ saturate(const Image<I>& input,
+ const V& min, const V& max)
{
trace::entering("level::saturate");
- mln_precondition(exact(input).domain() == exact(output).domain());
+ mln_precondition(exact(input).has_data());
- fun::v2v::saturate<mln_value(O)> f(min, max);
- output = level::transform(input, f);
+ fun::v2v::saturate<V> f(min, max);
+ mln_ch_value(I, V) output = level::transform(input, f);
trace::exiting("level::saturate");
+ return output;
}
template <typename I>
Index: mln/morpho/closing_volume.hh
--- mln/morpho/closing_volume.hh (revision 2968)
+++ mln/morpho/closing_volume.hh (working copy)
@@ -30,9 +30,8 @@
# define MLN_MORPHO_CLOSING_VOLUME_HH
/// \file mln/morpho/closing_volume.hh
-/// \brief Morphological volume closing.
///
-/// \todo Clean!
+/// Morphological volume closing.
# include <mln/morpho/closing_attribute.hh>
# include <mln/accu/volume.hh>
@@ -45,33 +44,29 @@
{
/// Morphological volume closing.
- template <typename I, typename N, typename O>
- void closing_volume(const Image<I>& input, const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output);
-
template <typename I, typename N>
mln_concrete(I)
- closing_volume(const Image<I>& input, const Neighborhood<N>& nbh, unsigned lambda)
- {
- mln_concrete(I) output;
- initialize(output, input);
- closing_volume(input, nbh, lambda, output);
- return output;
- }
+ closing_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 closing_volume(const Image<I>& input, const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output)
+ mln_concrete(I)
+ closing_volume(const Image<I>& input, const Neighborhood<N>& nbh,
+ unsigned lambda)
{
trace::entering("morpho::closing_volume");
- mln_precondition(exact(output).domain() == exact(input).domain());
- // FIXME: Change sig of closing_attribute!
- closing_attribute< accu::volume<I> >(input, nbh, lambda, output);
+
+ mln_precondition(exact(input).has_data());
+
+ mln_concrete(I) output;
+ output = closing_attribute< accu::volume<I> >(input, nbh, lambda);
+
trace::exiting("morpho::closing_volume");
+ return output;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/morpho/closing_area.hh
--- mln/morpho/closing_area.hh (revision 2968)
+++ mln/morpho/closing_area.hh (working copy)
@@ -29,10 +29,9 @@
#ifndef MLN_MORPHO_CLOSING_AREA_HH
# define MLN_MORPHO_CLOSING_AREA_HH
-/*! \file mln/morpho/closing_area.hh
- *
- * \brief Morphological area closing.
- */
+/// \file mln/morpho/closing_area.hh
+///
+/// Morphological area closing.
# include <mln/morpho/closing_attribute.hh>
# include <mln/accu/count.hh>
@@ -45,35 +44,29 @@
{
/// Morphological area closing.
- template <typename I, typename N, typename O>
- void closing_area(const Image<I>& input, const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output);
-
template <typename I, typename N>
- mln_concrete(I) closing_area(const Image<I>& input, const Neighborhood<N>& nbh,
+ mln_concrete(I)
+ closing_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 closing_area(const Image<I>& input, const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output)
+ mln_concrete(I)
+ closing_area(const Image<I>& input, const Neighborhood<N>& nbh,
+ unsigned lambda)
{
- mln_precondition(exact(output).domain() == exact(input).domain());
+ trace::entering("morpho::closing_area");
typedef util::pix<I> pix_t;
- // FIXME: Change sig of closing_attribute!
- closing_attribute< accu::count<pix_t> >(input, nbh, lambda, output);
- }
- template <typename I, typename N>
- mln_concrete(I) closing_area(const Image<I>& input, const Neighborhood<N>& nbh,
- unsigned lambda)
- {
+ mln_precondition(exact(input).has_data());
+
mln_concrete(I) output;
- initialize(output, input);
- closing_area(input, nbh, lambda, output);
+ output = closing_attribute< accu::count<pix_t> >(input, nbh, lambda);
+
+ trace::exiting("morpho::closing_area");
return output;
}
Index: mln/morpho/closing_height.hh
--- mln/morpho/closing_height.hh (revision 2968)
+++ mln/morpho/closing_height.hh (working copy)
@@ -30,7 +30,10 @@
# define MLN_MORPHO_CLOSING_HEIGHT_HH
/// \file mln/morpho/closing_height.hh
-/// \brief Morphological height closing.
+///
+/// Morphological height closing.
+///
+/// \todo The test result looks very weird... Debug!
# include <mln/morpho/closing_attribute.hh>
# include <mln/accu/height.hh>
@@ -43,21 +46,29 @@
{
/// Morphological height closing.
- template <typename I, typename N, typename O>
- void closing_height(const Image<I>& input, const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output);
+ template <typename I, typename N>
+ mln_concrete(I)
+ closing_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 closing_height(const Image<I>& input, const Neighborhood<N>& nbh,
- unsigned lambda, Image<O>& output)
+ mln_concrete(I)
+ closing_height(const Image<I>& input, const Neighborhood<N>& nbh,
+ unsigned lambda)
{
- mln_precondition(exact(output).domain() == exact(input).domain());
- // FIXME: Change sig of closing_attribute!
- closing_attribute< accu::height<I> >(input, nbh, lambda, output);
+ trace::entering("morpho::closing_height");
+
+ mln_precondition(exact(input).has_data());
+
+ mln_concrete(I) output;
+ output = closing_attribute< accu::height<I> >(input, nbh, lambda);
+
+ trace::exiting("morpho::closing_height");
+ return output;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/morpho/tree/compute_attribute_image.hh
--- mln/morpho/tree/compute_attribute_image.hh (revision 2968)
+++ mln/morpho/tree/compute_attribute_image.hh (working copy)
@@ -37,7 +37,6 @@
# include <mln/core/concept/image.hh>
# include <mln/util/pix.hh>
# include <mln/level/fill.hh>
-# include <mln/level/paste.hh>
@@ -84,26 +83,41 @@
{
trace::entering("morpho::tree::compute_attribute_image");
- const A& a = exact(a_);
-
typedef typename T::function I;
mln_ch_value(I, A) acc;
initialize(acc, t.f());
{
+ // Transmit "dynamic data" (state) of 'a' to every values of
+ // 'acc'. It is usually a no-op (so useless) except for a
+ // few accumulators, e.g., for accu::rank which has the 'k'
+ // attribute.
+ A a = exact(a_);
+ level::fill(acc, a);
+ }
+ {
+ // Initialize every attribute with the corresponding pixel.
mln_piter(I) p(t.f().domain());
for_all(p)
acc(p).take_as_init(make::pix(t.f(), p));
}
{
mln_piter(T) p(t.domain());
+ // Propagate attribute from a site to its parent.
for_all(p)
if (! t.is_root(p))
acc(t.parent(p)).take(acc(p));
+ // Back-propagate attribute from a node to sites of its
+ // component. Below, p is a non-node component site and
+ // parent(p) is a node, that is, the site representative of
+ // the component p belongs to.
for_all(p)
if (! t.is_a_node(p))
+ {
+ mln_assertion(t.is_a_node(t.parent(p)));
acc(p) = acc(t.parent(p));
}
+ }
typedef typename T::function I;
mln_ch_value(I, mln_result(A)) output;
Index: mln/morpho/closing_attribute.hh
--- mln/morpho/closing_attribute.hh (revision 2968)
+++ mln/morpho/closing_attribute.hh (working copy)
@@ -30,7 +30,10 @@
# define MLN_MORPHO_CLOSING_ATTRIBUTE_HH
/// \file mln/morpho/closing_attribute.hh
-/// \brief Morphological attribute closing.
+///
+/// Morphological attribute closing.
+///
+/// \todo How to pass dynamic data (e.g., k of accu::rank) to the routine?
# include <mln/morpho/includes.hh>
# include <mln/canvas/morpho/algebraic_union_find.hh>
@@ -45,10 +48,11 @@
{
/// Morphological attribute closing.
- template <typename A,
- typename I, typename N, typename O>
- void closing_attribute(const Image<I>& input, const Neighborhood<N>& nbh,
- mln_result(A) lambda, Image<O>& output);
+ template <typename A, typename I, typename N>
+ mln_concrete(I)
+ closing_attribute(const Image<I>& input, const Neighborhood<N>& nbh,
+ mln_result(A) lambda);
+
# ifndef MLN_INCLUDE_ONLY
@@ -68,19 +72,16 @@
mln_result(A) lambda;
const S s;
- inline
void init()
{
// FIXME: border::fill(input, mln_max(mln_value(I)));
}
- inline
bool is_active(const A& attr) const
{
return attr.to_result() < lambda;
}
- inline
void inactivate(A& attr)
{
attr.set_value(lambda);
@@ -88,7 +89,6 @@
// end of requirements
- inline
closing_attribute_t(const Image<I>& input, mln_result(A) lambda)
: lambda(lambda),
s(level::sort_psites_increasing(exact(input)))
@@ -100,22 +100,33 @@
} // end of namespace mln::morpho::impl
- template <typename A,
- typename I, typename N, typename O>
+ template <typename A, typename I, typename N>
inline
- void closing_attribute(const Image<I>& input,
- const Neighborhood<N>& nbh, mln_result(A) lambda,
- Image<O>& output)
+ mln_concrete(I)
+ closing_attribute(const Image<I>& input, const Neighborhood<N>& nbh,
+ mln_result(A) lambda)
{
+ trace::entering("morpho::closing_attribute");
+
+ mln_precondition(exact(input).has_data());
+
+ mln_concrete(I) output;
+ initialize(output, input);
+
typedef impl::closing_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::closing_attribute");
+ return output;
}
- // -----------------------------------------------------------
- // Old code below.
+
+ /* -----------------------------------------------------------
+
+ Old code below.
namespace impl
{
@@ -146,11 +157,9 @@
void init()
{
// FIXME: border::fill(input, mln_max(mln_value(I)));
- /* FIXME: Shouldn't it be
-
- border::fill(input, mln_max(mln_value(I)))
-
- instead? */
+ // FIXME: Shouldn't it be
+ // border::fill(input, mln_max(mln_value(I)))
+ // instead?
}
inline
@@ -199,6 +208,8 @@
mln_postcondition(output >= input);
}
+ */
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::morpho
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix morpho attribute image computation.
* tests/morpho/tree/compute_attribute_image.cc
(main): Use relevant input image to test.
* mln/math/diff_abs.hh: Upgrade doc style.
(diff_abs): Use a test to be more robuste; remind that
1u - 2u is not equal to -1 in C!
* mln/morpho/tree/compute_attribute_image.hh: Fix.
Non-nodes have to fetch the attribute of their component.
mln/math/diff_abs.hh | 10 +++++-----
mln/morpho/tree/compute_attribute_image.hh | 3 +++
tests/morpho/tree/compute_attribute_image.cc | 8 ++++----
3 files changed, 12 insertions(+), 9 deletions(-)
Index: tests/morpho/tree/compute_attribute_image.cc
--- tests/morpho/tree/compute_attribute_image.cc (revision 2967)
+++ tests/morpho/tree/compute_attribute_image.cc (working copy)
@@ -49,11 +49,11 @@
using namespace mln;
{
- unsigned vals[] = { 5, 6, 6,
- 8, 9, 9,
- 8, 9, 9 };
+ unsigned char vals[] = { 3, 2, 1,
+ 3, 2, 3,
+ 3, 4, 1 };
- typedef image2d<unsigned> I;
+ typedef image2d<unsigned char> I;
I f = make::image2d(vals);
debug::println(f);
Index: mln/math/diff_abs.hh
--- mln/math/diff_abs.hh (revision 2967)
+++ mln/math/diff_abs.hh (working copy)
@@ -1,4 +1,5 @@
// 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_MATH_DIFF_ABS_HH
# define MLN_MATH_DIFF_ABS_HH
-/*! \file mln/math/diff_abs.hh
- *
- * \brief Define diff_abs routine.
- */
+/// \file mln/math/diff_abs.hh
+///
+/// \brief Define diff_abs routine.
namespace mln
@@ -50,7 +50,7 @@
inline
T diff_abs(const T& v1, const T& v2)
{
- return abs(v1 - v2);
+ return v1 > v2 ? v1 - v2 : v2 - v1;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/morpho/tree/compute_attribute_image.hh
--- mln/morpho/tree/compute_attribute_image.hh (revision 2967)
+++ mln/morpho/tree/compute_attribute_image.hh (working copy)
@@ -100,6 +100,9 @@
for_all(p)
if (! t.is_root(p))
acc(t.parent(p)).take(acc(p));
+ for_all(p)
+ if (! t.is_a_node(p))
+ acc(p) = acc(t.parent(p));
}
typedef typename T::function I;
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add a test of attribute image computation.
* geraud/test_attribute.cc: New.
test_attribute.cc | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 122 insertions(+)
Index: geraud/test_attribute.cc
--- geraud/test_attribute.cc (revision 0)
+++ geraud/test_attribute.cc (revision 0)
@@ -0,0 +1,122 @@
+// Copyright (C) 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
+// 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/tree/compute_attribute_image.cc
+///
+/// Tests on mln::morpho::tree::compute_attribute_image.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/site_set/p_array.hh>
+#include <mln/level/sort_psites.hh>
+#include <mln/level/transform.hh>
+
+#include <mln/debug/println.hh>
+#include <mln/core/var.hh>
+#include <mln/value/int_u8.hh>
+
+#include <mln/morpho/tree/data.hh>
+#include <mln/morpho/tree/compute_attribute_image.hh>
+
+#include <mln/morpho/closing_area.hh>
+#include <mln/morpho/opening_area.hh>
+
+#include <mln/accu/count.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/io/pbm/save.hh>
+
+#include <mln/arith/min.hh>
+#include <mln/arith/diff_abs.hh>
+
+
+struct sat_t : mln::Function_v2v<sat_t>
+{
+ typedef mln::value::int_u8 result;
+ result operator()(unsigned u) const
+ {
+ return u > 255 ? 255 : u;
+ }
+}
+ sat;
+
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ typedef image2d<int_u8> I;
+ typedef p_array<point2d> S;
+ typedef util::pix<I> Px;
+
+
+ I f;
+ io::pgm::load(f, "../../../img/tiny.pgm");
+
+
+ image2d<unsigned> area_inc, area_dec;
+ {
+ S s = level::sort_psites_increasing(f);
+ morpho::tree::data<I,S> t(f, s, c4());
+ accu::count<Px> a;
+ area_inc = morpho::tree::compute_attribute_image(a, t);
+ debug::println("area_inc =", area_inc);
+ }
+ {
+ S s = level::sort_psites_decreasing(f);
+ morpho::tree::data<I,S> t(f, s, c4());
+ accu::count<Px> a;
+ area_dec = morpho::tree::compute_attribute_image(a, t);
+ debug::println("area_dec =", area_dec);
+ }
+
+ io::pgm::save(level::transform(area_inc, sat), "inc.pgm");
+ io::pgm::save(level::transform(area_dec, sat), "dec.pgm");
+
+ image2d<unsigned> area = arith::min(area_inc, area_dec);
+ io::pgm::save(level::transform(area, sat), "min.pgm");
+
+ unsigned lambda = 20;
+
+ {
+ I clo = morpho::closing_area(f, c4(), lambda);
+ io::pgm::save(clo, "clo.pgm");
+
+ I ope(clo.domain());
+ morpho::opening_area(f, c4(), lambda, ope);
+ io::pgm::save(ope, "ope.pgm");
+
+ I d_clo = arith::diff_abs(f, clo);
+ io::pgm::save(d_clo, "d_clo.pgm");
+
+ I d_ope = arith::diff_abs(f, ope);
+ io::pgm::save(d_ope, "d_ope.pgm");
+ }
+
+}
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update tests on morpho compute parent tree.
* tests/core/site_set/p_vaccess.cc: Layout.
* tests/morpho/tree/compute_parent.cc
(main): Re-activate code and use a relevant image.
(include): Update.
* tests/morpho/tree/data.cc: Likewise.
* mln/core/site_set/p_vaccess.hh: Update doc style.
(pset): New typedef.
(t_eligible_values_set): Fix missing typedef required by
value iterators.
* img/fly.pgm: New.
img/fly.pgm | 5 +++++
mln/core/site_set/p_vaccess.hh | 11 +++++++----
tests/core/site_set/p_vaccess.cc | 1 +
tests/morpho/tree/compute_parent.cc | 32 +++++++++++++-------------------
tests/morpho/tree/data.cc | 17 +++++++----------
5 files changed, 33 insertions(+), 33 deletions(-)
Index: tests/core/site_set/p_vaccess.cc
--- tests/core/site_set/p_vaccess.cc (revision 2965)
+++ tests/core/site_set/p_vaccess.cc (working copy)
@@ -58,6 +58,7 @@
if (s(v).nsites() == 0)
continue;
std::cout << int(v) << ": ";
+
mln_piter_(Arr) p(s(v));
for_all(p)
std::cout << p << ' ';
Index: tests/morpho/tree/compute_parent.cc
--- tests/morpho/tree/compute_parent.cc (revision 2965)
+++ tests/morpho/tree/compute_parent.cc (working copy)
@@ -31,13 +31,13 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/alias/neighb2d.hh>
-
-#include <mln/debug/println.hh>
-#include <mln/debug/iota.hh>
-
#include <mln/core/var.hh>
#include <mln/core/image/image_if.hh>
+#include <mln/core/site_set/p_array.hh>
+
+#include <mln/level/sort_psites.hh>
#include <mln/pw/value.hh>
+#include <mln/debug/println.hh>
#include <mln/morpho/tree/compute_parent.hh>
@@ -55,26 +55,20 @@
debug::println(sub);
mln_VAR(par, morpho::tree::compute_parent(sub, c4(), sub.domain()));
- debug::println(par);
+ debug::println("par =", par);
}
-/*
- {
- image2d<unsigned> ima(3, 3);
- debug::iota(ima);
- debug::println(ima);
-
- debug::println( morpho::tree::compute_parent(ima, c4(), ima.domain()) );
- }
-
-
{
- image2d<unsigned> ima(3, 3);
- level::fill(ima, 0);
+ unsigned char vals[] = { 3, 2, 1,
+ 3, 2, 3,
+ 3, 4, 1 };
+ image2d<unsigned char> ima = make::image2d(vals);
debug::println(ima);
- debug::println( morpho::tree::compute_parent(ima, c4(), ima.domain()) );
+ typedef p_array<point2d> S;
+ S s = level::sort_psites_increasing(ima);
+ mln_VAR(par, morpho::tree::compute_parent(ima, c4(), s));
+ debug::println("par =", par);
}
-*/
}
Index: tests/morpho/tree/data.cc
--- tests/morpho/tree/data.cc (revision 2965)
+++ tests/morpho/tree/data.cc (working copy)
@@ -31,14 +31,10 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/alias/neighb2d.hh>
-#include <mln/pw/image.hh>
-
-#include <mln/debug/println.hh>
-#include <mln/debug/iota.hh>
-#include <mln/morpho/elementary/dilation.hh>
-
#include <mln/core/site_set/p_array.hh>
+
#include <mln/level/sort_psites.hh>
+#include <mln/debug/println.hh>
#include <mln/morpho/tree/data.hh>
@@ -47,11 +43,12 @@
{
using namespace mln;
- typedef image2d<unsigned> I;
- I ima(3, 3);
- debug::iota(ima);
+ typedef image2d<unsigned char> I;
+ unsigned char vals[] = { 3, 2, 1,
+ 3, 2, 3,
+ 3, 4, 1 };
+ I ima = make::image2d(vals);
- ima = morpho::elementary::dilation(ima, c8());
debug::println("ima = ", ima);
typedef p_array<point2d> S;
Index: mln/core/site_set/p_vaccess.hh
--- mln/core/site_set/p_vaccess.hh (revision 2965)
+++ mln/core/site_set/p_vaccess.hh (working copy)
@@ -1,4 +1,5 @@
// 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_CORE_SITE_SET_P_VACCESS_HH
# define MLN_CORE_SITE_SET_P_VACCESS_HH
-/*! \file mln/core/site_set/p_vaccess.hh
- *
- * \todo Fix the FIXMEs.
- */
+/// \file mln/core/site_set/p_vaccess.hh
+///
+/// \todo Fix the FIXMEs.
# include <utility>
# include <mln/core/site_set/p_double.hh>
@@ -81,7 +81,10 @@
/// Value_Set associated type.
typedef mln::value::set<V> vset;
+ typedef vset t_eligible_values_set; // FIXME: Required by value set iterators...
+ /// Inner site set associated type.
+ typedef S pset;
/// Psite associated type.
typedef p_double_psite<self_, S> psite;
Index: img/fly.pgm
--- img/fly.pgm (revision 0)
+++ img/fly.pgm (revision 0)
@@ -0,0 +1,5 @@
+P5
+# CREATOR: GIMP PNM Filter Version 1.1
+5 5
+255
+�|��jt���uuZ�l�kWvm�kI}�u
\ No newline at end of file
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add a version of parent computation that store roots.
* geraud/compute_parent_more.hh: New.
compute_parent_more.hh | 191 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 191 insertions(+)
Index: geraud/compute_parent_more.hh
--- geraud/compute_parent_more.hh (revision 0)
+++ geraud/compute_parent_more.hh (revision 0)
@@ -0,0 +1,191 @@
+// Copyright (C) 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
+// 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_TREE_COMPUTE_PARENT_HH
+# define MLN_MORPHO_TREE_COMPUTE_PARENT_HH
+
+/// \file mln/morpho/tree/compute_parent.hh
+///
+/// Compute a canonized tree from an image.
+///
+/// \todo Specialize for low quant (and try fastest).
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/level/fill.hh>
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ namespace tree
+ {
+
+
+ template <typename T>
+ inline
+ mln_psite(T)
+ zfind_root(T& zpar, const mln_psite(T)& x)
+ {
+ mlc_equal(mln_value(T), mln_psite(T))::check();
+ if (zpar(x) == x)
+ return x;
+ else
+ return zpar(x) = zfind_root(zpar, zpar(x));
+ }
+
+
+
+ template <typename I, typename N, typename S>
+ inline
+ mln_ch_value(I, mln_psite(I))
+ compute_parent_more(const Image<I>& f_,
+ const Neighborhood<N>& nbh_,
+ const Site_Set<S>& s_)
+ {
+ typedef mln_psite(I) P;
+
+ const I& f = exact(f_);
+ const N& nbh = exact(nbh_);
+ const S& s = exact(s_);
+
+ // Auxiliary data.
+ mln_ch_value(I, bool) deja_vu;
+ mln_ch_value(I, P) parent;
+ mln_ch_value(I, P) zpar;
+
+ initialize(deja_vu, f);
+ initialize(parent, f);
+ initialize(zpar, f);
+
+ typedef mln_vset(S) Vs;
+ typedef mln_pset(S) Ps;
+ S roots;
+
+ // Initialization.
+ level::fill(deja_vu, false);
+ unsigned nnodes = 0;
+
+ // Body.
+ mln_bkd_viter(Vs) v(s.values());
+ for_all(v)
+ {
+ if (s(v).is_empty())
+ continue;
+
+ mln_bkd_piter(Ps) p(s(v));
+ mln_niter(N) n(nbh, p);
+ for_all(p)
+ {
+ // Make-Set.
+ parent(p) = p;
+ zpar(p) = p;
+
+ for_all(n)
+ if (f.domain().has(n) && deja_vu(n))
+ {
+ // Do-Union.
+ P r = internal::zfind_root(zpar, n);
+ if (r != p)
+ {
+ parent(r) = p;
+ zpar(r) = p;
+ }
+ }
+ deja_vu(p) = true;
+ }
+
+
+ /*
+
+ // Canonization on the-fly.
+ {
+ // Intra-v:
+ mln_fwd_piter(Ps) p(s(v));
+ for_all(p)
+ parent(p) = parent(parent(p));
+
+ // Inter "previous v and current v":
+ mln_piter(Ps) r(v_roots);
+ for_all(r)
+ parent(r) = parent(parent(r));
+ v_roots.clear();
+
+ {
+ // New roots:
+ mln_piter(Ps) p(s(v));
+ for_all(p)
+ if (parent(p) == p)
+ v_roots.insert(p);
+ nnodes += v_roots.nsites();
+ }
+ }
+
+ */
+
+ // Storing roots.
+ {
+ mln_piter(Ps) p(s(v));
+ for_all(p)
+ if (parent(p) == p)
+ roots(v).insert(p);
+ nnodes += roots(v).nsites();
+ }
+
+ } // end of "for_all(v)"
+
+
+ // Canonization.
+ {
+ mln_fwd_piter(S) p(s);
+ for_all(p)
+ {
+ P q = parent(p);
+ if (f(parent(q)) == f(q))
+ parent(p) = parent(q);
+ }
+ }
+
+ std::cout << "roots = " << roots << std::endl;
+ std::cout << "nnodes = " << nnodes << std::endl;
+
+
+ return parent;
+ }
+
+
+ } // end of namespace mln::morpho::tree
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MORPHO_TREE_COMPUTE_PARENT_HH
1
0
* doc/examples/erosion.cc: Apply a vertical and a horizontal erosion
on a given image.
* doc/examples/graph.cc: Show how to use graphes with images.
---
milena/ChangeLog | 9 +++
milena/doc/examples/erosion.cc | 110 +++++++++++++++++++++++++++++++++++++
milena/doc/examples/graph.cc | 116 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 235 insertions(+), 0 deletions(-)
create mode 100644 milena/doc/examples/erosion.cc
create mode 100644 milena/doc/examples/graph.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 28fdcc9..374175c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,4 +1,13 @@
2008-11-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add new examples.
+
+ * doc/examples/erosion.cc: Apply a vertical and a horizontal erosion
+ on a given image.
+
+ * doc/examples/graph.cc: Show how to use graphes with images.
+
+2008-11-27 Guillaume Lazzara <z(a)lrde.epita.fr>
Various small fixes.
diff --git a/milena/doc/examples/erosion.cc b/milena/doc/examples/erosion.cc
new file mode 100644
index 0000000..890fd81
--- /dev/null
+++ b/milena/doc/examples/erosion.cc
@@ -0,0 +1,110 @@
+// Copyright (C) 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
+// 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 doc/examples/my_test.cc
+///
+/// Test on mln::morpho::hit_or_miss.
+
+# include <mln/core/image/image2d.hh>
+
+# include <mln/core/image/image_if.hh>
+# include <mln/core/image/sub_image.hh>
+# include <mln/core/alias/neighb2d.hh>
+# include <mln/core/var.hh>
+# include <mln/core/site_set/p_vaccess.hh>
+
+# include <mln/binarization/threshold.hh>
+# include <mln/morpho/hit_or_miss.hh>
+# include <mln/level/fill.hh>
+# include <mln/border/fill.hh>
+# include <mln/io/pbm/load.hh>
+# include <mln/io/pgm/load.hh>
+# include <mln/io/pbm/save.hh>
+# include <mln/io/pgm/save.hh>
+# include <mln/debug/println.hh>
+# include <mln/morpho/opening.hh>
+# include <mln/trait/value_.hh>
+# include <mln/value/int_u8.hh>
+# include <mln/level/paste.hh>
+# include <mln/labeling/blobs.hh>
+# include <mln/level/fill.hh>
+# include <mln/pw/all.hh>
+# include <mln/convert/to_fun.hh>
+# include <mln/geom/bbox.hh>
+
+
+void clean_lines(mln::image2d<bool>& in,
+ const mln::image2d<bool>& ima,
+ unsigned bbox_larger)
+{
+ using namespace mln;
+ using value::label8;
+
+ label8 nlabels;
+ image2d<label8> lbl = labeling::blobs(ima, c4(), nlabels);
+
+ for (unsigned i = nlabels; i > 0; --i)
+ {
+ level::paste(pw::cst(false)
+ | geom::bbox(lbl | (pw::value(lbl) == pw::cst(i))),//.to_larger(bbox_larger),
+ in);
+ }
+}
+
+
+int main(int argc, char*argv[])
+{
+ using namespace mln;
+ using value::int_u8;
+
+ if (argc < 2)
+ {
+ std::cout << argv[0] << " <image.pgm> <height> <width>" << std::endl;
+ return 1;
+ }
+
+ image2d<bool> in;
+ io::pbm::load(in, argv[1]);
+
+ unsigned h = atoi(argv[2]);
+ unsigned w = atoi(argv[3]);
+ unsigned n = atoi(argv[4]);
+
+ // Remove vertical lines.
+ win::rectangle2d vwin(h, w);
+ image2d<bool> vout = morpho::opening(in, vwin);
+ io::pbm::save(vout, "./vout.pbm");
+ clean_lines(in, vout, n);
+
+ // Remove Horizontal lines.
+ win::rectangle2d hwin(w, h);
+ image2d<bool> hout = morpho::opening(in, hwin);
+ io::pbm::save(hout, "./hout.pbm");
+ clean_lines(in, hout, n);
+
+ io::pbm::save(in, "./out.pbm");
+}
diff --git a/milena/doc/examples/graph.cc b/milena/doc/examples/graph.cc
new file mode 100644
index 0000000..08f0944
--- /dev/null
+++ b/milena/doc/examples/graph.cc
@@ -0,0 +1,116 @@
+// Copyright (C) 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
+// 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.
+
+
+#include <mln/essential/2d.hh>
+#include <mln/transform/influence_zone_geodesic.hh>
+#include <mln/make/graph.hh>
+#include <mln/util/graph.hh>
+#include <mln/util/line_graph.hh>
+#include <mln/debug/draw_graph.hh>
+#include <mln/debug/colorize.hh>
+
+template <typename G>
+struct gcolor_t : public mln::Function< gcolor_t<G> >
+{
+ typedef mln::value::rgb8 result;
+
+ mln::value::rgb8
+ operator()(const mln::util::vertex<G>& v) const
+ {
+ return mln::literal::cyan;
+ }
+
+ mln::value::rgb8
+ operator()(const mln::util::edge<G>& e) const
+ {
+ return mln::literal::magenta;
+ }
+
+};
+
+
+int main(int, char *argv[])
+{
+ using namespace mln;
+ using value::label16;
+ using value::rgb8;
+
+ image2d<bool> ima;
+ io::pbm::load(ima, argv[1]);
+ //logical::not_inplace(ima);
+
+ label16 nlabels;
+ image2d<label16> lbl = labeling::blobs(ima, c8(), nlabels);
+
+#ifndef NOUT
+ io::ppm::save(debug::colorize(rgb8(), lbl, nlabels), "01-lbl.ppm");
+#endif
+
+ image2d<label16> iz = transform::influence_zone_geodesic(lbl, c8(), mln_max(int));
+
+#ifndef NOUT
+ io::ppm::save(debug::colorize(rgb8(), iz, nlabels), "02-iz.ppm");
+#endif
+
+ util::graph g = make::graph(iz, nlabels);
+
+ // Compute the components center and use them as vertex.
+ //FIXME: Add fun::vertex2p
+ typedef fun::i2v::array<point2d> fv2p_t;
+ util::array<point2d> centers = labeling::compute(accu::center<point2d>(), iz, nlabels);
+ fv2p_t fv2p = convert::to<fv2p_t>(centers);
+
+ // Create a p_vertices.
+ p_vertices<util::graph, fv2p_t> pv(g, fv2p);
+
+#ifndef NOUT
+ image2d<rgb8> gima = level::convert(rgb8(), ima);
+ debug::draw_graph(gima, pv, gcolor_t<util::graph>());
+ io::ppm::save(gima, "03-graph.ppm");
+#endif
+
+ typedef util::line_graph<util::graph> LG;
+ LG lg(g);
+
+ // Find lines (sites) associated to edges in g.
+ typedef fun::i2v::array<p_line2d> i2e_t;
+ util::array<p_line2d> lines;
+ mln_edge_iter_(util::graph) e(g);
+ for_all(e)
+ lines.append(p_line2d(fv2p(e.v1()), fv2p(e.v2())));
+
+ // Map lines to vertices in lg.
+ p_vertices<LG, i2e_t> pvlg(lg, convert::to<i2e_t>(lines));
+/*
+#ifndef NOUT
+ image2d<rgb8> lgima = level::convert(rgb8(), ima);
+ debug::draw_graph(lgima, pvlg, gcolor_t<LG>());
+ io::ppm::save(gima, "04-line-graph.ppm");
+#endif
+*/
+}
--
1.5.6.5
1
0