Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
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);
1
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();
1
0
URL: https://svn.lrde.org/svn/oln/trunk/milena
ChangeLog:
2007-11-15 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Fix the guard oh all headers.
* mln/canvas/browsing/dir_ricard51.hh,
* mln/canvas/browsing/directional.hh,
* mln/convert/to_p_array.hh,
* mln/convert/to_p_set.hh,
* mln/core/concept/generalized_pixel.hh,
* mln/core/concept/point_iterator.hh,
* mln/core/concept/value_iterator.hh,
* mln/core/image1d.hh,
* mln/core/image2d.hh,
* mln/core/image3d.hh,
* mln/core/internal/image_if_base.hh,
* mln/core/mesh_p.hh,
* mln/core/mesh_psite.hh,
* mln/core/p_array.hh,
* mln/core/p_array_piter.hh,
* mln/core/p_priority_queue_fast.hh,
* mln/core/p_queue.hh,
* mln/core/p_queue_fast.hh,
* mln/core/p_set.hh,
* mln/core/pixter1d.hh,
* mln/core/pixter2d.hh,
* mln/core/pixter3d.hh,
* mln/core/trait/op_mult.hh,
* mln/fun/i2v/all_to.hh,
* mln/level/memcpy_.hh,
* mln/level/memset_.hh,
* mln/metal/converts_to.hh,
* mln/metal/goes_to.hh,
* mln/metal/if.hh,
* mln/metal/is.hh,
* mln/metal/is_a.hh,
* mln/metal/is_not.hh,
* mln/metal/none.hh,
* mln/win/backdiag2d.hh,
* mln/win/cube3d.hh,
* mln/win/diag2d.hh,
* mln/win/disk2d.hh,
* mln/win/hline2d.hh,
* mln/win/line.hh,
* mln/win/octagon2d.hh,
* mln/win/rectangle2d.hh,
* mln/win/segment1d.hh,
* mln/win/vline2d.hh: Fix.
---
canvas/browsing/dir_ricard51.hh | 6 +++---
canvas/browsing/directional.hh | 6 +++---
convert/to_p_array.hh | 6 +++---
convert/to_p_set.hh | 6 +++---
core/concept/generalized_pixel.hh | 6 +++---
core/concept/point_iterator.hh | 6 +++---
core/concept/value_iterator.hh | 6 +++---
core/image1d.hh | 6 +++---
core/image2d.hh | 6 +++---
core/image3d.hh | 6 +++---
core/internal/image_if_base.hh | 6 +++---
core/mesh_p.hh | 6 +++---
core/mesh_psite.hh | 6 +++---
core/p_array.hh | 6 +++---
core/p_array_piter.hh | 6 +++---
core/p_priority_queue_fast.hh | 6 +++---
core/p_queue.hh | 6 +++---
core/p_queue_fast.hh | 6 +++---
core/p_set.hh | 6 +++---
core/pixter1d.hh | 6 +++---
core/pixter2d.hh | 6 +++---
core/pixter3d.hh | 6 +++---
core/trait/op_mult.hh | 6 +++---
fun/i2v/all_to.hh | 6 +++---
level/memcpy_.hh | 6 +++---
level/memset_.hh | 6 +++---
metal/converts_to.hh | 6 +++---
metal/goes_to.hh | 6 +++---
metal/if.hh | 6 +++---
metal/is.hh | 6 +++---
metal/is_a.hh | 6 +++---
metal/is_not.hh | 6 +++---
metal/none.hh | 6 +++---
win/backdiag2d.hh | 6 +++---
win/cube3d.hh | 6 +++---
win/diag2d.hh | 6 +++---
win/disk2d.hh | 6 +++---
win/hline2d.hh | 6 +++---
win/line.hh | 6 +++---
win/octagon2d.hh | 6 +++---
win/rectangle2d.hh | 6 +++---
win/segment1d.hh | 6 +++---
win/vline2d.hh | 6 +++---
43 files changed, 129 insertions(+), 129 deletions(-)
Index: trunk/milena/mln/core/mesh_psite.hh
===================================================================
--- trunk/milena/mln/core/mesh_psite.hh (revision 1485)
+++ trunk/milena/mln/core/mesh_psite.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_MESH_PSITE_HH
-# define MLN_MESH_PSITE_HH
+#ifndef MLN_CORE_MESH_PSITE_HH
+# define MLN_CORE_MESH_PSITE_HH
/*! \file mln/core/mesh_psite.hh
*
@@ -100,4 +100,4 @@
} // end of mln
-#endif // MLN_MESH_PSITE_HH
+#endif // MLN_CORE_MESH_PSITE_HH
Index: trunk/milena/mln/core/p_queue.hh
===================================================================
--- trunk/milena/mln/core/p_queue.hh (revision 1485)
+++ trunk/milena/mln/core/p_queue.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_QUEUE_P_HH
-# define MLN_CORE_QUEUE_P_HH
+#ifndef MLN_CORE_P_QUEUE_HH
+# define MLN_CORE_P_QUEUE_HH
/*! \file mln/core/p_queue.hh
*
@@ -280,4 +280,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_QUEUE_P_HH
+#endif // ! MLN_CORE_P_QUEUE_HH
Index: trunk/milena/mln/core/mesh_p.hh
===================================================================
--- trunk/milena/mln/core/mesh_p.hh (revision 1485)
+++ trunk/milena/mln/core/mesh_p.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_MESH_P_HH
-# define MLN_MESH_P_HH
+#ifndef MLN_CORE_MESH_P_HH
+# define MLN_CORE_MESH_P_HH
# include <mln/core/concept/point_site.hh>
# include <mln/core/internal/point_set_base.hh>
@@ -116,4 +116,4 @@
} // end of mln
-#endif // MLN_MESH_P_HH
+#endif // MLN_CORE_MESH_P_HH
Index: trunk/milena/mln/core/internal/image_if_base.hh
===================================================================
--- trunk/milena/mln/core/internal/image_if_base.hh (revision 1485)
+++ trunk/milena/mln/core/internal/image_if_base.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_IMAGE_IF_BASE_HH
-# define MLN_CORE_IMAGE_IF_BASE_HH
+#ifndef MLN_CORE_INTERNAL_IMAGE_IF_BASE_HH
+# define MLN_CORE_INTERNAL_IMAGE_IF_BASE_HH
/*! \file mln/core/internal/image_if_base.hh
*
@@ -193,4 +193,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_IMAGE_IF_BASE_HH
+#endif // ! MLN_CORE_INTERNAL_IMAGE_IF_BASE_HH
Index: trunk/milena/mln/core/p_priority_queue_fast.hh
===================================================================
--- trunk/milena/mln/core/p_priority_queue_fast.hh (revision 1485)
+++ trunk/milena/mln/core/p_priority_queue_fast.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_QUEUE_P_FAST_PRIORITY_HH
-# define MLN_CORE_QUEUE_P_FAST_PRIORITY_HH
+#ifndef MLN_CORE_P_PRIORITY_QUEUE_FAST_HH
+# define MLN_CORE_P_PRIORITY_QUEUE_FAST_HH
/*! \file mln/core/p_priority_queue_fast.hh
*
@@ -334,4 +334,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_QUEUE_P_FAST_PRIORITY_HH
+#endif // ! MLN_CORE_P_PRIORITY_QUEUE_FAST_HH
Index: trunk/milena/mln/core/p_set.hh
===================================================================
--- trunk/milena/mln/core/p_set.hh (revision 1485)
+++ trunk/milena/mln/core/p_set.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_SET_P_HH
-# define MLN_CORE_SET_P_HH
+#ifndef MLN_CORE_P_SET_HH
+# define MLN_CORE_P_SET_HH
/*! \file mln/core/p_set.hh
*
@@ -169,4 +169,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_SET_P_HH
+#endif // ! MLN_CORE_P_SET_HH
Index: trunk/milena/mln/core/trait/op_mult.hh
===================================================================
--- trunk/milena/mln/core/trait/op_mult.hh (revision 1485)
+++ trunk/milena/mln/core/trait/op_mult.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_TRAIT_OP_MULT_HH
-# define MLN_TRAIT_OP_MULT_HH
+#ifndef MLN_CORE_TRAIT_OP_MULT_HH
+# define MLN_CORE_TRAIT_OP_MULT_HH
/*!
* \file mln/core/trait/op_mult.hh
@@ -145,4 +145,4 @@
} // end of namespace mln
-#endif // ! MLN_TRAIT_OP_MULT_HH
+#endif // ! MLN_CORE_TRAIT_OP_MULT_HH
Index: trunk/milena/mln/core/pixter1d.hh
===================================================================
--- trunk/milena/mln/core/pixter1d.hh (revision 1485)
+++ trunk/milena/mln/core/pixter1d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_PIXTER1D_B_HH
-# define MLN_CORE_PIXTER1D_B_HH
+#ifndef MLN_CORE_PIXTER1D_HH
+# define MLN_CORE_PIXTER1D_HH
/*! \file mln/core/pixter1d.hh
*
@@ -87,4 +87,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_PIXTER1D_B_HH
+#endif // ! MLN_CORE_PIXTER1D_HH
Index: trunk/milena/mln/core/pixter2d.hh
===================================================================
--- trunk/milena/mln/core/pixter2d.hh (revision 1485)
+++ trunk/milena/mln/core/pixter2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_PIXTER2D_B_HH
-# define MLN_CORE_PIXTER2D_B_HH
+#ifndef MLN_CORE_PIXTER2D_HH
+# define MLN_CORE_PIXTER2D_HH
/*! \file mln/core/pixter2d.hh
*
@@ -172,4 +172,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_PIXTER2D_B_HH
+#endif // ! MLN_CORE_PIXTER2D_HH
Index: trunk/milena/mln/core/pixter3d.hh
===================================================================
--- trunk/milena/mln/core/pixter3d.hh (revision 1485)
+++ trunk/milena/mln/core/pixter3d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_PIXTER3D_B_HH
-# define MLN_CORE_PIXTER3D_B_HH
+#ifndef MLN_CORE_PIXTER3D_HH
+# define MLN_CORE_PIXTER3D_HH
/*! \file mln/core/pixter3d.hh
*
@@ -127,4 +127,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_PIXTER3D_B_HH
+#endif // ! MLN_CORE_PIXTER3D_HH
Index: trunk/milena/mln/core/p_queue_fast.hh
===================================================================
--- trunk/milena/mln/core/p_queue_fast.hh (revision 1485)
+++ trunk/milena/mln/core/p_queue_fast.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_QUEUE_P_FAST_HH
-# define MLN_CORE_QUEUE_P_FAST_HH
+#ifndef MLN_CORE_P_QUEUE_FAST_HH
+# define MLN_CORE_P_QUEUE_FAST_HH
/*! \file mln/core/p_queue_fast.hh
*
@@ -289,4 +289,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_QUEUE_P_FAST_HH
+#endif // ! MLN_CORE_P_QUEUE_FAST_HH
Index: trunk/milena/mln/core/concept/value_iterator.hh
===================================================================
--- trunk/milena/mln/core/concept/value_iterator.hh (revision 1485)
+++ trunk/milena/mln/core/concept/value_iterator.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_CONCEPT_VITER_HH
-# define MLN_CORE_CONCEPT_VITER_HH
+#ifndef MLN_CORE_CONCEPT_VALUE_ITERATOR_HH
+# define MLN_CORE_CONCEPT_VALUE_ITERATOR_HH
/*! \file mln/core/concept/value_iterator.hh
*
@@ -101,4 +101,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_CONCEPT_VITER_HH
+#endif // ! MLN_CORE_CONCEPT_VALUE_ITERATOR_HH
Index: trunk/milena/mln/core/concept/generalized_pixel.hh
===================================================================
--- trunk/milena/mln/core/concept/generalized_pixel.hh (revision 1485)
+++ trunk/milena/mln/core/concept/generalized_pixel.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_CONCEPT_GENPIXEL_HH
-# define MLN_CORE_CONCEPT_GENPIXEL_HH
+#ifndef MLN_CORE_CONCEPT_GENERALIZED_PIXEL_HH
+# define MLN_CORE_CONCEPT_GENERALIZED_PIXEL_HH
/*! \file mln/core/concept/generalized_pixel.hh
*
@@ -101,4 +101,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_CONCEPT_GENPIXEL_HH
+#endif // ! MLN_CORE_CONCEPT_GENERALIZED_PIXEL_HH
Index: trunk/milena/mln/core/concept/point_iterator.hh
===================================================================
--- trunk/milena/mln/core/concept/point_iterator.hh (revision 1485)
+++ trunk/milena/mln/core/concept/point_iterator.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_CONCEPT_PITER_HH
-# define MLN_CORE_CONCEPT_PITER_HH
+#ifndef MLN_CORE_CONCEPT_POINT_ITERATOR_HH
+# define MLN_CORE_CONCEPT_POINT_ITERATOR_HH
/*! \file mln/core/concept/point_iterator.hh
*
@@ -113,4 +113,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_CONCEPT_PITER_HH
+#endif // ! MLN_CORE_CONCEPT_POINT_ITERATOR_HH
Index: trunk/milena/mln/core/p_array.hh
===================================================================
--- trunk/milena/mln/core/p_array.hh (revision 1485)
+++ trunk/milena/mln/core/p_array.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_VEC_P_HH
-# define MLN_CORE_VEC_P_HH
+#ifndef MLN_CORE_P_ARRAY_HH
+# define MLN_CORE_P_ARRAY_HH
/*! \file mln/core/p_array.hh
*
@@ -219,4 +219,4 @@
# include <mln/core/p_array_piter.hh>
-#endif // ! MLN_CORE_VEC_P_HH
+#endif // ! MLN_CORE_P_ARRAY_HH
Index: trunk/milena/mln/core/p_array_piter.hh
===================================================================
--- trunk/milena/mln/core/p_array_piter.hh (revision 1485)
+++ trunk/milena/mln/core/p_array_piter.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_VEC_P_PITER_HH
-# define MLN_CORE_VEC_P_PITER_HH
+#ifndef MLN_CORE_P_ARRAY_PITER_HH
+# define MLN_CORE_P_ARRAY_PITER_HH
/*! \file mln/core/p_array_piter.hh
*
@@ -269,4 +269,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_VEC_P_PITER_HH
+#endif // ! MLN_CORE_P_ARRAY_PITER_HH
Index: trunk/milena/mln/core/image1d.hh
===================================================================
--- trunk/milena/mln/core/image1d.hh (revision 1485)
+++ trunk/milena/mln/core/image1d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_IMAGE1D_B_HH
-# define MLN_CORE_IMAGE1D_B_HH
+#ifndef MLN_CORE_IMAGE1D_HH
+# define MLN_CORE_IMAGE1D_HH
/*! \file mln/core/image1d.hh
*
@@ -532,4 +532,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_IMAGE1D_B_HH
+#endif // ! MLN_CORE_IMAGE1D_HH
Index: trunk/milena/mln/core/image2d.hh
===================================================================
--- trunk/milena/mln/core/image2d.hh (revision 1485)
+++ trunk/milena/mln/core/image2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_IMAGE2D_B_HH
-# define MLN_CORE_IMAGE2D_B_HH
+#ifndef MLN_CORE_IMAGE2D_HH
+# define MLN_CORE_IMAGE2D_HH
/*! \file mln/core/image2d.hh
*
@@ -579,4 +579,4 @@
# include <mln/make/image2d.hh>
-#endif // ! MLN_CORE_IMAGE2D_B_HH
+#endif // ! MLN_CORE_IMAGE2D_HH
Index: trunk/milena/mln/core/image3d.hh
===================================================================
--- trunk/milena/mln/core/image3d.hh (revision 1485)
+++ trunk/milena/mln/core/image3d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_IMAGE3D_B_HH
-# define MLN_CORE_IMAGE3D_B_HH
+#ifndef MLN_CORE_IMAGE3D_HH
+# define MLN_CORE_IMAGE3D_HH
/*! \file mln/core/image3d.hh
*
@@ -571,4 +571,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_IMAGE3D_B_HH
+#endif // ! MLN_CORE_IMAGE3D_HH
Index: trunk/milena/mln/metal/is_not.hh
===================================================================
--- trunk/milena/mln/metal/is_not.hh (revision 1485)
+++ trunk/milena/mln/metal/is_not.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_METAL_IS_NOT_HH
-# define MLN_CORE_METAL_IS_NOT_HH
+#ifndef MLN_METAL_IS_NOT_HH
+# define MLN_METAL_IS_NOT_HH
/*! \file mln/metal/is_not.hh
*
@@ -60,4 +60,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_METAL_IS_NOT_HH
+#endif // ! MLN_METAL_IS_NOT_HH
Index: trunk/milena/mln/metal/if.hh
===================================================================
--- trunk/milena/mln/metal/if.hh (revision 1485)
+++ trunk/milena/mln/metal/if.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_METAL_IF_HH
-# define MLN_CORE_METAL_IF_HH
+#ifndef MLN_METAL_IF_HH
+# define MLN_METAL_IF_HH
/*! \file mln/metal/if.hh
*
@@ -82,4 +82,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_METAL_IF_HH
+#endif // ! MLN_METAL_IF_HH
Index: trunk/milena/mln/metal/goes_to.hh
===================================================================
--- trunk/milena/mln/metal/goes_to.hh (revision 1485)
+++ trunk/milena/mln/metal/goes_to.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_METAL_GOES_TO_HH
-# define MLN_CORE_METAL_GOES_TO_HH
+#ifndef MLN_METAL_GOES_TO_HH
+# define MLN_METAL_GOES_TO_HH
/*! \file mln/metal/goes_to.hh
*
@@ -61,4 +61,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_METAL_GOES_TO_HH
+#endif // ! MLN_METAL_GOES_TO_HH
Index: trunk/milena/mln/metal/none.hh
===================================================================
--- trunk/milena/mln/metal/none.hh (revision 1485)
+++ trunk/milena/mln/metal/none.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_METAL_NONE_HH
-# define MLN_CORE_METAL_NONE_HH
+#ifndef MLN_METAL_NONE_HH
+# define MLN_METAL_NONE_HH
/*! \file mln/metal/none.hh
*
@@ -54,4 +54,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_METAL_NONE_HH
+#endif // ! MLN_METAL_NONE_HH
Index: trunk/milena/mln/metal/converts_to.hh
===================================================================
--- trunk/milena/mln/metal/converts_to.hh (revision 1485)
+++ trunk/milena/mln/metal/converts_to.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_METAL_CONVERTS_TO_HH
-# define MLN_CORE_METAL_CONVERTS_TO_HH
+#ifndef MLN_METAL_CONVERTS_TO_HH
+# define MLN_METAL_CONVERTS_TO_HH
/*! \file mln/metal/converts_to.hh
*
@@ -76,4 +76,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_METAL_CONVERTS_TO_HH
+#endif // ! MLN_METAL_CONVERTS_TO_HH
Index: trunk/milena/mln/metal/is_a.hh
===================================================================
--- trunk/milena/mln/metal/is_a.hh (revision 1485)
+++ trunk/milena/mln/metal/is_a.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_METAL_IS_A_HH
-# define MLN_CORE_METAL_IS_A_HH
+#ifndef MLN_METAL_IS_A_HH
+# define MLN_METAL_IS_A_HH
/*! \file mln/metal/is_a.hh
*
@@ -91,4 +91,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_METAL_IS_A_HH
+#endif // ! MLN_METAL_IS_A_HH
Index: trunk/milena/mln/metal/is.hh
===================================================================
--- trunk/milena/mln/metal/is.hh (revision 1485)
+++ trunk/milena/mln/metal/is.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_METAL_IS_HH
-# define MLN_CORE_METAL_IS_HH
+#ifndef MLN_METAL_IS_HH
+# define MLN_METAL_IS_HH
/*! \file mln/metal/is.hh
*
@@ -88,4 +88,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_METAL_IS_HH
+#endif // ! MLN_METAL_IS_HH
Index: trunk/milena/mln/level/memset_.hh
===================================================================
--- trunk/milena/mln/level/memset_.hh (revision 1485)
+++ trunk/milena/mln/level/memset_.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LEVEL_MEMSET_HH
-# define MLN_LEVEL_MEMSET_HH
+#ifndef MLN_LEVEL_MEMSET__HH
+# define MLN_LEVEL_MEMSET__HH
/*! \file mln/level/memset_.hh
*
@@ -131,4 +131,4 @@
} // end of namespace mln
-#endif // ! MLN_LEVEL_MEMSET_HH
+#endif // ! MLN_LEVEL_MEMSET__HH
Index: trunk/milena/mln/level/memcpy_.hh
===================================================================
--- trunk/milena/mln/level/memcpy_.hh (revision 1485)
+++ trunk/milena/mln/level/memcpy_.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LEVEL_MEMCPY_HH
-# define MLN_LEVEL_MEMCPY_HH
+#ifndef MLN_LEVEL_MEMCPY__HH
+# define MLN_LEVEL_MEMCPY__HH
/*! \file mln/level/memcpy_.hh
*
@@ -109,4 +109,4 @@
} // end of namespace mln
-#endif // ! MLN_LEVEL_MEMCPY_HH
+#endif // ! MLN_LEVEL_MEMCPY__HH
Index: trunk/milena/mln/convert/to_p_set.hh
===================================================================
--- trunk/milena/mln/convert/to_p_set.hh (revision 1485)
+++ trunk/milena/mln/convert/to_p_set.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CONVERT_TO_SET_P_HH
-# define MLN_CONVERT_TO_SET_P_HH
+#ifndef MLN_CONVERT_TO_P_SET_HH
+# define MLN_CONVERT_TO_P_SET_HH
/*! \file mln/convert/to_p_set.hh
*
@@ -146,4 +146,4 @@
} // end of namespace mln
-#endif // ! MLN_CONVERT_TO_SET_P_HH
+#endif // ! MLN_CONVERT_TO_P_SET_HH
Index: trunk/milena/mln/convert/to_p_array.hh
===================================================================
--- trunk/milena/mln/convert/to_p_array.hh (revision 1485)
+++ trunk/milena/mln/convert/to_p_array.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CONVERT_TO_VEC_P_HH
-# define MLN_CONVERT_TO_VEC_P_HH
+#ifndef MLN_CONVERT_TO_P_ARRAY_HH
+# define MLN_CONVERT_TO_P_ARRAY_HH
/*! \file mln/convert/to_p_array.hh
*
@@ -85,4 +85,4 @@
} // end of namespace mln
-#endif // ! MLN_CONVERT_TO_VEC_P_HH
+#endif // ! MLN_CONVERT_TO_P_ARRAY_HH
Index: trunk/milena/mln/fun/i2v/all_to.hh
===================================================================
--- trunk/milena/mln/fun/i2v/all_to.hh (revision 1485)
+++ trunk/milena/mln/fun/i2v/all_to.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_ALL_TO_HH
-# define MLN_FUN_ALL_TO_HH
+#ifndef MLN_FUN_I2V_ALL_TO_HH
+# define MLN_FUN_I2V_ALL_TO_HH
/*! \file mln/fun/i2v/all_to.hh
*
@@ -102,4 +102,4 @@
} // end of namespace mln
-#endif // ! MLN_FUN_ALL_TO_HH
+#endif // ! MLN_FUN_I2V_ALL_TO_HH
Index: trunk/milena/mln/win/vline2d.hh
===================================================================
--- trunk/milena/mln/win/vline2d.hh (revision 1485)
+++ trunk/milena/mln/win/vline2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_VLINE2D_HH
-# define MLN_CORE_WIN_VLINE2D_HH
+#ifndef MLN_WIN_VLINE2D_HH
+# define MLN_WIN_VLINE2D_HH
/*! \file mln/win/vline2d.hh
*
@@ -62,4 +62,4 @@
-#endif // ! MLN_CORE_WIN_VLINE2D_HH
+#endif // ! MLN_WIN_VLINE2D_HH
Index: trunk/milena/mln/win/cube3d.hh
===================================================================
--- trunk/milena/mln/win/cube3d.hh (revision 1485)
+++ trunk/milena/mln/win/cube3d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_CUBE3D_HH
-# define MLN_CORE_WIN_CUBE3D_HH
+#ifndef MLN_WIN_CUBE3D_HH
+# define MLN_WIN_CUBE3D_HH
/*! \file mln/win/cube3d.hh
*
@@ -190,4 +190,4 @@
-#endif // ! MLN_CORE_WIN_CUBE3D_HH
+#endif // ! MLN_WIN_CUBE3D_HH
Index: trunk/milena/mln/win/hline2d.hh
===================================================================
--- trunk/milena/mln/win/hline2d.hh (revision 1485)
+++ trunk/milena/mln/win/hline2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_HLINE2D_HH
-# define MLN_CORE_WIN_HLINE2D_HH
+#ifndef MLN_WIN_HLINE2D_HH
+# define MLN_WIN_HLINE2D_HH
/*! \file mln/win/hline2d.hh
*
@@ -60,4 +60,4 @@
-#endif // ! MLN_CORE_WIN_HLINE2D_HH
+#endif // ! MLN_WIN_HLINE2D_HH
Index: trunk/milena/mln/win/line.hh
===================================================================
--- trunk/milena/mln/win/line.hh (revision 1485)
+++ trunk/milena/mln/win/line.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_LINE_HH
-# define MLN_CORE_WIN_LINE_HH
+#ifndef MLN_WIN_LINE_HH
+# define MLN_WIN_LINE_HH
/*! \file mln/win/line.hh
*
@@ -180,4 +180,4 @@
-#endif // ! MLN_CORE_WIN_LINE_HH
+#endif // ! MLN_WIN_LINE_HH
Index: trunk/milena/mln/win/segment1d.hh
===================================================================
--- trunk/milena/mln/win/segment1d.hh (revision 1485)
+++ trunk/milena/mln/win/segment1d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_SEGMENT1D_HH
-# define MLN_CORE_WIN_SEGMENT1D_HH
+#ifndef MLN_WIN_SEGMENT1D_HH
+# define MLN_WIN_SEGMENT1D_HH
/*! \file mln/win/segment1d.hh
*
@@ -178,4 +178,4 @@
-#endif // ! MLN_CORE_WIN_SEGMENT1D_HH
+#endif // ! MLN_WIN_SEGMENT1D_HH
Index: trunk/milena/mln/win/diag2d.hh
===================================================================
--- trunk/milena/mln/win/diag2d.hh (revision 1485)
+++ trunk/milena/mln/win/diag2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_DIAG2D_HH
-# define MLN_CORE_WIN_DIAG2D_HH
+#ifndef MLN_WIN_DIAG2D_HH
+# define MLN_WIN_DIAG2D_HH
/*! \file mln/win/diag2d.hh
*
@@ -182,4 +182,4 @@
-#endif // ! MLN_CORE_WIN_DIAG2D_HH
+#endif // ! MLN_WIN_DIAG2D_HH
Index: trunk/milena/mln/win/rectangle2d.hh
===================================================================
--- trunk/milena/mln/win/rectangle2d.hh (revision 1485)
+++ trunk/milena/mln/win/rectangle2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_RECTANGLE2D_HH
-# define MLN_CORE_WIN_RECTANGLE2D_HH
+#ifndef MLN_WIN_RECTANGLE2D_HH
+# define MLN_WIN_RECTANGLE2D_HH
/*! \file mln/win/rectangle2d.hh
*
@@ -204,4 +204,4 @@
# include <mln/win/vline2d.hh>
-#endif // ! MLN_CORE_WIN_RECTANGLE2D_HH
+#endif // ! MLN_WIN_RECTANGLE2D_HH
Index: trunk/milena/mln/win/backdiag2d.hh
===================================================================
--- trunk/milena/mln/win/backdiag2d.hh (revision 1485)
+++ trunk/milena/mln/win/backdiag2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_BACKDIAG2D_HH
-# define MLN_CORE_WIN_BACKDIAG2D_HH
+#ifndef MLN_WIN_BACKDIAG2D_HH
+# define MLN_WIN_BACKDIAG2D_HH
/*! \file mln/win/backdiag2d.hh
*
@@ -182,4 +182,4 @@
-#endif // ! MLN_CORE_WIN_BACKDIAG2D_HH
+#endif // ! MLN_WIN_BACKDIAG2D_HH
Index: trunk/milena/mln/win/disk2d.hh
===================================================================
--- trunk/milena/mln/win/disk2d.hh (revision 1485)
+++ trunk/milena/mln/win/disk2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_DISK2D_HH
-# define MLN_CORE_WIN_DISK2D_HH
+#ifndef MLN_WIN_DISK2D_HH
+# define MLN_WIN_DISK2D_HH
/*! \file mln/win/disk2d.hh
*
@@ -176,4 +176,4 @@
-#endif // ! MLN_CORE_WIN_DISK2D_HH
+#endif // ! MLN_WIN_DISK2D_HH
Index: trunk/milena/mln/win/octagon2d.hh
===================================================================
--- trunk/milena/mln/win/octagon2d.hh (revision 1485)
+++ trunk/milena/mln/win/octagon2d.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_WIN_OCTAGON2D_HH
-# define MLN_CORE_WIN_OCTAGON2D_HH
+#ifndef MLN_WIN_OCTAGON2D_HH
+# define MLN_WIN_OCTAGON2D_HH
/*! \file mln/win/octagon2d.hh
*
@@ -223,4 +223,4 @@
# include <mln/win/diag2d.hh>
# include <mln/win/backdiag2d.hh>
-#endif // ! MLN_CORE_WIN_OCTAGON2D_HH
+#endif // ! MLN_WIN_OCTAGON2D_HH
Index: trunk/milena/mln/canvas/browsing/dir_ricard51.hh
===================================================================
--- trunk/milena/mln/canvas/browsing/dir_ricard51.hh (revision 1485)
+++ trunk/milena/mln/canvas/browsing/dir_ricard51.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CANVAS_DIR_RICARD51_HH
-# define MLN_CANVAS_DIR_RICARD51_HH
+#ifndef MLN_CANVAS_BROWSING_DIR_RICARD51_HH
+# define MLN_CANVAS_BROWSING_DIR_RICARD51_HH
/*! \file mln/canvas/browsing/dir_ricard51.hh
*
@@ -170,4 +170,4 @@
} // end of namespace mln
-#endif // ! MLN_CANVAS_DIR_RICARD51_HH
+#endif // ! MLN_CANVAS_BROWSING_DIR_RICARD51_HH
Index: trunk/milena/mln/canvas/browsing/directional.hh
===================================================================
--- trunk/milena/mln/canvas/browsing/directional.hh (revision 1485)
+++ trunk/milena/mln/canvas/browsing/directional.hh (revision 1486)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CANVAS_DIRECTIONAL_HH
-# define MLN_CANVAS_DIRECTIONAL_HH
+#ifndef MLN_CANVAS_BROWSING_DIRECTIONAL_HH
+# define MLN_CANVAS_BROWSING_DIRECTIONAL_HH
/*! \file mln/canvas/browsing/directional.hh
*
@@ -115,4 +115,4 @@
} // end of namespace mln
-#endif // ! MLN_CANVAS_DIRECTIONAL_HH
+#endif // ! MLN_CANVAS_BROWSING_DIRECTIONAL_HH
1
0
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");
+ }
+
+}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-15 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Review the mln/literal directory.
* mln/literal/black.hh,
* mln/literal/colors.hh,
* mln/literal/grays.hh,
* mln/literal/one.hh,
* mln/literal/origin.hh,
* mln/literal/white.hh,
* tests/literal/black.cc: Use extern const ref, not static. Move
impl. within MLN_INCLUDE_ONLY.
Move/add some unit tests.
* tests/literal/literal_medium_gray.cc: Rename as...
* tests/literal/medium_gray.cc: ...this.
* tests/literal/literal_zero.cc: Rename as...
* tests/literal/zero.cc: ...this.
* tests/literal/one.cc: New.
* tests/literal/white.cc: New.
---
mln/literal/black.hh | 9 +++++-
mln/literal/colors.hh | 14 ++++++++--
mln/literal/grays.hh | 9 +++++-
mln/literal/one.hh | 4 ++
mln/literal/origin.hh | 9 +++++-
mln/literal/white.hh | 9 +++++-
tests/literal/black.cc | 52 ++++++++++++++++++++++++++++++++++++++
tests/literal/medium_gray.cc | 57 ++++++++++++++++++++++++++++++++++++++++++
tests/literal/one.cc | 58 +++++++++++++++++++++++++++++++++++++++++++
tests/literal/white.cc | 53 +++++++++++++++++++++++++++++++++++++++
tests/literal/zero.cc | 58 +++++++++++++++++++++++++++++++++++++++++++
11 files changed, 323 insertions(+), 9 deletions(-)
Index: trunk/milena/tests/literal/literal_zero.cc (deleted)
===================================================================
Index: trunk/milena/tests/literal/literal_medium_gray.cc (deleted)
===================================================================
Index: trunk/milena/tests/literal/black.cc
===================================================================
--- trunk/milena/tests/literal/black.cc (revision 0)
+++ trunk/milena/tests/literal/black.cc (revision 1484)
@@ -0,0 +1,52 @@
+// 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/literal/black.cc
+ *
+ * \brief Tests on mln::literal::black.
+ */
+
+#include <mln/value/rgb8.hh>
+#include <mln/literal/black.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using value::rgb8;
+ using literal::black;
+
+ {
+ rgb8 c(0, 0, 0);
+
+ c.green() = 254;
+ mln_assertion(c != black);
+
+ c = black;
+ mln_assertion(c == black);
+ }
+}
Index: trunk/milena/tests/literal/zero.cc
===================================================================
--- trunk/milena/tests/literal/zero.cc (revision 0)
+++ trunk/milena/tests/literal/zero.cc (revision 1484)
@@ -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/literal/zero.cc
+ *
+ * \brief Tests on mln::literal::zero.
+ */
+
+#include <mln/literal/zero.hh>
+#include <mln/literal/one.hh>
+#include <mln/literal/ops.hh>
+#include <mln/value/int_u8.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned char c;
+ c = literal::zero;
+ mln_assertion(c == 0);
+
+ double d;
+ d = literal::zero;
+ mln_assertion(d == 0);
+
+ mln_assertion(literal::zero != literal::one);
+
+ value::int_u8 u(literal::zero), uu;
+ uu = literal::zero;
+
+ mln_assertion(u == 0 && 0 == u);
+}
Index: trunk/milena/tests/literal/white.cc
===================================================================
--- trunk/milena/tests/literal/white.cc (revision 0)
+++ trunk/milena/tests/literal/white.cc (revision 1484)
@@ -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/literal/white.cc
+ *
+ * \brief Tests on mln::literal::white.
+ */
+
+#include <mln/value/rgb8.hh>
+#include <mln/literal/white.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using value::rgb8;
+ using literal::white;
+
+ {
+ rgb8 c(255, 255, 255);
+
+
+ c.green() = 254;
+ mln_assertion(c != white);
+
+ c = white;
+ mln_assertion(c == white);
+ }
+}
Index: trunk/milena/tests/literal/one.cc
===================================================================
--- trunk/milena/tests/literal/one.cc (revision 0)
+++ trunk/milena/tests/literal/one.cc (revision 1484)
@@ -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/literal/one.cc
+ *
+ * \brief Tests on mln::literal::one.
+ */
+
+#include <mln/literal/one.hh>
+#include <mln/literal/zero.hh>
+#include <mln/literal/ops.hh>
+#include <mln/value/int_u8.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned char c;
+ c = literal::one;
+ mln_assertion(c == 1);
+
+ double d;
+ d = literal::one;
+ mln_assertion(d == 1);
+
+ mln_assertion(literal::one != literal::zero);
+
+ value::int_u8 u(literal::one), uu;
+ uu = literal::one;
+
+ mln_assertion(u == 1 && 1 == u);
+}
Index: trunk/milena/tests/literal/medium_gray.cc
===================================================================
--- trunk/milena/tests/literal/medium_gray.cc (revision 0)
+++ trunk/milena/tests/literal/medium_gray.cc (revision 1484)
@@ -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/literal/medium_gray.cc
+ *
+ * \brief Tests on mln::literal::medium_gray.
+ */
+
+#include <mln/literal/grays.hh>
+#include <mln/value/graylevel.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ using literal::medium_gray;
+ using value::gl8;
+ using value::gl16;
+
+ gl8 a;
+ gl16 b;
+
+ a = medium_gray;
+
+ std::cout << int(a.value()) << std::endl;
+
+ b = a;
+ std::cout << int(b.value()) << std::endl;
+
+ b = medium_gray;
+ std::cout << int(b.value()) << std::endl;
+}
Index: trunk/milena/mln/literal/colors.hh
===================================================================
--- trunk/milena/mln/literal/colors.hh (revision 1483)
+++ trunk/milena/mln/literal/colors.hh (revision 1484)
@@ -58,13 +58,21 @@
/// Literal red.
- static red_t red = red_t();
+ extern const red_t& red;
/// Literal green.
- static green_t green = green_t();
+ extern const green_t& green;
/// Literal blue.
- static blue_t blue = blue_t();
+ extern const blue_t& blue;
+
+# ifndef MLN_INCLUDE_ONLY
+
+ const red_t& red = red_t();
+ const green_t& green = green_t();
+ const blue_t& blue = blue_t();
+
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
Index: trunk/milena/mln/literal/one.hh
===================================================================
--- trunk/milena/mln/literal/one.hh (revision 1483)
+++ trunk/milena/mln/literal/one.hh (revision 1484)
@@ -54,7 +54,7 @@
/// Literal one.
- static one_t one = one_t();
+ extern const one_t& one;
# ifndef MLN_INCLUDE_ONLY
@@ -66,6 +66,8 @@
return 1;
}
+ const one_t& one = one_t();
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
Index: trunk/milena/mln/literal/grays.hh
===================================================================
--- trunk/milena/mln/literal/grays.hh (revision 1483)
+++ trunk/milena/mln/literal/grays.hh (revision 1484)
@@ -47,7 +47,14 @@
};
/// Literal medium_gray.
- static medium_gray_t medium_gray = medium_gray_t();
+ extern const medium_gray_t& medium_gray;
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ const medium_gray_t& medium_gray = medium_gray_t();
+
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
Index: trunk/milena/mln/literal/origin.hh
===================================================================
--- trunk/milena/mln/literal/origin.hh (revision 1483)
+++ trunk/milena/mln/literal/origin.hh (revision 1484)
@@ -47,9 +47,14 @@
{
};
-
/// Literal origin.
- static origin_t origin = origin_t();
+ extern const origin_t& origin;
+
+# ifndef MLN_INCLUDE_ONLY
+
+ const origin_t& origin = origin_t();
+
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
Index: trunk/milena/mln/literal/black.hh
===================================================================
--- trunk/milena/mln/literal/black.hh (revision 1483)
+++ trunk/milena/mln/literal/black.hh (revision 1484)
@@ -48,7 +48,14 @@
/// Literal black.
- static black_t black = black_t();
+ extern const black_t& black;
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ const black_t& black = black_t();
+
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
Index: trunk/milena/mln/literal/white.hh
===================================================================
--- trunk/milena/mln/literal/white.hh (revision 1483)
+++ trunk/milena/mln/literal/white.hh (revision 1484)
@@ -48,7 +48,14 @@
/// Literal white.
- static white_t white = white_t();
+ extern const white_t& white;
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ const white_t& white = white_t();
+
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
1
0
15 Nov '07
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-15 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Move literals tests into tests/literal directory.
* tests/literal: New.
* tests/literal_medium_gray.cc: Rename as...
* tests/literal/literal_medium_gray.cc: ...this.
* tests/literal_zero.cc: Rename as...
* tests/literal/literal_zero.cc: ...this.
---
literal_medium_gray.cc | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
literal_zero.cc | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)
Index: trunk/milena/tests/literal_zero.cc (deleted)
===================================================================
Index: trunk/milena/tests/literal_medium_gray.cc (deleted)
===================================================================
Index: trunk/milena/tests/literal/literal_zero.cc
===================================================================
--- trunk/milena/tests/literal/literal_zero.cc (revision 0)
+++ trunk/milena/tests/literal/literal_zero.cc (revision 1483)
@@ -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/literal_zero.cc
+ *
+ * \brief Tests on mln::literal::zero.
+ */
+
+#include <mln/literal/zero.hh>
+#include <mln/literal/one.hh>
+#include <mln/literal/ops.hh>
+#include <mln/value/int_u8.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned char c;
+ c = literal::zero;
+ mln_assertion(c == 0);
+
+ double d;
+ d = literal::zero;
+ mln_assertion(d == 0);
+
+ mln_assertion(literal::zero != literal::one);
+
+ value::int_u8 u(literal::zero), uu;
+ uu = literal::zero;
+
+ mln_assertion(u == 0 && 0 == u);
+}
Index: trunk/milena/tests/literal/literal_medium_gray.cc
===================================================================
--- trunk/milena/tests/literal/literal_medium_gray.cc (revision 0)
+++ trunk/milena/tests/literal/literal_medium_gray.cc (revision 1483)
@@ -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/literal_medium_gray.cc
+ *
+ * \brief Tests on mln::literal::medium_gray.
+ */
+
+#include <mln/literal/grays.hh>
+#include <mln/value/graylevel.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ using literal::medium_gray;
+ using value::gl8;
+ using value::gl16;
+
+ gl8 a;
+ gl16 b;
+
+ a = medium_gray;
+
+ std::cout << int(a.value()) << std::endl;
+
+ b = a;
+ std::cout << int(b.value()) << std::endl;
+
+ b = medium_gray;
+ std::cout << int(b.value()) << std::endl;
+}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-15 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fix a bug in io::pbm::save.
* mln/io/pbm/save.hh: Fix a shift of 1 pixel in the image
saved.
* tests/io_pbm.cc: Update the test to ouput more pbm images.
---
mln/io/pbm/save.hh | 13 +++++++++----
tests/io_pbm.cc | 18 +++++++++++-------
2 files changed, 20 insertions(+), 11 deletions(-)
Index: trunk/milena/tests/io_pbm.cc
===================================================================
--- trunk/milena/tests/io_pbm.cc (revision 1481)
+++ trunk/milena/tests/io_pbm.cc (revision 1482)
@@ -42,6 +42,9 @@
#include <mln/level/compare.hh>
#include <mln/level/fill.hh>
+#include <mln/display/show.hh>
+#include <mln/display/save.hh>
+
#include <mln/border/thickness.hh>
int main()
@@ -49,27 +52,28 @@
using namespace mln;
using typename value::int_u8;
+ typedef image2d< bool > I;
+
border::thickness = 0;
image2d< int_u8 >
lena = io::pgm::load("../img/lena.pgm");
- image2d< bool > out(lena.domain());
+ I out(lena.domain());
level::fill(out, pw::value(lena) > pw::cst(127));
io::pbm::save(out, "out.pbm");
{
- image2d< bool >
- lena = io::pbm::load("out.pbm");
+ I lena = io::pbm::load("out.pbm");
image2d<bool> out(lena.domain());
- io::pbm::save(lena, "out.pbm");
+ io::pbm::save(lena, "out2.pbm");
- image2d< bool >
- lena2 = io::pbm::load("out.pbm");
+ I lena2 = io::pbm::load("out2.pbm");
- io::pbm::save(lena2, "out2.pbm");
+ io::pbm::save(lena2, "out3.pbm");
+ mln_assertion(lena.domain() == lena2.domain());
mln_assertion(lena == lena2);
}
}
Index: trunk/milena/mln/io/pbm/save.hh
===================================================================
--- trunk/milena/mln/io/pbm/save.hh (revision 1481)
+++ trunk/milena/mln/io/pbm/save.hh (revision 1482)
@@ -89,15 +89,20 @@
unsigned char c = 0;
int i = 0;
- for (p.row() = min_row; p.row() <= max_row; ++p.row())
- for (p.col() = min_col; p.col() <= max_col; ++p.col())
+
+ mln_piter(I) it(ima.domain());
+ for_all(it)
+ {
+ if (i && (i == 8))
{
- c += ima(p);
- if (i && (i % 8 == 0))
file.write((char*)(&c), 1);
+ i = 0;
+ }
c = c * 2;
+ c += ima(it);
++i;
}
+ file.write((char*)(&c), 1);
}
} // end of namespace mln::io::impl
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix the initialization of mln::literal::zero.
* mln/literal/zero.hh (mln::literal::zero): s/static/extern const/.
Use a reference.
Move implementation within MLN_INCLUDE_ONLY.
zero.hh | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
Index: mln/literal/zero.hh
--- mln/literal/zero.hh (revision 1480)
+++ mln/literal/zero.hh (working copy)
@@ -56,7 +56,7 @@
/// Literal zero.
- static zero_t zero = zero_t();
+ extern const zero_t& zero;
# ifndef MLN_INCLUDE_ONLY
@@ -68,6 +68,8 @@
return 0;
}
+ const zero_t& zero = zero_t();
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::literal
1
0
La route vers Olena 1.0 beta est par là :
https://trac.lrde.org/olena/wiki/Olena/Release1.0beta
J'ai pas encore créé les premiers tickets et les bornes (milestones)
intermédiaires avant le Beta-Graal
(https://trac.lrde.org/olena/milestone/Olena%201.0%C3%9F) On regarde
ça demain ?
1
0
14 Nov '07
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Change value index type is now 'unsigned'; several fixes.
Use "out foo(in)" instead of "void foo(in, out)".
* mln/labeling/level.hh: Do it.
* mln/labeling/foreground.hh: Do it.
* mln/labeling/background.hh: Do it.
* tests/labeling_algo.cc: Update.
* tests/labeling_level_fast.cc: Update.
* tests/labeling_foreground.cc: Update.
* tests/labeling_estimate.cc: Update.
* tests/clock_test.cc: Update.
* tests/seed2tiling.cc: Update.
Add another labeling algorithm for comparison purpose.
* mln/labeling/blobs.hh: New.
* tests/labeling_blobs.cc: New.
Change value index type from std::size_t to unsigned.
* mln/core/concept/value_set.hh: Do it.
* mln/core/concept/doc/value_set.hh: Update.
* mln/core/image2d.hh: Layout.
* mln/accu/histo.hh: Update.
* mln/value/other.hh: Update.
* mln/value/lut_vec.hh: Update.
* mln/value/float01_.hh: Update.
* mln/value/internal/iterable_set.hh: Update.
* mln/value/label.hh: Update.
* mln/convert/to_image.hh: Update.
Misc.
* tests/util_ordpair.cc: New.
* tests/core_p_set.cc: Layout.
* tests/convert_to_p_vec.cc: Remove; now obsolete
cause replaced by tests/convert_to_p_array.cc.
* tests/value_bool.cc: New.
* mln/core/cast_image.hh (trait): New specialization.
* mln/value/props.hh (value_at_index, index_of_value):
Update.
Explicitly compute with int/unsigned.
* mln/value/float01.hh: Fix missing includes.
* mln/convert/to_p_set.hh: Layout.
* mln/io/pnm/save.hh: Fix missing std::.
* mln/io/pnm/load.hh: Likewise.
* mln/io/pbm/load.hh: Fix.
* mln/util/tree_fast_to_image.hh (q): Rename as...
(l): ...this.
* mln/util/ordpair.hh: New.
mln/accu/histo.hh | 8 +-
mln/convert/to_image.hh | 4 -
mln/convert/to_p_set.hh | 1
mln/core/cast_image.hh | 13 +++
mln/core/concept/doc/value_set.hh | 6 -
mln/core/concept/value_set.hh | 24 +++++-
mln/core/image2d.hh | 3
mln/io/pbm/load.hh | 11 +-
mln/io/pnm/load.hh | 2
mln/io/pnm/save.hh | 4 -
mln/labeling/background.hh | 20 ++---
mln/labeling/blobs.hh | 134 +++++++++++++++++++++++++++++++++++
mln/labeling/foreground.hh | 20 ++---
mln/labeling/level.hh | 64 ++++++++++-------
mln/util/ordpair.hh | 139 +++++++++++++++++++++++++++++++++++++
mln/util/tree_fast_to_image.hh | 16 ++--
mln/value/float01.hh | 3
mln/value/float01_.hh | 4 -
mln/value/internal/iterable_set.hh | 14 ++-
mln/value/label.hh | 4 -
mln/value/lut_vec.hh | 12 +--
mln/value/other.hh | 2
mln/value/props.hh | 11 +-
tests/clock_test.cc | 8 --
tests/core_p_set.cc | 2
tests/labeling_algo.cc | 11 +-
tests/labeling_blobs.cc | 75 +++++++++++++++++++
tests/labeling_estimate.cc | 7 -
tests/labeling_foreground.cc | 30 ++++++-
tests/labeling_level_fast.cc | 3
tests/seed2tiling.cc | 13 +--
tests/util_ordpair.cc | 44 +++++++++++
tests/value_bool.cc | 45 +++++++++++
33 files changed, 621 insertions(+), 136 deletions(-)
Index: tests/labeling_blobs.cc
--- tests/labeling_blobs.cc (revision 0)
+++ tests/labeling_blobs.cc (revision 0)
@@ -0,0 +1,75 @@
+// 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/labeling_blob.cc
+ *
+ * \brief Test on mln::labeling::blob.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/cast_image.hh>
+#include <mln/core/neighb2d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/pw/all.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/labeling/blobs.hh>
+#include <mln/level/transform.hh>
+
+
+struct fold_t : public mln::Function_v2v< fold_t >
+{
+ typedef mln::value::int_u8 result;
+ result operator()(unsigned i) const { return i = 0 ? 0 : i % 255 + 1; }
+};
+
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+
+ image2d<int_u8> lena = io::pgm::load("../img/tiny.pgm");
+ unsigned n;
+ io::pgm::save(cast_image<int_u8>( labeling::blobs((pw::value(lena) > pw::cst(127u)) | lena.domain(),
+ c4(), n) ),
+ "out.pgm");
+ mln_assertion(n = 14);
+
+// image2d<int_u8>
+// lena = io::pgm::load("../img/lena.pgm"),
+// out;
+// unsigned n;
+// image2d<unsigned> labels = labeling::blobs((pw::value(lena) > pw::cst(127u)) | lena.domain(),
+// c8(), n);
+// mln_assertion(n = 528);
+// io::pgm::save( level::transform(labels, fold_t()),
+// "out.pgm" );
+}
Index: tests/labeling_algo.cc
--- tests/labeling_algo.cc (revision 1479)
+++ tests/labeling_algo.cc (working copy)
@@ -52,20 +52,17 @@
image2d<bool> in = io::pbm::load("../img/toto.pbm");
- image2d<int_u8> lab(in.domain());
- image2d<int_u8> inte(in.domain());
- image2d<int_u8> out(in.domain());
unsigned n;
- labeling::foreground(in, c8(), lab, n);
+ image2d<unsigned> lab = labeling::foreground(in, c8(), n);
std::cout << "number of labels = " << n << std::endl;
std::vector<int_u8> vec;
image2d<int> input(in.domain());
level::fill(input, lab);
- lab(make::point2d (0,0)) = 0;
+ lab.at(0,0) = 0;
- inte = geom::seeds2tiling(lab, c4 ());
+ image2d<unsigned> inte = geom::seeds2tiling(lab, c4 ());
border::fill (inte, 0);
image2d<int_u8> inte2(inte.domain());
@@ -76,6 +73,8 @@
mesh_p<point2d> m = make::voronoi(inte, lab, c4());
std::cout << "OK : generate inte.pgm and out.pgm" << std::endl;
+
+ image2d<int_u8> out(in.domain());
draw::mesh (out, m, 255, 128);
io::pgm::save(out, "out.pgm");
Index: tests/util_ordpair.cc
--- tests/util_ordpair.cc (revision 0)
+++ tests/util_ordpair.cc (revision 0)
@@ -0,0 +1,44 @@
+// 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 util/ordpair.cc
+ *
+ * \brief Tests on mln::util::ordpair.
+ */
+
+#include <mln/core/point2d.hh>
+#include <mln/util/ordpair.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ point2d p1(5,6), p2(5,7);
+ std::cout << util::ordpair(p1, p2) << std::endl;
+}
Index: tests/labeling_level_fast.cc
--- tests/labeling_level_fast.cc (revision 1479)
+++ tests/labeling_level_fast.cc (working copy)
@@ -55,8 +55,7 @@
debug::println(i1);
unsigned n;
- image2d<value::int_u8> out(i1.domain());
- labeling::level(i1, 2, c4(), out, n);
+ image2d<unsigned> out = labeling::level(i1, 2, c4(), n);
std::cout << "n = " << n << std::endl;
debug::println(out);
Index: tests/core_p_set.cc
--- tests/core_p_set.cc (revision 1479)
+++ tests/core_p_set.cc (working copy)
@@ -54,6 +54,4 @@
std::copy(ps.vect().begin(), ps.vect().end(),
std::ostream_iterator<point2d>(std::cout, " "));
std::cout << std::endl;
-
-
}
Index: tests/clock_test.cc
--- tests/clock_test.cc (revision 1479)
+++ tests/clock_test.cc (working copy)
@@ -149,12 +149,10 @@
a3, 1, a4,
a5, a6, a7};
- image2d<value::int_u8> out(ima.domain());
- image2d<value::int_u8> out2(ima.domain());
level::fill(ima, t);
- labeling::level(ima, false, c8(), out, n);
+ image2d<unsigned> out = labeling::level(ima, false, c8(), n);
tmp = testc4(ima, p);
if (tmp != n)
{
@@ -174,11 +172,11 @@
/// 0 before
level::fill(ima, u);
- labeling::level(ima, false, c4(), out, m);
+ out = labeling::level(ima, false, c4(), m);
/// 1 after
level::fill(ima, t);
- labeling::level(ima, false, c4(), out2, n);
+ image2d<unsigned> out2 = labeling::level(ima, false, c4(), n);
int diff = n - m;
if (diff < 0)
Index: tests/labeling_foreground.cc
--- tests/labeling_foreground.cc (revision 1479)
+++ tests/labeling_foreground.cc (working copy)
@@ -34,10 +34,19 @@
#include <mln/core/neighb2d.hh>
#include <mln/value/int_u8.hh>
#include <mln/pw/all.hh>
+#include <mln/core/cast_image.hh>
#include <mln/io/pgm/load.hh>
#include <mln/io/pgm/save.hh>
#include <mln/labeling/foreground.hh>
+#include <mln/level/transform.hh>
+
+
+struct fold_t : public mln::Function_v2v< fold_t >
+{
+ typedef mln::value::int_u8 result;
+ result operator()(unsigned i) const { return i = 0 ? 0 : i % 255 + 1; }
+};
int main()
@@ -45,13 +54,20 @@
using namespace mln;
using value::int_u8;
- image2d<int_u8>
- lena = io::pgm::load("../img/tiny.pgm"),
- out(lena.domain());
-
+ image2d<int_u8> lena = io::pgm::load("../img/tiny.pgm");
unsigned n;
- labeling::foreground((pw::value(lena) > pw::cst(127u)) | lena.domain(),
- c4(), out, n);
- io::pgm::save(out, "out.pgm");
+ io::pgm::save(cast_image<int_u8>( labeling::foreground((pw::value(lena) > pw::cst(127u)) | lena.domain(),
+ c4(), n) ),
+ "out.pgm");
mln_assertion(n = 14);
+
+// image2d<int_u8>
+// lena = io::pgm::load("../img/lena.pgm"),
+// out;
+// unsigned n;
+// image2d<unsigned> labels = labeling::foreground((pw::value(lena) > pw::cst(127u)) | lena.domain(),
+// c8(), n);
+// mln_assertion(n = 528);
+// io::pgm::save( level::transform(labels, fold_t()),
+// "out.pgm" );
}
Index: tests/labeling_estimate.cc
--- tests/labeling_estimate.cc (revision 1479)
+++ tests/labeling_estimate.cc (working copy)
@@ -46,13 +46,12 @@
using namespace mln;
using value::int_u8;
- image2d<int_u8> lena = io::pgm::load("../img/tiny.pgm"),
- out(lena.domain());
+ image2d<int_u8> lena = io::pgm::load("../img/tiny.pgm");
// FIXME: Below, 127u (instead of 127) is mandatory to avoid a warning...
unsigned n;
- labeling::foreground((pw::value(lena) > pw::cst(127u)) | lena.domain(),
- c4(), out, n);
+ image2d<unsigned> out = labeling::foreground((pw::value(lena) > pw::cst(127u)) | lena.domain(),
+ c4(), n);
mln_assertion(n = 14);
unsigned sum = 0;
Index: tests/seed2tiling.cc
--- tests/seed2tiling.cc (revision 1479)
+++ tests/seed2tiling.cc (working copy)
@@ -69,21 +69,17 @@
image2d<bool> input = io::pbm::load(argv[1]);
{
-
- image2d<unsigned> lab(input.domain());
- image2d<unsigned> inte(input.domain());
- image2d<int_u8> inte2(input.domain());
- image2d<int_u8> out(input.domain());
-
const w_window2d_int& w_win = make::mk_chamfer_3x3_int<2,3> ();
unsigned n;
- labeling::foreground(input, c4(), lab, n);
+ image2d<unsigned> lab = labeling::foreground(input, c4(), n);
std::cout << "number of labels = " << n << std::endl;
- inte = geom::seeds2tiling(lab, c4 ());
+ image2d<unsigned> inte = geom::seeds2tiling(lab, c4 ());
border::fill (inte, 0);
+
+ image2d<int_u8> inte2(input.domain());
level::stretch (inte, inte2);
io::pgm::save(inte2, "ima1.pgm");
@@ -91,6 +87,7 @@
<< std::endl;
inte = geom::seeds2tiling_with_chamfer(lab, w_win, max, c4 ());
border::fill (inte, 0);
+
level::stretch (inte, inte2);
io::pgm::save(inte2, "ima2.pgm");
Index: tests/value_bool.cc
--- tests/value_bool.cc (revision 0)
+++ tests/value_bool.cc (revision 0)
@@ -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.
+
+/*! \file tests/value_bool.cc
+ *
+ * \brief Tests on mln::value::set.
+ */
+
+#include <mln/value/props.hh>
+#include <mln/value/set.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(mln::trait::value_<bool>::card::value = 2);
+
+ value::set<bool> B;
+ std::cout << B << std::endl;
+}
Index: mln/core/cast_image.hh
--- mln/core/cast_image.hh (revision 1479)
+++ mln/core/cast_image.hh (working copy)
@@ -62,6 +62,19 @@
+ namespace trait
+ {
+
+ template <typename T, typename I>
+ struct image_< cast_image_<T,I> > : default_image_morpher_< I, T, cast_image_<T,I> >
+ {
+ typedef trait::image::io::read_only io;
+ };
+
+ } // end of namespace mln::trait
+
+
+
/*! \brief FIXME
*
*/
Index: mln/core/concept/value_set.hh
--- mln/core/concept/value_set.hh (revision 1479)
+++ mln/core/concept/value_set.hh (working copy)
@@ -66,10 +66,10 @@
bool has(const value& v) const;
- value operator[](std::size_t i) const;
- std::size_t index_of(const value& v) const;
+ value operator[](unsigned i) const;
+ unsigned index_of(const value& v) const;
- std::size_t nvalues() const;
+ unsigned nvalues() const;
*/
protected:
@@ -77,6 +77,10 @@
};
+ template <typename E>
+ std::ostream& operator<<(std::ostream& ostr, const Value_Set<E>& vs);
+
+
# ifndef MLN_INCLUDE_ONLY
template <typename E>
@@ -88,12 +92,22 @@
bool (E::*m1)(const value&) const = & E::has;
m1 = 0;
- value (E::*m2)(std::size_t) const = & E::operator[];
+ value (E::*m2)(unsigned) const = & E::operator[];
m2 = 0;
- std::size_t (E::*m3)() const = & E::nvalues;
+ unsigned (E::*m3)() const = & E::nvalues;
m3 = 0;
}
+ template <typename E>
+ std::ostream& operator<<(std::ostream& ostr, const Value_Set<E>& vs_)
+ {
+ const E& vs = exact(vs_);
+ ostr << "{ ";
+ for (unsigned i = 0; i < vs.nvalues(); ++i)
+ std::cout << vs[i] << ' ';
+ return ostr << '}';
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: mln/core/concept/doc/value_set.hh
--- mln/core/concept/doc/value_set.hh (revision 1479)
+++ mln/core/concept/doc/value_set.hh (working copy)
@@ -63,15 +63,15 @@
/*! \brief Give the number of values in this set.
*/
- std::size_t nvalues() const;
+ unsigned nvalues() const;
/*! \brief Give the \p i-th value of this set.
*/
- value operator[](std::size_t i) const;
+ value operator[](unsigned i) const;
/*! \brief Give the index of value \p v in this set.
*/
- std::size_t index_of(const value& v) const;
+ unsigned index_of(const value& v) const;
};
} // end of namespace mln::doc
Index: mln/core/image2d.hh
--- mln/core/image2d.hh (revision 1479)
+++ mln/core/image2d.hh (working copy)
@@ -208,11 +208,8 @@
T* buffer();
-
-
/// Resize image border with new_border.
void resize_(unsigned new_border);
-
};
Index: mln/accu/histo.hh
--- mln/accu/histo.hh (revision 1479)
+++ mln/accu/histo.hh (working copy)
@@ -67,8 +67,8 @@
void init();
std::size_t operator()(const argument& t) const;
- std::size_t operator[](std::size_t i) const;
- std::size_t nvalues() const;
+ std::size_t operator[](unsigned i) const;
+ unsigned nvalues() const;
std::size_t sum() const;
const std::vector<std::size_t>& vect() const;
@@ -152,14 +152,14 @@
template <typename S>
std::size_t
- histo<S>::operator[](std::size_t i) const
+ histo<S>::operator[](unsigned i) const
{
mln_precondition(i < s_.nvalues());
return h_[i];
}
template <typename S>
- std::size_t
+ unsigned
histo<S>::nvalues() const
{
return s_.nvalues();
Index: mln/value/other.hh
--- mln/value/other.hh (revision 1479)
+++ mln/value/other.hh (working copy)
@@ -92,7 +92,7 @@
{
const V& val = exact(val_);
value::set<V> s;
- std::size_t i = s.index_of(val);
+ unsigned i = s.index_of(val);
mln_assertion(s.nvalues() >= 2);
return i = 0 ? s[1] : s[0];
}
Index: mln/value/lut_vec.hh
--- mln/value/lut_vec.hh (revision 1479)
+++ mln/value/lut_vec.hh (working copy)
@@ -70,10 +70,10 @@
typedef bkd_viter_< lut_vec<S,T> > bkd_viter;
/// Give the \p i-th value.
- T operator[](std::size_t i) const;
+ T operator[](unsigned i) const;
/// Give the number of values.
- std::size_t nvalues() const;
+ unsigned nvalues() const;
// Apply the look-up-table. FIXME: Doc!
T operator()(const mln_value(S)& val) const;
@@ -82,7 +82,7 @@
bool has(const value& v) const;
/// Give the index of value \p v in this set.
- std::size_t index_of(const value& v) const;
+ unsigned index_of(const value& v) const;
/// Ctor. FIXME!
template <typename F>
@@ -108,7 +108,7 @@
}
template <typename S, typename T>
- std::size_t
+ unsigned
lut_vec<S,T>::index_of(const T& v) const
{
mln_invariant(0); // FIXME
@@ -137,14 +137,14 @@
template <typename S, typename T>
T
- lut_vec<S,T>::operator[](std::size_t i) const
+ lut_vec<S,T>::operator[](unsigned i) const
{
mln_precondition(i < nvalues());
return vec_[i];
}
template <typename S, typename T>
- std::size_t
+ unsigned
lut_vec<S,T>::nvalues() const
{
return vec_.size();
Index: mln/value/float01_.hh
--- mln/value/float01_.hh (revision 1479)
+++ mln/value/float01_.hh (working copy)
@@ -92,14 +92,14 @@
template <unsigned n>
struct convert_< float01_<n> >
{
- static float01_<n> value_at_index(std::size_t i)
+ static float01_<n> value_at_index(unsigned i)
{
float01_<n> tmp;
tmp.set_ind(i);
return tmp;
}
- static std::size_t index_of_value(const float01_<n>& v)
+ static unsigned index_of_value(const float01_<n>& v)
{
return v.to_enc();
}
Index: mln/value/internal/iterable_set.hh
--- mln/value/internal/iterable_set.hh (revision 1479)
+++ mln/value/internal/iterable_set.hh (working copy)
@@ -35,6 +35,8 @@
# include <mln/core/concept/value_set.hh>
# include <mln/value/props.hh>
+# include <mln/trait/value_.hh>
+# include <mln/value/builtin/all.hh>
namespace mln
@@ -71,13 +73,13 @@
bool has(const T& v) const;
/// Give the \p i-th value.
- T operator[](std::size_t i) const;
+ T operator[](unsigned i) const;
/// Give the index of value \p v in this iterable_set.
- std::size_t index_of(const T& v) const;
+ unsigned index_of(const T& v) const;
/// Give the number of values.
- std::size_t nvalues() const;
+ unsigned nvalues() const;
};
@@ -93,21 +95,21 @@
template <typename T, typename E>
T
- iterable_set<T,E>::operator[](std::size_t i) const
+ iterable_set<T,E>::operator[](unsigned i) const
{
mln_precondition(i < nvalues());
return mln::value::internal::convert_<T>::value_at_index(i);
}
template <typename T, typename E>
- std::size_t
+ unsigned
iterable_set<T,E>::index_of(const T& v) const
{
return mln::value::internal::convert_<T>::index_of_value(v);
}
template <typename T, typename E>
- std::size_t
+ unsigned
iterable_set<T,E>::nvalues() const
{
typedef mln_trait_value_card(T) card_;
Index: mln/value/props.hh
--- mln/value/props.hh (revision 1479)
+++ mln/value/props.hh (working copy)
@@ -96,14 +96,17 @@
template <typename T>
struct convert_
{
- static T value_at_index(std::size_t i)
+ // FIXME: Check that we have a type T compatible with 'int'.
+
+ static T value_at_index(unsigned i)
{
- return mln_min(T) + i;
+ return T( int(mln_min(T)) + int(i) );
}
- static std::size_t index_of_value(const T& v)
+ static unsigned index_of_value(const T& v)
{
- return v - mln_min(T);
+ return unsigned( int(v) - int(mln_min(T)) );
}
+
};
template <typename T>
Index: mln/value/float01.hh
--- mln/value/float01.hh (revision 1479)
+++ mln/value/float01.hh (working copy)
@@ -38,6 +38,9 @@
# include <mln/core/concept/value.hh>
# include <mln/value/float01_.hh>
+# include <mln/value/props.hh>
+# include <mln/trait/all.hh> // FIXME!
+# include <mln/trait/value_.hh>
Index: mln/value/label.hh
--- mln/value/label.hh (revision 1479)
+++ mln/value/label.hh (working copy)
@@ -96,11 +96,11 @@
template <unsigned n>
struct convert_< label<n> >
{
- static label<n> value_at_index(std::size_t i)
+ static label<n> value_at_index(unsigned i)
{
return i;
}
- static std::size_t index_of_value(const label<n>& v)
+ static unsigned index_of_value(const label<n>& v)
{
return v.to_enc();
}
Index: mln/convert/to_image.hh
--- mln/convert/to_image.hh (revision 1479)
+++ mln/convert/to_image.hh (working copy)
@@ -184,8 +184,8 @@
v_min = h.vset()[0],
v_max = h.vset()[h.vset().nvalues() - 1];
image1d<std::size_t> ima(make::box1d(v_min, v_max));
- for(std::size_t i = 0; i < h.vset().nvalues(); ++i)
- ima(make::point1d(i)) = h[i];
+ for(unsigned i = 0; i < h.vset().nvalues(); ++i)
+ ima(i) = h[i];
return ima;
}
Index: mln/convert/to_p_set.hh
--- mln/convert/to_p_set.hh (revision 1479)
+++ mln/convert/to_p_set.hh (working copy)
@@ -128,7 +128,6 @@
return pset;
}
-
template <typename S>
p_set<mln_psite(S)> to_p_set(const Point_Set<S>& ps_)
{
Index: mln/io/pnm/save.hh
--- mln/io/pnm/save.hh (revision 1479)
+++ mln/io/pnm/save.hh (working copy)
@@ -92,7 +92,7 @@
// write a scalar value into for uncontiguous datas
template <typename V>
void write_value(std::ofstream& file,
- V& v)
+ const V& v)
{
typedef typename V::enc E;
@@ -129,7 +129,7 @@
max_row = geom::max_row(ima);
point2d p;
p.col() = geom::min_col(ima);
- size_t len = geom::ncols(ima) * sizeof(mln_value(I));
+ std::size_t len = geom::ncols(ima) * sizeof(mln_value(I));
for (p.row() = min_row; p.row() <= max_row; ++p.row())
file.write((char*)(& ima(p)), len);
}
Index: mln/io/pnm/load.hh
--- mln/io/pnm/load.hh (revision 1479)
+++ mln/io/pnm/load.hh (working copy)
@@ -113,7 +113,7 @@
min_row = geom::min_row(ima),
max_row = geom::max_row(ima);
- size_t len = geom::ncols(ima) * sizeof(V);
+ std::size_t len = geom::ncols(ima) * sizeof(V);
for (p.row() = min_row; p.row() <= max_row; ++p.row())
file.read((char*)(&ima(p)), len);
}
Index: mln/io/pbm/load.hh
--- mln/io/pbm/load.hh (revision 1479)
+++ mln/io/pbm/load.hh (working copy)
@@ -85,18 +85,21 @@
min_col = geom::min_col(ima),
max_col = geom::max_col(ima);
- unsigned char c;
- int i = 0;
+ char c;
+ int i;
for (p.row() = min_row; p.row() <= max_row; ++p.row())
+ {
+ i = 0;
for (p.col() = min_col; p.col() <= max_col; ++p.col())
{
- if (i && (i % 8 = 0))
+ if (i % 8 = 0)
file.read((char*)(&c), 1);
ima(p) = c & 128;
- c = c * 2;
+ c *= 2;
++i;
}
}
+ }
} // end of namespace mln::io::internal
Index: mln/util/tree_fast_to_image.hh
--- mln/util/tree_fast_to_image.hh (revision 1479)
+++ mln/util/tree_fast_to_image.hh (working copy)
@@ -37,7 +37,7 @@
*/
# include <mln/util/tree_fast.hh>
-# include <mln/core/set_p.hh>
+# include <mln/core/p_set.hh>
# include <list>
namespace mln
@@ -57,22 +57,22 @@
tree_fast_to_image (tree_fast<T>& tree, Image<I>& output_)
{
I& output = exact(output_);
- std::list<unsigned> q;
+ std::list<unsigned> l;
- q.push_back (tree.root_);
- while (!(q.empty ()))
+ l.push_back (tree.root_);
+ while (! l.empty())
{
- unsigned current = q.front ();
+ unsigned current = l.front();
for (unsigned i = 0; i < tree.child_[current].size (); ++i)
- q.push_back (tree.child_[current][i]);
+ l.push_back(tree.child_[current][i]);
- mln_piter(set_p<point2d>) p(tree.data_[current].points);
+ mln_piter(p_set<point2d>) p(tree.data_[current].points);
for_all(p)
{
output(p) = tree.data_[current].value;
}
- q.pop_front ();
+ l.pop_front();
}
}
Index: mln/util/ordpair.hh
--- mln/util/ordpair.hh (revision 0)
+++ mln/util/ordpair.hh (revision 0)
@@ -0,0 +1,139 @@
+// 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_UTIL_ORDPAIR_HH
+# define MLN_UTIL_ORDPAIR_HH
+
+/*! \file mln/util/ordpair.hh
+ *
+ * \brief Definition of an ordered pair.
+ */
+
+# include <mln/core/concept/object.hh>
+
+
+namespace mln
+{
+
+ namespace util
+ {
+
+ /// Ordered pair structure s.a. this->first <= this->second;
+ /// ordered pairs are partially ordered using lexicographical
+ /// ordering.
+ template <typename T>
+ struct ordpair_ : public mln::Object< ordpair_<T> >
+ {
+ ordpair_(const T& t1, const T& t2);
+ T first;
+ T second;
+ };
+
+
+ template <typename T>
+ bool operator=(const ordpair_<T>& lhs, const ordpair_<T>& rhs);
+
+ template <typename T>
+ bool operator< (const ordpair_<T>& lhs, const ordpair_<T>& rhs);
+
+ template <typename T>
+ bool operator<=(const ordpair_<T>& lhs, const ordpair_<T>& rhs);
+
+
+ template <typename T>
+ std::ostream& operator<<(std::ostream& ostr, const ordpair_<T>& op);
+
+
+ /// Routine to construct a ordpair on the fly.
+ template <typename T>
+ ordpair_<T> ordpair(const T& t1, const T& t2);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T>
+ ordpair_<T>::ordpair_(const T& t1, const T& t2)
+ {
+ if (t1 > t2)
+ {
+ first = t2;
+ second = t1;
+ }
+ else
+ {
+ first = t1;
+ second = t2;
+ }
+ mln_postcondition(first <= second);
+ }
+
+ template <typename T>
+ bool operator=(const ordpair_<T>& lhs, const ordpair_<T>& rhs)
+ {
+ return lhs.first = rhs.first && lhs.second = rhs.second;
+ }
+
+ template <typename T>
+ bool operator< (const ordpair_<T>& lhs, const ordpair_<T>& rhs)
+ {
+ return
+ lhs.first < rhs.first ||
+ (lhs.first = rhs.first && lhs.second < rhs.second);
+ }
+
+ template <typename T>
+ bool operator<=(const ordpair_<T>& lhs, const ordpair_<T>& rhs)
+ {
+ return
+ lhs.first < rhs.first ||
+ (lhs.first = rhs.first && lhs.second <= rhs.second);
+ }
+
+
+ template <typename T>
+ std::ostream& operator<<(std::ostream& ostr, const ordpair_<T>& op)
+ {
+ return ostr << '(' << op.first << ',' << op.second << ')';
+ }
+
+
+ template <typename T>
+ ordpair_<T>
+ ordpair(const T& t1, const T& t2)
+ {
+ ordpair_<T> tmp(t1, t2);
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::util
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_EXACT_HH
Index: mln/labeling/blobs.hh
--- mln/labeling/blobs.hh (revision 0)
+++ mln/labeling/blobs.hh (revision 0)
@@ -0,0 +1,134 @@
+// 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_LABELING_BLOBS_HH
+# define MLN_LABELING_BLOBS_HH
+
+/*! \file mln/labeling/blobs.hh
+ *
+ * \brief Connected component labeling of the image objects at a given
+ * blobs.
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/level/fill.hh>
+# include <mln/core/p_queue_fast.hh>
+
+
+
+namespace mln
+{
+
+ namespace labeling
+ {
+
+ /*! Connected component labeling of the binary objects of a binary
+ * image.
+ *
+ * \param[in] input The input image.
+ * \param[in] nbh The neighborhood.
+ * \param[out] nlabels The number of labels.
+ * \return The label image.
+ *
+ * A fast queue is used so that the algorithm is not recursive and
+ * can handle large binary objects (blobs).
+ */
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ blobs(const Image<I>& input, const Neighborhood<N>& nbh, unsigned& nlabels);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // ...
+
+ } // end of namespace mln::labeling::impl
+
+
+ // Facade.
+
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ blobs(const Image<I>& input_, const Neighborhood<N>& nbh_, unsigned& nlabels)
+ {
+ const I& input = exact(input_);
+ const N& nbh = exact(nbh_);
+ mln_precondition(input.has_data());
+
+ typedef mln_psite(I) P;
+
+ P cur;
+ mln_niter(N) n(nbh, cur);
+ p_queue_fast<P> qu;
+
+ // Initialization.
+ nlabels = 0;
+ mln_ch_value(I, unsigned) output;
+ initialize(output, input);
+ level::fill(output, 0);
+
+ // Loop.
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ if (input(p) && ! output(p)) // Object point, not labeled yet.
+ {
+ // Label this point component.
+ ++nlabels;
+ mln_invariant(qu.is_empty());
+ qu.push(p);
+ output(p) = nlabels;
+ do
+ {
+ cur = qu.front();
+ qu.pop();
+ for_all(n) if (input.has(n))
+ if (input(n) && ! output(n))
+ {
+ mln_invariant(! qu.has(n));
+ qu.push(n);
+ output(n) = nlabels;
+ }
+ }
+ while (! qu.is_empty());
+ }
+
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::labeling
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LABELING_BLOBS_HH
Index: mln/labeling/level.hh
--- mln/labeling/level.hh (revision 1479)
+++ mln/labeling/level.hh (working copy)
@@ -37,8 +37,7 @@
# include <mln/core/concept/image.hh>
# include <mln/labeling/base.hh>
# include <mln/level/fill.hh>
-# include <mln/border/resize.hh>
-# include <mln/border/fill.hh>
+# include <mln/border/adjust.hh>
# include <mln/value/other.hh>
@@ -55,14 +54,14 @@
* \param[in] input The input image.
* \param[in] val The level to consider for the labeling.
* \param[in] nbh The neighborhood.
- * \param[out] output The label image.
* \param[out] nlabels The number of labels.
- *
- * \return Succeed or not.
+ * \return The label image.
*/
- template <typename I, typename N, typename O>
- bool level(const Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Image<O>& output, unsigned& nlabels);
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ level(const Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
+ unsigned& nlabels);
+
# ifndef MLN_INCLUDE_ONLY
@@ -98,16 +97,23 @@
// Routines.
- template <typename I, typename N, typename O>
- bool level_(trait::image::speed::any, const I& input,
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ level_(trait::image::speed::any, const I& input,
const mln_value(I)& val, const Neighborhood<N>& nbh,
- trait::image::speed::any, O& output, unsigned& nlabels)
+ unsigned& nlabels)
{
+ typedef mln_ch_value(I, unsigned) O;
+ O output;
+ initialize(output, input);
+
typedef impl::level_t<I,N,O> F;
F f(input, val, exact(nbh), output);
canvas::labeling<F> run(f);
+
nlabels = f.nlabels;
- return f.status;
+ // FIXME: Handle f.status
+ return output;
}
// FIXME: Add fast versions.
@@ -134,36 +140,42 @@
};
- template <typename I, typename N, typename O>
- bool level_(trait::image::speed::fastest, const I& input,
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ level_(trait::image::speed::fastest, const I& input,
const mln_value(I)& val, const Neighborhood<N>& nbh,
- trait::image::speed::fastest, O& output, unsigned& nlabels)
+ unsigned& nlabels)
{
+ typedef mln_ch_value(I, unsigned) O;
typedef level_fast_t<I,N,O> F;
- border::resize(input, exact(nbh).delta());
- border::resize(output, exact(nbh).delta());
+ border::adjust(input, exact(nbh).delta());
+ O output;
+ initialize(output, input);
+ mln_assertion(output.border() = input.border());
F f(input, val, exact(nbh), output);
-
canvas::labeling_fast<F> run(f);
+
+ // FIXME: Handle f.status
+
nlabels = f.nlabels;
- return f.status;
+ return output;
}
} // end of namespace mln::labeling::impl
+
// Facade.
- template <typename I, typename N, typename O>
- bool level(const Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Image<O>& output, unsigned& nlabels)
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ level(const Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
+ unsigned& nlabels)
{
- mln_precondition(exact(output).domain() = exact(input).domain());
+ mln_precondition(exact(input).has_data());
return impl::level_(mln_trait_image_speed(I)(), exact(input),
- val, nbh,
- mln_trait_image_speed(O)(), exact(output),
- nlabels);
+ val, nbh, nlabels);
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/labeling/foreground.hh
--- mln/labeling/foreground.hh (revision 1479)
+++ mln/labeling/foreground.hh (working copy)
@@ -48,26 +48,24 @@
*
* \param[in] input The input image.
* \param[in] nbh The neighborhood to consider.
- * \param[out] output The label image.
* \param[out] nlabels The number of labels.
- *
- * \return The number of labels.
+ * \return The label image.
*/
- template <typename I, typename N, typename O>
- bool foreground(const Image<I>& input, const Neighborhood<N>& nbh,
- Image<O>& output,
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ foreground(const Image<I>& input, const Neighborhood<N>& nbh,
unsigned& nlabels);
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename N, typename O>
- bool foreground(const Image<I>& input, const Neighborhood<N>& nbh,
- Image<O>& output,
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ foreground(const Image<I>& input, const Neighborhood<N>& nbh,
unsigned& nlabels)
{
- mln_precondition(exact(output).domain() = exact(input).domain());
- return labeling::level(input, true, nbh, output, nlabels);
+ mln_precondition(exact(input).has_data());
+ return labeling::level(input, true, nbh, nlabels);
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/labeling/background.hh
--- mln/labeling/background.hh (revision 1479)
+++ mln/labeling/background.hh (working copy)
@@ -48,26 +48,24 @@
*
* \param[in] input The input image.
* \param[in] nbh The neighborhood to consider.
- * \param[out] output The label image.
* \param[out] nlabels The number of labels.
- *
- * \return The number of labels.
+ * \return The label image.
*/
- template <typename I, typename N, typename O>
- bool background(const Image<I>& input, const Neighborhood<N>& nbh,
- Image<O>& output,
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ background(const Image<I>& input, const Neighborhood<N>& nbh,
unsigned& nlabels);
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename N, typename O>
- bool background(const Image<I>& input, const Neighborhood<N>& nbh,
- Image<O>& output,
+ template <typename I, typename N>
+ mln_ch_value(I, unsigned)
+ background(const Image<I>& input, const Neighborhood<N>& nbh,
unsigned& nlabels)
{
- mln_precondition(exact(output).domain() = exact(input).domain());
- return labeling::level(input, false, nbh, output, nlabels);
+ mln_precondition(exact(input).has_data());
+ return labeling::level(input, false, nbh, nlabels);
}
# endif // ! MLN_INCLUDE_ONLY
1
0