Olena-patches
Threads by month
- ----- 2025 -----
- 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
October 2012
- 9 participants
- 221 discussions

olena-2.0-87-g9d4bc6a More routines working on images immersed in K1.
by Guillaume Lazzara 19 Oct '12
by Guillaume Lazzara 19 Oct '12
19 Oct '12
* mln/core/concept/function.hh: Add Function_vvvv2v concept.
* mln/world/k1/display_enlarged.hh,
* mln/world/k1/internal/face_dim.hh,
* mln/world/k1/is_0_face.hh,
* mln/world/k1/is_1_face.hh,
* mln/world/k1/is_1_face_horizontal.hh,
* mln/world/k1/is_1_face_vertical.hh,
* mln/world/k1/is_2_face.hh,
* mln/world/k1/is_primary_face.hh: Add overloads.
* mln/world/k1/fill_0_from_1_faces.hh,
* mln/world/k1/fill_0_from_2_faces.hh,
* mln/world/k1/fill_0_from_primary_faces.hh,
* mln/world/k1/fill_1_from_2_faces.hh,
* mln/world/k1/fill_1_from_aux_2_faces.hh,
* mln/world/k1/fill_2_from_1_faces.hh,
* mln/world/k1/immerse.hh,
* mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh,
* mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh: New.
* mln/world/k1/un_immerse.hh: Write it.
* tests/world/k1/Makefile.am,
* tests/world/k1/fill_0_from_1_faces.cc,
* tests/world/k1/fill_0_from_2_faces.cc,
* tests/world/k1/fill_0_from_primary_faces.cc,
* tests/world/k1/fill_1_from_2_faces.cc,
* tests/world/k1/fill_1_from_aux_2_faces.cc,
* tests/world/k1/fill_2_from_1_faces.cc,
* tests/world/k1/immerse_and_duplicate_2_to_0_1_faces.cc,
* tests/world/k1/immerse_and_duplicate_2_to_1_faces.cc,
* tests/world/k1/un_immerse.cc: New tests.
---
milena/ChangeLog | 90 ++++++++----
milena/mln/core/concept/function.hh | 41 +++++
milena/mln/world/k1/display_enlarged.hh | 8 +-
milena/mln/world/k1/fill_0_from_1_faces.hh | 127 ++++++++++++++++
milena/mln/world/k1/fill_0_from_2_faces.hh | 127 ++++++++++++++++
milena/mln/world/k1/fill_0_from_primary_faces.hh | 109 ++++++++++++++
milena/mln/world/k1/fill_1_from_2_faces.hh | 142 ++++++++++++++++++
milena/mln/world/k1/fill_1_from_aux_2_faces.hh | 155 ++++++++++++++++++++
milena/mln/world/k1/fill_2_from_1_faces.hh | 127 ++++++++++++++++
milena/mln/world/k1/immerse.hh | 18 +-
.../k1/immerse_and_duplicate_2_to_0_1_faces.hh | 125 ++++++++++++++++
.../world/k1/immerse_and_duplicate_2_to_1_faces.hh | 111 ++++++++++++++
milena/mln/world/k1/internal/face_dim.hh | 11 ++-
milena/mln/world/k1/is_0_face.hh | 12 ++-
milena/mln/world/k1/is_1_face.hh | 15 ++-
milena/mln/world/k1/is_1_face_horizontal.hh | 11 ++-
milena/mln/world/k1/is_1_face_vertical.hh | 15 ++-
milena/mln/world/k1/is_2_face.hh | 12 ++-
milena/mln/world/k1/is_primary_face.hh | 12 ++
milena/mln/world/k1/un_immerse.hh | 134 +++++++++++++++--
milena/tests/world/k1/Makefile.am | 18 ++-
milena/tests/world/k1/fill_0_from_1_faces.cc | 93 ++++++++++++
milena/tests/world/k1/fill_0_from_2_faces.cc | 93 ++++++++++++
milena/tests/world/k1/fill_0_from_primary_faces.cc | 93 ++++++++++++
milena/tests/world/k1/fill_1_from_2_faces.cc | 94 ++++++++++++
milena/tests/world/k1/fill_1_from_aux_2_faces.cc | 104 +++++++++++++
milena/tests/world/k1/fill_2_from_1_faces.cc | 94 ++++++++++++
.../k1/immerse_and_duplicate_2_to_0_1_faces.cc | 55 +++++++
.../world/k1/immerse_and_duplicate_2_to_1_faces.cc | 55 +++++++
milena/tests/world/k1/un_immerse.cc | 54 +++++++
30 files changed, 2093 insertions(+), 62 deletions(-)
create mode 100644 milena/mln/world/k1/fill_0_from_1_faces.hh
create mode 100644 milena/mln/world/k1/fill_0_from_2_faces.hh
create mode 100644 milena/mln/world/k1/fill_0_from_primary_faces.hh
create mode 100644 milena/mln/world/k1/fill_1_from_2_faces.hh
create mode 100644 milena/mln/world/k1/fill_1_from_aux_2_faces.hh
create mode 100644 milena/mln/world/k1/fill_2_from_1_faces.hh
create mode 100644 milena/mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh
create mode 100644 milena/mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh
create mode 100644 milena/tests/world/k1/fill_0_from_1_faces.cc
create mode 100644 milena/tests/world/k1/fill_0_from_2_faces.cc
create mode 100644 milena/tests/world/k1/fill_0_from_primary_faces.cc
create mode 100644 milena/tests/world/k1/fill_1_from_2_faces.cc
create mode 100644 milena/tests/world/k1/fill_1_from_aux_2_faces.cc
create mode 100644 milena/tests/world/k1/fill_2_from_1_faces.cc
create mode 100644 milena/tests/world/k1/immerse_and_duplicate_2_to_0_1_faces.cc
create mode 100644 milena/tests/world/k1/immerse_and_duplicate_2_to_1_faces.cc
create mode 100644 milena/tests/world/k1/un_immerse.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 3db410c..d778238 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,33 +1,71 @@
2012-09-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+ More routines working on images immersed in K1.
+
+ * mln/core/concept/function.hh: Add Function_vvvv2v concept.
+
+ * mln/world/k1/display_enlarged.hh,
+ * mln/world/k1/internal/face_dim.hh,
+ * mln/world/k1/is_0_face.hh,
+ * mln/world/k1/is_1_face.hh,
+ * mln/world/k1/is_1_face_horizontal.hh,
+ * mln/world/k1/is_1_face_vertical.hh,
+ * mln/world/k1/is_2_face.hh,
+ * mln/world/k1/is_primary_face.hh: Add overloads.
+
+ * mln/world/k1/fill_0_from_1_faces.hh,
+ * mln/world/k1/fill_0_from_2_faces.hh,
+ * mln/world/k1/fill_0_from_primary_faces.hh,
+ * mln/world/k1/fill_1_from_2_faces.hh,
+ * mln/world/k1/fill_1_from_aux_2_faces.hh,
+ * mln/world/k1/fill_2_from_1_faces.hh,
+ * mln/world/k1/immerse.hh,
+ * mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh,
+ * mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh: New.
+
+ * mln/world/k1/un_immerse.hh: Write it.
+
+ * tests/world/k1/Makefile.am,
+ * tests/world/k1/fill_0_from_1_faces.cc,
+ * tests/world/k1/fill_0_from_2_faces.cc,
+ * tests/world/k1/fill_0_from_primary_faces.cc,
+ * tests/world/k1/fill_1_from_2_faces.cc,
+ * tests/world/k1/fill_1_from_aux_2_faces.cc,
+ * tests/world/k1/fill_2_from_1_faces.cc,
+ * tests/world/k1/immerse_and_duplicate_2_to_0_1_faces.cc,
+ * tests/world/k1/immerse_and_duplicate_2_to_1_faces.cc,
+ * tests/world/k1/un_immerse.cc: New tests.
+
+2012-09-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Initial commit of tools to work in K1.
- * milena/mln/world/k1/display_enlarged.hh,
- * milena/mln/world/k1/immerse.hh,
- * milena/mln/world/k1/internal/face_dim.hh,
- * milena/mln/world/k1/is_0_face.hh,
- * milena/mln/world/k1/is_0_or_1_face.hh,
- * milena/mln/world/k1/is_1_face.hh,
- * milena/mln/world/k1/is_1_face_horizontal.hh,
- * milena/mln/world/k1/is_1_face_vertical.hh,
- * milena/mln/world/k1/is_2_face.hh,
- * milena/mln/world/k1/is_primary_face.hh,
- * milena/mln/world/k1/un_immerse.hh: New.
-
- * milena/tests/world/k1/Makefile.am,
- * milena/tests/world/k1/display_enlarged.cc,
- * milena/tests/world/k1/immerse.cc,
- * milena/tests/world/k1/is_0_face.cc,
- * milena/tests/world/k1/is_0_or_1_face.cc,
- * milena/tests/world/k1/is_1_face.cc,
- * milena/tests/world/k1/is_1_face_horizontal.cc,
- * milena/tests/world/k1/is_1_face_vertical.cc,
- * milena/tests/world/k1/is_2_face.cc,
- * milena/tests/world/k1/is_primary_face.cc: New tests.
-
- * milena/tests/world/Makefile.am: Add Subdir.
-
- * milena/mln/make/image.hh: Add overloads.
+ * mln/world/k1/display_enlarged.hh,
+ * mln/world/k1/immerse.hh,
+ * mln/world/k1/internal/face_dim.hh,
+ * mln/world/k1/is_0_face.hh,
+ * mln/world/k1/is_0_or_1_face.hh,
+ * mln/world/k1/is_1_face.hh,
+ * mln/world/k1/is_1_face_horizontal.hh,
+ * mln/world/k1/is_1_face_vertical.hh,
+ * mln/world/k1/is_2_face.hh,
+ * mln/world/k1/is_primary_face.hh,
+ * mln/world/k1/un_immerse.hh: New.
+
+ * tests/world/k1/Makefile.am,
+ * tests/world/k1/display_enlarged.cc,
+ * tests/world/k1/immerse.cc,
+ * tests/world/k1/is_0_face.cc,
+ * tests/world/k1/is_0_or_1_face.cc,
+ * tests/world/k1/is_1_face.cc,
+ * tests/world/k1/is_1_face_horizontal.cc,
+ * tests/world/k1/is_1_face_vertical.cc,
+ * tests/world/k1/is_2_face.cc,
+ * tests/world/k1/is_primary_face.cc: New tests.
+
+ * tests/world/Makefile.am: Add Subdir.
+
+ * mln/make/image.hh: Add overloads.
2012-09-28 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/milena/mln/core/concept/function.hh b/milena/mln/core/concept/function.hh
index 22e338e..4a6b241 100644
--- a/milena/mln/core/concept/function.hh
+++ b/milena/mln/core/concept/function.hh
@@ -43,6 +43,7 @@ namespace mln
template <typename E> struct Function_v2v;
template <typename E> struct Function_v2b;
template <typename E> struct Function_vv2v;
+ template <typename E> struct Function_vvvv2v;
template <typename E> struct Function_vv2b;
@@ -183,6 +184,31 @@ namespace mln
};
+ /*----------------------------------------.
+ | (Value, Value, Value, Value) -> Value. |
+ `----------------------------------------*/
+
+ template <>
+ struct Function_vvvv2v<void> { typedef Function<void> super; };
+
+
+ /// \brief Base class for implementation of function-objects from
+ /// four values to a value.
+ ///
+ /// The parameter \a E is the exact type.
+ ///
+ /// \ingroup modfun
+ //
+ template <typename E>
+ struct Function_vvvv2v : public Function<E>
+ {
+ typedef Function_vvvv2v<void> category;
+ protected:
+ Function_vvvv2v();
+ Function_vvvv2v(const Function_vvvv2v&);
+ };
+
+
/*--------------------------.
| (Value, Value) -> Boolean.|
`--------------------------*/
@@ -297,6 +323,21 @@ namespace mln
{
}
+ // Function_vvvv2v.
+
+ template <typename E>
+ inline
+ Function_vvvv2v<E>::Function_vvvv2v()
+ {
+ }
+
+ template <typename E>
+ inline
+ Function_vvvv2v<E>::Function_vvvv2v(const Function_vvvv2v<E>& rhs)
+ : Function<E>(rhs)
+ {
+ }
+
// Function_vv2b.
template <typename E>
diff --git a/milena/mln/world/k1/display_enlarged.hh b/milena/mln/world/k1/display_enlarged.hh
index f3610c1..a247d38 100644
--- a/milena/mln/world/k1/display_enlarged.hh
+++ b/milena/mln/world/k1/display_enlarged.hh
@@ -114,21 +114,21 @@ namespace mln
{
for (mln::def::coord col = min_col; col <= max_col; ++col)
{
- if (is_0_face(point2d(row, col)))
+ if (is_0_face(row, col))
{
output.at_(row * shift, col * shift) = ima_k1.at_(row, col);
}
- else if (is_1_face_vertical(point2d(row, col)))
+ else if (is_1_face_vertical(row, col))
{
for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
output.at_(row * shift + j, col * shift) = ima_k1.at_(row, col);
}
- else if (is_1_face_horizontal(point2d(row, col)))
+ else if (is_1_face_horizontal(row, col))
{
for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
output.at_(row * shift, col * shift + j) = ima_k1.at_(row, col);
}
- else if (is_2_face(point2d(row, col)))
+ else if (is_2_face(row, col))
{
for (mln::def::coord i = -(shift - 1); i < (shift + 3); ++i)
for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
diff --git a/milena/mln/world/k1/fill_0_from_1_faces.hh b/milena/mln/world/k1/fill_0_from_1_faces.hh
new file mode 100644
index 0000000..c56f407
--- /dev/null
+++ b/milena/mln/world/k1/fill_0_from_1_faces.hh
@@ -0,0 +1,127 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Fill 1 faces in a K1 2D image using its 2 faces.
+
+#ifndef MLN_WORLD_K1_FILL_0_FROM_1_FACES_HH
+# define MLN_WORLD_K1_FILL_0_FROM_1_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_0_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Fill 1 faces in a K1 2D image using its 2 faces.
+
+ \param[in,out] inout A 2D image immersed in K1.
+ \param[in,out] f A functor computing a result from four values.
+
+ This function use the following neighborhood:
+
+ \verbatim
+ |
+ -.-
+ |
+ \endverbatim
+
+
+ */
+ template <typename I, typename F>
+ void fill_0_from_1_faces(Image<I>& inout, Function_vvvv2v<F>& f);
+
+ /// \overload
+ template <typename I, typename A>
+ void fill_0_from_1_faces(Image<I>& inout, const Accumulator<A>& accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename F>
+ void fill_0_from_1_faces(Image<I>& inout_, Function_vvvv2v<F>& f_)
+ {
+ trace::entering("mln::world::k1::fill_0_from_1_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ F& f = exact(f_);
+
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_0_face(p))
+ inout(p) = f(inout(p + up), inout(p + left), inout(p + right), inout(p + down));
+
+ trace::exiting("mln::world::k1::fill_0_from_1_faces");
+ }
+
+
+ template <typename I, typename A>
+ void fill_0_from_1_faces(Image<I>& inout_, const Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::k1::fill_0_from_1_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_0_face(p))
+ {
+ accu.init();
+ accu.take(inout(p + up));
+ accu.take(inout(p + left));
+ accu.take(inout(p + right));
+ accu.take(inout(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::k1::fill_0_from_1_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_FILL_0_FROM_1_FACES_HH
diff --git a/milena/mln/world/k1/fill_0_from_2_faces.hh b/milena/mln/world/k1/fill_0_from_2_faces.hh
new file mode 100644
index 0000000..7b3e57e
--- /dev/null
+++ b/milena/mln/world/k1/fill_0_from_2_faces.hh
@@ -0,0 +1,127 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Fill 1 faces in a K1 2D image using its 2 faces.
+
+#ifndef MLN_WORLD_K1_FILL_0_FROM_2_FACES_HH
+# define MLN_WORLD_K1_FILL_0_FROM_2_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_0_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Fill 0 faces in a K1 2D image using its 2 faces.
+
+ \param[in,out] inout A 2D image immersed in K1.
+ \param[in,out] f A functor computing a result from four values.
+
+ This function use the following neighborhood:
+
+ \verbatim
+ x x
+ .
+ x x
+ \endverbatim
+
+
+ */
+ template <typename I, typename F>
+ void fill_0_from_2_faces(Image<I>& inout, Function_vvvv2v<F>& f);
+
+ /// \overload
+ template <typename I, typename A>
+ void fill_0_from_2_faces(Image<I>& inout, const Accumulator<A>& accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename F>
+ void fill_0_from_2_faces(Image<I>& inout_, Function_vvvv2v<F>& f_)
+ {
+ trace::entering("mln::world::k1::fill_0_from_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ F& f = exact(f_);
+
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_0_face(p))
+ inout(p) = f(inout(p + up_left), inout(p + up_right), inout(p + down_left), inout(p + down_right));
+
+ trace::exiting("mln::world::k1::fill_0_from_2_faces");
+ }
+
+
+ template <typename I, typename A>
+ void fill_0_from_2_faces(Image<I>& inout_, const Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::k1::fill_0_from_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_0_face(p))
+ {
+ accu.init();
+ accu.take(inout(p + up_left));
+ accu.take(inout(p + up_right));
+ accu.take(inout(p + down_left));
+ accu.take(inout(p + down_right));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::k1::fill_0_from_2_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_FILL_0_FROM_2_FACES_HH
diff --git a/milena/mln/world/k1/fill_0_from_primary_faces.hh b/milena/mln/world/k1/fill_0_from_primary_faces.hh
new file mode 100644
index 0000000..db3aed8
--- /dev/null
+++ b/milena/mln/world/k1/fill_0_from_primary_faces.hh
@@ -0,0 +1,109 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Fill 1 faces in a K1 2D image using its primary faces.
+
+#ifndef MLN_WORLD_K1_FILL_0_FROM_PRIMARY_FACES_HH
+# define MLN_WORLD_K1_FILL_0_FROM_PRIMARY_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/fill_0_from_2_faces.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Fill 0 faces in a K1 2D image using its primary faces.
+
+ \param[in,out] inout A 2D image immersed in K1.
+ \param[in,out] f A functor computing a result from four values.
+
+ This function use the following neighborhood:
+
+ \verbatim
+ x x
+ .
+ x x
+ \endverbatim
+
+
+ */
+ template <typename I, typename F>
+ void fill_0_from_primary_faces(Image<I>& inout, Function_vvvv2v<F>& f);
+
+ /// \overload
+ template <typename I, typename A>
+ void fill_0_from_primary_faces(Image<I>& inout, const Accumulator<A>& accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename F>
+ void fill_0_from_primary_faces(Image<I>& inout, Function_vvvv2v<F>& f)
+ {
+ trace::entering("mln::world::k1::fill_0_from_primary_faces");
+
+ mln_precondition(exact(inout).is_valid());
+
+ fill_0_from_2_faces(inout, f);
+
+ trace::exiting("mln::world::k1::fill_0_from_primary_faces");
+ }
+
+
+ template <typename I, typename A>
+ void fill_0_from_primary_faces(Image<I>& inout, const Accumulator<A>& accu)
+ {
+ trace::entering("mln::world::k1::fill_0_from_primary_faces");
+
+ mln_precondition(exact(inout).is_valid());
+
+ fill_0_from_2_faces(inout, accu);
+
+ trace::exiting("mln::world::k1::fill_0_from_primary_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_FILL_0_FROM_PRIMARY_FACES_HH
diff --git a/milena/mln/world/k1/fill_1_from_2_faces.hh b/milena/mln/world/k1/fill_1_from_2_faces.hh
new file mode 100644
index 0000000..abec694
--- /dev/null
+++ b/milena/mln/world/k1/fill_1_from_2_faces.hh
@@ -0,0 +1,142 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Fill 1 faces in a K1 2D image using its 2 faces.
+
+#ifndef MLN_WORLD_K1_FILL_1_FROM_2_FACES_HH
+# define MLN_WORLD_K1_FILL_1_FROM_2_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_1_face_vertical.hh>
+# include <mln/world/k1/is_1_face_horizontal.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Fill 1 faces in a K1 2D image using its 2 faces.
+
+ \param[in,out] inout A 2D image immersed in K1.
+ \param[in,out] f A functor computing a result from two values.
+
+ This function use the following neighborhoods:
+
+ * In case of vertical 1 faces:
+
+ \verbatim
+ x | x
+ \endverbatim
+
+ * In case of horizontal 1 face:
+
+ \verbatim
+ x
+ -
+ x
+ \endverbatim
+
+ */
+ template <typename I, typename F>
+ void fill_1_from_2_faces(Image<I>& inout, Function_vv2v<F>& f);
+
+ /// \overload
+ template <typename I, typename A>
+ void fill_1_from_2_faces(Image<I>& inout, const Accumulator<A>& accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename F>
+ void fill_1_from_2_faces(Image<I>& inout_, Function_vv2v<F>& f_)
+ {
+ trace::entering("mln::world::k1::fill_1_from_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ F& f = exact(f_);
+
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_1_face_vertical(p))
+ inout(p) = f(inout(p + left), inout(p + right));
+ else if (is_1_face_horizontal(p))
+ inout(p) = f(inout(p + up), inout(p + down));
+
+ trace::exiting("mln::world::k1::fill_1_from_2_faces");
+ }
+
+
+ template <typename I, typename A>
+ void fill_1_from_2_faces(Image<I>& inout_, const Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::k1::fill_1_from_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_1_face_vertical(p))
+ {
+ accu.init();
+ accu.take(inout(p + left));
+ accu.take(inout(p + right));
+ inout(p) = accu.to_result();
+ }
+ else if (is_1_face_horizontal(p))
+ {
+ accu.init();
+ accu.take(inout(p + up));
+ accu.take(inout(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::k1::fill_1_from_2_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_FILL_1_FROM_2_FACES_HH
diff --git a/milena/mln/world/k1/fill_1_from_aux_2_faces.hh b/milena/mln/world/k1/fill_1_from_aux_2_faces.hh
new file mode 100644
index 0000000..e8a7358
--- /dev/null
+++ b/milena/mln/world/k1/fill_1_from_aux_2_faces.hh
@@ -0,0 +1,155 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Fill 1 faces in a K1 2D image using 2 faces from an
+/// auxiliary image.
+
+#ifndef MLN_WORLD_K1_FILL_1_FROM_AUX_2_FACES_HH
+# define MLN_WORLD_K1_FILL_1_FROM_AUX_2_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_1_face_vertical.hh>
+# include <mln/world/k1/is_1_face_horizontal.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Fill 1 faces in a K1 2D image using 2 faces from an
+ auxiliary image.
+
+ \param[in,out] inout A 2D image immersed in K1.
+ \param[in] aux A 2D image with the same domain as \p inout.
+ \param[in,out] f A functor computing a result from two values.
+
+ This function use the following neighborhoods:
+
+ * In case of vertical 1 faces:
+
+ \verbatim
+ x | x
+ \endverbatim
+
+ * In case of horizontal 1 face:
+
+ \verbatim
+ x
+ -
+ x
+ \endverbatim
+
+ */
+ template <typename I, typename J, typename F>
+ void fill_1_from_aux_2_faces(Image<I>& inout, const Image<J>& aux,
+ Function_vv2v<F>& f);
+
+ /// \overload
+ template <typename I, typename J, typename A>
+ void fill_1_from_aux_2_faces(Image<I>& inout, const Image<J>& aux,
+ const Accumulator<A>& accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename J, typename F>
+ void fill_1_from_aux_2_faces(Image<I>& inout_, const Image<J>& aux_,
+ Function_vv2v<F>& f_)
+ {
+ trace::entering("mln::world::k1::fill_1_from_aux_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ mln_precondition(exact(aux_).is_valid());
+ mln_precondition(exact(inout_).domain() == exact(aux_).domain());
+ I& inout = exact(inout_);
+ const J& aux = exact(aux_);
+ F& f = exact(f_);
+
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_1_face_vertical(p))
+ inout(p) = f(aux(p + left), aux(p + right));
+ else if (is_1_face_horizontal(p))
+ inout(p) = f(aux(p + up), aux(p + down));
+
+ trace::exiting("mln::world::k1::fill_1_from_aux_2_faces");
+ }
+
+
+ template <typename I, typename J, typename A>
+ void fill_1_from_aux_2_faces(Image<I>& inout_, const Image<J>& aux_,
+ const Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::k1::fill_1_from_aux_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ mln_precondition(exact(aux_).is_valid());
+ mln_precondition(exact(inout_).domain() == exact(aux_).domain());
+ I& inout = exact(inout_);
+ const J& aux = exact(aux_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_1_face_vertical(p))
+ {
+ accu.init();
+ accu.take(aux(p + left));
+ accu.take(aux(p + right));
+ inout(p) = accu.to_result();
+ }
+ else if (is_1_face_horizontal(p))
+ {
+ accu.init();
+ accu.take(aux(p + up));
+ accu.take(aux(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::k1::fill_1_from_aux_2_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_FILL_1_FROM_AUX_2_FACES_HH
diff --git a/milena/mln/world/k1/fill_2_from_1_faces.hh b/milena/mln/world/k1/fill_2_from_1_faces.hh
new file mode 100644
index 0000000..c539e30
--- /dev/null
+++ b/milena/mln/world/k1/fill_2_from_1_faces.hh
@@ -0,0 +1,127 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Fill 2 faces in a K1 2D image using its 1 faces.
+
+#ifndef MLN_WORLD_K1_FILL_2_FROM_1_FACES_HH
+# define MLN_WORLD_K1_FILL_2_FROM_1_FACES_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_2_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Fill 0 faces in a K1 2D image using its 2 faces.
+
+ \param[in,out] inout A 2D image immersed in K1.
+ \param[in,out] f A functor computing a result from four values.
+
+ This function use the following neighborhood:
+
+ \verbatim
+ -
+ |o|
+ -
+ \endverbatim
+
+
+ */
+ template <typename I, typename F>
+ void fill_2_from_1_faces(Image<I>& inout, Function_vvvv2v<F>& f);
+
+ /// \overload
+ template <typename I, typename A>
+ void fill_2_from_1_faces(Image<I>& inout, const Accumulator<A>& accu);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+
+ template <typename I, typename F>
+ void fill_2_from_1_faces(Image<I>& inout_, Function_vvvv2v<F>& f_)
+ {
+ trace::entering("mln::world::k1::fill_2_from_1_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ F& f = exact(f_);
+
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_2_face(p))
+ inout(p) = f(inout(p + up), inout(p + left), inout(p + right), inout(p + down));
+
+ trace::exiting("mln::world::k1::fill_2_from_1_faces");
+ }
+
+
+ template <typename I, typename A>
+ void fill_2_from_1_faces(Image<I>& inout_, const Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::k1::fill_2_from_1_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ (void) accu_;
+
+ A accu = A();
+ mln_piter(I) p(inout.domain());
+ for_all(p)
+ if (is_2_face(p))
+ {
+ accu.init();
+ accu.take(inout(p + up));
+ accu.take(inout(p + left));
+ accu.take(inout(p + right));
+ accu.take(inout(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::k1::fill_2_from_1_faces");
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_FILL_2_FROM_1_FACES_HH
diff --git a/milena/mln/world/k1/immerse.hh b/milena/mln/world/k1/immerse.hh
index 928012b..b9b58fb 100644
--- a/milena/mln/world/k1/immerse.hh
+++ b/milena/mln/world/k1/immerse.hh
@@ -66,6 +66,14 @@ namespace mln
namespace internal
{
+ /// Return the equivalent point in K1 from a point in K0.
+ inline
+ point2d immerse_point(const point2d& p)
+ {
+ point2d tmp(2 * p.row(), 2 * p.col());
+ return tmp;
+ }
+
/// \brief Return the equivalent domain in K1 from a domain in
/// K0.
template <typename B>
@@ -77,15 +85,7 @@ namespace mln
mln_deduce(B, site, delta) one;
one.set_all(1);
- return B(2 * b.pmin() - one, 2 * b.pmax() + one);
- }
-
- inline
- point2d
- immerse_point(const point2d& p)
- {
- point2d tmp(2 * p.row(), 2 * p.col());
- return tmp;
+ return B(immerse_point(b.pmin()) - one, immerse_point(b.pmax()) + one);
}
} // end of namespace mln::world::k1::internal
diff --git a/milena/mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh b/milena/mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh
new file mode 100644
index 0000000..137f4a3
--- /dev/null
+++ b/milena/mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh
@@ -0,0 +1,125 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Immerse a 2D image into K1 and copy 2 faces data into 0 and
+/// 1 faces.
+
+#ifndef MLN_WORLD_K1_IMMERSE_AND_DUPLICATE_2_TO_0_1_FACES_HH
+# define MLN_WORLD_K1_IMMERSE_AND_DUPLICATE_2_TO_0_1_FACES_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/box.hh>
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/immerse.hh>
+# include <mln/world/k1/is_1_face_vertical.hh>
+# include <mln/world/k1/is_1_face_horizontal.hh>
+# include <mln/world/k1/is_0_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Immerse a 2D image into K1 and copy 2 faces data into
+ * 0 and 1 faces.
+
+ Data is copied into 1 faces located at the bottom right of each
+ 2 faces.
+
+ -1 0 1 2 3
+ 0 1 -1 a a a d d
+ 0 a d 0 a a a d d
+ 1 b c -> 1 a a a d d
+ 2 b b b c c
+ 3 b b b c c
+
+ */
+ template <typename I>
+ mln_concrete(I)
+ immerse_and_duplicate_2_to_0_1_faces(const Image<I>& ima);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // Facade
+
+ template <typename I>
+ mln_concrete(I) immerse_and_duplicate_2_to_0_1_faces(const Image<I>& ima_)
+ {
+ trace::entering("mln::world::k1::immerse_and_duplicate_2_to_0_1_faces");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+
+ mln_concrete(I) output = immerse(ima);
+
+ mln_piter(I) p(output.domain());
+ for_all(p)
+ if (is_1_face_vertical(p))
+ {
+ if (output.domain().has(p + left))
+ output(p) = output(p + left);
+ else // Handle left border
+ output(p) = output(p + right);
+ }
+ else if (is_1_face_horizontal(p))
+ {
+ if (output.domain().has(p + up))
+ output(p) = output(p + up);
+ else // Handle top border
+ output(p) = output(p + down);
+ }
+ else if (is_0_face(p))
+ {
+ if (output.domain().has(p + up_left))
+ output(p) = output(p + up_left);
+ else if (output.domain().has(p + up_right)) // Handle left border
+ output(p) = output(p + up_right);
+ else
+ output(p) = output(p + down_left); // Handle top border
+ }
+
+ // First top left corner pixel. (Special case)
+ output(output.domain().pmin()) = output(output.domain().pmin() + down_right);
+
+ trace::exiting("mln::world::k1::immerse_and_duplicate_2_to_0_1_faces");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IMMERSE_AND_DUPLICATE_2_TO_0_1_FACES_HH
diff --git a/milena/mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh b/milena/mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh
new file mode 100644
index 0000000..27c1eb9
--- /dev/null
+++ b/milena/mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh
@@ -0,0 +1,111 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Immerse a 2D image into K1 and copy 2 faces data into 1
+/// faces.
+
+#ifndef MLN_WORLD_K1_IMMERSE_AND_DUPLICATE_2_TO_1_FACES_HH
+# define MLN_WORLD_K1_IMMERSE_AND_DUPLICATE_2_TO_1_FACES_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/box.hh>
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/immerse.hh>
+# include <mln/world/k1/is_1_face_vertical.hh>
+# include <mln/world/k1/is_1_face_horizontal.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Immerse a 2D image into K1 and copy 2 faces data into
+ * 1 faces.
+
+ Data is copied into 1 faces located at the bottom right of each
+ 2 faces.
+
+ -1 0 1 2 3
+ 0 1 -1 . a . d .
+ 0 a d 0 a a a d d
+ 1 b c -> 1 . a . d .
+ 2 b b b c c
+ 3 . b . c .
+
+ */
+ template <typename I>
+ mln_concrete(I)
+ immerse_and_duplicate_2_to_1_faces(const Image<I>& ima);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // Facade
+
+ template <typename I>
+ mln_concrete(I) immerse_and_duplicate_2_to_1_faces(const Image<I>& ima_)
+ {
+ trace::entering("mln::world::k1::immerse_and_duplicate_2_to_1_faces");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+
+ mln_concrete(I) output = immerse(ima);
+
+ mln_piter(I) p(output.domain());
+ for_all(p)
+ if (is_1_face_vertical(p))
+ {
+ if (output.domain().has(p + left))
+ output(p) = output(p + left);
+ else // Handle left border
+ output(p) = output(p + right);
+ }
+ else if (is_1_face_horizontal(p))
+ {
+ if (output.domain().has(p + up))
+ output(p) = output(p + up);
+ else // Handle top border
+ output(p) = output(p + down);
+ }
+
+ trace::exiting("mln::world::k1::immerse_and_duplicate_2_to_1_faces");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IMMERSE_AND_DUPLICATE_2_TO_1_FACES_HH
diff --git a/milena/mln/world/k1/internal/face_dim.hh b/milena/mln/world/k1/internal/face_dim.hh
index b933e86..34a0247 100644
--- a/milena/mln/world/k1/internal/face_dim.hh
+++ b/milena/mln/world/k1/internal/face_dim.hh
@@ -47,6 +47,9 @@ namespace mln
/// \brief Returns the dimension of site in K1.
unsigned face_dim(const point2d& p);
+ /// \overload
+ unsigned face_dim(const mln::def::coord& row, const mln::def::coord& col);
+
# ifndef MLN_INCLUDE_ONLY
@@ -56,7 +59,13 @@ namespace mln
inline
unsigned face_dim(const point2d& p)
{
- return (p[0] % 2 == 0) + (p[1] % 2 == 0);
+ return face_dim(p.row(), p.col());
+ }
+
+ inline
+ unsigned face_dim(const mln::def::coord& row, const mln::def::coord& col)
+ {
+ return (row % 2 == 0) + (col % 2 == 0);
}
diff --git a/milena/mln/world/k1/is_0_face.hh b/milena/mln/world/k1/is_0_face.hh
index c9d9b0e..01878d9 100644
--- a/milena/mln/world/k1/is_0_face.hh
+++ b/milena/mln/world/k1/is_0_face.hh
@@ -46,6 +46,10 @@ namespace mln
/// \brief Check if site is a 0 face
bool is_0_face(const point2d& p);
+ /// \overload
+ bool is_0_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
# ifndef MLN_INCLUDE_ONLY
@@ -55,9 +59,15 @@ namespace mln
inline
bool is_0_face(const point2d& p)
{
- return internal::face_dim(p) == 0;
+ return is_0_face(p.row(), p.col());
}
+ inline
+ bool is_0_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return internal::face_dim(row, col) == 0;
+ }
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/world/k1/is_1_face.hh b/milena/mln/world/k1/is_1_face.hh
index aafa442..60e2fdf 100644
--- a/milena/mln/world/k1/is_1_face.hh
+++ b/milena/mln/world/k1/is_1_face.hh
@@ -47,6 +47,12 @@ namespace mln
bool is_1_face(const point2d& p);
+ /// \overload
+ inline
+ bool is_1_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -55,7 +61,14 @@ namespace mln
inline
bool is_1_face(const point2d& p)
{
- return internal::face_dim(p) == 1;
+ return is_1_face(p.row(), p.col());
+ }
+
+ inline
+ bool is_1_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return internal::face_dim(row, col) == 1;
}
diff --git a/milena/mln/world/k1/is_1_face_horizontal.hh b/milena/mln/world/k1/is_1_face_horizontal.hh
index ff90b0c..e0e9cd8 100644
--- a/milena/mln/world/k1/is_1_face_horizontal.hh
+++ b/milena/mln/world/k1/is_1_face_horizontal.hh
@@ -47,6 +47,10 @@ namespace mln
bool is_1_face_horizontal(const point2d& p);
+ /// \overload
+ bool is_1_face_horizontal(const mln::def::coord& row,
+ const mln::def::coord& col);
+
# ifndef MLN_INCLUDE_ONLY
@@ -55,9 +59,14 @@ namespace mln
inline
bool is_1_face_horizontal(const point2d& p)
{
- return is_1_face(p) && p[1] % 2 == 0;
+ return is_1_face_horizontal(p.row(), p.col());
}
+ bool is_1_face_horizontal(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return is_1_face(row, col) && col % 2 == 0;
+ }
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/world/k1/is_1_face_vertical.hh b/milena/mln/world/k1/is_1_face_vertical.hh
index f10067d..b96bfe3 100644
--- a/milena/mln/world/k1/is_1_face_vertical.hh
+++ b/milena/mln/world/k1/is_1_face_vertical.hh
@@ -47,6 +47,11 @@ namespace mln
bool is_1_face_vertical(const point2d& p);
+ /// \overload
+ bool is_1_face_vertical(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -55,7 +60,15 @@ namespace mln
inline
bool is_1_face_vertical(const point2d& p)
{
- return is_1_face(p) && p[0] % 2 == 0;
+ return is_1_face_vertical(p.row(), p.col());
+ }
+
+
+ inline
+ bool is_1_face_vertical(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return is_1_face(row, col) && row % 2 == 0;
}
diff --git a/milena/mln/world/k1/is_2_face.hh b/milena/mln/world/k1/is_2_face.hh
index b3c8c98..4b40475 100644
--- a/milena/mln/world/k1/is_2_face.hh
+++ b/milena/mln/world/k1/is_2_face.hh
@@ -47,6 +47,11 @@ namespace mln
bool is_2_face(const point2d& p);
+ /// \overload
+ bool is_2_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -55,9 +60,14 @@ namespace mln
inline
bool is_2_face(const point2d& p)
{
- return internal::face_dim(p) == 2;
+ return is_2_face(p.row(), p.col());
}
+ bool is_2_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return internal::face_dim(row, col) == 2;
+ }
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/world/k1/is_primary_face.hh b/milena/mln/world/k1/is_primary_face.hh
index 572d25c..38639cc 100644
--- a/milena/mln/world/k1/is_primary_face.hh
+++ b/milena/mln/world/k1/is_primary_face.hh
@@ -47,6 +47,11 @@ namespace mln
bool is_primary_face(const point2d& p);
+ /// \overload
+ bool is_primary_face(const mln::def::coord& row,
+ const mln::def::coord& col);
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -58,6 +63,13 @@ namespace mln
return is_2_face(p);
}
+ inline
+ bool is_primary_face(const mln::def::coord& row,
+ const mln::def::coord& col)
+ {
+ return is_2_face(row, col);
+ }
+
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/world/k1/un_immerse.hh b/milena/mln/world/k1/un_immerse.hh
index 7978be9..8506f56 100644
--- a/milena/mln/world/k1/un_immerse.hh
+++ b/milena/mln/world/k1/un_immerse.hh
@@ -1,21 +1,123 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Un-immerse a 2D image from K1 to K0.
- inline
- point2d
- un_immerse(const point2d& p)
- {
- point2d tmp(p.row() / 2, p.col() / 2);
- return tmp;
- }
- struct is_2_face_t : Function_v2b< is_2_face_t >
- {
- typedef bool result;
- inline bool operator()(const point2d& p) const { return FIXME; } // p.row() % 2 && p.col() % 2
- } is_2_face;
+#ifndef MLN_WORLD_K1_UN_IMMERSE_HH
+# define MLN_WORLD_K1_UN_IMMERSE_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/box.hh>
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_2_face.hh>
+
+namespace mln
+{
- struct is_not_2_face_t : Function_v2b< is_not_2_face_t >
+ namespace world
{
- typedef bool result;
- inline bool operator()(const point2d& p) const { return FIXME; } // ! (p.row() % 2 && p.col() % 2)
- } is_not_2_face;
+
+ namespace k1
+ {
+
+ /*! \brief Un-immerse a 2D image from K1 to K0.
+
+ \verbatim
+
+ -1 0 1 2 3
+ -1 . - . - . 0 1
+ 0 | o | o | 0 o o
+ 1 . - . - . -> 1 o o
+ 2 | o | o |
+ 3 . - . - .
+
+ \endverbatim
+
+ */
+ template <typename I>
+ mln_concrete(I) un_immerse(const Image<I>& ima);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ /// Return the equivalent point in K1 from a point in K0.
+ inline
+ point2d un_immerse_point(const point2d& p)
+ {
+ point2d tmp(p.row() / 2, p.col() / 2);
+ return tmp;
+ }
+
+ /// \brief Return the equivalent domain in K0 from a domain in
+ /// K1.
+ template <typename B>
+ inline
+ B domain_K0_from_K1(const Box<B>& b_)
+ {
+ mln_precondition(exact(b_).is_valid());
+ const B& b = exact(b_);
+ return B(un_immerse_point(b.pmin()), un_immerse_point(b.pmax()));
+ }
+
+ } // end of namespace mln::world::k1::internal
+
+
+
+ // Facade
+
+ template <typename I>
+ mln_concrete(I) un_immerse(const Image<I>& ima_)
+ {
+ trace::entering("mln::world::k1::un_immerse");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+
+ mln_concrete(I) output(internal::domain_K0_from_K1(ima.domain()));
+
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ if (is_2_face(p))
+ output(internal::un_immerse_point(p)) = ima(p);
+
+ trace::exiting("mln::world::k1::un_immerse");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_UN_IMMERSE_HH
+
diff --git a/milena/tests/world/k1/Makefile.am b/milena/tests/world/k1/Makefile.am
index daa0d94..68866fb 100644
--- a/milena/tests/world/k1/Makefile.am
+++ b/milena/tests/world/k1/Makefile.am
@@ -18,19 +18,34 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
display_enlarged \
+ fill_0_from_1_faces \
+ fill_0_from_2_faces \
+ fill_0_from_primary_faces \
+ fill_1_from_2_faces \
+ fill_1_from_aux_2_faces \
+ fill_2_from_1_faces \
immerse \
immerse_and_duplicate_2_to_1_faces \
+ immerse_and_duplicate_2_to_0_1_faces \
is_0_face \
is_0_or_1_face \
is_1_face \
is_1_face_vertical \
is_1_face_horizontal \
is_2_face \
- is_primary_face
+ is_primary_face \
+ un_immerse
display_enlarged_SOURCES = display_enlarged.cc
+fill_0_from_1_faces_SOURCES = fill_0_from_1_faces.cc
+fill_0_from_2_faces_SOURCES = fill_0_from_2_faces.cc
+fill_0_from_primary_faces_SOURCES = fill_0_from_primary_faces.cc
+fill_1_from_2_faces_SOURCES = fill_1_from_2_faces.cc
+fill_1_from_aux_2_faces_SOURCES = fill_1_from_aux_2_faces.cc
+fill_2_from_1_faces_SOURCES = fill_2_from_1_faces.cc
immerse_SOURCES = immerse.cc
immerse_and_duplicate_2_to_1_faces_SOURCES = immerse_and_duplicate_2_to_1_faces.cc
+immerse_and_duplicate_2_to_0_1_faces_SOURCES = immerse_and_duplicate_2_to_0_1_faces.cc
is_0_face_SOURCES = is_0_face.cc
is_0_or_1_face_SOURCES = is_0_or_1_face.cc
is_1_face_SOURCES = is_1_face.cc
@@ -38,5 +53,6 @@ is_1_face_vertical_SOURCES = is_1_face_vertical.cc
is_1_face_horizontal_SOURCES = is_1_face_horizontal.cc
is_2_face_SOURCES = is_2_face.cc
is_primary_face_SOURCES = is_primary_face.cc
+un_immerse_SOURCES = un_immerse.cc
TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/world/k1/fill_0_from_1_faces.cc b/milena/tests/world/k1/fill_0_from_1_faces.cc
new file mode 100644
index 0000000..b6c1db6
--- /dev/null
+++ b/milena/tests/world/k1/fill_0_from_1_faces.cc
@@ -0,0 +1,93 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/k1/fill_0_from_1_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vvvv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2, const int& v3, const int& v4) const
+ {
+ return v1 + v2 + v3 + v4;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {2, 1, 3, 1, 2},
+ {1, 0, 1, 0, 1},
+ {3, 1, 4, 1, 3},
+ {1, 0, 1, 0, 1},
+ {2, 1, 3, 1, 2}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {0, 1, 0, 1, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 1, 0, 1, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 1, 0, 1, 0 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imak1, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::k1::fill_0_from_1_faces(imak1, accu);
+ mln_assertion(ref == imak1);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::k1::fill_0_from_1_faces(imak1, f);
+ mln_assertion(ref == imak1);
+ }
+}
diff --git a/milena/tests/world/k1/fill_0_from_2_faces.cc b/milena/tests/world/k1/fill_0_from_2_faces.cc
new file mode 100644
index 0000000..c32a0f2
--- /dev/null
+++ b/milena/tests/world/k1/fill_0_from_2_faces.cc
@@ -0,0 +1,93 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/k1/fill_0_from_2_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vvvv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2, const int& v3, const int& v4) const
+ {
+ return v1 + v2 + v3 + v4;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {1, 0, 2, 0, 1},
+ {0, 1, 0, 1, 0},
+ {2, 0, 4, 0, 2},
+ {0, 1, 0, 1, 0},
+ {1, 0, 2, 0, 1}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 1, 0 },
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 1, 0 },
+ {0, 0, 0, 0, 0 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imak1, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::k1::fill_0_from_2_faces(imak1, accu);
+ mln_assertion(ref == imak1);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::k1::fill_0_from_2_faces(imak1, f);
+ mln_assertion(ref == imak1);
+ }
+}
diff --git a/milena/tests/world/k1/fill_0_from_primary_faces.cc b/milena/tests/world/k1/fill_0_from_primary_faces.cc
new file mode 100644
index 0000000..70b9b1a
--- /dev/null
+++ b/milena/tests/world/k1/fill_0_from_primary_faces.cc
@@ -0,0 +1,93 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/k1/fill_0_from_primary_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vvvv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2, const int& v3, const int& v4) const
+ {
+ return v1 + v2 + v3 + v4;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {1, 0, 2, 0, 1},
+ {0, 1, 0, 1, 0},
+ {2, 0, 4, 0, 2},
+ {0, 1, 0, 1, 0},
+ {1, 0, 2, 0, 1}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 1, 0 },
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 1, 0 },
+ {0, 0, 0, 0, 0 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imak1, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::k1::fill_0_from_primary_faces(imak1, accu);
+ mln_assertion(ref == imak1);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::k1::fill_0_from_primary_faces(imak1, f);
+ mln_assertion(ref == imak1);
+ }
+}
diff --git a/milena/tests/world/k1/fill_1_from_2_faces.cc b/milena/tests/world/k1/fill_1_from_2_faces.cc
new file mode 100644
index 0000000..8822e60
--- /dev/null
+++ b/milena/tests/world/k1/fill_1_from_2_faces.cc
@@ -0,0 +1,94 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/k1/fill_1_from_2_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2) const
+ {
+ return v1 + v2;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {1, 3, 1, 3, 1},
+ {3, 3, 6, 3, 3},
+ {1, 6, 1, 6, 1},
+ {3, 3, 6, 3, 3},
+ {1, 3, 1, 3, 1}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {1, 0, 1, 0, 1 },
+ {0, 3, 0, 3, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 3, 0, 3, 0 },
+ {1, 0, 1, 0, 1 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imak1, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::k1::fill_1_from_2_faces(imak1, accu);
+ mln_assertion(ref == imak1);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::k1::fill_1_from_2_faces(imak1, f);
+ mln_assertion(ref == imak1);
+ }
+
+}
diff --git a/milena/tests/world/k1/fill_1_from_aux_2_faces.cc b/milena/tests/world/k1/fill_1_from_aux_2_faces.cc
new file mode 100644
index 0000000..045f540
--- /dev/null
+++ b/milena/tests/world/k1/fill_1_from_aux_2_faces.cc
@@ -0,0 +1,104 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/k1/fill_1_from_aux_2_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2) const
+ {
+ return v1 + v2;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {1, 1, 1, 4, 1},
+ {1, 3, 5, 3, 4},
+ {1, 5, 1, 5, 1},
+ {4, 3, 5, 3, 1},
+ {1, 4, 1, 1, 1}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int auxvals[5][5] = {
+ {0, 0, 0, 0, 0 },
+ {0, 1, 0, 4, 0 },
+ {0, 0, 0, 0, 0 },
+ {0, 4, 0, 1, 0 },
+ {0, 0, 0, 0, 1 }
+ };
+ image2d<int> aux = make::image(auxvals, point2d(-1, -1));
+
+
+ int vals[5][5] = {
+ {1, 0, 1, 0, 1 },
+ {0, 3, 0, 3, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 3, 0, 3, 0 },
+ {1, 0, 1, 0, 1 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imak1, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::k1::fill_1_from_aux_2_faces(imak1, aux, accu);
+ mln_assertion(ref == imak1);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::k1::fill_1_from_aux_2_faces(imak1, aux, f);
+ mln_assertion(ref == imak1);
+ }
+
+}
diff --git a/milena/tests/world/k1/fill_2_from_1_faces.cc b/milena/tests/world/k1/fill_2_from_1_faces.cc
new file mode 100644
index 0000000..6fb3e96
--- /dev/null
+++ b/milena/tests/world/k1/fill_2_from_1_faces.cc
@@ -0,0 +1,94 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+#include <mln/accu/math/sum.hh>
+#include <mln/world/k1/fill_2_from_1_faces.hh>
+#include <mln/border/fill.hh>
+
+
+namespace mln
+{
+
+ struct sum_t : Function_vvvv2v<sum_t>
+ {
+ typedef int result;
+
+ int operator()(const int& v1, const int& v2, const int& v3, const int& v4) const
+ {
+ return v1 + v2 + v3 + v4;
+ }
+
+ };
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[5][5] = {
+ {0, 1, 0, 1, 0},
+ {1, 4, 1, 4, 1},
+ {0, 1, 0, 1, 0},
+ {1, 4, 1, 4, 1},
+ {0, 1, 0, 1, 0}
+ };
+ image2d<int> ref = make::image(refvals, point2d(-1, -1));
+
+ int vals[5][5] = {
+ {0, 1, 0, 1, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 1, 0, 1, 0 },
+ {1, 0, 1, 0, 1 },
+ {0, 1, 0, 1, 0 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ /// Make sure the border is set to 0 to get deterministic results.
+ border::fill(imak1, 0);
+
+
+ // Overload with accumulator
+ {
+ accu::math::sum<int> accu;
+ world::k1::fill_2_from_1_faces(imak1, accu);
+ mln_assertion(ref == imak1);
+ }
+
+ // Overload with function
+ {
+ sum_t f;
+ world::k1::fill_2_from_1_faces(imak1, f);
+ mln_assertion(ref == imak1);
+ }
+
+}
diff --git a/milena/tests/world/k1/immerse_and_duplicate_2_to_0_1_faces.cc b/milena/tests/world/k1/immerse_and_duplicate_2_to_0_1_faces.cc
new file mode 100644
index 0000000..f03f905
--- /dev/null
+++ b/milena/tests/world/k1/immerse_and_duplicate_2_to_0_1_faces.cc
@@ -0,0 +1,55 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/world/k1/immerse_and_duplicate_2_to_0_1_faces.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int ref_vals[5][5] = {
+ {1, 1, 1, 2, 2 },
+ {1, 1, 1, 2, 2 },
+ {1, 1, 1, 2, 2 },
+ {3, 3, 3, 4, 4 },
+ {3, 3, 3, 4, 4 },
+ };
+ image2d<int> ref = make::image(ref_vals, point2d(-1, -1));
+
+ int vals[2][2] = {
+ {1, 2 },
+ {3, 4 }
+ };
+ image2d<int> ima = make::image(vals);
+
+ image2d<int> immersed = world::k1::immerse_and_duplicate_2_to_0_1_faces(ima);
+
+ mln_assertion(ref == immersed);
+}
diff --git a/milena/tests/world/k1/immerse_and_duplicate_2_to_1_faces.cc b/milena/tests/world/k1/immerse_and_duplicate_2_to_1_faces.cc
new file mode 100644
index 0000000..cbcb68d
--- /dev/null
+++ b/milena/tests/world/k1/immerse_and_duplicate_2_to_1_faces.cc
@@ -0,0 +1,55 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/world/k1/immerse_and_duplicate_2_to_1_faces.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int ref_vals[5][5] = {
+ {0, 1, 0, 2, 0 },
+ {1, 1, 1, 2, 2 },
+ {0, 1, 0, 2, 0 },
+ {3, 3, 3, 4, 4 },
+ {0, 3, 0, 4, 0 },
+ };
+ image2d<int> ref = make::image(ref_vals, point2d(-1, -1));
+
+ int vals[2][2] = {
+ {1, 2 },
+ {3, 4 }
+ };
+ image2d<int> ima = make::image(vals);
+
+ image2d<int> immersed = world::k1::immerse_and_duplicate_2_to_1_faces(ima);
+
+ mln_assertion(ref == immersed);
+}
diff --git a/milena/tests/world/k1/un_immerse.cc b/milena/tests/world/k1/un_immerse.cc
new file mode 100644
index 0000000..47e06e4
--- /dev/null
+++ b/milena/tests/world/k1/un_immerse.cc
@@ -0,0 +1,54 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/world/k1/un_immerse.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int refvals[2][2] = {
+ {3, 3},
+ {3, 3}
+ };
+ image2d<int> ref = make::image(refvals);
+
+ int vals[5][5] = {
+ {1, 2, 1, 2, 1 },
+ {2, 3, 2, 3, 2 },
+ {1, 2, 1, 2, 1 },
+ {2, 3, 2, 3, 2 },
+ {1, 2, 1, 2, 1 }
+ };
+ image2d<int> imak1 = make::image(vals, point2d(-1, -1));
+
+ image2d<int> imak0 = world::k1::un_immerse(imak1);
+ mln_assertion(imak0 == ref);
+}
--
1.7.2.5
1
0

olena-2.0-86-g539ff65 configure.ac: Configure milena/tests/world/k1/Makefile.am.
by Guillaume Lazzara 19 Oct '12
by Guillaume Lazzara 19 Oct '12
19 Oct '12
---
ChangeLog | 4 ++++
configure.ac | 1 +
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 81e9545..b2d2c6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * configure.ac: Configure milena/tests/world/k1/Makefile.am.
+
2011-11-16 Guillaume Lazzara <z(a)lrde.epita.fr>
* m4/oln-with-lib.m4: Lookup for multiple AND single libraries
diff --git a/configure.ac b/configure.ac
index a53bcf8..631bc89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -535,6 +535,7 @@ AC_CONFIG_FILES([
milena/tests/world/binary_2d/Makefile
milena/tests/world/inter_pixel/Makefile
milena/tests/world/inter_pixel/dim2/Makefile
+ milena/tests/world/k1/Makefile
])
dnl<<lrde
--
1.7.2.5
1
0

19 Oct '12
* milena/mln/world/k1/display_enlarged.hh,
* milena/mln/world/k1/immerse.hh,
* milena/mln/world/k1/internal/face_dim.hh,
* milena/mln/world/k1/is_0_face.hh,
* milena/mln/world/k1/is_0_or_1_face.hh,
* milena/mln/world/k1/is_1_face.hh,
* milena/mln/world/k1/is_1_face_horizontal.hh,
* milena/mln/world/k1/is_1_face_vertical.hh,
* milena/mln/world/k1/is_2_face.hh,
* milena/mln/world/k1/is_primary_face.hh,
* milena/mln/world/k1/un_immerse.hh: New.
* milena/tests/world/k1/Makefile.am,
* milena/tests/world/k1/display_enlarged.cc,
* milena/tests/world/k1/immerse.cc,
* milena/tests/world/k1/is_0_face.cc,
* milena/tests/world/k1/is_0_or_1_face.cc,
* milena/tests/world/k1/is_1_face.cc,
* milena/tests/world/k1/is_1_face_horizontal.cc,
* milena/tests/world/k1/is_1_face_vertical.cc,
* milena/tests/world/k1/is_2_face.cc,
* milena/tests/world/k1/is_primary_face.cc: New tests.
* milena/tests/world/Makefile.am: Add Subdir.
* milena/mln/make/image.hh: Add overloads.
---
milena/ChangeLog | 31 +++++
milena/mln/make/image.hh | 59 ++++++++--
milena/mln/world/k1/display_enlarged.hh | 154 +++++++++++++++++++++++++
milena/mln/world/k1/immerse.hh | 122 +++++++++++++++++++
milena/mln/world/k1/internal/face_dim.hh | 75 ++++++++++++
milena/mln/world/k1/is_0_face.hh | 70 +++++++++++
milena/mln/world/k1/is_0_or_1_face.hh | 71 +++++++++++
milena/mln/world/k1/is_1_face.hh | 70 +++++++++++
milena/mln/world/k1/is_1_face_horizontal.hh | 70 +++++++++++
milena/mln/world/k1/is_1_face_vertical.hh | 70 +++++++++++
milena/mln/world/k1/is_2_face.hh | 70 +++++++++++
milena/mln/world/k1/is_primary_face.hh | 70 +++++++++++
milena/mln/world/k1/un_immerse.hh | 21 ++++
milena/tests/world/Makefile.am | 6 +-
milena/tests/world/k1/Makefile.am | 42 +++++++
milena/tests/world/k1/display_enlarged.cc | 98 ++++++++++++++++
milena/tests/world/k1/immerse.cc | 53 +++++++++
milena/tests/world/k1/is_0_face.cc | 40 +++++++
milena/tests/world/k1/is_0_or_1_face.cc | 40 +++++++
milena/tests/world/k1/is_1_face.cc | 39 ++++++
milena/tests/world/k1/is_1_face_horizontal.cc | 41 +++++++
milena/tests/world/k1/is_1_face_vertical.cc | 41 +++++++
milena/tests/world/k1/is_2_face.cc | 39 ++++++
milena/tests/world/k1/is_primary_face.cc | 39 ++++++
24 files changed, 1418 insertions(+), 13 deletions(-)
create mode 100644 milena/mln/world/k1/display_enlarged.hh
create mode 100644 milena/mln/world/k1/immerse.hh
create mode 100644 milena/mln/world/k1/internal/face_dim.hh
create mode 100644 milena/mln/world/k1/is_0_face.hh
create mode 100644 milena/mln/world/k1/is_0_or_1_face.hh
create mode 100644 milena/mln/world/k1/is_1_face.hh
create mode 100644 milena/mln/world/k1/is_1_face_horizontal.hh
create mode 100644 milena/mln/world/k1/is_1_face_vertical.hh
create mode 100644 milena/mln/world/k1/is_2_face.hh
create mode 100644 milena/mln/world/k1/is_primary_face.hh
create mode 100644 milena/mln/world/k1/un_immerse.hh
create mode 100644 milena/tests/world/k1/Makefile.am
create mode 100644 milena/tests/world/k1/display_enlarged.cc
create mode 100644 milena/tests/world/k1/immerse.cc
create mode 100644 milena/tests/world/k1/is_0_face.cc
create mode 100644 milena/tests/world/k1/is_0_or_1_face.cc
create mode 100644 milena/tests/world/k1/is_1_face.cc
create mode 100644 milena/tests/world/k1/is_1_face_horizontal.cc
create mode 100644 milena/tests/world/k1/is_1_face_vertical.cc
create mode 100644 milena/tests/world/k1/is_2_face.cc
create mode 100644 milena/tests/world/k1/is_primary_face.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index fdc8bd7..3db410c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,34 @@
+2012-09-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Initial commit of tools to work in K1.
+
+ * milena/mln/world/k1/display_enlarged.hh,
+ * milena/mln/world/k1/immerse.hh,
+ * milena/mln/world/k1/internal/face_dim.hh,
+ * milena/mln/world/k1/is_0_face.hh,
+ * milena/mln/world/k1/is_0_or_1_face.hh,
+ * milena/mln/world/k1/is_1_face.hh,
+ * milena/mln/world/k1/is_1_face_horizontal.hh,
+ * milena/mln/world/k1/is_1_face_vertical.hh,
+ * milena/mln/world/k1/is_2_face.hh,
+ * milena/mln/world/k1/is_primary_face.hh,
+ * milena/mln/world/k1/un_immerse.hh: New.
+
+ * milena/tests/world/k1/Makefile.am,
+ * milena/tests/world/k1/display_enlarged.cc,
+ * milena/tests/world/k1/immerse.cc,
+ * milena/tests/world/k1/is_0_face.cc,
+ * milena/tests/world/k1/is_0_or_1_face.cc,
+ * milena/tests/world/k1/is_1_face.cc,
+ * milena/tests/world/k1/is_1_face_horizontal.cc,
+ * milena/tests/world/k1/is_1_face_vertical.cc,
+ * milena/tests/world/k1/is_2_face.cc,
+ * milena/tests/world/k1/is_primary_face.cc: New tests.
+
+ * milena/tests/world/Makefile.am: Add Subdir.
+
+ * milena/mln/make/image.hh: Add overloads.
+
2012-09-28 Guillaume Lazzara <z(a)lrde.epita.fr>
* mln/debug/draw_graph.hh: Add a new overload and fix comments.
diff --git a/milena/mln/make/image.hh b/milena/mln/make/image.hh
index ef80c57..5208293 100644
--- a/milena/mln/make/image.hh
+++ b/milena/mln/make/image.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and
+// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
@@ -37,6 +37,9 @@
# include <mln/core/image/image1d.hh>
# include <mln/core/image/image2d.hh>
# include <mln/core/image/image3d.hh>
+# include <mln/make/box1d.hh>
+# include <mln/make/box2d.hh>
+# include <mln/make/box3d.hh>
# include <mln/opt/at.hh>
@@ -54,8 +57,11 @@ namespace mln
/// \return A 1D image.
///
template <typename V, unsigned L>
- mln::image1d<V> image(V (&values)[L]);
+ mln::image1d<V> image(V (&values)[L], const point1d& pmin);
+ /// \overload pmin = (0)
+ template <typename V, unsigned L>
+ mln::image1d<V> image(V (&values)[L]);
/// Create an image2d from an 2D array of values.
///
@@ -64,6 +70,10 @@ namespace mln
/// \return A 2D image.
///
template <typename V, unsigned R, unsigned C>
+ mln::image2d<V> image(V (&values)[R][C], const point2d& pmin);
+
+ /// \overload pmin = (0,0)
+ template <typename V, unsigned R, unsigned C>
mln::image2d<V> image(V (&values)[R][C]);
@@ -74,6 +84,10 @@ namespace mln
/// \return A 3D image.
///
template <typename V, unsigned S, unsigned R, unsigned C>
+ mln::image3d<V> image(V (&values)[S][R][C], const point3d& pmin);
+
+ /// \overload pmin = (0,0,0)
+ template <typename V, unsigned S, unsigned R, unsigned C>
mln::image3d<V> image(V (&values)[S][R][C]);
@@ -82,37 +96,53 @@ namespace mln
template <typename V, unsigned L>
mln::image1d<V>
- image(V (&values)[L])
+ image(V (&values)[L], const point1d& pmin)
{
mlc_bool(L != 0)::check();
- mln::image1d<V> tmp(L);
+ mln::image1d<V> tmp(make::box1d(pmin.ind(), pmin.ind() + L - 1));
const def::coord ninds = static_cast<def::coord>(L);
for (def::coord ind = 0; ind < ninds; ++ind)
- tmp(point1d(ind)) = values[ind];
+ tmp(point1d(pmin.ind() + ind)) = values[ind];
return tmp;
}
+ template <typename V, unsigned L>
+ mln::image1d<V>
+ image(V (&values)[L])
+ {
+ return image(values, point1d(0));
+ }
+
template <typename V, unsigned R, unsigned C>
mln::image2d<V>
- image(V (&values)[R][C])
+ image(V (&values)[R][C], const point2d& pmin)
{
mlc_bool(R != 0 && C != 0)::check();
- mln::image2d<V> tmp(R, C);
+ mln::image2d<V> tmp(make::box2d(pmin.row(), pmin.col(),
+ pmin.row() + R - 1, pmin.col() + C - 1));
const def::coord
nrows = static_cast<def::coord>(R),
ncols = static_cast<def::coord>(C);
for (def::coord row = 0; row < nrows; ++row)
for (def::coord col = 0; col < ncols; ++col)
- opt::at(tmp, row, col) = values[row][col];
+ opt::at(tmp, pmin.row() + row, pmin.col() + col) = values[row][col];
return tmp;
}
+ template <typename V, unsigned R, unsigned C>
+ mln::image2d<V>
+ image(V (&values)[R][C])
+ {
+ return image(values, point2d(0, 0));
+ }
+
template <typename V, unsigned S, unsigned R, unsigned C>
mln::image3d<V>
- image(V (&values)[S][R][C])
+ image(V (&values)[S][R][C], const point3d& pmin)
{
mlc_bool(S != 0 && R != 0 && C != 0)::check();
- mln::image3d<V> tmp(S, R, C);
+ mln::image3d<V> tmp(make::box3d(pmin.sli(), pmin.row(), pmin.col(),
+ pmin.sli() + S - 1, pmin.row() + R - 1, pmin.col() + C - 1));
const def::coord
nslis = static_cast<def::coord>(S),
nrows = static_cast<def::coord>(R),
@@ -120,10 +150,17 @@ namespace mln
for (def::coord sli = 0; sli < nslis; ++sli)
for (def::coord row = 0; row < nrows; ++row)
for (def::coord col = 0; col < ncols; ++col)
- opt::at(tmp, sli, row, col) = values[sli][row][col];
+ opt::at(tmp, pmin.sli() + sli, pmin.row() + row, pmin.col() + col) = values[sli][row][col];
return tmp;
}
+ template <typename V, unsigned S, unsigned R, unsigned C>
+ mln::image3d<V>
+ image(V (&values)[S][R][C])
+ {
+ return image(values, point3d(0, 0, 0));
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::make
diff --git a/milena/mln/world/k1/display_enlarged.hh b/milena/mln/world/k1/display_enlarged.hh
new file mode 100644
index 0000000..f3610c1
--- /dev/null
+++ b/milena/mln/world/k1/display_enlarged.hh
@@ -0,0 +1,154 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Create a new image where 2 faces are enlarged for better
+/// visualization.
+
+#ifndef MLN_WORLD_K1_DISPLAY_ENLARGED_HH
+# define MLN_WORLD_K1_DISPLAY_ENLARGED_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_0_face.hh>
+# include <mln/world/k1/is_1_face_vertical.hh>
+# include <mln/world/k1/is_1_face_horizontal.hh>
+# include <mln/world/k1/is_2_face.hh>
+# include <mln/geom/all.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Create a new image where 2 faces are enlarged for better
+ visualization.
+
+ Exemple with zoom = 3:
+ \verbatim
+ . - . - . . - - - . - - - .
+ | o | o | | o o o | o o o |
+ . - . - . -> | o o o | o o o |
+ | o | o | | o o o | o o o |
+ . - . - . . - - - . - - - .
+ | o o o | o o o |
+ | o o o | o o o |
+ | o o o | o o o |
+ . - - - . - - - .
+ \endverbatim
+
+ \param[in] ima_k1 A 2D image immersed in K1.
+ \param[in] zoom The number of times 2 faces must be duplicated
+ (must be odd).
+
+
+ This function is useful for debugging to distinguish 2 faces
+ from others.
+
+ */
+ template <typename I>
+ mln_concrete(I)
+ display_enlarged(const Image<I>& ima_k1, unsigned zoom);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ template <typename I>
+ mln_concrete(I)
+ display_enlarged(const Image<I>& ima_k1_, unsigned zoom_)
+ {
+ trace::entering("mln::world::k1::display_enlarged");
+
+ mln_precondition(exact(ima_k1_).is_valid());
+ mln_assertion(zoom_ % 2);
+
+ const I& ima_k1 = exact(ima_k1_);
+ int shift = zoom_ - 1;
+
+ // No zoom: return original image.
+ if (zoom_ == 1)
+ return ima_k1;
+
+ mln_concrete(I) output(make::box2d(ima_k1.domain().pmin().row() * shift,
+ ima_k1.domain().pmin().col() * shift,
+ ima_k1.domain().pmax().row() * shift,
+ ima_k1.domain().pmax().col() * shift));
+
+ const mln::def::coord
+ min_row = geom::min_row(ima_k1),
+ max_row = geom::max_row(ima_k1),
+ min_col = geom::min_col(ima_k1),
+ max_col = geom::max_col(ima_k1);
+
+ for (mln::def::coord row = min_row; row <= max_row; ++row)
+ {
+ for (mln::def::coord col = min_col; col <= max_col; ++col)
+ {
+ if (is_0_face(point2d(row, col)))
+ {
+ output.at_(row * shift, col * shift) = ima_k1.at_(row, col);
+ }
+ else if (is_1_face_vertical(point2d(row, col)))
+ {
+ for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
+ output.at_(row * shift + j, col * shift) = ima_k1.at_(row, col);
+ }
+ else if (is_1_face_horizontal(point2d(row, col)))
+ {
+ for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
+ output.at_(row * shift, col * shift + j) = ima_k1.at_(row, col);
+ }
+ else if (is_2_face(point2d(row, col)))
+ {
+ for (mln::def::coord i = -(shift - 1); i < (shift + 3); ++i)
+ for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j)
+ output.at_(row * shift + i, col * shift + j) = ima_k1.at_(row, col);
+ }
+ }
+ }
+
+ trace::exiting("mln::world::k1::display_enlarged");
+ return output;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_DISPLAY_ENLARGED_HH
+
diff --git a/milena/mln/world/k1/immerse.hh b/milena/mln/world/k1/immerse.hh
new file mode 100644
index 0000000..928012b
--- /dev/null
+++ b/milena/mln/world/k1/immerse.hh
@@ -0,0 +1,122 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Immerse a 2D image into K1.
+
+#ifndef MLN_WORLD_K1_IMMERSE_HH
+# define MLN_WORLD_K1_IMMERSE_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/box.hh>
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /*! \brief Immerse a 2D image into K1.
+
+ \verbatim
+
+ -1 0 1 2 3
+ 0 1 -1 . - . - .
+ 0 o o 0 | o | o |
+ 1 o o -> 1 . - . - .
+ 2 | o | o |
+ 3 . - . - .
+
+ \endverbatim
+
+ */
+ template <typename I>
+ mln_concrete(I) immerse(const Image<I>& ima);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ /// \brief Return the equivalent domain in K1 from a domain in
+ /// K0.
+ template <typename B>
+ inline
+ B domain_from_K0(const Box<B>& b_)
+ {
+ mln_precondition(exact(b_).is_valid());
+ const B& b = exact(b_);
+
+ mln_deduce(B, site, delta) one;
+ one.set_all(1);
+ return B(2 * b.pmin() - one, 2 * b.pmax() + one);
+ }
+
+ inline
+ point2d
+ immerse_point(const point2d& p)
+ {
+ point2d tmp(2 * p.row(), 2 * p.col());
+ return tmp;
+ }
+
+ } // end of namespace mln::world::k1::internal
+
+
+
+ // Facade
+
+ template <typename I>
+ mln_concrete(I) immerse(const Image<I>& ima_)
+ {
+ trace::entering("mln::world::k1::immerse");
+ mln_precondition(exact(ima_).is_valid());
+ const I& ima = exact(ima_);
+
+ mln_concrete(I) output(internal::domain_from_K0(ima.domain()));
+
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ output(internal::immerse_point(p)) = ima(p);
+
+ trace::exiting("mln::world::k1::immerse");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IMMERSE_HH
diff --git a/milena/mln/world/k1/internal/face_dim.hh b/milena/mln/world/k1/internal/face_dim.hh
new file mode 100644
index 0000000..b933e86
--- /dev/null
+++ b/milena/mln/world/k1/internal/face_dim.hh
@@ -0,0 +1,75 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Returns the dimension of site in K1.
+
+#ifndef MLN_WORLD_K1_FACE_DIM_HH
+# define MLN_WORLD_K1_FACE_DIM_HH
+
+# include <mln/core/alias/point2d.hh>
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ namespace internal
+ {
+
+ /// \brief Returns the dimension of site in K1.
+ unsigned face_dim(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ unsigned face_dim(const point2d& p)
+ {
+ return (p[0] % 2 == 0) + (p[1] % 2 == 0);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::work::k1::internal
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_FACE_DIM_HH
+
+
diff --git a/milena/mln/world/k1/is_0_face.hh b/milena/mln/world/k1/is_0_face.hh
new file mode 100644
index 0000000..c9d9b0e
--- /dev/null
+++ b/milena/mln/world/k1/is_0_face.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Check if site is a 0 face.
+
+#ifndef MLN_WORLD_K1_IS_0_FACE_HH
+# define MLN_WORLD_K1_IS_0_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 0 face
+ bool is_0_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_0_face(const point2d& p)
+ {
+ return internal::face_dim(p) == 0;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_0_FACE_HH
diff --git a/milena/mln/world/k1/is_0_or_1_face.hh b/milena/mln/world/k1/is_0_or_1_face.hh
new file mode 100644
index 0000000..6f3f47a
--- /dev/null
+++ b/milena/mln/world/k1/is_0_or_1_face.hh
@@ -0,0 +1,71 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Check if site is a 1 face.
+
+#ifndef MLN_WORLD_K1_IS_0_OR_1_FACE_HH
+# define MLN_WORLD_K1_IS_0_OR_1_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_0_or_1_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_0_or_1_face(const point2d& p)
+ {
+ unsigned dim = internal::face_dim(p);
+ return dim == 0 || dim == 1;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_0_OR_1_FACE_HH
diff --git a/milena/mln/world/k1/is_1_face.hh b/milena/mln/world/k1/is_1_face.hh
new file mode 100644
index 0000000..aafa442
--- /dev/null
+++ b/milena/mln/world/k1/is_1_face.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Check if site is a 1 face.
+
+#ifndef MLN_WORLD_K1_IS_1_FACE_HH
+# define MLN_WORLD_K1_IS_1_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face(const point2d& p)
+ {
+ return internal::face_dim(p) == 1;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_1_FACE_HH
diff --git a/milena/mln/world/k1/is_1_face_horizontal.hh b/milena/mln/world/k1/is_1_face_horizontal.hh
new file mode 100644
index 0000000..ff90b0c
--- /dev/null
+++ b/milena/mln/world/k1/is_1_face_horizontal.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Check if site is a 1 face.
+
+#ifndef MLN_WORLD_K1_IS_1_FACE_HORIZONTAL_HH
+# define MLN_WORLD_K1_IS_1_FACE_HORIZONTAL_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_1_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face_horizontal(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face_horizontal(const point2d& p)
+ {
+ return is_1_face(p) && p[1] % 2 == 0;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_1_FACE_HORIZONTAL_HH
diff --git a/milena/mln/world/k1/is_1_face_vertical.hh b/milena/mln/world/k1/is_1_face_vertical.hh
new file mode 100644
index 0000000..f10067d
--- /dev/null
+++ b/milena/mln/world/k1/is_1_face_vertical.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Check if site is a 1 face.
+
+#ifndef MLN_WORLD_K1_IS_1_FACE_VERTICAL_HH
+# define MLN_WORLD_K1_IS_1_FACE_VERTICAL_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_1_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 1 face
+ bool is_1_face_vertical(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_1_face_vertical(const point2d& p)
+ {
+ return is_1_face(p) && p[0] % 2 == 0;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_1_FACE_VERTICAL_HH
diff --git a/milena/mln/world/k1/is_2_face.hh b/milena/mln/world/k1/is_2_face.hh
new file mode 100644
index 0000000..b3c8c98
--- /dev/null
+++ b/milena/mln/world/k1/is_2_face.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Check if site is a 2 face.
+
+#ifndef MLN_WORLD_K1_IS_2_FACE_HH
+# define MLN_WORLD_K1_IS_2_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/internal/face_dim.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a 2 face
+ bool is_2_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_2_face(const point2d& p)
+ {
+ return internal::face_dim(p) == 2;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_2_FACE_HH
diff --git a/milena/mln/world/k1/is_primary_face.hh b/milena/mln/world/k1/is_primary_face.hh
new file mode 100644
index 0000000..572d25c
--- /dev/null
+++ b/milena/mln/world/k1/is_primary_face.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+///
+/// \brief Check if site is a primary face.
+
+#ifndef MLN_WORLD_K1_IS_PRIMARY_FACE_HH
+# define MLN_WORLD_K1_IS_PRIMARY_FACE_HH
+
+# include <mln/core/alias/point2d.hh>
+# include <mln/world/k1/is_2_face.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace k1
+ {
+
+ /// \brief Check if site is a primary face
+ bool is_primary_face(const point2d& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Facade
+
+ inline
+ bool is_primary_face(const point2d& p)
+ {
+ return is_2_face(p);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::k1
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_K1_IS_PRIMARY_FACE_HH
diff --git a/milena/mln/world/k1/un_immerse.hh b/milena/mln/world/k1/un_immerse.hh
new file mode 100644
index 0000000..7978be9
--- /dev/null
+++ b/milena/mln/world/k1/un_immerse.hh
@@ -0,0 +1,21 @@
+
+
+ inline
+ point2d
+ un_immerse(const point2d& p)
+ {
+ point2d tmp(p.row() / 2, p.col() / 2);
+ return tmp;
+ }
+
+ struct is_2_face_t : Function_v2b< is_2_face_t >
+ {
+ typedef bool result;
+ inline bool operator()(const point2d& p) const { return FIXME; } // p.row() % 2 && p.col() % 2
+ } is_2_face;
+
+ struct is_not_2_face_t : Function_v2b< is_not_2_face_t >
+ {
+ typedef bool result;
+ inline bool operator()(const point2d& p) const { return FIXME; } // ! (p.row() % 2 && p.col() % 2)
+ } is_not_2_face;
diff --git a/milena/tests/world/Makefile.am b/milena/tests/world/Makefile.am
index 3bae089..494271c 100644
--- a/milena/tests/world/Makefile.am
+++ b/milena/tests/world/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2009, 2012 EPITA Research and Development Laboratory
+# (LRDE).
#
# This file is part of Olena.
#
@@ -18,4 +19,5 @@ include $(top_srcdir)/milena/tests/tests.mk
SUBDIRS = \
binary_2d \
- inter_pixel
+ inter_pixel \
+ k1
diff --git a/milena/tests/world/k1/Makefile.am b/milena/tests/world/k1/Makefile.am
new file mode 100644
index 0000000..daa0d94
--- /dev/null
+++ b/milena/tests/world/k1/Makefile.am
@@ -0,0 +1,42 @@
+# Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE).
+#
+# This file is part of Olena.
+#
+# Olena is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, version 2 of the License.
+#
+# Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ display_enlarged \
+ immerse \
+ immerse_and_duplicate_2_to_1_faces \
+ is_0_face \
+ is_0_or_1_face \
+ is_1_face \
+ is_1_face_vertical \
+ is_1_face_horizontal \
+ is_2_face \
+ is_primary_face
+
+display_enlarged_SOURCES = display_enlarged.cc
+immerse_SOURCES = immerse.cc
+immerse_and_duplicate_2_to_1_faces_SOURCES = immerse_and_duplicate_2_to_1_faces.cc
+is_0_face_SOURCES = is_0_face.cc
+is_0_or_1_face_SOURCES = is_0_or_1_face.cc
+is_1_face_SOURCES = is_1_face.cc
+is_1_face_vertical_SOURCES = is_1_face_vertical.cc
+is_1_face_horizontal_SOURCES = is_1_face_horizontal.cc
+is_2_face_SOURCES = is_2_face.cc
+is_primary_face_SOURCES = is_primary_face.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/world/k1/display_enlarged.cc b/milena/tests/world/k1/display_enlarged.cc
new file mode 100644
index 0000000..3365fbe
--- /dev/null
+++ b/milena/tests/world/k1/display_enlarged.cc
@@ -0,0 +1,98 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/world/k1/display_enlarged.hh>
+#include <mln/world/k1/immerse.hh>
+#include <mln/make/box2d.hh>
+#include <mln/data/compare.hh>
+
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ int vals[5][5] = {
+ {1, 2, 1, 2, 1 },
+ {2, 3, 2, 3, 2 },
+ {1, 2, 1, 2, 1 },
+ {2, 3, 2, 3, 2 },
+ {1, 2, 1, 2, 1 }
+ };
+
+ int vals3[9][9] = {
+ {1, 2, 2, 2, 1, 2, 2, 2, 1},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {1, 2, 2, 2, 1, 2, 2, 2, 1},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {2, 3, 3, 3, 2, 3, 3, 3, 2},
+ {1, 2, 2, 2, 1, 2, 2, 2, 1}
+ };
+
+ int vals5[17][17] = {
+ {1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2},
+ {1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1}
+ };
+
+ image2d<int> ima = make::image(vals, point2d(-1, -1));
+
+ {
+ image2d<int> enlarged = world::k1::display_enlarged(ima, 1);
+ mln_assertion(ima == enlarged);
+ }
+
+ {
+ image2d<int> ref3 = make::image(vals3, point2d(-2, -2));
+ image2d<int> enlarged = world::k1::display_enlarged(ima, 3);
+ mln_assertion(ref3 == enlarged);
+ }
+
+ {
+ image2d<int> ref5 = make::image(vals5, point2d(-4, -4));
+ image2d<int> enlarged = world::k1::display_enlarged(ima, 5);
+ mln_assertion(ref5 == enlarged);
+ }
+}
diff --git a/milena/tests/world/k1/immerse.cc b/milena/tests/world/k1/immerse.cc
new file mode 100644
index 0000000..8a17056
--- /dev/null
+++ b/milena/tests/world/k1/immerse.cc
@@ -0,0 +1,53 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/image/image2d.hh>
+#include <mln/world/k1/immerse.hh>
+#include <mln/make/box2d.hh>
+
+int main()
+{
+ using namespace mln;
+
+
+ int vals[2][2] = {
+ {1, 2 },
+ {3, 4 }
+ };
+ image2d<int> ima = make::image(vals);
+
+ image2d<int> immersed = world::k1::immerse(ima);
+
+ // Check domain
+ mln_assertion(immersed.domain() == make::box2d(-1, -1, 3, 3));
+
+ // Check values
+ mln_assertion(immersed(point2d(0, 0)) == 1);
+ mln_assertion(immersed(point2d(2, 0)) == 3);
+ mln_assertion(immersed(point2d(0, 2)) == 2);
+ mln_assertion(immersed(point2d(2, 2)) == 4);
+}
diff --git a/milena/tests/world/k1/is_0_face.cc b/milena/tests/world/k1/is_0_face.cc
new file mode 100644
index 0000000..6033af6
--- /dev/null
+++ b/milena/tests/world/k1/is_0_face.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_0_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(world::k1::is_0_face(point2d(-1, -1)));
+ mln_assertion(!world::k1::is_0_face(point2d(-1, 0)));
+ mln_assertion(!world::k1::is_0_face(point2d(0, -1)));
+ mln_assertion(!world::k1::is_0_face(point2d(0, 0)));
+ mln_assertion(world::k1::is_0_face(point2d(1, 1)));
+}
diff --git a/milena/tests/world/k1/is_0_or_1_face.cc b/milena/tests/world/k1/is_0_or_1_face.cc
new file mode 100644
index 0000000..f977566
--- /dev/null
+++ b/milena/tests/world/k1/is_0_or_1_face.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_0_or_1_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(world::k1::is_0_or_1_face(point2d(-1, -1)));
+ mln_assertion(world::k1::is_0_or_1_face(point2d(-1, 0)));
+ mln_assertion(world::k1::is_0_or_1_face(point2d(0, -1)));
+ mln_assertion(!world::k1::is_0_or_1_face(point2d(0, 0)));
+ mln_assertion(world::k1::is_0_or_1_face(point2d(1, 1)));
+}
diff --git a/milena/tests/world/k1/is_1_face.cc b/milena/tests/world/k1/is_1_face.cc
new file mode 100644
index 0000000..bd50f84
--- /dev/null
+++ b/milena/tests/world/k1/is_1_face.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_1_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_1_face(point2d(-1, -1)));
+ mln_assertion(world::k1::is_1_face(point2d(-1, 0)));
+ mln_assertion(world::k1::is_1_face(point2d(0, -1)));
+ mln_assertion(!world::k1::is_1_face(point2d(0, 0)));
+}
diff --git a/milena/tests/world/k1/is_1_face_horizontal.cc b/milena/tests/world/k1/is_1_face_horizontal.cc
new file mode 100644
index 0000000..4f6e406
--- /dev/null
+++ b/milena/tests/world/k1/is_1_face_horizontal.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_1_face_horizontal.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_1_face_horizontal(point2d(-1, -1)));
+ mln_assertion(world::k1::is_1_face_horizontal(point2d(-1, 0)));
+ mln_assertion(world::k1::is_1_face_horizontal(point2d(1, 0)));
+ mln_assertion(!world::k1::is_1_face_horizontal(point2d(0, -1)));
+ mln_assertion(!world::k1::is_1_face_horizontal(point2d(0, 1)));
+ mln_assertion(!world::k1::is_1_face_horizontal(point2d(0, 0)));
+}
diff --git a/milena/tests/world/k1/is_1_face_vertical.cc b/milena/tests/world/k1/is_1_face_vertical.cc
new file mode 100644
index 0000000..e204f97
--- /dev/null
+++ b/milena/tests/world/k1/is_1_face_vertical.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_1_face_vertical.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_1_face_vertical(point2d(-1, -1)));
+ mln_assertion(!world::k1::is_1_face_vertical(point2d(-1, 0)));
+ mln_assertion(!world::k1::is_1_face_vertical(point2d(1, 0)));
+ mln_assertion(world::k1::is_1_face_vertical(point2d(0, -1)));
+ mln_assertion(world::k1::is_1_face_vertical(point2d(0, 1)));
+ mln_assertion(!world::k1::is_1_face_vertical(point2d(0, 0)));
+}
diff --git a/milena/tests/world/k1/is_2_face.cc b/milena/tests/world/k1/is_2_face.cc
new file mode 100644
index 0000000..912567d
--- /dev/null
+++ b/milena/tests/world/k1/is_2_face.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_2_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_2_face(point2d(-1, -1)));
+ mln_assertion(!world::k1::is_2_face(point2d(-1, 0)));
+ mln_assertion(!world::k1::is_2_face(point2d(0, -1)));
+ mln_assertion(world::k1::is_2_face(point2d(0, 0)));
+}
diff --git a/milena/tests/world/k1/is_primary_face.cc b/milena/tests/world/k1/is_primary_face.cc
new file mode 100644
index 0000000..32eb871
--- /dev/null
+++ b/milena/tests/world/k1/is_primary_face.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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
+
+#include <mln/core/alias/point2d.hh>
+#include <mln/world/k1/is_primary_face.hh>
+
+int main()
+{
+ using namespace mln;
+
+ mln_assertion(!world::k1::is_primary_face(point2d(-1, -1)));
+ mln_assertion(!world::k1::is_primary_face(point2d(-1, 0)));
+ mln_assertion(!world::k1::is_primary_face(point2d(0, -1)));
+ mln_assertion(world::k1::is_primary_face(point2d(0, 0)));
+}
--
1.7.2.5
1
0

olena-2.0-84-gf46dedd scribo/text/recognition.hh: Restore previous locale.
by Guillaume Lazzara 19 Oct '12
by Guillaume Lazzara 19 Oct '12
19 Oct '12
---
scribo/ChangeLog | 4 ++++
scribo/scribo/text/recognition.hh | 6 ++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index a3e6e7e..1bb8769 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,9 @@
2011-12-06 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * scribo/text/recognition.hh: Restore previous locale.
+
+2011-12-06 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Ensure current locale is C while calling Tesseract.
* demo/viewer/main.cc: Move call to setLocale...
diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh
index 22d31f6..d754e66 100644
--- a/scribo/scribo/text/recognition.hh
+++ b/scribo/scribo/text/recognition.hh
@@ -193,6 +193,9 @@ namespace scribo
delete [] s;
}
+ // Restore default locale.
+ setlocale(LC_ALL, "");
+
trace::exiting("scribo::text::recognition");
}
@@ -268,6 +271,9 @@ namespace scribo
if (!output_file.empty())
file.close();
+ // Restore default locale.
+ setlocale(LC_ALL, "");
+
trace::exiting("scribo::text::recognition");
}
--
1.7.2.5
1
0

olena-2.0-83-g6412c07 Ensure current locale is C while calling Tesseract.
by Guillaume Lazzara 19 Oct '12
by Guillaume Lazzara 19 Oct '12
19 Oct '12
* demo/viewer/main.cc: Move call to setLocale...
* scribo/text/recognition.hh: ... Here.
---
scribo/ChangeLog | 7 +++++++
scribo/demo/viewer/main.cc | 14 --------------
scribo/scribo/text/recognition.hh | 14 ++++++++++++++
3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 48c1b84..a3e6e7e 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,10 @@
+2011-12-06 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Ensure current locale is C while calling Tesseract.
+
+ * demo/viewer/main.cc: Move call to setLocale...
+ * scribo/text/recognition.hh: ... Here.
+
2011-11-16 Guillaume Lazzara <z(a)lrde.epita.fr>
* scribo/text/recognition.hh: Fix code for Tesseract 3.01
diff --git a/scribo/demo/viewer/main.cc b/scribo/demo/viewer/main.cc
index 704dfe7..0c50c7b 100644
--- a/scribo/demo/viewer/main.cc
+++ b/scribo/demo/viewer/main.cc
@@ -18,10 +18,6 @@
#include <QtGui>
#include <iostream>
-# ifdef HAVE_TESSERACT_2
-#include <clocale>
-# endif // ! HAVE_TESSERACT_2
-
#undef MLN_WO_GLOBAL_VARS
#include "viewer.hh"
#include <mln/labeling/colorize.hh>
@@ -49,15 +45,5 @@ int main(int argc, char** argv)
if (!viewer)
return -1;
-
-# ifdef HAVE_TESSERACT_2
- // Tesseract 2.x is known to have issues while reading training data
- // depending on the current locales in use. Training data files use
- // float data and the decimal separator can be either '.' or ','
- // causing errors.
- // Setting locale to "C" fix that issue.
- setlocale(LC_ALL, "C");
-# endif // ! HAVE_TESSERACT_2
-
return viewer->exec();
}
diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh
index fe2c94a..22d31f6 100644
--- a/scribo/scribo/text/recognition.hh
+++ b/scribo/scribo/text/recognition.hh
@@ -40,6 +40,7 @@
# include <ostream>
+# include <clocale>
# include <mln/core/image/dmorph/image_if.hh>
# include <mln/core/concept/neighborhood.hh>
@@ -113,6 +114,12 @@ namespace scribo
{
trace::entering("scribo::text::recognition");
+ // Tesseract is known to have issues while reading training data
+ // depending on the current locales in use. Training data files use
+ // float data and the decimal separator can be either '.' or ','
+ // causing errors.
+ // Setting locale to "C" fix that issue.
+ setlocale(LC_ALL, "C");
// Initialize Tesseract.
TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL);
@@ -201,6 +208,13 @@ namespace scribo
const I& line = exact(line_);
mln_precondition(line.is_valid());
+ // Tesseract is known to have issues while reading training data
+ // depending on the current locales in use. Training data files use
+ // float data and the decimal separator can be either '.' or ','
+ // causing errors.
+ // Setting locale to "C" fix that issue.
+ setlocale(LC_ALL, "C");
+
// Initialize Tesseract.
TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL);
--
1.7.2.5
1
0

olena-2.0-82-gba481b8 m4/oln-with-lib.m4: Lookup for multiple AND single libraries while checking Tesseract availability.
by Guillaume Lazzara 19 Oct '12
by Guillaume Lazzara 19 Oct '12
19 Oct '12
---
ChangeLog | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 41798a8..81e9545 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-16 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * m4/oln-with-lib.m4: Lookup for multiple AND single libraries
+ while checking Tesseract availability.
+
2012-06-25 Guillaume Lazzara <z(a)lrde.epita.fr>
* distrib/macports/Portfile.in: Apply changes required by MacPorts
--
1.7.2.5
1
0

olena-2.0-81-g2ac2f4b scribo/text/recognition.hh: Fix code for Tesseract 3.01 compatibility.
by Guillaume Lazzara 19 Oct '12
by Guillaume Lazzara 19 Oct '12
19 Oct '12
---
scribo/ChangeLog | 5 +++++
scribo/scribo/text/recognition.hh | 1 -
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index afb1147..48c1b84 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-16 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ * scribo/text/recognition.hh: Fix code for Tesseract 3.01
+ compatibility.
+
2012-09-26 Guillaume Lazzara <z(a)lrde.epita.fr>
* scribo/src/content_in_doc.cc: Add more debug images.
diff --git a/scribo/scribo/text/recognition.hh b/scribo/scribo/text/recognition.hh
index 2b9d5a1..fe2c94a 100644
--- a/scribo/scribo/text/recognition.hh
+++ b/scribo/scribo/text/recognition.hh
@@ -115,7 +115,6 @@ namespace scribo
// Initialize Tesseract.
-
TessBaseAPI::InitWithLanguage(NULL, NULL, language, NULL, false, 0, NULL);
typedef mln_ch_value(L,bool) I;
--
1.7.2.5
1
0
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch unstable/scribo has been updated
via f46deddccad811cc836aca7917a6cfbd6a5d12cc (commit)
via 6412c07f5e375f1bc8a22ae3d42288e601b3471d (commit)
via ba481b8ad2a28420b170e8e5f8a4890b2f6bd9cf (commit)
via 2ac2f4b257f2c7cdf521a100c047a828b39f39f4 (commit)
from 39c49007646f0a4b5ca021af14ee039220865935 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
No new revisions were added by this update.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
scribo/ChangeLog | 16 ++++++++++++++++
scribo/demo/viewer/main.cc | 14 --------------
scribo/scribo/text/recognition.hh | 21 ++++++++++++++++++++-
4 files changed, 41 insertions(+), 15 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform
1
0
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/khalimsky has been updated
discards 0ee6ca936752310d487231054017dbfe2685dbcf (commit)
discards 63a31e89870d37a1cabe9f2185ea37755d40cfa4 (commit)
discards 1a5b21fe7b038b69f458c5eff9470cf9a297d062 (commit)
discards df0ecc75bbd147bb9bd3733217189879aafe1221 (commit)
discards acb3c05ba9f4d806c74604c440533ff5d7db3014 (commit)
discards 6b05452c6453e2114d063aef6c53078159c793ff (commit)
discards f81a760ac268c88667aa3d9f51f19b968640d308 (commit)
discards 61eef32bf34aa5d7b65ce8f27405ae16bed66d30 (commit)
discards 027f767ead3b99a0b564cf5723b6acac18dc3716 (commit)
discards cbf3fe229ced061e0a6b9aa590593c91fced0d10 (commit)
discards be35e3941a0a8bb5ec44a7be4e55a0142c734430 (commit)
discards 1cde74522f42b4cfdd260df9e3d2f46c50510eb1 (commit)
discards bbd4359f6eda38f4c6f04a0c69203ad4d5120d9b (commit)
discards b52230fdd12773c58aceb1e8a9d3d28c584f5a50 (commit)
discards 378bb80be1f173841b2358c47b15be1ce87add88 (commit)
discards c709c0740a7690c450763f5fe2e13bde69795f31 (commit)
discards 0c9847ecc8e97564ab24fc23dd2aee7ace9aa072 (commit)
discards 841c962c69fee0d982dbdae5b155c479bdd73c99 (commit)
discards d2cc34cb2d84e990fce7f03ecc130cb3cbe86e2b (commit)
discards 3ce4ce1dc14779f0ce244fef70a6fa984f494d59 (commit)
discards e5977cbc87ffe43c37e74e83f36eee278f15ce13 (commit)
discards 25a6947e13ca488b5f1b0601f2333d113c85d2d7 (commit)
discards 91b3fcb92cb20730dc0c3b29a6e8ea1462eec7f7 (commit)
discards d0d18bf100fa99b288d55dd025055c1c79ada3cc (commit)
discards b0be295569b332dfffbeb4313ff208726ca01794 (commit)
discards f669bdcced156e0cbf9307a77515860911ad17bd (commit)
discards cb1593cc1781f87210c01db60ac8cd138121fa2b (commit)
discards 39e1152eceddabf1c61e368c2f7bd477dbc2c46e (commit)
discards 1a7b4fcf3f2e141a6b59bc39db3ae2298329b379 (commit)
discards 0a1c1c9af1b82c13146555ce8caca89030e7af58 (commit)
discards 287d09bba75106e59f22e1a313225481cf7f9bd8 (commit)
discards cc2c4ef347d9a8fdce6fc6bbf29213f14e366131 (commit)
via c8699b912ad6e68f3ead87f6165612c8fe7ed067 (commit)
via c680fc72f05286ea1875e0eb3adac770afd8c96c (commit)
via 4bae71d7d231b34e2db0ec358a146b2f96b1073d (commit)
via 995652fc46f68950a7c0b3e24ffa14282b24929b (commit)
via 1b1c0afd99678c36cbdb118a7b43895cbfe7725d (commit)
via 253edef48d8dcb2d2696a362543866be852041f3 (commit)
via 318c0f779abc51062e0bbf57fb61bb75cec3e81c (commit)
via 3e7e4f92950eba72a5e6d78ccb9a8e0bf5ab1401 (commit)
via b96d7cc9a2f10653fdaaf81ffe233da62810e1ab (commit)
via 81ed289d3056035e658a6c6f7faff0f33a94b1b4 (commit)
via e242c846a5f0385c93c0d5fbc487034e1e80e50e (commit)
via d61b69f1285c177ef4a4fe3d2fa819cb3fc6900e (commit)
via a42ca7ea8a3cb38c1aee89eea4cc3e299f4b4802 (commit)
via 3d34eb099ffc8e71bd8c8540283c96015521f3b8 (commit)
via cc965b2b677c5f3d7e6e10b8a4c55fe87cfebe5a (commit)
via 06d861d159a4cc3783f28465f883f6539cfaa058 (commit)
via e0efc4408d2274f91e82ceccd49b2ee75efcfc5a (commit)
via ed21680bd937412edb5edc9af255dc0c3322d656 (commit)
via dbc709fd9b4e968f4d9b7663815f22881244717d (commit)
via 12b51e718856528402a9dc8937cb031440e57e8a (commit)
via 7cbca2dfd04d1848bc9fb9372324094fc8b42b75 (commit)
via 4a735fd7e0aed4a1901659e242a41e5f24925a9d (commit)
via 64344919991cdcaef004d295f727888c13de0aac (commit)
via 82a0e36765d634513cff57997a97afc8f7ad2ae8 (commit)
via 759954227486a5ef88810bd8f2368f89fc50bb27 (commit)
via 7aacabf8927300b389ee6b4c70c3340d4063c23a (commit)
via 99ee8c8080a11b9c547f2ca12d9f20bd6b566f22 (commit)
via 9d4bc6a3cca30b47451090bade9cfa27e7b56be0 (commit)
via 539ff65ac5534696410e3642eaea0fa35a6e5cf5 (commit)
via 1f96c87d44e8ec5b5d06b15954a9aec5ed2888ae (commit)
via f46deddccad811cc836aca7917a6cfbd6a5d12cc (commit)
via 6412c07f5e375f1bc8a22ae3d42288e601b3471d (commit)
via ba481b8ad2a28420b170e8e5f8a4890b2f6bd9cf (commit)
via 2ac2f4b257f2c7cdf521a100c047a828b39f39f4 (commit)
via 39c49007646f0a4b5ca021af14ee039220865935 (commit)
via 4b68faa4d9d1d5895d02886babfa882daacfff34 (commit)
via 100a5de1c32ce7239ed7516e695f73039d34c197 (commit)
via a0009d29906b8d09acfec883cb0525a744af261c (commit)
via 4e2298d2cb279e72733a1623e6df1bc913d8df2d (commit)
via 3388ab1a99b95859e0ee2f8645195904d8825eff (commit)
via 031310f04de779261c2d1c947639fd26a977aa61 (commit)
via c6498e5c0810332d9df1f36eacd18c71f49bb84a (commit)
via 3ce08d0601400cc731547fb4787a721be550f253 (commit)
via 0c8e07f9d1f011558bd12f93d3cd8f4f3f268d40 (commit)
via 378f3533e395702eaf862094eb2a6efbd7b28562 (commit)
via cf88d225eedfd2b1171d7d682e41b8d058022896 (commit)
via 3a65b8d103648386c782e6ffd7e6c6f9d4d31876 (commit)
via 9aec99882d259af348743be9789cf7ed1048fa2a (commit)
via 8c4e2dd61bf3a218b8d74a3d404ac031148f1fba (commit)
via e1b3bd773168c12df5dba50ec1f51800099f680e (commit)
via 183d8311bb8ebc4f50368d5b514d146eb140dece (commit)
via 9846847b09170222664d4bc855138c413867687a (commit)
via 13097b17352c352b39d2aa6c3db44247bf5a7e05 (commit)
via b7cf120ad8026ef2ab94a4bf72f0b1cf75ee8659 (commit)
via 6bc3a11973ec08c060943988bf96e1155d66c387 (commit)
via 03eaf1cd586c489ec0ef5e1353c5752aed78a4a7 (commit)
via 962ceb9b1aa6da7d0b2a1278d375c52e94095279 (commit)
via f3c06f65c794685bb17d73b321afcda9f70b05af (commit)
via c471618c68f0572f188c1851e2a016d92ca42855 (commit)
via e9bb20fdca74a67c31321df1050a0937d69600e8 (commit)
via 9a738ad40e072fa940b1745b7843d89b9d9c09f5 (commit)
via a20c0650f91295e50e8913ecd9f8bf0516747318 (commit)
via 4f0a66f09045818f9b9bb16dc315ca7691e30c03 (commit)
via d5207270e354bb9317c6339ab1ada1bc7e88f701 (commit)
via ae6f6e5e98ec7c589cadc60ac8547639c36e45d8 (commit)
via 876593557f34e3a78366a5aa9322fec0afae8af3 (commit)
via 54defbbea0f22afc1413698b007cd6457d245f40 (commit)
via d5de13336922ea9fe734e176b0f25a22e895d302 (commit)
via 7307887029d66c125b3fc70de134e40913814c30 (commit)
via e916a0335fe6e931a87fb8de965948ae7674f10c (commit)
via 85d28da864d15cf517e3857141d802c411f21047 (commit)
via 923296ed8b82d64c6cba045374136c12f8d4d685 (commit)
via 6b6f7a188e2a850f405bec64e81f2000e848cfe9 (commit)
via ef341a251501dd4c232dfb6ac0f85e41086c4d4f (commit)
via 317c7bee067b7bd678eb55e5ed866861ac892274 (commit)
via b926dc165dc73387115470edbbba0b6b2e0964d1 (commit)
via 0c44c4c4c9b5e9112cde2b58e0131d09153e046f (commit)
via 91bcd8b415ad22099a16cd941b54f459968b348b (commit)
via 19c45fe85a90403b06454eab85b2a1e628f8d617 (commit)
via b77d84adbfa931b4b6685b5069ad15b8cd447056 (commit)
via ec7416a0b0021f1b53482c04a5854cdb8c182832 (commit)
via b340c526ae583ce7be9ea28b63bf98f25aae1add (commit)
via 3b03179e7f4d5bd9354bdfbcc897dfd47968fe05 (commit)
via 6982d67f5d2c708ed42648e039ad0b1cfcc959ab (commit)
via 520e734397bbc288a76bfba987f23b13614d540d (commit)
via 8cef82347f1de7ee16f351e8536b9ebc34227ffc (commit)
via 481bcb1c9eac10beda96f0e176b2481fd5e4c86c (commit)
via 80d159955caf5c547a844c660c45984bcdb8d880 (commit)
via 0461de7a9a2d473326a09fa6d09fda03df9b6fd9 (commit)
via ad194b5f069f035d7624f748b6063baf2525cbde (commit)
via fc1b111887113926a038df4cc292561bf1d5f31e (commit)
via 674e43ac4187e2adf6a4826c9bc77c886d0cec89 (commit)
via 699326af505c203e1eeb4a2d67d2a0d85d5cd6d1 (commit)
via f31589e55f08e02a6b3f450015c892600024ec15 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (0ee6ca936752310d487231054017dbfe2685dbcf)
\
N -- N -- N (c8699b912ad6e68f3ead87f6165612c8fe7ed067)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
c8699b9 New comparison functions.
c680fc7 Force abort() on unsafe conversions.
4bae71d Refine util::level operators.
995652f Let the user specify conversion functions in K2 immersion.
1b1c0af mln/core/routine/ops.hh: Update comments.
253edef tests/value/interval.cc: Add more tests.
318c0f7 Introduce level tag.
3e7e4f9 Fix accu::stat::median_interval.
b96d7cc Introduce K2 and Kn spaces.
81ed289 Some fixes.
e242c84 New span accumulator.
d61b69f Add functions.
a42ca7e Improve accu::median_interval.
3d34eb0 mln/value/intsub.hh: Add more constructors.
cc965b2 mln/value/concept/interval.hh: New. Add value::Interval concept.
06d861d Add an accumulator median based on intervals.
e0efc44 Rename interval::nelements() to interval::nvalues().
ed21680 Replace range class with interval and improve it.
dbc709f Improve value::intsub class.
12b51e7 mln/value/builtin/ops.hh: Handle all the comparison operators.
7cbca2d Add mathematical tools.
4a735fd tests/world/k1/Makefile.am: Fix target names.
6434491 Replace unsignedh type by intsub.
82a0e36 New routines to browse values into a value set.
7599542 New value types.
7aacabf New routine for filling internal border in K1.
99ee8c8 mln/world/k1/neighb2d.hh: New neighborhoods.
9d4bc6a More routines working on images immersed in K1.
539ff65 configure.ac: Configure milena/tests/world/k1/Makefile.am.
1f96c87 Initial commit of tools to work in K1.
f46dedd scribo/text/recognition.hh: Restore previous locale.
6412c07 Ensure current locale is C while calling Tesseract.
ba481b8 m4/oln-with-lib.m4: Lookup for multiple AND single libraries while checking Tesseract availability.
2ac2f4b scribo/text/recognition.hh: Fix code for Tesseract 3.01 compatibility.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 14 +
NEWS | 19 +
distrib/macports/Portfile.in | 7 +-
milena/ChangeLog | 371 ++++++++++++++++-
milena/apps/papers/levillain.09.ismm/graph.cc | 7 +-
.../examples/tuto4_genericity_and_algorithms.cc | 7 +-
milena/headers.mk | 5 +-
milena/mln/accu/count_labels.hh | 4 +-
milena/mln/accu/line.hh | 6 +-
milena/mln/accu/math/sumpow.hh | 201 +++++++++
milena/mln/accu/transform_line.hh | 26 +-
milena/mln/algebra/vec.hh | 165 +++++++-
milena/mln/binarization/threshold.hh | 7 +-
milena/mln/border/duplicate.hh | 8 +-
milena/mln/border/fill.hh | 8 +-
milena/mln/canvas/browsing/diagonal2d.hh | 7 +-
milena/mln/canvas/labeling/sorted.hh | 2 +-
milena/mln/convert/from_to.hh | 130 +++---
milena/mln/convert/from_to.hxx | 441 +-------------------
milena/mln/convert/impl/from_double_to_value.hh | 159 ++++----
milena/mln/convert/impl/from_float_to_value.hh | 179 ++++----
milena/mln/convert/impl/from_image_to_site_set.hh | 8 +-
milena/mln/convert/impl/from_int_to_value.hh | 101 ++---
milena/mln/convert/impl/from_unsigned_to_value.hh | 140 +++----
milena/mln/convert/impl/from_value_to_value.hh | 7 +-
milena/mln/convert/to.hh | 1 -
milena/mln/convert/to_qimage.hh | 9 +-
milena/mln/core/alias/neighb2d.hh | 75 ++--
milena/mln/core/alias/neighb3d.hh | 65 ++--
milena/mln/core/alias/point1d.hh | 5 +-
milena/mln/core/alias/point2d.hh | 5 +-
milena/mln/core/alias/point3d.hh | 5 +-
milena/mln/core/alias/window1d.hh | 51 +--
milena/mln/core/alias/window2d.hh | 100 ++---
milena/mln/core/alias/window3d.hh | 56 +--
milena/mln/core/concept/accumulator.hh | 81 ++---
milena/mln/core/concept/box.hh | 7 +-
milena/mln/core/concept/doc/image_fastest.hh | 9 +-
milena/mln/core/concept/gdpoint.hh | 61 +--
milena/mln/core/concept/generalized_pixel.hh | 9 +-
milena/mln/core/concept/gpoint.hh | 123 ++----
milena/mln/core/concept/graph.hh | 34 +-
milena/mln/core/concept/image.hh | 108 +++---
milena/mln/core/concept/iterator.hh | 11 +-
milena/mln/core/concept/neighborhood.hh | 9 +-
milena/mln/core/concept/proxy.hh | 56 +--
milena/mln/core/concept/pseudo_site.hh | 7 +-
milena/mln/core/concept/site_iterator.hh | 15 +-
milena/mln/core/concept/site_proxy.hh | 7 +-
milena/mln/core/concept/site_set.hh | 132 +++---
milena/mln/core/concept/value_iterator.hh | 5 +-
milena/mln/core/concept/value_set.hh | 8 +-
milena/mln/core/concept/weighted_window.hh | 7 +-
milena/mln/core/concept/window.hh | 136 +++----
milena/mln/core/dpoint.hh | 1 -
milena/mln/core/dpoints_pixter.hh | 8 +-
milena/mln/core/image/dmorph/slice_image.hh | 16 +-
milena/mln/core/image/graph_window_if_piter.hh | 4 +-
milena/mln/core/image/image1d.hh | 99 +----
milena/mln/core/image/image2d.hh | 27 +-
milena/mln/core/image/image3d.hh | 16 +-
milena/mln/core/image/imorph/decorated_image.hh | 4 +-
milena/mln/core/internal/check/image_fastest.hh | 37 +-
milena/mln/core/internal/image_identity.hh | 11 +-
milena/mln/core/internal/neighborhood_base.hh | 9 +-
milena/mln/core/internal/pixel_impl.hh | 6 +-
.../core/internal/site_relative_iterator_base.hh | 10 +-
milena/mln/core/mixed_neighb.hh | 72 ++--
milena/mln/core/neighb.hh | 76 ++---
milena/mln/core/pixel.hh | 5 +-
milena/mln/core/point.hh | 172 ++-------
milena/mln/core/site_set/operators.hh | 13 +-
milena/mln/core/site_set/p_centered.hh | 5 +-
milena/mln/core/site_set/p_vaccess.hh | 4 +-
milena/mln/core/w_window.hh | 191 +++------
milena/mln/data/compute_in_window.hh | 248 +++++++++++
milena/mln/data/fill_with_value.spe.hh | 5 +-
milena/mln/data/memset_.hh | 4 +-
milena/mln/debug/draw_graph.hh | 66 +++-
milena/mln/draw/box_plain.hh | 9 +-
milena/mln/fun/i2v/array.hh | 154 +++----
milena/mln/fun/v2b/all.hh | 6 +-
milena/mln/fun/v2b/compare.hh | 84 ++++
milena/mln/fun/v2b/essential.hh | 6 +-
milena/mln/fun/v2b/threshold.hh | 84 ----
milena/mln/fun/v2b/threshold_ge.hh | 88 ++++
milena/mln/fun/v2b/threshold_gt.hh | 88 ++++
milena/mln/fun/v2b/threshold_le.hh | 88 ++++
milena/mln/fun/v2b/threshold_lt.hh | 87 ++++
milena/mln/fun/v2v/hsl_to_rgb.hh | 10 +-
milena/mln/fun/v2v/rgb_to_hsl.hh | 4 +-
milena/mln/geom/crop.hh | 73 ++++
milena/mln/geom/crop_without_localization.hh | 81 ++++
milena/mln/histo/array.hh | 34 ++-
milena/mln/io/dicom/load.hh | 4 +-
milena/mln/io/magick/load.hh | 6 +-
milena/mln/io/magick/save.hh | 274 ++++++++++++-
milena/mln/io/off/load.hh | 6 +-
milena/mln/io/off/save.hh | 2 +-
milena/mln/io/plot/save.hh | 5 +-
milena/mln/labeling/blobs_and_compute.hh | 5 +-
milena/mln/labeling/value_and_compute.hh | 7 +-
milena/mln/linear/gaussian_directional_2d.hh | 9 +-
milena/mln/make/w_window2d.hh | 5 +-
.../morpho/reconstruction/by_erosion/union_find.hh | 5 +-
milena/mln/morpho/watershed/topological.hh | 4 +-
milena/mln/registration/icp.hh | 2 +-
milena/mln/subsampling/antialiased.hh | 8 +-
.../internal/complex_relative_iterator_base.hh | 7 +-
milena/mln/trait/image/props.hh | 11 +-
.../transform/internal/closest_point_functor.hh | 5 +-
milena/mln/util/array.hh | 138 ++++---
milena/mln/util/level.hh | 79 ++--
milena/mln/util/object_id.hh | 46 +--
milena/mln/value/hsl.hh | 104 +++---
milena/mln/value/int_u.hh | 162 ++++----
milena/mln/value/interval.hh | 3 +-
milena/mln/value/label.hh | 150 +++----
milena/mln/value/qt/rgb32.hh | 78 +---
milena/mln/value/rgb.hh | 196 ++++------
milena/mln/win/multiple.hh | 5 +-
milena/mln/win/multiple_size.hh | 3 +-
milena/mln/world/binary_2d/enlarge.hh | 6 +-
milena/mln/world/binary_2d/subsample.hh | 6 +-
milena/mln/world/k2/converters.hh | 9 +-
milena/tests/accu/site_set/rectangularity.cc | 4 +-
milena/tests/algebra/h_vec.cc | 1 +
milena/tests/core/alias/point1d.cc | 4 +-
milena/tests/core/other/graph_elt_neighborhood.cc | 3 +-
milena/tests/core/other/graph_elt_window.cc | 5 +-
milena/tests/core/other/point_set_compatibility.cc | 4 +-
milena/tests/data/Makefile.am | 2 +
milena/tests/data/compute_in_window.cc | 79 ++++
milena/tests/draw/graph.cc | 4 +-
milena/tests/io/dump/Makefile.am | 4 +-
milena/tests/io/dump/dump.cc | 20 +-
milena/tests/labeling/n_max.cc | 4 +-
milena/tests/literal/Makefile.am | 12 +-
milena/tests/literal/colors.cc | 77 ++++
milena/tests/literal/identity.cc | 47 ++
milena/tests/literal/max.cc | 45 ++
milena/tests/literal/medium_gray.cc | 25 +-
milena/tests/literal/min.cc | 45 ++
milena/tests/literal/origin.cc | 42 ++
milena/tests/metal/unconst.cc | 9 +-
milena/tests/morpho/complex_image_wst.cc | 2 +
milena/tests/trait/super.cc | 1 +
milena/tests/unit_test/unit-tests.mk | 10 +-
milena/tests/util/level.cc | 63 +++-
scribo/ChangeLog | 249 +++++++++++-
scribo/demo/Makefile.am | 8 +-
scribo/demo/xml2doc/templates/html/main.xsl | 31 +-
scribo/demo/xml2doc/templates/html/main_base64.xsl | 31 +-
scribo/demo/xml2doc/templates/pdf/line.xsl | 157 ++++----
scribo/headers.mk | 12 +-
scribo/scribo/binarization/all.hh | 5 +-
scribo/scribo/binarization/global_threshold.hh | 4 +-
.../internal/compute_local_threshold.hh | 224 ++++++++++
.../internal/compute_sauvola_threshold.hh | 285 -------------
.../binarization/internal/first_pass_functor.hh | 24 +-
.../binarization/internal/local_threshold_debug.hh | 88 ++++
.../binarization/internal/niblack_formula.hh | 105 +++++
.../scribo/binarization/internal/sauvola_debug.hh | 87 ----
.../binarization/internal/sauvola_formula.hh | 121 ++++++
scribo/scribo/binarization/niblack.hh | 218 ++++++++++
scribo/scribo/binarization/niblack_threshold.hh | 299 +++++++++++++
scribo/scribo/binarization/otsu.hh | 85 ++++
scribo/scribo/binarization/otsu_threshold.hh | 132 ++++++
scribo/scribo/binarization/sauvola.hh | 24 +-
scribo/scribo/binarization/sauvola_ms.hh | 49 +--
scribo/scribo/binarization/sauvola_ms_split.hh | 5 +-
scribo/scribo/binarization/sauvola_threshold.hh | 296 +++++++++++++
.../scribo/binarization/sauvola_threshold_image.hh | 301 -------------
scribo/scribo/canvas/integral_browsing.hh | 6 +-
scribo/scribo/core/line_info.hh | 21 +-
scribo/scribo/debug/logger.hh | 252 +++++++++++-
scribo/scribo/debug/option_check.hh | 19 +-
scribo/scribo/debug/option_parser.hh | 19 +-
scribo/scribo/draw/line_components.hh | 8 +-
scribo/scribo/filter/object_groups_with_holes.hh | 2 +-
scribo/scribo/filter/objects_with_holes.hh | 2 +-
.../io/xml/internal/extended_page_xml_visitor.hh | 1 +
scribo/scribo/io/xml/internal/full_xml_visitor.hh | 1 +
scribo/scribo/io/xml/load.hh | 1 +
scribo/scribo/postprocessing/fill_object_holes.hh | 2 +-
scribo/scribo/preprocessing/rotate_90.hh | 10 +-
scribo/scribo/primitive/extract/internal/union.hh | 6 +-
.../primitive/extract/lines_h_thick_and_thin.hh | 8 +-
scribo/scribo/primitive/extract/lines_pattern.hh | 2 +-
.../primitive/extract/separators_nonvisible.hh | 16 +-
scribo/scribo/primitive/internal/rd.hh | 2 +-
.../link/merge_double_link_closest_aligned.hh | 4 +-
scribo/scribo/subsampling/integral.hh | 8 +-
scribo/scribo/subsampling/integral_single_image.hh | 28 +-
scribo/scribo/text/clean.hh | 7 +-
scribo/scribo/text/clean_inplace.hh | 6 +-
scribo/scribo/text/merging.hh | 4 +-
scribo/scribo/text/merging_hdoc.hh | 4 +-
scribo/scribo/text/recognition.hh | 204 +++++++--
scribo/scribo/toolchain/text_in_doc_preprocess.hh | 13 +-
scribo/src/Makefile.am | 15 +-
scribo/src/afp/components.hh | 4 +-
scribo/src/binarization/Makefile.am | 49 ++-
scribo/src/binarization/global_threshold.cc | 104 +++++
scribo/src/binarization/niblack.cc | 106 +++++
scribo/src/binarization/otsu.cc | 99 +++++
scribo/src/binarization/pgm_sauvola.cc | 80 ----
scribo/src/binarization/pgm_sauvola_ms.cc | 111 -----
.../binarization/pgm_sauvola_threshold_image.cc | 77 ----
scribo/src/binarization/ppm_sauvola.cc | 88 ----
scribo/src/binarization/ppm_sauvola_ms.cc | 123 ------
scribo/src/binarization/ppm_sauvola_ms_fg.cc | 134 ------
scribo/src/binarization/ppm_sauvola_ms_split.cc | 128 ------
scribo/src/content_in_doc.cc | 8 +-
scribo/src/content_in_hdoc.cc | 7 +-
scribo/src/contest/DAE-2011/README | 23 +
scribo/src/contest/DAE-2011/content_in_doc_dae.cc | 5 +-
scribo/src/contest/DAE-2011/content_in_hdoc_dae.cc | 5 +-
scribo/src/contest/hdibco-2010/README | 21 +
scribo/src/contest/hdlac-2011/README | 26 ++
.../contest/hdlac-2011/content_in_hdoc_hdlac.cc | 10 +-
scribo/src/non_text_components.cc | 5 +-
scribo/src/text_in_picture_dual.cc | 146 +++++++
scribo/src/text_in_picture_neg.cc | 197 ---------
scribo/tests/binarization/Makefile.am | 8 +-
scribo/tests/binarization/global_threshold.cc | 7 +-
scribo/tests/binarization/niblack.cc | 52 +++
scribo/tests/binarization/niblack.ref.pbm | Bin 0 -> 32884 bytes
scribo/tests/binarization/otsu.cc | 52 +++
scribo/tests/binarization/otsu.ref.pbm | Bin 0 -> 32884 bytes
scribo/tests/unit_test/unit-tests.mk | 24 +-
231 files changed, 7379 insertions(+), 4924 deletions(-)
create mode 100644 milena/mln/accu/math/sumpow.hh
create mode 100644 milena/mln/data/compute_in_window.hh
create mode 100644 milena/mln/fun/v2b/compare.hh
delete mode 100644 milena/mln/fun/v2b/threshold.hh
create mode 100644 milena/mln/fun/v2b/threshold_ge.hh
create mode 100644 milena/mln/fun/v2b/threshold_gt.hh
create mode 100644 milena/mln/fun/v2b/threshold_le.hh
create mode 100644 milena/mln/fun/v2b/threshold_lt.hh
create mode 100644 milena/mln/geom/crop.hh
create mode 100644 milena/mln/geom/crop_without_localization.hh
create mode 100644 milena/tests/data/compute_in_window.cc
create mode 100644 milena/tests/literal/colors.cc
create mode 100644 milena/tests/literal/identity.cc
create mode 100644 milena/tests/literal/max.cc
create mode 100644 milena/tests/literal/min.cc
create mode 100644 milena/tests/literal/origin.cc
create mode 100644 scribo/scribo/binarization/internal/compute_local_threshold.hh
delete mode 100644 scribo/scribo/binarization/internal/compute_sauvola_threshold.hh
create mode 100644 scribo/scribo/binarization/internal/local_threshold_debug.hh
create mode 100644 scribo/scribo/binarization/internal/niblack_formula.hh
delete mode 100644 scribo/scribo/binarization/internal/sauvola_debug.hh
create mode 100644 scribo/scribo/binarization/internal/sauvola_formula.hh
create mode 100644 scribo/scribo/binarization/niblack.hh
create mode 100644 scribo/scribo/binarization/niblack_threshold.hh
create mode 100644 scribo/scribo/binarization/otsu.hh
create mode 100644 scribo/scribo/binarization/otsu_threshold.hh
create mode 100644 scribo/scribo/binarization/sauvola_threshold.hh
delete mode 100644 scribo/scribo/binarization/sauvola_threshold_image.hh
create mode 100644 scribo/src/binarization/global_threshold.cc
create mode 100644 scribo/src/binarization/niblack.cc
create mode 100644 scribo/src/binarization/otsu.cc
delete mode 100644 scribo/src/binarization/pgm_sauvola.cc
delete mode 100644 scribo/src/binarization/pgm_sauvola_ms.cc
delete mode 100644 scribo/src/binarization/pgm_sauvola_threshold_image.cc
delete mode 100644 scribo/src/binarization/ppm_sauvola.cc
delete mode 100644 scribo/src/binarization/ppm_sauvola_ms.cc
delete mode 100644 scribo/src/binarization/ppm_sauvola_ms_fg.cc
delete mode 100644 scribo/src/binarization/ppm_sauvola_ms_split.cc
create mode 100644 scribo/src/contest/DAE-2011/README
create mode 100644 scribo/src/contest/hdibco-2010/README
create mode 100644 scribo/src/contest/hdlac-2011/README
create mode 100644 scribo/src/text_in_picture_dual.cc
delete mode 100644 scribo/src/text_in_picture_neg.cc
create mode 100644 scribo/tests/binarization/niblack.cc
create mode 100644 scribo/tests/binarization/niblack.ref.pbm
create mode 100644 scribo/tests/binarization/otsu.cc
create mode 100644 scribo/tests/binarization/otsu.ref.pbm
hooks/post-receive
--
Olena, a generic and efficient image processing platform
1
0
* mln/fun/v2b/compare.hh,
* mln/fun/v2b/threshold_gt.hh,
* mln/fun/v2b/threshold_lt.hh: New.
---
milena/ChangeLog | 8 ++++
milena/mln/fun/v2b/{lnot.hh => compare.hh} | 35 +++++++++++++-------
.../fun/v2b/{threshold_ge.hh => threshold_gt.hh} | 18 +++++-----
.../fun/v2b/{threshold_ge.hh => threshold_lt.hh} | 21 ++++++------
4 files changed, 50 insertions(+), 32 deletions(-)
copy milena/mln/fun/v2b/{lnot.hh => compare.hh} (73%)
copy milena/mln/fun/v2b/{threshold_ge.hh => threshold_gt.hh} (84%)
copy milena/mln/fun/v2b/{threshold_ge.hh => threshold_lt.hh} (81%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 6433185..7052b67 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,13 @@
2012-10-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+ New comparison functions.
+
+ * mln/fun/v2b/compare.hh,
+ * mln/fun/v2b/threshold_gt.hh,
+ * mln/fun/v2b/threshold_lt.hh: New.
+
+2012-10-19 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Force abort() on unsafe conversions.
* mln/value/interval.hh,
diff --git a/milena/mln/fun/v2b/lnot.hh b/milena/mln/fun/v2b/compare.hh
similarity index 73%
copy from milena/mln/fun/v2b/lnot.hh
copy to milena/mln/fun/v2b/compare.hh
index 73d9ecf..22f5d88 100644
--- a/milena/mln/fun/v2b/lnot.hh
+++ b/milena/mln/fun/v2b/compare.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,12 +23,12 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_FUN_V2B_LNOT_HH
-# define MLN_FUN_V2B_LNOT_HH
+#ifndef MLN_FUN_V2B_COMPARE_HH
+# define MLN_FUN_V2B_COMPARE_HH
/// \file
///
-/// Functor that computes "logical not" on a value.
+/// FIXME.
# include <mln/core/concept/function.hh>
@@ -42,12 +42,16 @@ namespace mln
namespace v2b
{
- /// Functor computing logical-not on a value.
+ /// Comparison function.
+ /// f(v) = (v == ref).
template <typename V>
- struct lnot : public Function_v2b< lnot<V> >
+ struct compare : public Function_v2b< compare<V> >
{
- typedef V result;
- V operator()(const V& v) const;
+ typedef bool result;
+ bool operator()(const V& v) const;
+
+ compare(const V& a);
+ V a;
};
@@ -55,10 +59,17 @@ namespace mln
template <typename V>
inline
- V
- lnot<V>::operator()(const V& v) const
+ compare<V>::compare(const V& a)
+ : a(a)
+ {
+ }
+
+ template <typename V>
+ inline
+ bool
+ compare<V>::operator()(const V& v) const
{
- return ! v;
+ return v == a;
}
# endif // ! MLN_INCLUDE_ONLY
@@ -70,4 +81,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_FUN_V2B_LNOT_HH
+#endif // ! MLN_FUN_V2B_COMPARE_HH
diff --git a/milena/mln/fun/v2b/threshold_ge.hh b/milena/mln/fun/v2b/threshold_gt.hh
similarity index 84%
copy from milena/mln/fun/v2b/threshold_ge.hh
copy to milena/mln/fun/v2b/threshold_gt.hh
index c5fef9e..05edd97 100644
--- a/milena/mln/fun/v2b/threshold_ge.hh
+++ b/milena/mln/fun/v2b/threshold_gt.hh
@@ -24,8 +24,8 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_FUN_V2B_THRESHOLD_GE_HH
-# define MLN_FUN_V2B_THRESHOLD_GE_HH
+#ifndef MLN_FUN_V2B_THRESHOLD_GT_HH
+# define MLN_FUN_V2B_THRESHOLD_GT_HH
/// \file
///
@@ -44,14 +44,14 @@ namespace mln
{
/// Threshold function.
- /// f(v) = (v >= threshold).
+ /// f(v) = (v > threshold).
template <typename V>
- struct threshold_ge : public Function_v2b< threshold_ge<V> >
+ struct threshold_gt : public Function_v2b< threshold_gt<V> >
{
typedef bool result;
bool operator()(const V& v) const;
- threshold_ge(const V& a);
+ threshold_gt(const V& a);
V a;
};
@@ -60,7 +60,7 @@ namespace mln
template <typename V>
inline
- threshold_ge<V>::threshold_ge(const V& a)
+ threshold_gt<V>::threshold_gt(const V& a)
: a(a)
{
}
@@ -68,12 +68,12 @@ namespace mln
template <typename V>
inline
bool
- threshold_ge<V>::operator()(const V& v) const
+ threshold_gt<V>::operator()(const V& v) const
{
// Here the test seems to be inversed compared to the usual
// use. Indeed, we want to preserve the following convention:
// True for foreground and False for background.
- return v >= a;
+ return v > a;
}
# endif // ! MLN_INCLUDE_ONLY
@@ -85,4 +85,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_FUN_V2B_THRESHOLD_GE_HH
+#endif // ! MLN_FUN_V2B_THRESHOLD_GT_HH
diff --git a/milena/mln/fun/v2b/threshold_ge.hh b/milena/mln/fun/v2b/threshold_lt.hh
similarity index 81%
copy from milena/mln/fun/v2b/threshold_ge.hh
copy to milena/mln/fun/v2b/threshold_lt.hh
index c5fef9e..dd82305 100644
--- a/milena/mln/fun/v2b/threshold_ge.hh
+++ b/milena/mln/fun/v2b/threshold_lt.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -24,8 +23,8 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_FUN_V2B_THRESHOLD_GE_HH
-# define MLN_FUN_V2B_THRESHOLD_GE_HH
+#ifndef MLN_FUN_V2B_THRESHOLD_LT_HH
+# define MLN_FUN_V2B_THRESHOLD_LT_HH
/// \file
///
@@ -44,14 +43,14 @@ namespace mln
{
/// Threshold function.
- /// f(v) = (v >= threshold).
+ /// f(v) = (v < threshold).
template <typename V>
- struct threshold_ge : public Function_v2b< threshold_ge<V> >
+ struct threshold_lt : public Function_v2b< threshold_lt<V> >
{
typedef bool result;
bool operator()(const V& v) const;
- threshold_ge(const V& a);
+ threshold_lt(const V& a);
V a;
};
@@ -60,7 +59,7 @@ namespace mln
template <typename V>
inline
- threshold_ge<V>::threshold_ge(const V& a)
+ threshold_lt<V>::threshold_lt(const V& a)
: a(a)
{
}
@@ -68,12 +67,12 @@ namespace mln
template <typename V>
inline
bool
- threshold_ge<V>::operator()(const V& v) const
+ threshold_lt<V>::operator()(const V& v) const
{
// Here the test seems to be inversed compared to the usual
// use. Indeed, we want to preserve the following convention:
// True for foreground and False for background.
- return v >= a;
+ return v < a;
}
# endif // ! MLN_INCLUDE_ONLY
@@ -85,4 +84,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_FUN_V2B_THRESHOLD_GE_HH
+#endif // ! MLN_FUN_V2B_THRESHOLD_LT_HH
--
1.7.2.5
1
0