
* mln/util/graph.hh: move is_valid and invalidate to... * mln/core/concept/graph.hh: ... here. Currently, these methods have a default implementation. * tests/morpho/artificial_line_graph_image_wst.cc, * tests/morpho/graph_image_wst.cc, * tests/morpho/lena_line_graph_image_wst1.cc, * tests/morpho/lena_line_graph_image_wst2.cc, * tests/morpho/line_graph_image_wst.cc: use the new graph_elt_neighborhood and line_graph_elt_neighborhood aliases. * mln/core/image/graph_elt_neighborhood.hh * mln/core/image/graph_elt_window.hh * mln/core/image/line_graph_elt_neighborhood.hh * mln/core/image/line_graph_elt_window.hh: move back definition of neighborhood_impl specialization from *_elt_neighborhood to *_elt_window. --- milena/ChangeLog | 22 +++++++++++++++ milena/mln/core/concept/graph.hh | 29 ++++++++++++++++++- milena/mln/core/image/graph_elt_neighborhood.hh | 12 -------- milena/mln/core/image/graph_elt_window.hh | 13 +++++++++ .../mln/core/image/line_graph_elt_neighborhood.hh | 12 -------- milena/mln/core/image/line_graph_elt_window.hh | 13 +++++++++ milena/mln/util/graph.hh | 23 --------------- .../morpho/artificial_line_graph_image_wst.cc | 7 ++--- milena/tests/morpho/graph_image_wst.cc | 8 ++--- milena/tests/morpho/lena_line_graph_image_wst1.cc | 7 ++--- milena/tests/morpho/lena_line_graph_image_wst2.cc | 7 ++--- milena/tests/morpho/line_graph_image_wst.cc | 8 ++--- 12 files changed, 90 insertions(+), 71 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 033dacf..9932eb3 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,25 @@ +2009-01-06 Guillaume Lazzara <z@lrde.epita.fr> + + Fix graph related tests. + + * mln/util/graph.hh: move is_valid and invalidate to... + * mln/core/concept/graph.hh: ... here. Currently, these methods have + a default implementation. + + * tests/morpho/artificial_line_graph_image_wst.cc, + * tests/morpho/graph_image_wst.cc, + * tests/morpho/lena_line_graph_image_wst1.cc, + * tests/morpho/lena_line_graph_image_wst2.cc, + * tests/morpho/line_graph_image_wst.cc: use the new + graph_elt_neighborhood and line_graph_elt_neighborhood aliases. + + * mln/core/image/graph_elt_neighborhood.hh + * mln/core/image/graph_elt_window.hh + * mln/core/image/line_graph_elt_neighborhood.hh + * mln/core/image/line_graph_elt_window.hh: move back definition of + neighborhood_impl specialization from *_elt_neighborhood to + *_elt_window. + 2009-01-05 Guillaume Lazzara <z@lrde.epita.fr> Add step 3 in tutorial. diff --git a/milena/mln/core/concept/graph.hh b/milena/mln/core/concept/graph.hh index 81f4f3c..fa07e78 100644 --- a/milena/mln/core/concept/graph.hh +++ b/milena/mln/core/concept/graph.hh @@ -72,7 +72,14 @@ namespace mln const E& id() const; template<typename G2> bool is_subgraph_of(const G2& gr) const; - + */ + /// Return true if this graph is valid. + /// FIXME: currently it always returns true. + bool is_valid() const; + /// Invalidate the graph. + /// FIXME: does nothing! + void invalidate(); + /* // Vertex and edges oriented. unsigned v_other(unsigned id_e, unsigned id_v) const; @@ -140,7 +147,25 @@ namespace mln // a templated method. //bool (E::*m14)(...) = & E::is_subgraph_of; //m14 = 0; -} + } + + template <typename E> + inline + bool + Graph<E>::is_valid() const + { + //FIXME: should not always return true! + return true; + } + + template <typename E> + inline + void + Graph<E>::invalidate() + { + //FIXME: No op! Should do something. + } + # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/mln/core/image/graph_elt_neighborhood.hh b/milena/mln/core/image/graph_elt_neighborhood.hh index dc08ad9..4de7669 100644 --- a/milena/mln/core/image/graph_elt_neighborhood.hh +++ b/milena/mln/core/image/graph_elt_neighborhood.hh @@ -40,18 +40,6 @@ namespace mln { - namespace internal - { - - template <typename G, typename F, typename E> - struct neighborhood_impl<graph_elt_window<G,F>,E> - : public neighborhood_extra_impl<graph_elt_window<G,F>,E> - { - }; - - } // end of namespace mln::internal - - /// Elementary neighborhood on graph class. template <typename G, typename F> struct graph_elt_neighborhood diff --git a/milena/mln/core/image/graph_elt_window.hh b/milena/mln/core/image/graph_elt_window.hh index e1929df..6143c9e 100644 --- a/milena/mln/core/image/graph_elt_window.hh +++ b/milena/mln/core/image/graph_elt_window.hh @@ -46,6 +46,19 @@ namespace mln /// Forward declaration template <typename G, typename F> class graph_elt_window; + + namespace internal + { + + template <typename G, typename F, typename E> + struct neighborhood_impl<graph_elt_window<G,F>,E> + : public neighborhood_extra_impl<graph_elt_window<G,F>,E> + { + }; + + } // end of namespace mln::internal + + namespace trait { diff --git a/milena/mln/core/image/line_graph_elt_neighborhood.hh b/milena/mln/core/image/line_graph_elt_neighborhood.hh index 92c7611..da49fdf 100644 --- a/milena/mln/core/image/line_graph_elt_neighborhood.hh +++ b/milena/mln/core/image/line_graph_elt_neighborhood.hh @@ -40,18 +40,6 @@ namespace mln { - namespace internal - { - - template <typename G, typename F, typename E> - struct neighborhood_impl<line_graph_elt_window<G,F>,E> - : public neighborhood_extra_impl<line_graph_elt_window<G,F>,E> - { - }; - - } // end of namespace mln::internal - - /// Elementary neighborhood on line graph class. template <typename G, typename F> struct line_graph_elt_neighborhood diff --git a/milena/mln/core/image/line_graph_elt_window.hh b/milena/mln/core/image/line_graph_elt_window.hh index d9f7138..1cb3fee 100644 --- a/milena/mln/core/image/line_graph_elt_window.hh +++ b/milena/mln/core/image/line_graph_elt_window.hh @@ -46,6 +46,19 @@ namespace mln /// Forward declaration template <typename G, typename F> class line_graph_elt_window; + + namespace internal + { + + template <typename G, typename F, typename E> + struct neighborhood_impl<line_graph_elt_window<G,F>,E> + : public neighborhood_extra_impl<line_graph_elt_window<G,F>,E> + { + }; + + } // end of namespace mln::internal + + namespace trait { diff --git a/milena/mln/util/graph.hh b/milena/mln/util/graph.hh index 2aed416..897deb4 100644 --- a/milena/mln/util/graph.hh +++ b/milena/mln/util/graph.hh @@ -142,14 +142,6 @@ namespace mln /// Construct a graph with \p nvertices vertices. graph(unsigned nvertices); - - /// Return true if this graph is valid. - /// FIXME: currently it always returns true. - bool is_valid() const; - /// Invalidate the graph. - /// FIXME: does nothing! - void invalidate(); - /// Vertex oriented. /// \{ @@ -288,21 +280,6 @@ namespace mln this->data_ = new mln::internal::data<util::graph>(nvertices); } - inline - bool - graph::is_valid() const - { - //FIXME: should not always return true! - return true; - } - - inline - void - graph::invalidate() - { - //FIXME: No op! Should do something. - } - /*---------------. | Vertex related | `---------------*/ diff --git a/milena/tests/morpho/artificial_line_graph_image_wst.cc b/milena/tests/morpho/artificial_line_graph_image_wst.cc index c88ac15..415ad87 100644 --- a/milena/tests/morpho/artificial_line_graph_image_wst.cc +++ b/milena/tests/morpho/artificial_line_graph_image_wst.cc @@ -54,7 +54,7 @@ /// Required for line graph images. #include <mln/core/site_set/p_edges.hh> -#include <mln/core/image/line_graph_elt_window.hh> +#include <mln/core/image/line_graph_elt_neighborhood.hh> #include <mln/core/var.hh> #include <mln/pw/all.hh> #include <mln/fun/i2v/array.hh> @@ -122,9 +122,8 @@ int main() | WST. | `------*/ - typedef line_graph_elt_window<util::graph, lg_ima_t::pset::fun_t> win_t; - win_t win; - neighb<win_t> nbh(win); + typedef line_graph_elt_neighborhood<util::graph, lg_ima_t::pset::fun_t> nbh_t; + nbh_t nbh; // Perform a Watershed Transform. unsigned nbasins; diff --git a/milena/tests/morpho/graph_image_wst.cc b/milena/tests/morpho/graph_image_wst.cc index 2893903..caecece 100644 --- a/milena/tests/morpho/graph_image_wst.cc +++ b/milena/tests/morpho/graph_image_wst.cc @@ -34,8 +34,7 @@ /// Required for graph images. #include <mln/core/site_set/p_vertices.hh> -#include <mln/core/image/graph_elt_window.hh> -#include <mln/core/neighb.hh> +#include <mln/core/image/graph_elt_neighborhood.hh> #include <mln/core/var.hh> #include <mln/pw/all.hh> #include <mln/fun/i2v/array.hh> @@ -112,9 +111,8 @@ int main() | WST. | `------*/ - typedef graph_elt_window<util::graph, fsite_t> win_t; - win_t win; - neighb<win_t> nbh(win); + typedef graph_elt_neighborhood<util::graph, fsite_t> nbh_t; + nbh_t nbh; unsigned nbasins; mln_const_VAR(wshed, morpho::meyer_wst(ima, nbh, nbasins)); diff --git a/milena/tests/morpho/lena_line_graph_image_wst1.cc b/milena/tests/morpho/lena_line_graph_image_wst1.cc index b100bec..aa2d257 100644 --- a/milena/tests/morpho/lena_line_graph_image_wst1.cc +++ b/milena/tests/morpho/lena_line_graph_image_wst1.cc @@ -60,7 +60,7 @@ /// Required for line graph images. #include <mln/core/site_set/p_edges.hh> -#include <mln/core/image/line_graph_elt_window.hh> +#include <mln/core/image/line_graph_elt_neighborhood.hh> #include <mln/core/var.hh> #include <mln/pw/all.hh> #include <mln/fun/i2v/array.hh> @@ -156,9 +156,8 @@ int main() | WST. | `------*/ - typedef line_graph_elt_window<util::graph, edge_sites_t> win_t; - win_t win; - neighb<win_t> nbh; + typedef line_graph_elt_neighborhood<util::graph, edge_sites_t> nbh_t; + nbh_t nbh; // Perform a Watershed Transform. int_u8 nbasins; diff --git a/milena/tests/morpho/lena_line_graph_image_wst2.cc b/milena/tests/morpho/lena_line_graph_image_wst2.cc index de48d35..ba822fa 100644 --- a/milena/tests/morpho/lena_line_graph_image_wst2.cc +++ b/milena/tests/morpho/lena_line_graph_image_wst2.cc @@ -56,7 +56,7 @@ /// Required for line graph images. #include <mln/core/site_set/p_edges.hh> -#include <mln/core/image/line_graph_elt_window.hh> +#include <mln/core/image/line_graph_elt_neighborhood.hh> #include <mln/core/var.hh> #include <mln/pw/all.hh> #include <mln/fun/i2v/array.hh> @@ -109,9 +109,8 @@ int main() | Simplification. | `-----------------*/ - typedef line_graph_elt_window<util::graph, lg_ima_t::pset::fun_t> win_t; - win_t win; - neighb<win_t> nbh(win); + typedef line_graph_elt_neighborhood<util::graph, lg_ima_t::pset::fun_t> nbh_t; + nbh_t nbh; mln_VAR(closed_lg_ima, morpho::closing_area_on_vertices(lg_ima, nbh, 20)); diff --git a/milena/tests/morpho/line_graph_image_wst.cc b/milena/tests/morpho/line_graph_image_wst.cc index c6c2ac0..73afbda 100644 --- a/milena/tests/morpho/line_graph_image_wst.cc +++ b/milena/tests/morpho/line_graph_image_wst.cc @@ -33,8 +33,7 @@ /// Required for line graph images. #include <mln/core/site_set/p_edges.hh> -#include <mln/core/image/line_graph_elt_window.hh> -#include <mln/core/neighb.hh> +#include <mln/core/image/line_graph_elt_neighborhood.hh> #include <mln/core/var.hh> #include <mln/pw/all.hh> #include <mln/fun/i2v/array.hh> @@ -130,9 +129,8 @@ int main() std::cout << "ima (" << p << ") = " << ima(p) << std::endl; std::cout << std::endl; - typedef line_graph_elt_window<util::graph, edge_sites_t> win_t; - win_t win; - neighb<win_t> nbh(win); + typedef line_graph_elt_neighborhood<util::graph, edge_sites_t> nbh_t; + nbh_t nbh; unsigned nbasins; mln_const_VAR(wshed, morpho::meyer_wst(ima, nbh, nbasins)); -- 1.5.6.5
participants (1)
-
Guillaume Lazzara