URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-16 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add simple tests for level.
* tests/level/compare.cc,
* tests/level/compute.cc,
* tests/level/saturate.cc,
* tests/level/sort_points.cc,
* tests/level/stretch.cc: New test for level.
* tests/level/median.cc,
* tests/level/paste.cc,
* tests/level/transform.cc: Upadate test.
---
compare.cc | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
compute.cc | 53 ++++++++++++++++++++++++++++++
median.cc | 2 -
paste.cc | 6 ---
saturate.cc | 57 +++++++++++++++++++++++++++++++++
sort_points.cc | 61 +++++++++++++++++++++++++++++++++++
stretch.cc | 65 +++++++++++++++++++++++++++++++++++++
transform.cc | 12 +++++-
8 files changed, 345 insertions(+), 9 deletions(-)
Index: trunk/milena/tests/level/median.cc
===================================================================
--- trunk/milena/tests/level/median.cc (revision 1490)
+++ trunk/milena/tests/level/median.cc (revision 1491)
@@ -51,7 +51,7 @@
border::thickness = 52;
image2d<int_u8>
- lena = io::pgm::load("../img/lena.pgm"),
+ lena = io::pgm::load("../../img/lena.pgm"),
out(lena.domain());
level::median(lena, rect, out);
Index: trunk/milena/tests/level/transform.cc
===================================================================
--- trunk/milena/tests/level/transform.cc (revision 1490)
+++ trunk/milena/tests/level/transform.cc (revision 1491)
@@ -52,15 +52,23 @@
{
using namespace mln;
- const unsigned size = 10000;
+ const unsigned size = 1000;
image2d<unsigned short>
ima(size, size);
+ image2d<unsigned short>
+ out(size, size);
(std::cout << "iota... ").flush();
debug::iota(ima);
std::cout << "done" << std::endl;
(std::cout << "transform... ").flush();
- level::transform(ima, mysqrt(), ima);
+ level::transform(ima, mysqrt(), out);
+ std::cout << "done" << std::endl;
+
+ (std::cout << "checking... ").flush();
+ box_fwd_piter_<point2d> p(out.domain());
+ for_all(p)
+ mln_assertion((unsigned short)std::sqrt(ima(p)) == out(p));
std::cout << "done" << std::endl;
}
Index: trunk/milena/tests/level/stretch.cc
===================================================================
--- trunk/milena/tests/level/stretch.cc (revision 0)
+++ trunk/milena/tests/level/stretch.cc (revision 1491)
@@ -0,0 +1,65 @@
+// 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/stretch.cc
+ *
+ * \brief Tests on mln::level::stretch.
+ */
+
+
+#include <mln/core/image2d.hh>
+#include <mln/level/stretch.hh>
+#include <mln/debug/iota.hh>
+#include <mln/value/int_u8.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ int vs[3][3] = {
+ { 1000, 2000, 3000 },
+ { 1000, 2000, 3000 },
+ { 1000, 2000, 3000 }
+ };
+ image2d<int> ima(make::image2d(vs));
+
+ image2d<int_u8> out(3, 3);
+
+ int_u8 ws[3][3] = {
+ { 0, 127, 255 },
+ { 0, 127, 255 },
+ { 0, 127, 255 }
+ };
+
+ image2d<int_u8> ref(make::image2d(ws));
+ level::stretch(ima, out);
+ box_fwd_piter_<point2d> p(out.domain());
+ for_all(p)
+ mln_assertion(out(p) == ref(p));
+}
Index: trunk/milena/tests/level/compute.cc
===================================================================
--- trunk/milena/tests/level/compute.cc (revision 0)
+++ trunk/milena/tests/level/compute.cc (revision 1491)
@@ -0,0 +1,53 @@
+// 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/compute.cc
+ *
+ * \brief Tests on mln::level::compute.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/level/compute.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);
+ int min = level::compute(ima, acu_min);
+ int max = level::compute(ima, acu_max);
+ mln_assertion(min == 1);
+ mln_assertion(max == 40000);
+}
Index: trunk/milena/tests/level/paste.cc
===================================================================
--- trunk/milena/tests/level/paste.cc (revision 1490)
+++ trunk/milena/tests/level/paste.cc (revision 1491)
@@ -45,18 +45,12 @@
box2d b(make::point2d(1,2), make::point2d(2,4));
image2d<int> ima(b, 2);
debug::iota(ima);
- debug::println(ima);
-
box2d b2(make::point2d(-1,-2), make::point2d(3,6));
image2d<int> ima2(b2, 0);
debug::iota(ima2);
- debug::println(ima2);
-
- trace::quiet = false;
level::paste(ima, ima2); // Fast version.
- debug::println(ima2);
level::impl::generic::paste_(ima, ima2); // Not so fast version...
}
Index: trunk/milena/tests/level/sort_points.cc
===================================================================
--- trunk/milena/tests/level/sort_points.cc (revision 0)
+++ trunk/milena/tests/level/sort_points.cc (revision 1491)
@@ -0,0 +1,61 @@
+// 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/sort_points.cc
+ *
+ * \brief Tests on mln::level::sort_points.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/debug/iota.hh>
+#include <mln/level/sort_points.hh>
+#include <mln/core/p_array.hh>
+
+
+int main ()
+{
+ using namespace mln;
+
+ image2d<int> ima(3, 3);
+ debug::iota (ima);
+ p_array<point2d> array_inc = level::sort_points_increasing(ima);
+ p_array<point2d> array_dec = level::sort_points_decreasing(ima);
+
+ p_array<point2d> array_inc_ref;
+ p_array<point2d> array_dec_ref;
+
+ for (int i = 0; i < 3; ++i)
+ for (int j = 0; j < 3; ++j)
+ array_inc_ref.append(point2d(i, j));
+
+ for (int i = 2; i >= 0; --i)
+ for (int j = 2; j >= 0; --j)
+ array_dec_ref.append(point2d(i, j));
+
+ mln_assertion(array_inc == array_inc_ref);
+ mln_assertion(array_dec == array_dec_ref);
+}
Index: trunk/milena/tests/level/compare.cc
===================================================================
--- trunk/milena/tests/level/compare.cc (revision 0)
+++ trunk/milena/tests/level/compare.cc (revision 1491)
@@ -0,0 +1,98 @@
+// 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/compare.cc
+ *
+ * \brief Tests on mln::level::compare.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/level/compare.hh>
+#include <mln/debug/iota.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 3;
+ image2d<int> rhs(size, size), lhs(rhs.domain());
+ debug::iota(rhs);
+ debug::iota(lhs);
+ mln_assertion( (lhs == rhs));
+ mln_assertion( (lhs <= rhs));
+ mln_assertion(! (lhs < rhs));
+ mln_assertion( (lhs >= rhs));
+ mln_assertion(! (lhs > rhs));
+
+ int vs[3][3] = {
+
+ { 2, 3, 4 },
+ { 5, 6, 7 },
+ { 8, 9, 10 },
+
+ };
+
+ rhs = make::image2d(vs);
+
+ mln_assertion(! (lhs == rhs));
+ mln_assertion( (lhs <= rhs));
+ mln_assertion( (lhs < rhs));
+ mln_assertion(! (lhs >= rhs));
+ mln_assertion(! (lhs > rhs));
+
+ mln_assertion(! (rhs == lhs));
+ mln_assertion(! (rhs <= lhs));
+ mln_assertion(! (rhs < lhs));
+ mln_assertion( (rhs >= lhs));
+ mln_assertion( (rhs > lhs));
+
+
+ int ws[3][3] = {
+
+ { 1, 3, 4 },
+ { 4, 6, 7 },
+ { 7, 9, 10 },
+
+ };
+
+ rhs = make::image2d(ws);
+
+ mln_assertion(! (lhs == rhs));
+ mln_assertion( (lhs <= rhs));
+ mln_assertion(! (lhs < rhs));
+ mln_assertion(! (lhs >= rhs));
+ mln_assertion(! (lhs > rhs));
+
+ mln_assertion(! (rhs == lhs));
+ mln_assertion(! (rhs <= lhs));
+ mln_assertion(! (rhs < lhs));
+ mln_assertion( (rhs >= lhs));
+ mln_assertion(! (rhs > lhs));
+
+
+}
Index: trunk/milena/tests/level/saturate.cc
===================================================================
--- trunk/milena/tests/level/saturate.cc (revision 0)
+++ trunk/milena/tests/level/saturate.cc (revision 1491)
@@ -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/saturate.cc
+ *
+ * \brief Tests on mln::level::saturate.
+ */
+
+
+#include <mln/core/image2d.hh>
+#include <mln/level/saturate.hh>
+#include <mln/debug/iota.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 1000;
+ image2d<int> ima(3, 3);
+ int vs[3][3] = {
+ { 2, 2, 3 },
+ { 4, 5, 6 },
+ { 6, 6, 6 }
+ };
+
+ image2d<int> ref(make::image2d(vs));
+ debug::iota(ima);
+ level::saturate_inplace(ima, 2, 6);
+ box_fwd_piter_<point2d> p(ima.domain());
+ for_all(p)
+ mln_assertion(ima(p) == ref(p));
+}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-16 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Review the mln/geom directory.
* mln/geom/seeds2tiling.hh: Clean dead code, update doc. Fixme for
guillaume : Review the documentation.
* mln/geom/seeds2tiling_with_chamfer.hh: likewise.
Add unit tests.
* tests/geom/bbox.cc: New.
* tests/geom/max_col.cc: New.
* tests/geom/max_ind.cc: New.
* tests/geom/max_row.cc: New.
* tests/geom/max_sli.cc: New.
* tests/geom/min_col.cc: New.
* tests/geom/min_ind.cc: New.
* tests/geom/min_row.cc: New.
* tests/geom/min_sli.cc: New.
* tests/geom/ncols.cc: New.
* tests/geom/ninds.cc: New.
* tests/geom/nrows.cc: New.
* tests/geom/nslis.cc: New.
* tests/geom/pmin_pmax.cc: New.
* tests/geom/shift.cc: New.
* tests/geom/sym.cc: New.
* tests/geom: New.
---
mln/geom/seeds2tiling.hh | 23 +-------------
mln/geom/seeds2tiling_with_chamfer.hh | 2 -
tests/geom/bbox.cc | 45 ++++++++++++++++++++++++++++
tests/geom/max_col.cc | 39 ++++++++++++++++++++++++
tests/geom/max_ind.cc | 39 ++++++++++++++++++++++++
tests/geom/max_row.cc | 39 ++++++++++++++++++++++++
tests/geom/max_sli.cc | 39 ++++++++++++++++++++++++
tests/geom/min_col.cc | 39 ++++++++++++++++++++++++
tests/geom/min_ind.cc | 39 ++++++++++++++++++++++++
tests/geom/min_row.cc | 39 ++++++++++++++++++++++++
tests/geom/min_sli.cc | 39 ++++++++++++++++++++++++
tests/geom/ncols.cc | 39 ++++++++++++++++++++++++
tests/geom/ninds.cc | 39 ++++++++++++++++++++++++
tests/geom/nrows.cc | 39 ++++++++++++++++++++++++
tests/geom/nslis.cc | 39 ++++++++++++++++++++++++
tests/geom/pmin_pmax.cc | 50 +++++++++++++++++++++++++++++++
tests/geom/shift.cc | 54 ++++++++++++++++++++++++++++++++++
tests/geom/sym.cc | 54 ++++++++++++++++++++++++++++++++++
18 files changed, 674 insertions(+), 22 deletions(-)
Index: trunk/milena/tests/geom/max_sli.cc
===================================================================
--- trunk/milena/tests/geom/max_sli.cc (revision 0)
+++ trunk/milena/tests/geom/max_sli.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image3d.hh>
+
+#include <mln/geom/max_sli.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image3d<int> ima(3,4,5);
+
+ mln_assertion(geom::max_sli(ima) == 2);
+}
Index: trunk/milena/tests/geom/nrows.cc
===================================================================
--- trunk/milena/tests/geom/nrows.cc (revision 0)
+++ trunk/milena/tests/geom/nrows.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image2d.hh>
+
+#include <mln/geom/nrows.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(make::box2d(-1,-4,2,6));
+
+ mln_assertion(geom::nrows(ima) == 4);
+}
Index: trunk/milena/tests/geom/sym.cc
===================================================================
--- trunk/milena/tests/geom/sym.cc (revision 0)
+++ trunk/milena/tests/geom/sym.cc (revision 1490)
@@ -0,0 +1,54 @@
+// 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.
+
+#include <mln/core/window2d.hh>
+#include <mln/core/dpoint2d.hh>
+
+#include <mln/geom/sym.hh>
+
+int main()
+{
+ using namespace mln;
+
+ dpoint2d dp(2, 2);
+
+ window2d win, win2;
+
+ win.insert(make::dpoint2d(0,0));
+ win.insert(make::dpoint2d(1,2));
+ win.insert(make::dpoint2d(3,4));
+ win.insert(make::dpoint2d(5,6));
+ win.insert(make::dpoint2d(7,8));
+
+ win2.insert(make::dpoint2d(0,0));
+ win2.insert(make::dpoint2d(-1,-2));
+ win2.insert(make::dpoint2d(-3,-4));
+ win2.insert(make::dpoint2d(-5,-6));
+ win2.insert(make::dpoint2d(-7,-8));
+
+ mln_assertion(geom::sym(win) == win2);
+}
Index: trunk/milena/tests/geom/min_row.cc
===================================================================
--- trunk/milena/tests/geom/min_row.cc (revision 0)
+++ trunk/milena/tests/geom/min_row.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image2d.hh>
+
+#include <mln/geom/min_row.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(make::box2d(-1,-4,2,6));
+
+ mln_assertion(geom::min_row(ima) == -1);
+}
Index: trunk/milena/tests/geom/ninds.cc
===================================================================
--- trunk/milena/tests/geom/ninds.cc (revision 0)
+++ trunk/milena/tests/geom/ninds.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image1d.hh>
+
+#include <mln/geom/ninds.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image1d<int> ima(make::box1d(-1,8));
+
+ mln_assertion(geom::ninds(ima) == 10);
+}
Index: trunk/milena/tests/geom/max_row.cc
===================================================================
--- trunk/milena/tests/geom/max_row.cc (revision 0)
+++ trunk/milena/tests/geom/max_row.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image2d.hh>
+
+#include <mln/geom/max_row.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(make::box2d(-1,-4,2,6));
+
+ mln_assertion(geom::max_row(ima) == 2);
+}
Index: trunk/milena/tests/geom/shift.cc
===================================================================
--- trunk/milena/tests/geom/shift.cc (revision 0)
+++ trunk/milena/tests/geom/shift.cc (revision 1490)
@@ -0,0 +1,54 @@
+// 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.
+
+#include <mln/core/window2d.hh>
+#include <mln/core/dpoint2d.hh>
+
+#include <mln/geom/shift.hh>
+
+int main()
+{
+ using namespace mln;
+
+ dpoint2d dp(2, 2);
+
+ window2d win, win2;
+
+ win.insert(make::dpoint2d(0,0));
+ win.insert(make::dpoint2d(1,2));
+ win.insert(make::dpoint2d(3,4));
+ win.insert(make::dpoint2d(5,6));
+ win.insert(make::dpoint2d(7,8));
+
+ win2.insert(make::dpoint2d(2,2));
+ win2.insert(make::dpoint2d(3,4));
+ win2.insert(make::dpoint2d(5,6));
+ win2.insert(make::dpoint2d(7,8));
+ win2.insert(make::dpoint2d(9,10));
+
+ mln_assertion(geom::shift(win, dp) == win2);
+}
Index: trunk/milena/tests/geom/min_ind.cc
===================================================================
--- trunk/milena/tests/geom/min_ind.cc (revision 0)
+++ trunk/milena/tests/geom/min_ind.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image1d.hh>
+
+#include <mln/geom/min_ind.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image1d<int> ima(make::box1d(-1,8));
+
+ mln_assertion(geom::min_ind(ima) == -1);
+}
Index: trunk/milena/tests/geom/ncols.cc
===================================================================
--- trunk/milena/tests/geom/ncols.cc (revision 0)
+++ trunk/milena/tests/geom/ncols.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image2d.hh>
+
+#include <mln/geom/ncols.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(make::box2d(-1,-4,2,6));
+
+ mln_assertion(geom::ncols(ima) == 11);
+}
Index: trunk/milena/tests/geom/max_ind.cc
===================================================================
--- trunk/milena/tests/geom/max_ind.cc (revision 0)
+++ trunk/milena/tests/geom/max_ind.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image1d.hh>
+
+#include <mln/geom/max_ind.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image1d<int> ima(make::box1d(-1,8));
+
+ mln_assertion(geom::max_ind(ima) == 8);
+}
Index: trunk/milena/tests/geom/min_col.cc
===================================================================
--- trunk/milena/tests/geom/min_col.cc (revision 0)
+++ trunk/milena/tests/geom/min_col.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image2d.hh>
+
+#include <mln/geom/min_col.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(make::box2d(-1,-4,2,6));
+
+ mln_assertion(geom::min_col(ima) == -4);
+}
Index: trunk/milena/tests/geom/max_col.cc
===================================================================
--- trunk/milena/tests/geom/max_col.cc (revision 0)
+++ trunk/milena/tests/geom/max_col.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image2d.hh>
+
+#include <mln/geom/max_col.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(make::box2d(-1,-4,2,6));
+
+ mln_assertion(geom::max_col(ima) == 6);
+}
Index: trunk/milena/tests/geom/pmin_pmax.cc
===================================================================
--- trunk/milena/tests/geom/pmin_pmax.cc (revision 0)
+++ trunk/milena/tests/geom/pmin_pmax.cc (revision 1490)
@@ -0,0 +1,50 @@
+// 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.
+
+#include <mln/core/point2d.hh>
+#include <mln/core/p_set.hh>
+
+#include <mln/geom/pmin_pmax.hh>
+
+int main()
+{
+ using namespace mln;
+
+ p_set<point2d> p;
+ point2d min, max;
+
+ p.insert(make::point2d(0,0));
+ p.insert(make::point2d(-1,2));
+ p.insert(make::point2d(-3,4));
+ p.insert(make::point2d(7,6));
+ p.insert(make::point2d(5,8));
+
+ geom::pmin_pmax(p, min, max);
+
+ mln_assertion(min == (make::point2d(-3 ,0)));
+ mln_assertion(max == (make::point2d( 7 ,8)));
+}
Index: trunk/milena/tests/geom/nslis.cc
===================================================================
--- trunk/milena/tests/geom/nslis.cc (revision 0)
+++ trunk/milena/tests/geom/nslis.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image3d.hh>
+
+#include <mln/geom/nslis.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image3d<int> ima(3,4,5);
+
+ mln_assertion(geom::nslis(ima) == 3);
+}
Index: trunk/milena/tests/geom/bbox.cc
===================================================================
--- trunk/milena/tests/geom/bbox.cc (revision 0)
+++ trunk/milena/tests/geom/bbox.cc (revision 1490)
@@ -0,0 +1,45 @@
+// 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.
+
+#include <mln/core/p_set.hh>
+#include <mln/core/point2d.hh>
+#include <mln/core/box2d.hh>
+
+#include <mln/geom/bbox.hh>
+
+int main()
+{
+ using namespace mln;
+ p_set<point2d> s;
+
+ s.insert(make::point2d(0,0));
+ s.insert(make::point2d(0,5));
+ s.insert(make::point2d(5,0));
+ s.insert(make::point2d(5,5));
+
+ mln_assertion(geom::bbox(s) == make::box2d(0,0,5,5));
+}
Index: trunk/milena/tests/geom/min_sli.cc
===================================================================
--- trunk/milena/tests/geom/min_sli.cc (revision 0)
+++ trunk/milena/tests/geom/min_sli.cc (revision 1490)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <mln/core/image3d.hh>
+
+#include <mln/geom/min_sli.hh>
+
+int main()
+{
+ using namespace mln;
+
+ image3d<int> ima(3,4,5);
+
+ mln_assertion(geom::min_sli(ima) == 0);
+}
Index: trunk/milena/mln/geom/seeds2tiling.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling.hh (revision 1489)
+++ trunk/milena/mln/geom/seeds2tiling.hh (revision 1490)
@@ -30,8 +30,7 @@
/*! \file mln/geom/seeds2tiling.hh
*
- * \brief Definition of a function which takes a labeled image and
- * returns an image which has blew up its labeled values.
+ * \brief Convert a binary image with seeds into a labeled image.
*/
# include <map>
@@ -76,25 +75,7 @@
}
}
-// // Body.
-// {
-// while (! q.is_empty())
-// {
-// mln_psite(I) p = q.front();
-// q.pop();
-// mln_invariant(ima(p) == 0);
-
-// mln_niter(N) n(nbh, p);
-// for_all(n) if (ima.has(n))
-// if (out(n) != 0)
-// out(p) = out(n);
-// else
-// if (! q.has(n))
-// q.push(n);
-// }
-// }
-
- // Body: alternative version.
+ // Body.
{
while (! q.is_empty())
{
Index: trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh (revision 1489)
+++ trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh (revision 1490)
@@ -30,7 +30,7 @@
/*! \file mln/geom/seeds2tiling_with_chamfer.hh
*
- * \brief FIXME.
+ * \brief seeds2tiling with chamfer method.
*/
# include <map>
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-15 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update level and add specialization for algorithm.
* mln/level/assign.hh,
* mln/level/fill.hh,
* mln/level/take.hh,
* mln/level/apply.hh: Remove specialization stuff and add
generic namespace.
Specialization files
* mln/level/assign.spe.hh,
* mln/level/fill.spe.hh,
* mln/level/take.spe.hh,
* mln/level/apply.spe.hh: New file for specialization.
Update
* mln/level/abs.hh,
* mln/level/all.hh,
* mln/level/compare.hh,
* mln/level/sort_points.hh: Update.
---
abs.hh | 4 ++
all.hh | 1
apply.hh | 24 +++++++++-----
apply.spe.hh | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
assign.hh | 32 ++++++++++++-------
assign.spe.hh | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fill.hh | 38 ++++++++++++++++++-----
fill.spe.hh | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
take.hh | 24 +++++++++-----
take.spe.hh | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++
10 files changed, 440 insertions(+), 39 deletions(-)
Index: trunk/milena/mln/level/sort_points.hh
===================================================================
Index: trunk/milena/mln/level/take.hh
===================================================================
--- trunk/milena/mln/level/take.hh (revision 1488)
+++ trunk/milena/mln/level/take.hh (revision 1489)
@@ -36,6 +36,8 @@
# include <mln/core/concept/accumulator.hh>
# include <mln/core/concept/image.hh>
+// Specializations are in:
+# include <mln/level/take.spe.hh>
namespace mln
{
@@ -62,22 +64,22 @@
namespace impl
{
+ namespace generic
+ {
template <typename A, typename I>
- void take(trait::image::speed::any, const I& input, A& a)
+ void take_(const I& input, A& a)
{
+ trace::entering("level::impl::generic::take");
+
mln_piter(I) p(input.domain());
for_all(p)
a.take(input(p));
- }
- template <typename A, typename I>
- void take(trait::image::speed::fastest, const I& input, A& a)
- {
- mln_pixter(const I) pxl(input);
- for_all(pxl)
- a.take(pxl.val());
+ trace::exiting("level::impl::generic::take");
}
+ } // end of namespace mln::level::impl::generic
+
} // end of namespace mln::level::impl
@@ -86,9 +88,13 @@
template <typename A, typename I>
void take(const Image<I>& input, Accumulator<A>& a)
{
+ trace::entering("level::take");
+
mln_precondition(exact(input).has_data());
- impl::take(mln_trait_image_speed(I)(), exact(input),
+ impl::take_(mln_trait_image_speed(I)(), exact(input),
exact(a));
+
+ trace::exiting("level::take");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/assign.hh
===================================================================
--- trunk/milena/mln/level/assign.hh (revision 1488)
+++ trunk/milena/mln/level/assign.hh (revision 1489)
@@ -38,6 +38,11 @@
# include <mln/core/concept/image.hh>
+// Specializations are in:
+# include <mln/level/assign.spe.hh>
+
+
+
namespace mln
{
@@ -64,34 +69,37 @@
namespace impl
{
+ namespace generic
+ {
template <typename L, typename R>
- void assign(trait::image::speed::any, L& target,
- trait::image::speed::any, const R& data)
+ void assign_(L& target, const R& data)
{
+ trace::entering("level::impl::generic::assign_");
+
mln_piter(L) p(target.domain());
for_all(p)
target(p) = data(p);
- }
- template <typename L, typename R>
- void assign(trait::image::speed::fastest, L& target,
- trait::image::speed::fastest, const R& data)
- {
- mln_pixter(L) lhs(target);
- mln_pixter(const R) rhs(data);
- for_all_2(lhs, rhs)
- lhs.val() = rhs.val();
+ trace::exiting("level::impl::generic::assign_");
}
+ } // end of namespace mln::level::impl::generic
+
} // end of namespace mln::level::impl
+ // Facade.
+
template <typename L, typename R>
void assign(Image<L>& target, const Image<R>& data)
{
+ trace::entering("level::assign");
+
mln_precondition(exact(data).domain() == exact(target).domain());
- impl::assign(mln_trait_image_speed(L)(), exact(target),
+ impl::assign_(mln_trait_image_speed(L)(), exact(target),
mln_trait_image_speed(R)(), exact(data));
+
+ trace::exiting("level::assign");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/apply.hh
===================================================================
--- trunk/milena/mln/level/apply.hh (revision 1488)
+++ trunk/milena/mln/level/apply.hh (revision 1489)
@@ -36,6 +36,9 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/function.hh>
+// Specializations are in:
+# include <mln/level/apply.spe.hh>
+
namespace mln
{
@@ -66,22 +69,23 @@
namespace impl
{
+ namespace generic
+ {
+
template <typename I, typename F>
- void apply_(trait::image::speed::any, I& input, const F& f)
+ void apply_(I& input, const F& f)
{
+ trace::entering("level::impl::generic::apply_");
+
mln_piter(I) p(input.domain());
for_all(p)
input(p) = f(input(p));
- }
- template <typename I, typename F>
- void apply_(trait::image::speed::fastest, I& input, const F& f)
- {
- mln_pixter(I) pxl(input);
- for_all(pxl)
- pxl.val() = f(pxl.val());
+ trace::exiting("level::impl::generic::apply_");
}
+ } // end of namespace mln::level::impl::generic
+
} // end of namespace mln::level::impl
@@ -90,9 +94,13 @@
template <typename I, typename F>
void apply(Image<I>& input, const Function_v2v<F>& f)
{
+ trace::entering("level::apply");
+
mln_precondition(exact(input).has_data());
impl::apply_(mln_trait_image_speed(I)(), exact(input),
exact(f));
+
+ trace::exiting("level::apply");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/compare.hh
===================================================================
Index: trunk/milena/mln/level/fill.hh
===================================================================
--- trunk/milena/mln/level/fill.hh (revision 1488)
+++ trunk/milena/mln/level/fill.hh (revision 1489)
@@ -43,6 +43,9 @@
# include <mln/level/memset_.hh>
+// Specializations are in:
+# include <mln/level/fill.spe.hh>
+
namespace mln
{
@@ -132,25 +135,22 @@
namespace impl
{
-
- // fill_with_value
-
+ namespace generic
+ {
template <typename I>
void fill_with_value(trait::image::speed::any, I& ima,
const mln_value(I)& value)
{
+ trace::entering("level::impl::generic::fill_with_value");
+
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = value;
- }
- template <typename I>
- void fill_with_value(trait::image::speed::fastest, I& ima,
- const mln_value(I)& value)
- {
- level::memset_(ima, ima.point_at_offset(0), value, ima.ncells());
+ trace::exiting("level::impl::generic::fill_with_value");
}
+ } // end if namespace mln::level::impl::generic
} // end of namespace mln::level::impl
@@ -161,10 +161,14 @@
template <typename I>
void fill(Image<I>& ima, const mln_value(I)& value)
{
+ trace::entering("level::fill");
+
mlc_is(mln_trait_image_io(I), trait::image::io::write)::check(); // FIXME: Only the upcoming general facade!!!
mln_precondition(exact(ima).has_data());
impl::fill_with_value(mln_trait_image_speed(I)(), exact(ima),
value);
+
+ trace::exiting("level::fill");
}
@@ -173,12 +177,16 @@
template <typename I, typename F>
void fill(Image<I>& ima_, const Function_p2v<F>& f_)
{
+ trace::entering("level::fill");
+
I& ima = exact(ima_);
mln_precondition(ima.has_data());
const F& f = exact(f_);
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = f(p);
+
+ trace::exiting("level::fill");
}
@@ -188,12 +196,16 @@
void fill_f(Image<I>& ima_,
mln_value(I) (*f)(const mln_point(I)& p))
{
+ trace::entering("level::fill_f");
+
mln_precondition(f != 0);
I& ima = exact(ima_);
mln_precondition(ima.has_data());
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = f(p);
+
+ trace::exiting("level::fill_f");
}
@@ -202,6 +214,8 @@
template <typename I, unsigned N>
void fill(Image<I>& ima_, mln_value(I) (&arr)[N])
{
+ trace::entering("level::fill");
+
I& ima = exact(ima_);
mln_precondition(ima.has_data());
mln_precondition(N == ima.npoints());
@@ -209,6 +223,8 @@
unsigned i = 0;
for_all(p)
ima(p) = arr[i++];
+
+ trace::exiting("level::fill");
}
@@ -217,6 +233,8 @@
template <typename I, typename J>
void fill(Image<I>& ima_, const Image<J>& data_)
{
+ trace::entering("level::fill");
+
I& ima = exact(ima_);
const J& data = exact(data_);
mln_precondition(ima.domain() <= data.domain());
@@ -224,6 +242,8 @@
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = data(p);
+
+ trace::exiting("level::fill");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/abs.hh
===================================================================
--- trunk/milena/mln/level/abs.hh (revision 1488)
+++ trunk/milena/mln/level/abs.hh (revision 1489)
@@ -68,15 +68,19 @@
template <typename I, typename O>
void abs(const Image<I>& input, Image<O>& output)
{
+ trace::entering("level::abs");
mln_precondition(exact(input).domain() == exact(output).domain());
level::transform(input, fun::v2v::abs<mln_value(I)>(), output);
+ trace::exiting("level::abs");
}
template <typename I>
void abs_inplace(Image<I>& input)
{
+ trace::entering("level::abs_inplace");
mln_precondition(exact(input).has_data());
level::apply(input, fun::v2v::abs<mln_value(I)>());
+ trace::exiting("level::abs_inplace");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/all.hh
===================================================================
--- trunk/milena/mln/level/all.hh (revision 1488)
+++ trunk/milena/mln/level/all.hh (revision 1489)
@@ -47,7 +47,6 @@
}
# include <mln/level/abs.hh>
-# include <mln/level/all.hh>
# include <mln/level/apply.hh>
# include <mln/level/approx/all.hh>
# include <mln/level/assign.hh>
Index: trunk/milena/mln/level/assign.spe.hh
===================================================================
--- trunk/milena/mln/level/assign.spe.hh (revision 0)
+++ trunk/milena/mln/level/assign.spe.hh (revision 1489)
@@ -0,0 +1,92 @@
+// 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.
+
+#ifndef MLN_LEVEL_ASSIGN_SPE_HH
+# define MLN_LEVEL_ASSIGN_SPE_HH
+
+/*! \file mln/level/assign.spe.hh
+ *
+ * \brief Specializations for mln::level::assign.
+ *
+ */
+
+# include <mln/core/concept/image.hh>
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+ template <typename L, typename R>
+ void assign_(L& target, const R& data);
+ }
+
+
+ // Disjunction.
+
+
+ template <typename L, typename R>
+ void assign_(trait::image::speed::any, L& target,
+ trait::image::speed::any, const R& data)
+ {
+ generic::assign_(target, data);
+ }
+
+ template <typename L, typename R>
+ void assign_(trait::image::speed::fastest, L& target,
+ trait::image::speed::fastest, const R& data)
+ {
+ trace::entering("level::impl::assign_");
+
+ mln_pixter(L) lhs(target);
+ mln_pixter(const R) rhs(data);
+ for_all_2(lhs, rhs)
+ lhs.val() = rhs.val();
+
+ trace::exiting("level::impl::assign_");
+ }
+
+
+ } // end of namespace mln::level::impl
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+#endif // ! MLN_LEVEL_ASSIGN_SPE_HH
Index: trunk/milena/mln/level/take.spe.hh
===================================================================
--- trunk/milena/mln/level/take.spe.hh (revision 0)
+++ trunk/milena/mln/level/take.spe.hh (revision 1489)
@@ -0,0 +1,82 @@
+// 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.
+
+#ifndef MLN_LEVEL_TAKE_SPE_HH
+# define MLN_LEVEL_TAKE_SPE_HH
+
+/*! \file mln/level/take.spe.hh
+ *
+ * \brief Specializations for mln::level::take.
+ */
+
+# include <mln/core/concept/accumulator.hh>
+# include <mln/core/concept/image.hh>
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+ template <typename A, typename I>
+ void take_(const I& input, A& a);
+ }
+
+ template <typename A, typename I>
+ void take_(trait::image::speed::any, const I& input, A& a)
+ {
+ generic::take_(input, a);
+ }
+
+ template <typename A, typename I>
+ void take_(trait::image::speed::fastest, const I& input, A& a)
+ {
+ trace::entering("level::impl::take");
+
+ mln_pixter(const I) pxl(input);
+ for_all(pxl)
+ a.take(pxl.val());
+
+ trace::exiting("level::impl::take");
+ }
+
+ } // end of namespace mln::level::impl
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+#endif // ! MLN_LEVEL_TAKE_HH
Index: trunk/milena/mln/level/apply.spe.hh
===================================================================
--- trunk/milena/mln/level/apply.spe.hh (revision 0)
+++ trunk/milena/mln/level/apply.spe.hh (revision 1489)
@@ -0,0 +1,89 @@
+// 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.
+
+#ifndef MLN_LEVEL_APPLY_SPE_HH
+# define MLN_LEVEL_APPLY_SPE_HH
+
+/*! \file mln/level/apply.spe.hh
+ *
+ * \brief Specializations for mln::level::apply.
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/function.hh>
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+ template <typename I, typename F>
+ void apply_(I& input, const F& f);
+ }
+
+
+ // Disjunction.
+
+ template <typename I, typename F>
+ void apply_(trait::image::speed::any, I& input, const F& f)
+ {
+ generic::apply_(input, f);
+ }
+
+ template <typename I, typename F>
+ void apply_(trait::image::speed::fastest, I& input, const F& f)
+ {
+ trace::entering("level::impl::apply_");
+
+ mln_pixter(I) pxl(input);
+ for_all(pxl)
+ pxl.val() = f(pxl.val());
+
+ trace::exiting("level::impl::apply_");
+ }
+
+
+ } // end of namespace mln::level::impl
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+#endif // ! MLN_LEVEL_APPLY_HH
Index: trunk/milena/mln/level/fill.spe.hh
===================================================================
--- trunk/milena/mln/level/fill.spe.hh (revision 0)
+++ trunk/milena/mln/level/fill.spe.hh (revision 1489)
@@ -0,0 +1,93 @@
+// 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.
+
+#ifndef MLN_LEVEL_FILL_SPE_HH
+# define MLN_LEVEL_FILL_SPE_HH
+
+/*! \file mln/level/fill.spe.hh
+ *
+ * \brief Specializations for mln::level::fill.
+ *
+ */
+
+# include <cstring>
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/core/inplace.hh>
+# include <mln/level/memset_.hh>
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+ template <typename I>
+ void fill_with_value(I& ima, const mln_value(I)& value);
+ }
+
+
+ // Disjunction.
+
+
+ template <typename I>
+ void fill_with_value(trait::image::speed::any, I& ima,
+ const mln_value(I)& value)
+ {
+ generic::fill_with_value(ima, value);
+ }
+
+ template <typename I>
+ void fill_with_value(trait::image::speed::fastest, I& ima,
+ const mln_value(I)& value)
+ {
+ trace::entering("level::impl::fill_with_value");
+
+ level::memset_(ima, ima.point_at_offset(0), value, ima.ncells());
+
+ trace::exiting("level::impl::fill_with_value");
+ }
+
+
+ } // end of namespace mln::level::impl
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+#endif // ! MLN_LEVEL_FILL_SPE_HH
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);
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-15 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Review the debug namespace.
* mln/debug/format.hh: Fix style.
* mln/debug/iota.hh: Move spezialisations to iota.spe.hh.
* mln/debug/iota.spe.hh: New, specializations of iota.
* mln/debug/println.hh: Move spezialisations to println.spe.hh.
* mln/debug/println.spe.hh: New, specializations of println.
* mln/debug/println_with_border.hh: Move spezialisations to
println_with_border.spe.hh.
* mln/debug/println_with_border.spe.hh: New, specializations of
println.
* tests/debug_iota.cc: New, add a test for iota.
---
mln/debug/format.hh | 12 +-
mln/debug/iota.hh | 30 +++---
mln/debug/iota.spe.hh | 71 +++++++++++++++
mln/debug/println.hh | 106 +----------------------
mln/debug/println.spe.hh | 160 +++++++++++++++++++++++++++++++++++
mln/debug/println_with_border.hh | 56 +-----------
mln/debug/println_with_border.spe.hh | 113 ++++++++++++++++++++++++
tests/debug_iota.cc | 49 ++++++++++
8 files changed, 434 insertions(+), 163 deletions(-)
Index: trunk/milena/tests/debug_iota.cc
===================================================================
--- trunk/milena/tests/debug_iota.cc (revision 0)
+++ trunk/milena/tests/debug_iota.cc (revision 1487)
@@ -0,0 +1,49 @@
+// 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/debug_iota.cc
+ *
+ * \brief Tests on mln::debug::iota.
+ */
+
+#include <mln/core/image2d.hh>
+
+#include <mln/value/int_u8.hh>
+
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ image2d<int_u8> in(32, 32);
+
+ debug::iota(in);
+ debug::println(in);
+}
Index: trunk/milena/mln/debug/iota.spe.hh
===================================================================
--- trunk/milena/mln/debug/iota.spe.hh (revision 0)
+++ trunk/milena/mln/debug/iota.spe.hh (revision 1487)
@@ -0,0 +1,71 @@
+// 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.
+
+#ifndef MLN_DEBUG_IOTA_SPE_HH
+# define MLN_DEBUG_IOTA_SPE_HH
+
+/*! \file mln/debug/iota.spe.hh
+ *
+ * \brief Specializations for mln::debug::iota.
+ */
+
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace debug
+ {
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ template <typename I>
+ void
+ iota(trait::image::speed::fastest, I& input)
+ {
+ unsigned i = 0;
+ mln_pixter(I) p(input);
+ for_all(p)
+ // FIXME : remove the convertion when the bug will be
+ // resolved.
+ p.val() = ++i % int(mln_max(mln_value(I)));
+ }
+
+ } // end of namespace mln::debug::impl
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::debug
+
+} // end of namespace mln
+
+
+#endif // ! MLN_DEBUG_IOTA_SPE_HH
Index: trunk/milena/mln/debug/println_with_border.spe.hh
===================================================================
--- trunk/milena/mln/debug/println_with_border.spe.hh (revision 0)
+++ trunk/milena/mln/debug/println_with_border.spe.hh (revision 1487)
@@ -0,0 +1,113 @@
+// 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.
+
+#ifndef MLN_DEBUG_PRINTLN_WITH_BORDER_SPE_HH
+# define MLN_DEBUG_PRINTLN_WITH_BORDER_SPE_HH
+
+/*! \file mln/debug/println_with_border_spe.hh
+ *
+ * \brief Specializations for mln::debug::println_with_border.
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/window.hh>
+# include <mln/debug/format.hh>
+
+namespace mln
+{
+
+ namespace debug
+ {
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+# ifdef MLN_CORE_BOX2D_HH
+
+ // 2D version.
+ template <typename I>
+ void
+ println_with_border(const box2d& b, const I& input)
+ {
+ const std::size_t ncols = b.ncols() + 2 * input.border();
+ for (size_t i = 0; i < input.ncells(); i++)
+ {
+ std::cout << format(input.buffer()[i]) << ' ';
+ if (((i + 1) % ncols) == 0)
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+# endif // MLN_CORE_BOX2D_HH
+
+
+# ifdef MLN_CORE_BOX3D_HH
+
+ // 3D version.
+ template <typename I>
+ void
+ println_with_border(const box3d& b, const I& input)
+ {
+ typedef mln_point(I) P;
+
+ std::size_t len_s = b.len(P::dim - 3);
+ std::size_t len_r = b.len(P::dim - 2);
+ std::size_t len_c = b.len(P::dim - 1);
+
+ std::size_t border = input.border();
+ std::size_t real_len_s = len_s + 2 * border;
+ std::size_t real_len_c = len_c + 2 * border;
+ std::size_t real_len_r = len_r + 2 * border;
+
+ for (std::size_t k = 0; k < real_len_s; ++k)
+ {
+ for (std::size_t j = 0; j < real_len_r; ++j)
+ {
+ for (std::size_t i = 0; i < real_len_c; ++i)
+ std::cout << format(input[k * (real_len_r * real_len_c) + j * real_len_c + i])
+ << ' ';
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+
+# endif // MLN_CORE_BOX3D_HH
+
+ } // end of namespace mln::debug::impl
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::debug
+
+} // end of namespace mln
+
+
+#endif // ! MLN_DEBUG_PRINTLN_WITH_BORDER_SPE_HH
Index: trunk/milena/mln/debug/println.hh
===================================================================
--- trunk/milena/mln/debug/println.hh (revision 1486)
+++ trunk/milena/mln/debug/println.hh (revision 1487)
@@ -37,6 +37,8 @@
# include <mln/core/concept/window.hh>
# include <mln/debug/format.hh>
+// Specializations are in:
+# include <mln/debug/println.spe.hh>
namespace mln
{
@@ -54,9 +56,10 @@
namespace impl
{
- // generic version
+ // Generic version.
template <typename S, typename I>
- void println(const S&, const Image<I>& input_)
+ void
+ println(const S&, const Image<I>& input_)
{
const I& input = exact(input_);
mln_piter(I) p(input.domain());
@@ -65,108 +68,13 @@
std::cout << std::endl;
}
-# ifdef MLN_CORE_BOX2D_HH
-
- // 2D version
- template <typename I>
- void println(const box2d& b, const I& input)
- {
- point2d p;
- int& row = p.row();
- int& col = p.col();
- const int
- max_row = b.max_row(),
- max_col = b.max_col();
-
- for (row = b.min_row(); row <= max_row; ++row)
- {
- for (col = b.min_col(); col <= max_col; ++col)
- if (input.has(p))
- std::cout << format( input(p) ) << ' ';
- else
- std::cout << " ";
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
-
-# endif // MLN_CORE_BOX2D_HH
-
-# ifdef MLN_CORE_IMAGE2D_H_HH
-
- // Hexa version
- template <typename I>
- void println(const box2d_h& b, const hexa<I>& input)
- {
- typename hexa<I>::fwd_piter p(input.domain());
-
- int c = 1;
- int r = 1;
- int row_len = 1 + (b.max_col() - b.min_col()) / 2;
-
- for_all(p)
- {
- if (input.has(p))
- std::cout << format(input(p)) << " ";
- else
- std::cout << " ";
-
- if (c >= row_len)
- {
- std::cout << std::endl;
- if (r % 2)
- std::cout << " ";
- c = 0;
- r++;
- }
- c++;
- }
- std::cout << std::endl;
- }
-
-# endif // MLN_CORE_IMAGE2D_H_HH
-
-
-# ifdef MLN_CORE_BOX3D_HH
-
- template <typename I>
- void println(const box3d& b, const I& input)
- {
- point3d p;
- int& sli = p.sli();
- int& row = p.row();
- int& col = p.col();
- const int
- max_row = b.max_row(),
- max_sli = b.max_sli(),
- max_col = b.max_col();
-
- for (sli = b.min_sli(); sli <= max_sli; ++sli)
- {
- for (row = b.min_row(); row <= max_row; ++row)
- {
- for (int i = max_row; i >= row; --i)
- std::cout << ' ';
- for (col = b.min_col(); col <= max_col; ++col)
- if (input.has(p))
- std::cout << format( input(p) ) << ' ';
- else
- std::cout << " ";
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- }
-
-# endif // MLN_CORE_BOX3D_HH
-
} // end of namespace mln::debug::impl
// Facade.
-
template <typename I>
- void println(const Image<I>& input)
+ void
+ println(const Image<I>& input)
{
impl::println(exact(input).bbox(), exact(input));
}
Index: trunk/milena/mln/debug/format.hh
===================================================================
--- trunk/milena/mln/debug/format.hh (revision 1486)
+++ trunk/milena/mln/debug/format.hh (revision 1487)
@@ -61,22 +61,26 @@
# ifndef MLN_INCLUDE_ONLY
template <typename T>
- const T& format(const T& v)
+ const T&
+ format(const T& v)
{
return v;
}
- char format(bool v)
+ char
+ format(bool v)
{
return v ? '|' : '-';
}
- signed short format(signed char v)
+ signed short
+ format(signed char v)
{
return v;
}
- unsigned short format(unsigned char v)
+ unsigned short
+ format(unsigned char v)
{
return v;
}
Index: trunk/milena/mln/debug/iota.hh
===================================================================
--- trunk/milena/mln/debug/iota.hh (revision 1486)
+++ trunk/milena/mln/debug/iota.hh (revision 1487)
@@ -35,6 +35,9 @@
# include <mln/core/concept/image.hh>
+// Specializations are in:
+# include <mln/debug/iota.spe.hh>
+
namespace mln
{
@@ -42,7 +45,11 @@
namespace debug
{
- /// FIXME
+ /*! Fill the image \p input with successive values.
+ *
+ * \param[in,out] destination The image in which values are
+ * assigned.
+ */
template <typename I>
void iota(Image<I>& input);
@@ -53,31 +60,28 @@
{
template <typename I>
- void iota(trait::image::speed::any, I& input)
+ void
+ iota(trait::image::speed::any, I& input)
{
unsigned i = 0;
mln_piter(I) p(input.domain());
for_all(p)
- input(p) = ++i;
- }
-
- template <typename I>
- void iota(trait::image::speed::fastest, I& input)
- {
- unsigned i = 0;
- mln_pixter(I) p(input);
- for_all(p)
- p.val() = ++i;
+ // FIXME : remove the convertion when the bug will be
+ // resolved.
+ input(p) = ++i % int(mln_max(mln_value(I)));
}
} // end of namespace mln::debug::impl
template <typename I>
- void iota(Image<I>& input)
+ void
+ iota(Image<I>& input)
{
+ trace::entering("debug::iota");
mln_precondition(exact(input).has_data());
impl::iota(mln_trait_image_speed(I)(), exact(input));
+ trace::exiting("debug::iota");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/debug/println.spe.hh
===================================================================
--- trunk/milena/mln/debug/println.spe.hh (revision 0)
+++ trunk/milena/mln/debug/println.spe.hh (revision 1487)
@@ -0,0 +1,160 @@
+// 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.
+
+#ifndef MLN_DEBUG_PRINTLN_SPE_HH
+# define MLN_DEBUG_PRINTLN_SPE_HH
+
+/*! \file mln/debug/println.spe.hh
+ *
+ * \brief Specializations for mln::debug::println.
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/window.hh>
+# include <mln/debug/format.hh>
+
+
+namespace mln
+{
+
+ namespace debug
+ {
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+# ifdef MLN_CORE_BOX2D_HH
+
+ // 2D version.
+ template <typename I>
+ void
+ println(const box2d& b, const I& input)
+ {
+ point2d p;
+ int& row = p.row();
+ int& col = p.col();
+ const int
+ max_row = b.max_row(),
+ max_col = b.max_col();
+
+ for (row = b.min_row(); row <= max_row; ++row)
+ {
+ for (col = b.min_col(); col <= max_col; ++col)
+ if (input.has(p))
+ std::cout << format(input(p)) << ' ';
+ else
+ std::cout << " ";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+
+# endif // MLN_CORE_BOX2D_HH
+
+# ifdef MLN_CORE_IMAGE2D_H_HH
+
+ // Hexa version.
+ template <typename I>
+ void
+ println(const box2d_h& b, const hexa<I>& input)
+ {
+ typename hexa<I>::fwd_piter p(input.domain());
+
+ int c = 1;
+ int r = 1;
+ int row_len = 1 + (b.max_col() - b.min_col()) / 2;
+
+ for_all(p)
+ {
+ if (input.has(p))
+ std::cout << format(input(p)) << " ";
+ else
+ std::cout << " ";
+
+ if (c >= row_len)
+ {
+ std::cout << std::endl;
+ if (r % 2)
+ std::cout << " ";
+ c = 0;
+ r++;
+ }
+ c++;
+ }
+ std::cout << std::endl;
+ }
+
+# endif // MLN_CORE_IMAGE2D_H_HH
+
+
+# ifdef MLN_CORE_BOX3D_HH
+
+ // 3D version.
+ template <typename I>
+ void
+ println(const box3d& b, const I& input)
+ {
+ point3d p;
+ int& sli = p.sli();
+ int& row = p.row();
+ int& col = p.col();
+ const int
+ max_row = b.max_row(),
+ max_sli = b.max_sli(),
+ max_col = b.max_col();
+
+ for (sli = b.min_sli(); sli <= max_sli; ++sli)
+ {
+ for (row = b.min_row(); row <= max_row; ++row)
+ {
+ for (int i = max_row; i >= row; --i)
+ std::cout << ' ';
+ for (col = b.min_col(); col <= max_col; ++col)
+ if (input.has(p))
+ std::cout << format(input(p)) << ' ';
+ else
+ std::cout << " ";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+ }
+ }
+
+# endif // MLN_CORE_BOX3D_HH
+
+ } // end of namespace mln::debug::impl
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::debug
+
+} // end of namespace mln
+
+
+#endif // ! MLN_DEBUG_PRINTLN_SPE_HH
Index: trunk/milena/mln/debug/println_with_border.hh
===================================================================
--- trunk/milena/mln/debug/println_with_border.hh (revision 1486)
+++ trunk/milena/mln/debug/println_with_border.hh (revision 1487)
@@ -40,6 +40,9 @@
# include <mln/core/box2d.hh>
# include <mln/core/box3d.hh>
+// Specializations are in:
+# include <mln/debug/println_with_border.spe.hh>
+
namespace mln
{
@@ -56,64 +59,23 @@
namespace impl
{
- // generic version
+ // Generic version.
template <typename S, typename I>
- void println_with_border(const S&, const I& input)
- {
- for (size_t i = 0; i < input.ncells(); i++)
- std::cout << format( input.buffer()[i] ) << ' ';
- std::cout << std::endl;
- }
-
- // 2D version
- template <typename I>
- void println_with_border(const box2d& b, const I& input)
+ void
+ println_with_border(const S&, const I& input)
{
- const std::size_t ncols = b.ncols() + 2 * input.border();
for (size_t i = 0; i < input.ncells(); i++)
- {
std::cout << format( input.buffer()[i] ) << ' ';
- if (((i+1) % ncols) == 0)
std::cout << std::endl;
}
- std::cout << std::endl;
- }
-
- // 3D version
- template <typename I>
- void println_with_border(const box3d& b, const I& input)
- {
- typedef mln_point(I) P;
-
- std::size_t len_s = b.len(P::dim - 3);
- std::size_t len_r = b.len(P::dim - 2);
- std::size_t len_c = b.len(P::dim - 1);
-
- std::size_t border = input.border ();
- std::size_t real_len_s = len_s + 2 * border;
- std::size_t real_len_c = len_c + 2 * border;
- std::size_t real_len_r = len_r + 2 * border;
- for (std::size_t k = 0; k < real_len_s; ++k)
- {
- for (std::size_t j = 0; j < real_len_r; ++j)
- {
- for (std::size_t i = 0; i < real_len_c; ++i)
- std::cout << format(input[k * (real_len_r * real_len_c) + j * real_len_c + i])
- << ' ';
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
- std::cout << std::endl;
- }
} // end of namespace mln::debug::impl
-
- // facade
+ // Facade.
template <typename I>
- void println_with_border(const Image<I>& input)
+ void
+ println_with_border(const Image<I>& input)
{
mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-15 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Move level test in level tests repertory.
* tests/level/abs.cc: New.
* tests/level/apply.cc: New.
* tests/level/approx: New.
* tests/level/approx_median.cc: New.
* tests/level/assign.cc: New.
* tests/level/fill.cc: New.
* tests/level/median.cc: New.
* tests/level/median_dir.cc: New.
* tests/level/median_fast.cc: New.
* tests/level/median_hline2d.cc: New.
* tests/level/memcpy_.cc: New.
* tests/level/memset_.cc: New.
* tests/level/naive/median.cc: New.
* tests/level/naive: New.
* tests/level/paste.cc: New.
* tests/level/transform.cc: New.
* tests/level: New.
* tests/level_approx_median.cc: Remove.
* tests/level_assign.cc: Remove.
* tests/level_fill.cc: Remove.
* tests/level_median.cc: Remove.
* tests/level_median_dir.cc: Remove.
* tests/level_median_fast.cc: Remove.
* tests/level_median_hline2d.cc: Remove.
* tests/level_memcpy_.cc: Remove.
* tests/level_memset_.cc: Remove.
* tests/level_naive_median.cc: Remove.
* tests/level_paste.cc: Remove.
* tests/level_transform.cc: Remove.
---
abs.cc | 60 +++++++++++++++++++++++++++++++
apply.cc | 57 +++++++++++++++++++++++++++++
approx_median.cc | 62 ++++++++++++++++++++++++++++++++
assign.cc | 48 ++++++++++++++++++++++++
fill.cc | 70 ++++++++++++++++++++++++++++++++++++
median.cc | 59 ++++++++++++++++++++++++++++++
median_dir.cc | 55 ++++++++++++++++++++++++++++
median_fast.cc | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
median_hline2d.cc | 64 +++++++++++++++++++++++++++++++++
memcpy_.cc | 58 ++++++++++++++++++++++++++++++
memset_.cc | 53 +++++++++++++++++++++++++++
naive/median.cc | 58 ++++++++++++++++++++++++++++++
paste.cc | 62 ++++++++++++++++++++++++++++++++
transform.cc | 66 ++++++++++++++++++++++++++++++++++
14 files changed, 876 insertions(+)
Index: trunk/milena/tests/level_naive_median.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_median_hline2d.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_transform.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_memcpy_.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_median.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_median_dir.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_fill.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_median_fast.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_approx_median.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_paste.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_assign.cc (deleted)
===================================================================
Index: trunk/milena/tests/level_memset_.cc (deleted)
===================================================================
Index: trunk/milena/tests/level/transform.cc
===================================================================
--- trunk/milena/tests/level/transform.cc (revision 0)
+++ trunk/milena/tests/level/transform.cc (revision 1485)
@@ -0,0 +1,66 @@
+// 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/transform.cc
+ *
+ * \brief Tests on mln::level::transform
+ */
+
+#include <cmath>
+
+#include <mln/core/image2d.hh>
+#include <mln/level/transform.hh>
+#include <mln/debug/iota.hh>
+
+
+struct mysqrt : mln::Function_v2v<mysqrt>
+{
+ typedef unsigned short result;
+ result operator()(unsigned short c) const
+ {
+ return result( std::sqrt(float(c)) );
+ }
+};
+
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 10000;
+ image2d<unsigned short>
+ ima(size, size);
+
+ (std::cout << "iota... ").flush();
+ debug::iota(ima);
+ std::cout << "done" << std::endl;
+
+ (std::cout << "transform... ").flush();
+ level::transform(ima, mysqrt(), ima);
+ std::cout << "done" << std::endl;
+}
Index: trunk/milena/tests/level/median_dir.cc
===================================================================
--- trunk/milena/tests/level/median_dir.cc (revision 0)
+++ trunk/milena/tests/level/median_dir.cc (revision 1485)
@@ -0,0 +1,55 @@
+// 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/median_dir.cc
+ *
+ * \brief Test on mln::level::median.
+ */
+
+#include <mln/core/image2d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/level/median.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ border::thickness = 7;
+
+ image2d<int_u8>
+ lena = io::pgm::load("../img/lena.pgm"),
+ out(lena.domain());
+
+ level::median_dir(lena, 1, 15, out);
+ io::pgm::save(out, "out.pgm");
+}
Index: trunk/milena/tests/level/paste.cc
===================================================================
--- trunk/milena/tests/level/paste.cc (revision 0)
+++ trunk/milena/tests/level/paste.cc (revision 1485)
@@ -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/paste.cc
+ *
+ * \brief Tests on mln::level::paste.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/level/fill.hh>
+#include <mln/level/paste.hh>
+
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ box2d b(make::point2d(1,2), make::point2d(2,4));
+ image2d<int> ima(b, 2);
+ debug::iota(ima);
+ debug::println(ima);
+
+
+ box2d b2(make::point2d(-1,-2), make::point2d(3,6));
+ image2d<int> ima2(b2, 0);
+ debug::iota(ima2);
+ debug::println(ima2);
+
+ trace::quiet = false;
+
+ level::paste(ima, ima2); // Fast version.
+ debug::println(ima2);
+
+ level::impl::generic::paste_(ima, ima2); // Not so fast version...
+}
Index: trunk/milena/tests/level/median.cc
===================================================================
--- trunk/milena/tests/level/median.cc (revision 0)
+++ trunk/milena/tests/level/median.cc (revision 1485)
@@ -0,0 +1,59 @@
+// 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/median.cc
+ *
+ * \brief Test on mln::level::median.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/level/median.hh>
+
+
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ win::rectangle2d rect(51, 51);
+ border::thickness = 52;
+
+ image2d<int_u8>
+ lena = io::pgm::load("../img/lena.pgm"),
+ out(lena.domain());
+
+ level::median(lena, rect, out);
+ io::pgm::save(out, "out.pgm");
+}
Index: trunk/milena/tests/level/naive/median.cc
===================================================================
--- trunk/milena/tests/level/naive/median.cc (revision 0)
+++ trunk/milena/tests/level/naive/median.cc (revision 1485)
@@ -0,0 +1,58 @@
+// 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/naive/median.cc
+ *
+ * \brief Test on mln::level::naive::median.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/level/naive/median.hh>
+
+
+using namespace mln;
+using namespace mln::value;
+
+
+int main()
+{
+ win::rectangle2d rec(51, 51);
+ border::thickness = 52;
+
+ image2d<int_u8>
+ lena = io::pgm::load("../img/lena.pgm"),
+ out(lena.domain());
+
+ level::naive::median(lena, rec, out);
+ io::pgm::save(out, "out.pgm");
+}
Index: trunk/milena/tests/level/median_hline2d.cc
===================================================================
--- trunk/milena/tests/level/median_hline2d.cc (revision 0)
+++ trunk/milena/tests/level/median_hline2d.cc (revision 1485)
@@ -0,0 +1,64 @@
+// 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/median_hline2d.cc
+ *
+ * \brief Test on the hline2d version of mln::level::median.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/level/median.hh>
+#include <mln/level/compare.hh>
+
+
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ border::thickness = 0;
+
+ image2d<int_u8>
+ lena = io::pgm::load("../img/lena.pgm"),
+ out(lena.domain()),
+ ref(lena.domain());
+
+ level::median(lena, win::rectangle2d(1, 101), ref);
+
+ level::median(lena, win::hline2d(101), out);
+ io::pgm::save(out, "out.pgm");
+
+ // FIXME: mln_assertion(out == ref);
+}
Index: trunk/milena/tests/level/assign.cc
===================================================================
--- trunk/milena/tests/level/assign.cc (revision 0)
+++ trunk/milena/tests/level/assign.cc (revision 1485)
@@ -0,0 +1,48 @@
+// 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/assign.cc
+ *
+ * \brief Tests on mln::level::assign.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/level/assign.hh>
+#include <mln/level/compare.hh>
+#include <mln/debug/iota.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 1000;
+ image2d<int> rhs(size, size), lhs(rhs.domain());
+ debug::iota(rhs);
+ level::assign(lhs, rhs);
+ mln_assertion(lhs == rhs);
+}
Index: trunk/milena/tests/level/apply.cc
===================================================================
--- trunk/milena/tests/level/apply.cc (revision 0)
+++ trunk/milena/tests/level/apply.cc (revision 1485)
@@ -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/apply.cc
+ *
+ * \brief Tests on mln::level::apply.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/level/apply.hh>
+#include <mln/debug/iota.hh>
+#include <mln/fun/v2v/saturate.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 1000;
+ image2d<int> ima(3, 3);
+ int vs[3][3] = {
+ { 2, 2, 3 },
+ { 4, 5, 6 },
+ { 6, 6, 6 }
+ };
+
+ image2d<int> ref(make::image2d(vs));
+ debug::iota(ima);
+ level::apply(ima, fun::v2v::saturate<int>(2, 6));
+ box_fwd_piter_<point2d> p(ima.domain());
+ for_all(p)
+ mln_assertion(ima(p) == ref(p));
+}
Index: trunk/milena/tests/level/abs.cc
===================================================================
--- trunk/milena/tests/level/abs.cc (revision 0)
+++ trunk/milena/tests/level/abs.cc (revision 1485)
@@ -0,0 +1,60 @@
+// 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/abs.cc
+ *
+ * \brief Tests on mln::level::abs.
+ */
+
+# include <mln/core/image2d.hh>
+# include <mln/level/abs.hh>
+
+int main()
+{
+
+ using namespace mln;
+
+ typedef image2d<int> I;
+
+ int vs[6][5] = {
+
+ { -3, -3, -4, -4, -4 },
+ { -2, -1, -1, -1, -1 },
+ { -1, -4, -4, -4, -1 },
+ { -1, -4, -3, -4, -1 },
+ { -1, -4, -5, -3, -1 },
+ { -1, -1, -1, -1, -1 }
+
+ };
+
+ image2d<int> ima(make::image2d(vs));
+ image2d<int> out(ima.domain());
+ level::abs(ima, out);
+ box_fwd_piter_<point2d> p(ima.domain());
+ for_all (p)
+ mln_assertion (out(p) >= 0);
+}
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 1485)
@@ -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 0)
+++ trunk/milena/tests/level/fill.cc (revision 1485)
@@ -0,0 +1,70 @@
+// 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/fill.cc
+ *
+ * \brief Tests on mln::level::fill
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/sub_image.hh>
+#include <mln/level/fill.hh>
+
+#include <mln/debug/println.hh>
+#include <mln/value/props.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+
+ unsigned u = 300;
+ 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);
+ }
+
+// {
+// // do *not* compile so that's great since ima is not mutable
+// sub_image< const image2d<int>, box2d > ima;
+// level::fill(ima, 0);
+// }
+
+}
Index: trunk/milena/tests/level/memcpy_.cc
===================================================================
--- trunk/milena/tests/level/memcpy_.cc (revision 0)
+++ trunk/milena/tests/level/memcpy_.cc (revision 1485)
@@ -0,0 +1,58 @@
+// 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/memcpy_.cc
+ *
+ * \brief Tests on mln::level::memcpy_.
+ *
+ * \todo Make this test not dummy!
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/inplace.hh>
+#include <mln/debug/iota.hh>
+#include <mln/level/memcpy_.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef image2d<int> I;
+ I ima(3, 3);
+ debug::iota(ima);
+
+ point2d
+ src = make::point2d(0, 2),
+ dest = make::point2d(1, 2);
+
+ level::memcpy_(inplace(make::pixel(ima, dest)),
+ make::pixel(ima, src),
+ 2 + 2 * ima.border());
+
+ mln_assertion(ima(dest) == ima(src));
+}
Index: trunk/milena/tests/level/memset_.cc
===================================================================
--- trunk/milena/tests/level/memset_.cc (revision 0)
+++ trunk/milena/tests/level/memset_.cc (revision 1485)
@@ -0,0 +1,53 @@
+// 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/memset_.cc
+ *
+ * \brief Tests on mln::level::memset_.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/geom/ncols.hh>
+#include <mln/level/fill.hh>
+#include <mln/level/memset_.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(3, 3);
+ level::fill(ima, 0);
+ int X = 9;
+ level::memset_(ima, make::point2d(0,0),
+ X,
+ geom::ncols(ima) + 2 * ima.border() + 1);
+ // ^
+ // |
+ mln_assertion(ima.at(1,0) == X); // <----------------+
+ mln_assertion(ima.at(1,1) != X);
+}
Index: trunk/milena/tests/level/median_fast.cc
===================================================================
--- trunk/milena/tests/level/median_fast.cc (revision 0)
+++ trunk/milena/tests/level/median_fast.cc (revision 1485)
@@ -0,0 +1,104 @@
+// 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/median_fast.cc
+ *
+ * \brief Test on mln::level::fast_median.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+#include <mln/level/fast_median.hh>
+
+#include <mln/core/dpoints_pixter.hh>
+#include <mln/core/pixel.hh>
+
+
+namespace mln
+{
+
+ template <typename I, typename W>
+ void test(I& input, const W& win)
+ {
+ mln_point(I) p;
+ p.row() = p.col() = 1;
+
+ {
+ mln_qixter(I, W) qix(input, win, p);
+ for_all(qix)
+ std::cout << qix.val() << ' ';
+ std::cout << " : " << qix.center_val() << std::endl;
+ }
+
+ {
+ pixel<I> pix(input, p);
+ mln_qixter(I, W) qix(input, win, pix);
+ for_all(qix)
+ std::cout << qix.val() << ' ';
+ std::cout << " : " << qix.center_val() << std::endl;
+ }
+ }
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+// {
+// win::rectangle2d rect(3, 3);
+// border::thickness = 4;
+// image2d<int_u8> ima(3, 3);
+// debug::iota(ima);
+// debug::println(ima);
+// test(ima, rect);
+// }
+
+
+ {
+ win::rectangle2d rect(51, 51);
+ border::thickness = 52;
+
+ image2d<int_u8>
+ lena = io::pgm::load("../img/lena.pgm"),
+ out(lena.domain());
+
+ level::fast_median(lena, rect, out);
+ io::pgm::save(out, "out.pgm");
+ }
+
+}