
https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> A couple of bug fix. * mln/morpho/thinning.hh (thinning_tests): Fix. * mln/morpho/Rd.hh: Fix. (greater_point): Replace by... (ord_strict): ...this. Layout. * tests/morpho/combined.cc: Rename as... * tests/morpho/Rd.cc: ...this; to be consistent. * tests/morpho/Makefile.am: Update. mln/morpho/Rd.hh | 28 ++++++++------------ mln/morpho/thinning.hh | 20 +++++++------- tests/morpho/Makefile.am | 4 +- tests/morpho/Rd.cc | 64 ++++------------------------------------------- 4 files changed, 30 insertions(+), 86 deletions(-) Index: mln/morpho/thinning.hh --- mln/morpho/thinning.hh (revision 3744) +++ mln/morpho/thinning.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008, 2009 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_MORPHO_THINNING_HH # define MLN_MORPHO_THINNING_HH -/*! \file mln/morpho/thinning.hh - * - * \brief Morphological thinning. - */ +/// \file mln/morpho/thinning.hh +/// +/// Morphological thinning. # include <mln/morpho/hit_or_miss.hh> # include <mln/morpho/thickening.hh> @@ -46,10 +46,10 @@ { - /*! Morphological thinning. - * - * This operator is THIN_B = Id - HMT_B, where B = (Bfg, Bbg). - */ + /// Morphological thinning. + /// + /// This operator is THIN_B = Id - HMT_B, where B = (Bfg, Bbg). + // template <typename I, typename Wfg, typename Wbg> mln_concrete(I) thinning(const Image<I>& input, @@ -74,7 +74,7 @@ // Tests. mln_precondition(input.is_valid()); - mln_precondition(win_bg.is_centered()); + mln_precondition(win_fg.is_centered()); mln_precondition(! win_bg.is_empty()); mln_precondition((win_fg && win_bg).is_empty()); Index: mln/morpho/Rd.hh --- mln/morpho/Rd.hh (revision 3744) +++ mln/morpho/Rd.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2009 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 @@ -31,23 +32,18 @@ // FIXME: This file, as well its functions and classes, shall not // contain capital letters. -/*! - * \file mln/morpho/Rd.hh - * - * \brief FIXME. - */ +/// \file mln/morpho/Rd.hh +/// +/// \todo Reform code! Also go and see sandbox/theo/Rd. # include <vector> - # include <mln/core/concept/image.hh> # include <mln/core/concept/neighborhood.hh> - # include <mln/trait/value_.hh> - # include <mln/data/fill.hh> # include <mln/level/compare.hh> +# include <mln/util/ord.hh> -# include <mln/util/greater_point.hh> namespace mln { @@ -56,7 +52,8 @@ { template <typename I, typename N> - I Rd(const Image<I>& f, const Image<I>& g, const Neighborhood<N>& nbh); + I + Rd(const Image<I>& f, const Image<I>& g, const Neighborhood<N>& nbh); # ifndef MLN_INCLUDE_ONLY @@ -134,7 +131,7 @@ mln_niter(N) n(nbh, p); for_all(n) { - if (f.has(n)) + if (f.domain().has(n)) assert(is_proc(n) == is_proc__(n, p)); if (f.has(n) && is_proc(n)) do_union(n, p); @@ -153,7 +150,6 @@ else o(p) = o(parent(p)); } - is_proc(p) = true; } } @@ -161,8 +157,7 @@ inline bool is_proc__(const point& n, const point& p) const { - util::greater_point<I> greater_than(g); - return g(n) > g(p) || (g(n) == g(p) && greater_than(p,n)); + return g(n) > g(p) || (g(n) == g(p) && util::ord_strict(point(n), p)); } inline @@ -212,7 +207,8 @@ template <typename I, typename N> inline - I Rd(const Image<I>& f, const Image<I>& g, const Neighborhood<N>& nbh) + I + Rd(const Image<I>& f, const Image<I>& g, const Neighborhood<N>& nbh) { assert(f <= g); impl::Rd<I,N> run(exact(f), exact(g), exact(nbh)); Index: tests/morpho/Rd.cc --- tests/morpho/Rd.cc (revision 3739) +++ tests/morpho/Rd.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2009 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,75 +27,22 @@ // Public License. /// \file tests/morpho/combined.cc -/// \brief Test on several mln::morpho entities. - -#include <cmath> +/// +/// Test on mln::morpho::Rd. #include <mln/core/image/image2d.hh> -#include <mln/data/fill.hh> -#include <mln/debug/println.hh> - -#include <mln/core/alias/window2d.hh> -#include <mln/win/rectangle2d.hh> - #include <mln/core/alias/neighb2d.hh> - -#include <mln/morpho/erosion.hh> -#include <mln/morpho/Rd.hh> - #include <mln/value/int_u8.hh> +#include <mln/morpho/Rd.hh> -// static value::int_u8 cos_sin(const mln::point2d& p) -// { -// return (value::int_u8)(255 * std::cos(float(p.row())) * std::sin(float(p.col()))); -// } int main() { using namespace mln; - const unsigned size = 1000; + const unsigned size = 100; image2d<value::int_u8> f(size, size); morpho::Rd(f, f, c8()); } - - - -// box2d b = make::box2d(/* row = */ 1, 3, -// /* col = */ 4, 6); -// std::cout << b << std::endl; - -// bool w[] = -// { 0, 1, 0, -// 0, 1, 0, -// 1, 0, 0 }; -// window2d win = convert::to<window2d>(w); -// std::cout << win << std::endl; -// std::cout << c8() << std::endl; - -// { -// image2d<int> ima(b); -// data::fill(ima, 51); -// debug::println(ima); - -// std::cout << win << std::endl; - -// morpho::erosion(ima, win); - -// rectangle2d rec(1, 2); -// std::cout << rec << std::endl; -// } - - -// { -// image2d<int> ima(b); -// data::fill(ima, cos_sin); -// debug::println(ima); - -// std::cout << std::endl; - -// image2d<int> ima2 = morpho::erosion(ima, win); -// debug::println(ima2); -// } Property changes on: tests/morpho/Rd.cc ___________________________________________________________________ Added: svn:mergeinfo Index: tests/morpho/Makefile.am --- tests/morpho/Makefile.am (revision 3744) +++ tests/morpho/Makefile.am (working copy) @@ -13,7 +13,6 @@ check_PROGRAMS = \ artificial_line_graph_image_wst \ - combined \ complex_image_morpho \ complex_image_wst \ contrast \ @@ -32,6 +31,7 @@ meyer_wst \ meyer_wst_long \ rank_filter \ + Rd \ skeleton_constrained \ thinning \ top_hat @@ -61,7 +61,7 @@ rank_filter_SOURCES = rank_filter.cc skeleton_constrained_SOURCES = skeleton_constrained.cc top_hat_SOURCES = top_hat.cc -combined_SOURCES = combined.cc +Rd_SOURCES = Rd.cc # --------------- #