URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-15 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update tests/level.
* tests/level/fill.cc: Update.
* tests/level/take.cc: New simple test for level:take.
* tests/level/approx_median.cc: Rename this file into ...
* tests/level/approx/median.cc: ... this.
---
approx/median.cc | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
fill.cc | 28 +++++++++++++++---------
take.cc | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 136 insertions(+), 11 deletions(-)
Index: trunk/milena/tests/level/approx_median.cc (deleted)
===================================================================
Index: trunk/milena/tests/level/take.cc
===================================================================
--- trunk/milena/tests/level/take.cc (revision 0)
+++ trunk/milena/tests/level/take.cc (revision 1488)
@@ -0,0 +1,57 @@
+// 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/level/take.cc
+ *
+ * \brief Tests on mln::level::take.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/level/take.hh>
+#include <mln/level/compare.hh>
+#include <mln/debug/iota.hh>
+#include <mln/accu/min.hh>
+#include <mln/accu/max.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 200;
+ image2d<int> ima(size, size);
+ accu::min_<int> acu_min;
+ accu::max_<int> acu_max;
+
+ debug::iota(ima);
+ level::take(ima, acu_min);
+ level::take(ima, acu_max);
+
+ mln_assertion(acu_min.to_result() == 1);
+ mln_assertion(acu_max.to_result() == 40000);
+
+}
Index: trunk/milena/tests/level/approx/median.cc
===================================================================
--- trunk/milena/tests/level/approx/median.cc (revision 0)
+++ trunk/milena/tests/level/approx/median.cc (revision 1488)
@@ -0,0 +1,62 @@
+// 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/level/approx/median.cc
+ *
+ * \brief Test on mln::level::approx::median.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+#include <mln/win/octagon2d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/level/approx/median.hh>
+
+
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ win::rectangle2d rect(51, 51);
+ win::octagon2d oct(13);
+ border::thickness = 52;
+
+ image2d<int_u8>
+ lena = io::pgm::load("../../../img/lena.pgm"),
+ out(lena.domain());
+
+// level::approx::median(lena, rect, out);
+ level::approx::median(lena, oct, out);
+ io::pgm::save(out, "out.pgm");
+}
Index: trunk/milena/tests/level/fill.cc
===================================================================
--- trunk/milena/tests/level/fill.cc (revision 1487)
+++ trunk/milena/tests/level/fill.cc (revision 1488)
@@ -47,21 +47,27 @@
unsigned char uc = u;
mln_assertion(uc == 44);
-// {
-// const unsigned size = 3;
-// image2d<unsigned> ima(size, size);
-// level::fill(ima, u);
-// debug::println(ima);
-// }
-
{
- const unsigned size = 10000;
- image2d<unsigned char> ima(size, size);
- for (unsigned i = 0; i < 5; ++i)
- level::fill(ima, uc);
+ const unsigned size = 3;
+ image2d<unsigned> ima(size, size);
+ level::fill(ima, u);
+ box_fwd_piter_<point2d> p(ima.domain());
+ for_all (p)
+ mln_assertion (ima(p) == u);
+
}
// {
+// const unsigned size = 10000;
+// image2d<unsigned char> ima(size, size);
+// for (unsigned i = 0; i < 5; ++i)
+// level::fill(ima, uc);
+// box_fwd_piter_<point2d> p(ima.domain());
+// for_all (p)
+// mln_assertion (ima(p) == uc);
+// }
+
+// {
// // do *not* compile so that's great since ima is not mutable
// sub_image< const image2d<int>, box2d > ima;
// level::fill(ima, 0);