
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-11-29 Simon Nivault <simon.nivault@lrde.epita.fr> . * tests/p_runs.cc: Renama as... * tests/core/p_runs.cc: ...this * tests/core/Makefile.am: Add test. * tests/fun/x2x/rotation.cc, * tests/level/median.cc, * tests/level/median_dir.cc, * tests/level/median_fast.cc, * tests/level/median_hline2d.cc: Fix load call. --- core/Makefile.am | 2 + core/p_runs.cc | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ fun/x2x/rotation.cc | 3 + level/median.cc | 6 +-- level/median_dir.cc | 6 +-- level/median_fast.cc | 6 +-- level/median_hline2d.cc | 3 + 7 files changed, 106 insertions(+), 11 deletions(-) Index: trunk/milena/tests/p_runs.cc (deleted) =================================================================== Index: trunk/milena/tests/level/median_dir.cc =================================================================== --- trunk/milena/tests/level/median_dir.cc (revision 1573) +++ trunk/milena/tests/level/median_dir.cc (revision 1574) @@ -46,9 +46,9 @@ border::thickness = 7; - image2d<int_u8> - lena = io::pgm::load("../../img/lena.pgm"), - out(lena.domain()); + image2d<int_u8> lena; + io::pgm::load(lena, "../../img/lena.pgm"); + image2d<int_u8> out(lena.domain()); level::median_dir(lena, 1, 15, out); io::pgm::save(out, "out.pgm"); Index: trunk/milena/tests/level/median.cc =================================================================== --- trunk/milena/tests/level/median.cc (revision 1573) +++ trunk/milena/tests/level/median.cc (revision 1574) @@ -50,9 +50,9 @@ win::rectangle2d rect(5, 5); border::thickness = 6; - image2d<int_u8> - lena = io::pgm::load("../../img/lena.pgm"), - out(lena.domain()); + image2d<int_u8> lena; + io::pgm::load(lena, "../../img/lena.pgm"); + image2d<int_u8> out(lena.domain()); level::median(lena, rect, out); io::pgm::save(out, "out.pgm"); Index: trunk/milena/tests/level/median_hline2d.cc =================================================================== --- trunk/milena/tests/level/median_hline2d.cc (revision 1573) +++ trunk/milena/tests/level/median_hline2d.cc (revision 1574) @@ -50,8 +50,9 @@ border::thickness = 0; + image2d<int_u8> lena; + io::pgm::load(lena, "../../img/lena.pgm"); image2d<int_u8> - lena = io::pgm::load("../../img/lena.pgm"), out(lena.domain()), ref(lena.domain()); Index: trunk/milena/tests/level/median_fast.cc =================================================================== --- trunk/milena/tests/level/median_fast.cc (revision 1573) +++ trunk/milena/tests/level/median_fast.cc (revision 1574) @@ -93,9 +93,9 @@ win::rectangle2d rect(51, 51); border::thickness = 52; - image2d<int_u8> - lena = io::pgm::load("../../img/lena.pgm"), - out(lena.domain()); + image2d<int_u8> lena; + io::pgm::load(lena, "../../img/lena.pgm"); + image2d<int_u8> out(lena.domain()); level::fast_median(lena, rect, out); io::pgm::save(out, "out.pgm"); Index: trunk/milena/tests/fun/x2x/rotation.cc =================================================================== --- trunk/milena/tests/fun/x2x/rotation.cc (revision 1573) +++ trunk/milena/tests/fun/x2x/rotation.cc (revision 1574) @@ -45,7 +45,8 @@ using namespace mln; using value::int_u8; - image2d<int_u8> lena = io::pgm::load("../../../img/lena.pgm"); + image2d<int_u8> lena; + io::pgm::load(lena, "../../../img/lena.pgm"); image2d<int_u8> out(lena.domain()); interpolated<image2d<int_u8> > inter(lena); Index: trunk/milena/tests/core/Makefile.am =================================================================== --- trunk/milena/tests/core/Makefile.am (revision 1573) +++ trunk/milena/tests/core/Makefile.am (revision 1574) @@ -7,12 +7,14 @@ clone \ exact \ initialize \ + p_runs \ t_image category_SOURCES = category.cc clone_SOURCES = clone.cc exact_SOURCES = exact.cc initialize_SOURCES = initialize.cc +p_runs_SOURCES = p_runs.cc t_image_SOURCES = t_image.cc TESTS = $(check_PROGRAMS) Index: trunk/milena/tests/core/p_runs.cc =================================================================== --- trunk/milena/tests/core/p_runs.cc (revision 0) +++ trunk/milena/tests/core/p_runs.cc (revision 1574) @@ -0,0 +1,91 @@ +// 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. + +/*! \file tests/core/p_runs.cc + * + * \brief Test on mln::p_runs_ and related tools. + */ + +#include <mln/core/image2d.hh> +#include <mln/core/p_runs.hh> + + +template <typename Pset> +void parc(const Pset& pset) +{ + mln_fwd_piter(Pset) it_(pset); + for_all(it_) + std::cout << it_ << std::endl; + + mln_bkd_piter(Pset) rit_(pset); + for_all(rit_) + std::cout << rit_ << std::endl; +} + + +int main() +{ + using namespace mln; + + point2d p, q, r; + p = make::point2d(2, 4); + q = make::point2d(18, 42); + r = make::point2d(50, 76); + + // Psite declaration + runs_psite<point2d> site(p, 5, 0); + runs_psite<point2d> site2(r, 40, 0); + + // Pset test + p_runs_<point2d> ps; + + ps.insert(p_run<point2d>(p, 7)); + mln_assertion(ps.npoints() == 7); + + ps.insert(p_run<point2d>(q, 5)); + mln_assertion(ps.npoints() == 12); + + mln_assertion(ps.has(site)); + mln_assertion(!ps.has(site2)); + + ps.insert(p_run<point2d>(r, 2)); + mln_assertion(!ps.has(site2)); + + ps.insert(p_run<point2d>(make::point2d(17,40), 6)); + mln_fwd_piter_(p_runs_<point2d>) ppf(ps); + for_all(ppf) + { + std::cout << ppf << std::endl; + } + std::cout << std::endl; + mln_bkd_piter_(p_runs_<point2d>) ppb(ps); + for_all(ppb) + { + std::cout << ppb << std::endl; + } + // parc(ps); +}
participants (1)
-
nivaul_s@lrde.epita.fr