
* mln/core/image/complex_image.hh: update comments. * mln/core/image/complex_neighborhood_piter.hh: avoid a warning. * mln/core/internal/site_relative_iterator_base.hh: call center_at_() earlier. * mln/core/site_set/p_vertices.hh: call the proper graph() method. * mln/fun/v2v/ch_function_value.hh, * mln/trait/ch_function_value.hh: fix a recursive inclusion. * tests/core/image/graph_image.cc: fix layout. * tests/core/image/line_graph_image.cc: cleanup includes. * tests/level/paste_full.cc: move to... * tests/data/paste_full.cc: ... this file. * tests/level/Makefile.am: remove obsolete entries. * tests/histo/to_image1d.cc: Fix compilation issue. An incorrect image type was expected. * tools/area_flooding.cc: fix a warning. * tests/core/site_set/p_vertices.cc: The function mapping vertices to sites was not large enough to hold all the values. * mln/fun/x2v/bilinear.hh: avoid warnings using static_cast. --- milena/ChangeLog | 35 ++++++++++++++++++++ milena/mln/core/image/complex_image.hh | 7 ++-- .../mln/core/image/complex_neighborhood_piter.hh | 2 +- .../core/internal/site_relative_iterator_base.hh | 2 +- milena/mln/core/site_set/p_vertices.hh | 2 +- milena/mln/fun/v2v/ch_function_value.hh | 4 ++- milena/mln/fun/x2v/bilinear.hh | 8 ++-- milena/mln/trait/ch_function_value.hh | 9 +++-- milena/tests/core/image/graph_image.cc | 6 ++-- milena/tests/core/image/line_graph_image.cc | 11 ++---- milena/tests/core/site_set/p_vertices.cc | 4 +- milena/tests/{level => data}/paste_full.cc | 0 milena/tests/histo/to_image1d.cc | 10 +++--- milena/tests/level/Makefile.am | 8 ---- milena/tools/area_flooding.cc | 4 +-- 15 files changed, 69 insertions(+), 43 deletions(-) rename milena/tests/{level => data}/paste_full.cc (100%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 8952f82..d5c4ca8 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,40 @@ 2008-12-31 Guillaume Lazzara <z@lrde.epita.fr> + Various small fixes (again). + + * mln/core/image/complex_image.hh: update comments. + + * mln/core/image/complex_neighborhood_piter.hh: avoid a warning. + + * mln/core/internal/site_relative_iterator_base.hh: call center_at_() + earlier. + + * mln/core/site_set/p_vertices.hh: call the proper graph() method. + + * mln/fun/v2v/ch_function_value.hh, + * mln/trait/ch_function_value.hh: fix a recursive inclusion. + + * tests/core/image/graph_image.cc: fix layout. + + * tests/core/image/line_graph_image.cc: cleanup includes. + + * tests/level/paste_full.cc: move to... + * tests/data/paste_full.cc: ... this file. + + * tests/level/Makefile.am: remove obsolete entries. + + * tests/histo/to_image1d.cc: Fix compilation issue. An incorrect image + type was expected. + + * tools/area_flooding.cc: fix a warning. + + * tests/core/site_set/p_vertices.cc: The function mapping vertices to + sites was not large enough to hold all the values. + + * mln/fun/x2v/bilinear.hh: avoid warnings using static_cast. + +2008-12-31 Guillaume Lazzara <z@lrde.epita.fr> + Re-enable tests in morpho and make them work again. * tests/morpho/Makefile.am: re-enable all tests. diff --git a/milena/mln/core/image/complex_image.hh b/milena/mln/core/image/complex_image.hh index 1d37cea..0e98c4e 100644 --- a/milena/mln/core/image/complex_image.hh +++ b/milena/mln/core/image/complex_image.hh @@ -29,7 +29,8 @@ # define MLN_CORE_IMAGE_COMPLEX_IMAGE_HH /// \file mln/core/image/complex_image.hh -/// \brief Definition of a line complex-based image. +/// +/// Definition of a line complex-based image. # include <vector> @@ -113,7 +114,7 @@ namespace mln } // end of namespace mln::trait - /// \brief Image based on a complex. + /// Image based on a complex. /// /// Values attached to each face of the complex. /// @@ -133,7 +134,7 @@ namespace mln /// Value associated type. typedef V value; - /// \brief Return type of read-write access. + /// Return type of read-write access. /// /// We use the associated type \c reference instead of a plain /// reference on th value type (\tparam V), because it's the only way diff --git a/milena/mln/core/image/complex_neighborhood_piter.hh b/milena/mln/core/image/complex_neighborhood_piter.hh index f57588b..0a91f30 100644 --- a/milena/mln/core/image/complex_neighborhood_piter.hh +++ b/milena/mln/core/image/complex_neighborhood_piter.hh @@ -240,7 +240,7 @@ namespace mln template <typename Pref> inline void - complex_neighborhood_fwd_piter<I, G, N>::center_at_(const Pref& c) + complex_neighborhood_fwd_piter<I, G, N>::center_at_(const Pref&) { iter_.center_at(this->center().face()); } diff --git a/milena/mln/core/internal/site_relative_iterator_base.hh b/milena/mln/core/internal/site_relative_iterator_base.hh index c65503f..7a662b6 100644 --- a/milena/mln/core/internal/site_relative_iterator_base.hh +++ b/milena/mln/core/internal/site_relative_iterator_base.hh @@ -141,8 +141,8 @@ namespace mln { mlc_converts_to(P, const mln_psite(S)&)::check(); c_ = & static_cast< const mln_psite(S)& >(c); - this->invalidate(); exact(this)->center_at_(c); + this->invalidate(); } template <typename S, typename E> diff --git a/milena/mln/core/site_set/p_vertices.hh b/milena/mln/core/site_set/p_vertices.hh index 0ebab63..cf78f0a 100644 --- a/milena/mln/core/site_set/p_vertices.hh +++ b/milena/mln/core/site_set/p_vertices.hh @@ -320,7 +320,7 @@ namespace mln bool operator==(const p_vertices<G,F>& lhs, const p_vertices<G,F>& rhs) { - return (lhs.g_) == (rhs.g_); + return (lhs.graph()) == (rhs.graph()); } template <typename G, typename F> diff --git a/milena/mln/fun/v2v/ch_function_value.hh b/milena/mln/fun/v2v/ch_function_value.hh index a4c7ca4..e1f97f8 100644 --- a/milena/mln/fun/v2v/ch_function_value.hh +++ b/milena/mln/fun/v2v/ch_function_value.hh @@ -34,7 +34,6 @@ /// Wrap a function v2v and convert its result to another type. # include <mln/core/concept/function.hh> -# include <mln/convert/to.hh> # include <mln/fun/internal/ch_function_value_impl.hh> @@ -42,6 +41,9 @@ namespace mln { + // Forward declaration. + namespace convert { template <typename T, typename O> T to(const O& from); } + namespace fun { diff --git a/milena/mln/fun/x2v/bilinear.hh b/milena/mln/fun/x2v/bilinear.hh index b997da2..1b7578d 100644 --- a/milena/mln/fun/x2v/bilinear.hh +++ b/milena/mln/fun/x2v/bilinear.hh @@ -98,10 +98,10 @@ namespace mln double y2 = std::floor(v[1]) + 1; //if (not ima.has(point2d(x1, y1))) return mln_value(I)(); - vsum q11 = ima(point2d(x1, y1)); - vsum q12 = ima(point2d(x1, y2)); - vsum q21 = ima(point2d(x2, y1)); - vsum q22 = ima(point2d(x2, y2)); + vsum q11 = ima(point2d(static_cast<unsigned>(x1), static_cast<unsigned>(y1))); + vsum q12 = ima(point2d(static_cast<unsigned>(x1), static_cast<unsigned>(y2))); + vsum q21 = ima(point2d(static_cast<unsigned>(x2), static_cast<unsigned>(y1))); + vsum q22 = ima(point2d(static_cast<unsigned>(x2), static_cast<unsigned>(y2))); double x2_x1 = x2 - x1; double y2_y1 = y2 - y1; diff --git a/milena/mln/trait/ch_function_value.hh b/milena/mln/trait/ch_function_value.hh index 6ed1e47..ddb499d 100644 --- a/milena/mln/trait/ch_function_value.hh +++ b/milena/mln/trait/ch_function_value.hh @@ -44,12 +44,13 @@ mln::trait::ch_functionvalue< I, V >::ret namespace mln { - namespace trait - { + // Forward declarations. + namespace trait { template <typename F, typename V> struct ch_function_value; } + namespace fun { namespace i2v { template <typename T> class array; } } - // Forward declaration. - template <typename F, typename V> struct ch_function_value; + namespace trait + { namespace impl { diff --git a/milena/tests/core/image/graph_image.cc b/milena/tests/core/image/graph_image.cc index 20e0961..2e88446 100644 --- a/milena/tests/core/image/graph_image.cc +++ b/milena/tests/core/image/graph_image.cc @@ -95,7 +95,7 @@ int main() // Edges. util::graph g; // Populate the graph with vertices. - for(unsigned i = 0; i < sites.size(); ++i) + for (unsigned i = 0; i < sites.size(); ++i) g.add_vertex(); // Populate the graph with edges. g.add_edge(0, 1); @@ -120,11 +120,11 @@ int main() // Graph values. typedef fun::i2v::array<unsigned> viota_t; viota_t iota(pv.nsites()); - for(unsigned i = 0; i < iota.size(); ++i) + for (unsigned i = 0; i < iota.size(); ++i) iota(i) = 10 + i; // Create graph image. - mln_const_VAR(ima,(iota | pv)); + mln_const_VAR(ima, (iota | pv)); { // FIXME: Move this part to a special test case. diff --git a/milena/tests/core/image/line_graph_image.cc b/milena/tests/core/image/line_graph_image.cc index e7008e7..981a09a 100644 --- a/milena/tests/core/image/line_graph_image.cc +++ b/milena/tests/core/image/line_graph_image.cc @@ -29,20 +29,17 @@ /// /// Tests on mln::graph_image. -#include <vector> - #include <mln/core/alias/point2d.hh> -#include <mln/pw/all.hh> -#include <mln/core/image/line_graph_elt_window.hh> +/// 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/var.hh> +#include <mln/pw/all.hh> #include <mln/fun/i2v/array.hh> - #include <mln/util/graph.hh> -#include <mln/core/var.hh> /* The graph and its corresponding line graph are as follows: diff --git a/milena/tests/core/site_set/p_vertices.cc b/milena/tests/core/site_set/p_vertices.cc index e74d9c5..bcce18a 100644 --- a/milena/tests/core/site_set/p_vertices.cc +++ b/milena/tests/core/site_set/p_vertices.cc @@ -57,8 +57,8 @@ int main() // Map vertices to sites. typedef fun::i2v::array<point2d> F; - F f(5); - for (unsigned i = 0; i < 5; ++i) + F f(6); + for (unsigned i = 0; i < 6; ++i) f(i) = point2d(i, 0); typedef p_vertices<util::graph, F> p_vertices; diff --git a/milena/tests/level/paste_full.cc b/milena/tests/data/paste_full.cc similarity index 100% rename from milena/tests/level/paste_full.cc rename to milena/tests/data/paste_full.cc diff --git a/milena/tests/histo/to_image1d.cc b/milena/tests/histo/to_image1d.cc index cc6ba46..ee09b85 100644 --- a/milena/tests/histo/to_image1d.cc +++ b/milena/tests/histo/to_image1d.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/histo/to_image1d.cc - * - * \brief Tests on mln::accu::histo and mln::histo::data. - */ +/// \file tests/histo/to_image1d.cc +/// +/// Tests on mln::accu::histo and mln::histo::data. #include <iterator> @@ -71,7 +71,7 @@ int main() histo::data<int_u8> h = histo::compute(ima); std::cout << h << std::endl; - image1d<std::size_t> ima2 = convert::to_image(h); + image1d<unsigned> ima2 = convert::to_image(h); debug::println(ima2); } } diff --git a/milena/tests/level/Makefile.am b/milena/tests/level/Makefile.am index 8da9ef0..8e62b6b 100644 --- a/milena/tests/level/Makefile.am +++ b/milena/tests/level/Makefile.am @@ -11,15 +11,11 @@ check_PROGRAMS = \ compare \ compute \ convert \ - fill \ - fill_with_value \ - fill_with_image \ median \ median_ \ median_dir \ median_fast \ median_hline2d \ - paste \ saturate \ sort_psites \ stretch \ @@ -33,15 +29,11 @@ apply_SOURCES = apply.cc compare_SOURCES = compare.cc compute_SOURCES = compute.cc convert_SOURCES = convert.cc -fill_SOURCES = fill.cc -fill_with_value_SOURCES = fill_with_value.cc -fill_with_image_SOURCES = fill_with_image.cc median_SOURCES = median.cc median__SOURCES = median_.cc median_dir_SOURCES = median_dir.cc median_fast_SOURCES = median_fast.cc median_hline2d_SOURCES = median_hline2d.cc -paste_SOURCES = paste.cc saturate_SOURCES = saturate.cc sort_psites_SOURCES = sort_psites.cc stretch_SOURCES = stretch.cc diff --git a/milena/tools/area_flooding.cc b/milena/tools/area_flooding.cc index 0157f9c..10abdb7 100644 --- a/milena/tools/area_flooding.cc +++ b/milena/tools/area_flooding.cc @@ -164,8 +164,6 @@ int main(int argc, char* argv[]) for_all(p) if (wshed(p) != wshed_label) { - // FIXME: Equip the iterator with first() and second() - // accessors? wshed2d(p.first()) = wshed(p); wshed2d(p.second()) = wshed(p); } @@ -186,7 +184,7 @@ int main(int argc, char* argv[]) // Create an output image using the average gray levels of the basins. orig_ima_t output(input.domain()); for_all(q) - output(q) = average[wshed2d(q)]; + output(q) = convert::to<mln_value_(orig_ima_t)>(average[wshed2d(q)]); std::cout << "area = " << area << " \t" << "nregions = " << nregions << std::endl; -- 1.5.6.5