
* mln/accu/label_used.hh: add missing includes. * mln/canvas/browsing/depth_first_search.hh, * mln/io/pgm/save.hh: add preconditions. * mln/make/influence_zone_adjacency_graph.hh: rename the routine in order to have the same name as the file name. * mln/make/rag_and_labeled_wsl.hh: Add more doc. * mln/value/lut_vec.hh: add a constructor overload for util::array which is now considered as a function. * tests/make/Makefile.am: update test name entry for influence_zone_adjacency_graph. * tests/morpho/attribute/sum.cc, * tests/morpho/line_graph_image_wst.cc: avoid warnings. --- milena/ChangeLog | 23 ++++++++++ milena/mln/accu/label_used.hh | 1 + milena/mln/canvas/browsing/depth_first_search.hh | 1 + milena/mln/io/pgm/save.hh | 3 + milena/mln/make/influence_zone_adjacency_graph.hh | 49 +++++++++++--------- milena/mln/make/rag_and_labeled_wsl.hh | 47 +++++++++++--------- milena/mln/value/lut_vec.hh | 26 ++++++++++- milena/tests/make/Makefile.am | 5 +- milena/tests/morpho/attribute/sum.cc | 2 +- milena/tests/morpho/line_graph_image_wst.cc | 4 +- 10 files changed, 111 insertions(+), 50 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 06dba5b..6117e06 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,28 @@ 2009-04-15 Guillaume Lazzara <lazzara@lrde.epita.fr> + Small fixes. + + * mln/accu/label_used.hh: add missing includes. + + * mln/canvas/browsing/depth_first_search.hh, + * mln/io/pgm/save.hh: add preconditions. + + * mln/make/influence_zone_adjacency_graph.hh: rename the routine in + order to have the same name as the file name. + + * mln/make/rag_and_labeled_wsl.hh: Add more doc. + + * mln/value/lut_vec.hh: add a constructor overload for util::array + which is now considered as a function. + + * tests/make/Makefile.am: update test name entry for + influence_zone_adjacency_graph. + + * tests/morpho/attribute/sum.cc, + * tests/morpho/line_graph_image_wst.cc: avoid warnings. + +2009-04-15 Guillaume Lazzara <lazzara@lrde.epita.fr> + Add a routine to generate formatted debug filenames. * mln/debug/filename.hh: new routine. diff --git a/milena/mln/accu/label_used.hh b/milena/mln/accu/label_used.hh index 6323d3e..fe3553f 100644 --- a/milena/mln/accu/label_used.hh +++ b/milena/mln/accu/label_used.hh @@ -36,6 +36,7 @@ # include <mln/accu/internal/base.hh> # include <mln/core/concept/meta_accumulator.hh> # include <mln/math/max.hh> +# include <mln/fun/i2v/array.hh> namespace mln diff --git a/milena/mln/canvas/browsing/depth_first_search.hh b/milena/mln/canvas/browsing/depth_first_search.hh index 2880397..818e44b 100644 --- a/milena/mln/canvas/browsing/depth_first_search.hh +++ b/milena/mln/canvas/browsing/depth_first_search.hh @@ -101,6 +101,7 @@ namespace mln trace::entering("canvas::browsing::depth_first_search"); const G& g = exact(g_); + mln_precondition(g.is_valid()); f.init(g); // <--- init diff --git a/milena/mln/io/pgm/save.hh b/milena/mln/io/pgm/save.hh index 5e7df76..0137580 100644 --- a/milena/mln/io/pgm/save.hh +++ b/milena/mln/io/pgm/save.hh @@ -82,6 +82,9 @@ namespace mln // FIXME: Is it exhaustive? mlc_is_not_a(mln_value(I), value::Vectorial)::check(); mlc_converts_to(mln_value(I),unsigned)::check(); + /// Make sure this is a low quantification value type + /// (mln_card returns 0 if it is not) + metal::bool_<mln_card(mln_value(I)) != 0>::check(); trace::entering("mln::io::pgm::save"); io::pnm::save(PGM, exact(ima), filename); diff --git a/milena/mln/make/influence_zone_adjacency_graph.hh b/milena/mln/make/influence_zone_adjacency_graph.hh index 9c0f33e..7113962 100644 --- a/milena/mln/make/influence_zone_adjacency_graph.hh +++ b/milena/mln/make/influence_zone_adjacency_graph.hh @@ -26,10 +26,10 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_MAKE_GRAPH_HH -# define MLN_MAKE_GRAPH_HH +#ifndef MLN_MAKE_INFLUENCE_ZONE_ADJACENCY_GRAPH_HH +# define MLN_MAKE_INFLUENCE_ZONE_ADJACENCY_GRAPH_HH -/// \file mln/make/graph.hh +/// \file mln/make/influence_zone_adjacency_graph.hh /// /// Create a graph from an influence zone image. /// @@ -59,8 +59,9 @@ namespace mln /// \return util::graph Graph based on the adjacency of the influence zones. template <typename I, typename N> util::graph - graph(const Image<I>& iz_, const Neighborhood<N>& nbh, - mln_value(I) nlabels); + influence_zone_adjacency_graph(const Image<I>& iz_, + const Neighborhood<N>& nbh, + mln_value(I) nlabels); @@ -72,8 +73,9 @@ namespace mln template <typename I, typename N> void - graph_tests(const Image<I>& iz, const Neighborhood<N>& nbh, - mln_value(I)) + influence_zone_adjacency_graph_tests(const Image<I>& iz, + const Neighborhood<N>& nbh, + mln_value(I)) { mln_precondition(exact(iz).is_valid()); mln_precondition(exact(nbh).is_valid()); @@ -92,12 +94,13 @@ namespace mln template <typename I, typename N> util::graph - graph(const Image<I>& iz_, const Neighborhood<N>& nbh_, - mln_value(I) nlabels) + influence_zone_adjacency_graph(const Image<I>& iz_, + const Neighborhood<N>& nbh_, + mln_value(I) nlabels) { - trace::entering("make::impl::generic::graph"); + trace::entering("make::impl::generic::influence_zone_adjacency_graph"); - internal::graph_tests(iz_, nbh_, nlabels); + internal::influence_zone_adjacency_graph_tests(iz_, nbh_, nlabels); const I& iz = exact(iz_); const N& nbh = exact(nbh_); @@ -136,7 +139,7 @@ namespace mln if (adj(point2d(i,j))) g.add_edge(i, j); - trace::exiting("make::impl::generic::graph"); + trace::exiting("make::impl::generic::influence_zone_adjacency_graph"); return g; } @@ -151,10 +154,11 @@ namespace mln template <typename I, typename N> util::graph - graph_dispatch(const Image<I>& iz, const Neighborhood<N>& nbh, - mln_value(I) nlabels) + influence_zone_adjacency_graph_dispatch(const Image<I>& iz, + const Neighborhood<N>& nbh, + mln_value(I) nlabels) { - return make::impl::generic::graph(iz, nbh, nlabels); + return make::impl::generic::influence_zone_adjacency_graph(iz, nbh, nlabels); } } // end of namespace mln::make::internal @@ -166,16 +170,17 @@ namespace mln template <typename I, typename N> inline util::graph - graph(const Image<I>& iz, const Neighborhood<N>& nbh, - mln_value(I) nlabels) + influence_zone_adjacency_graph(const Image<I>& iz, + const Neighborhood<N>& nbh, + mln_value(I) nlabels) { - trace::entering("make::graph"); + trace::entering("make::influence_zone_adjacency_graph"); - internal::graph_tests(iz, nbh, nlabels); + internal::influence_zone_adjacency_graph_tests(iz, nbh, nlabels); - util::graph g = internal::graph_dispatch(iz, nbh, nlabels); + util::graph g = internal::influence_zone_adjacency_graph_dispatch(iz, nbh, nlabels); - trace::exiting("make::graph"); + trace::exiting("make::influence_zone_adjacency_graph"); return g; } @@ -188,4 +193,4 @@ namespace mln } // end of namespace mln -#endif // ! MLN_MAKE_GRAPH_HH +#endif // ! MLN_MAKE_INFLUENCE_ZONE_ADJACENCY_GRAPH_HH diff --git a/milena/mln/make/rag_and_labeled_wsl.hh b/milena/mln/make/rag_and_labeled_wsl.hh index 7ace36f..1ad3705 100644 --- a/milena/mln/make/rag_and_labeled_wsl.hh +++ b/milena/mln/make/rag_and_labeled_wsl.hh @@ -65,27 +65,32 @@ namespace mln /// image with a labeled watershed line. /*! ** - ** |-----------------| |-----------------| \n - ** | 1 1 1 0 2 2 0 3 | | . . . 1 . . 2 . | \n - ** | 1 1 0 2 2 2 0 3 | | . . 1 . . . 2 . | \n - ** | 1 0 4 0 2 0 3 3 | ----> | . 1 . 3 . 4 . . | \n - ** | 0 4 4 4 0 5 0 3 | | 1 . . . 5 . 6 . | \n - ** |-----------------| |-----------------| \n - ** \n - ** Watershed image Labeled watershed line \n - ** (watershed line labeled with 0) \n - ** \n - ** \n - ** | \n - ** | \n - ** | \n - ** v \n - ** \n - ** 1 -- 2 - 3 \n - ** \ / / \n - ** 4 -- 5 \n - ** \n - ** Region Adjacency graph (RAG) \n + ** \verbatim + ** + ** |-----------------| |-----------------| + ** | 1 1 1 0 2 2 0 3 | | . . . 1 . . 2 . | + ** | 1 1 0 2 2 2 0 3 | | . . 1 . . . 2 . | + ** | 1 0 4 0 2 0 3 3 | ----> | . 1 . 3 . 4 . . | + ** | 0 4 4 4 0 5 0 3 | | 1 . . . 5 . 6 . | + ** |-----------------| |-----------------| + ** + ** Watershed image Labeled watershed line + ** (watershed line labeled with 0) + ** + ** + ** | + ** | + ** | + ** v + ** + ** 1 -- 2 - 3 + ** \ / / + ** 4 -- 5 + ** + ** Region Adjacency graph (RAG) + ** + ** \endverbatim + ** */ template <typename I, typename N> util::couple<util::graph,mln_concrete(I)> diff --git a/milena/mln/value/lut_vec.hh b/milena/mln/value/lut_vec.hh index 8c817a2..a88db43 100644 --- a/milena/mln/value/lut_vec.hh +++ b/milena/mln/value/lut_vec.hh @@ -51,6 +51,9 @@ namespace mln template <typename T> class array; } // end of namespace mln::fun::i2v } // end of namespace mln::fun + namespace util{ + template <typename T> class array; + } // end of namespace mln::util namespace value { @@ -93,14 +96,21 @@ namespace mln /// Give the index of value \p v in this set. unsigned index_of(const value& v) const; - /// Ctor. FIXME! + /// Constructors + /// @{ + /// Constructor from a Site_set and any Function_v2v. template <typename F> lut_vec(const S& vset, const Function_v2v<F>& f); - /// Ctor. FIXME! + /// Constructor from a Site_set and any fun::i2v::array. template <typename V> lut_vec(const S& vset, const Function_v2v< fun::i2v::array<V> >& f); + /// Constructor from a Site_set and any util::array. + template <typename V> + lut_vec(const S& vset, const Function_v2v< util::array<V> >& f); + /// @} + protected: const S& vset_; @@ -159,6 +169,18 @@ namespace mln } template <typename S, typename T> + template <typename V> + inline + lut_vec<S,T>::lut_vec(const S& vset, const Function_v2v< util::array<V> >& f) + : vset_(vset) + { + const util::array<V>& f_ = exact(f); + n_ = f_.size(); + vec_ = f_.std_vector(); + } + + + template <typename S, typename T> inline T lut_vec<S,T>::operator()(const mln_value(S)& val) const diff --git a/milena/tests/make/Makefile.am b/milena/tests/make/Makefile.am index ba517cd..f83f95c 100644 --- a/milena/tests/make/Makefile.am +++ b/milena/tests/make/Makefile.am @@ -6,7 +6,7 @@ check_PROGRAMS = \ dual_neighb \ dummy_p_edges \ dummy_p_vertices \ - graph \ + influence_zone_adjacency_graph \ h_mat \ image2d \ image3d \ @@ -18,10 +18,11 @@ check_PROGRAMS = \ w_window \ w_window_directional +dual_neighb_SOURCES = dual_neighb.c dual_neighb_SOURCES = dual_neighb.cc dummy_p_edges_SOURCES = dummy_p_edges.cc dummy_p_vertices_SOURCES = dummy_p_vertices.cc -graph_SOURCES = graph.cc +influence_zone_adjacency_graph_SOURCES = influence_zone_adjacency_graph.cc h_mat_SOURCES = h_mat.cc image2d_SOURCES = image2d.cc image3d_SOURCES = image3d.cc diff --git a/milena/tests/morpho/attribute/sum.cc b/milena/tests/morpho/attribute/sum.cc index 330b10f..85a1d2e 100644 --- a/milena/tests/morpho/attribute/sum.cc +++ b/milena/tests/morpho/attribute/sum.cc @@ -49,5 +49,5 @@ int main() s.take(px); s.take(px); s.take(px); - mln_assertion(s == 51); + mln_assertion(s == 51u); } diff --git a/milena/tests/morpho/line_graph_image_wst.cc b/milena/tests/morpho/line_graph_image_wst.cc index 6df2052..afc39ba 100644 --- a/milena/tests/morpho/line_graph_image_wst.cc +++ b/milena/tests/morpho/line_graph_image_wst.cc @@ -108,11 +108,11 @@ int main() typedef fun::i2v::array<int> edge_values_t; edge_values_t edge_values(10); - static const int values[] = { 0, 10, 5, 2, 4, 6, 0, 3, 5, 2 }; + static const unsigned values[] = { 0, 10, 5, 2, 4, 6, 0, 3, 5, 2 }; for (unsigned i = 0; i < edge_values.size(); ++i) edge_values(i) = values[i]; - typedef vertex_image< P, int, util::line_graph<util::graph> > ima_t; + typedef vertex_image< P, unsigned, util::line_graph<util::graph> > ima_t; ima_t ima(lg, sites, edge_values); -- 1.5.6.5
participants (1)
-
Guillaume Lazzara