#182: Repair Swilena
----------------------+-----------------------------------------------------
Reporter: levill_r | Owner: levill_r
Type: defect | Status: new
Priority: minor | Milestone: Olena 1.0
Component: Milena | Version: 1.0
Keywords: |
----------------------+-----------------------------------------------------
[source:trunk/swilena Swilena] is broken since the end of Summer 2008
(before the merging back of [source:branches/cleanup-2008 cleanup-2008/]
into [source:trunk/ trunk/]). Have it compile and pass the tests again.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/182>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
* mln/core/concept/site_iterator.hh
(for_all_in_nbh for_all_in_nbh_, for_all_in_win, for_all_in_win_):
New macros.
(mln::internal::make_and_start_iterator): New helper functions.
* tests/core/image/for_all_in.cc: New.
* tests/core/image/Makefile.am (check_PROGRAMS): Add for_all_in.
(for_all_in_SOURCES): New.
---
milena/ChangeLog | 12 ++++
milena/mln/core/concept/site_iterator.hh | 92 ++++++++++++++++++++++++++++++
milena/tests/core/image/Makefile.am | 2 +
milena/tests/core/image/for_all_in.cc | 65 +++++++++++++++++++++
4 files changed, 171 insertions(+), 0 deletions(-)
create mode 100644 milena/tests/core/image/for_all_in.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 34bb8a0..b83ee26 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,15 @@
+2008-12-29 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Add sugar macros for iterations on neighborhoods and windows.
+
+ * mln/core/concept/site_iterator.hh
+ (for_all_in_nbh for_all_in_nbh_, for_all_in_win, for_all_in_win_):
+ New macros.
+ (mln::internal::make_and_start_iterator): New helper functions.
+ * tests/core/image/for_all_in.cc: New.
+ * tests/core/image/Makefile.am (check_PROGRAMS): Add for_all_in.
+ (for_all_in_SOURCES): New.
+
2009-05-14 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add morpho reconstruction by_dilation union_find algorithm.
diff --git a/milena/mln/core/concept/site_iterator.hh b/milena/mln/core/concept/site_iterator.hh
index 97cbc57..ef37285 100644
--- a/milena/mln/core/concept/site_iterator.hh
+++ b/milena/mln/core/concept/site_iterator.hh
@@ -40,6 +40,54 @@
# include <mln/core/concept/iterator.hh> // To fetch the macros.
+/// \brief Loop shortcuts for iterations on neighborhood and windows.
+///
+/// These iterations only work with default-constructible
+/// neighborhoods and windows.
+///
+/// If we were using `typeof' (non-standard GNU extension) or `auto'
+/// (C++0x keyword), we could be more flexible w.r.t. the
+/// initialization of the neighborhood/window.
+// \{
+
+// FIXME: Factor neighborhood and window versions.
+// FIXME: What about for_all_in_fwd an for_all_in_bkd?
+
+/// \brief Loop to browse all the elements of a neighborhood of type
+/// \p nbh_t centered at \p p, using an iterator named \p n (template
+/// version).
+# define for_all_in_nbh(n, nbh_t, p) \
+ for (mln_niter(nbh_t) n = \
+ mln::internal::make_and_start_iterator(nbh_t(), p); \
+ n.is_valid(); n.next())
+
+/// \brief Loop to browse all the elements of a neighborhood of type
+/// \p nbh_t centered at \p p, using an iterator named \p n
+/// (non-template version).
+# define for_all_in_nbh_(n, nbh_t, p) \
+ for (mln_niter_(nbh_t) n = \
+ mln::internal::make_and_start_iterator(nbh_t(), p); \
+ n.is_valid(); n.next())
+
+/// \brief Loop to browse all the elements of a window of type \p
+/// win_t centered at \p p, using an iterator named \p q (template
+/// version).
+# define for_all_in_win(q, win_t, p) \
+ for (mln_niter(win_t) q = \
+ mln::internal::make_and_start_iterator(win_t(), p); \
+ q.is_valid(); q.next())
+
+/// \brief Loop to browse all the elements of a window of type \p
+/// win_t centered at \p p, using an iterator named \p q (non-template
+/// version).
+# define for_all_in_win_(q, win_t, p) \
+ for (mln_niter_(win_t) q = \
+ mln::internal::make_and_start_iterator(win_t(), p); \
+ q.is_valid(); q.next())
+
+/// \}
+
+
namespace mln
{
@@ -86,6 +134,26 @@ namespace mln
};
+ // Forward declarations.
+ template <typename E> struct Neighborhood;
+ template <typename E> struct Window;
+
+ namespace internal
+ {
+
+ /// \brief Helper for for_all_in_nbh and for_all_in_nbh_ macros.
+ template <typename N, typename P>
+ mln_niter(N)
+ make_and_start_iterator(const Neighborhood<N>& nbh, const P& center);
+
+ /// \brief Helper for for_all_in_win and for_all_in_win_ macros.
+ template <typename W, typename P>
+ mln_niter(W)
+ make_and_start_iterator(const Window<W>& win, const P& center);
+
+ } // end of namespace mln::internal
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -147,6 +215,30 @@ namespace mln
m5 = 0;
}
+
+ namespace internal
+ {
+
+ template <typename N, typename P>
+ mln_niter(N)
+ make_and_start_iterator(const Neighborhood<N>& nbh, const P& center)
+ {
+ mln_niter(N) n(exact(nbh), center);
+ n.start();
+ return n;
+ }
+
+ template <typename W, typename P>
+ mln_niter(W)
+ make_and_start_iterator(const Window<W>& win, const P& center)
+ {
+ mln_niter(W) q(exact(win), center);
+ q.start();
+ return q;
+ }
+
+ } // end of namespace mln::internal
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
diff --git a/milena/tests/core/image/Makefile.am b/milena/tests/core/image/Makefile.am
index cdd52f6..89c9bd7 100644
--- a/milena/tests/core/image/Makefile.am
+++ b/milena/tests/core/image/Makefile.am
@@ -10,6 +10,7 @@ check_PROGRAMS = \
edge_image \
flat_image \
hexa \
+ for_all_in \
graph_image \
image1d \
image2d \
@@ -47,6 +48,7 @@ decorated_image_SOURCES = decorated_image.cc
graph_image_SOURCES = graph_image.cc
flat_image_SOURCES = flat_image.cc
hexa_SOURCES = hexa.cc
+for_all_in_SOURCES = for_all_in.cc
image1d_SOURCES = image1d.cc
image2d_SOURCES = image2d.cc
image2d_h_SOURCES = image2d_h.cc
diff --git a/milena/tests/core/image/for_all_in.cc b/milena/tests/core/image/for_all_in.cc
new file mode 100644
index 0000000..7978d18
--- /dev/null
+++ b/milena/tests/core/image/for_all_in.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file tests/core/image/for_all_in.cc
+/// \brief Tests on for_all_in_* macros.
+
+#include <iostream>
+
+#include <mln/core/image/complex_neighborhoods.hh>
+#include <mln/debug/iota.hh>
+
+#include "tests/core/image/complex_image.hh"
+
+
+int main()
+{
+ typedef mln::int_u8_2complex_image2d ima_t;
+ ima_t ima = make_test_complex_image();
+
+ // FIXME: Update comment.
+
+ /* This for_all_in_nbh_ shortcut is much shorter than the following
+ equivalent lines:
+
+ mln::neighb2d nbh = mln::c4();
+ mln_niter_(mln::neighb2d) n(nbh)
+ for_all_in_nbh_(n)
+ std::cout << n << ' ';
+ std::cout << std::endl;
+
+ However it doesn't work with non default-constructible
+ neighborhoods (yet). */
+ mln_piter_(ima_t) p(ima.domain());
+ for_all(p)
+ {
+ typedef mln::complex_lower_neighborhood< 2, mln_geom_(ima_t) > nbh_t;
+ std::cout << p << std::endl;
+ for_all_in_nbh_(n, nbh_t, p)
+ std::cout << " " << n << std::endl;
+ }
+}
--
1.6.1.2
* mln/core/concept/site_iterator.hh
(for_all_in_nbh for_all_in_nbh_, for_all_in_win, for_all_in_win_):
New macros.
(mln::internal::make_and_start_iterator): New helper functions.
* tests/core/image/for_all_in.cc: New.
* tests/core/image/Makefile.am (check_PROGRAMS): Add for_all_in.
(for_all_in_SOURCES): New.
---
milena/ChangeLog | 12 ++++
milena/mln/core/concept/site_iterator.hh | 92 ++++++++++++++++++++++++++++++
milena/tests/core/image/Makefile.am | 2 +
milena/tests/core/image/for_all_in.cc | 65 +++++++++++++++++++++
4 files changed, 171 insertions(+), 0 deletions(-)
create mode 100644 milena/tests/core/image/for_all_in.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 34bb8a0..b83ee26 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,15 @@
+2008-12-29 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Add sugar macros for iterations on neighborhoods and windows.
+
+ * mln/core/concept/site_iterator.hh
+ (for_all_in_nbh for_all_in_nbh_, for_all_in_win, for_all_in_win_):
+ New macros.
+ (mln::internal::make_and_start_iterator): New helper functions.
+ * tests/core/image/for_all_in.cc: New.
+ * tests/core/image/Makefile.am (check_PROGRAMS): Add for_all_in.
+ (for_all_in_SOURCES): New.
+
2009-05-14 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add morpho reconstruction by_dilation union_find algorithm.
diff --git a/milena/mln/core/concept/site_iterator.hh b/milena/mln/core/concept/site_iterator.hh
index 97cbc57..ef37285 100644
--- a/milena/mln/core/concept/site_iterator.hh
+++ b/milena/mln/core/concept/site_iterator.hh
@@ -40,6 +40,54 @@
# include <mln/core/concept/iterator.hh> // To fetch the macros.
+/// \brief Loop shortcuts for iterations on neighborhood and windows.
+///
+/// These iterations only work with default-constructible
+/// neighborhoods and windows.
+///
+/// If we were using `typeof' (non-standard GNU extension) or `auto'
+/// (C++0x keyword), we could be more flexible w.r.t. the
+/// initialization of the neighborhood/window.
+// \{
+
+// FIXME: Factor neighborhood and window versions.
+// FIXME: What about for_all_in_fwd an for_all_in_bkd?
+
+/// \brief Loop to browse all the elements of a neighborhood of type
+/// \p nbh_t centered at \p p, using an iterator named \p n (template
+/// version).
+# define for_all_in_nbh(n, nbh_t, p) \
+ for (mln_niter(nbh_t) n = \
+ mln::internal::make_and_start_iterator(nbh_t(), p); \
+ n.is_valid(); n.next())
+
+/// \brief Loop to browse all the elements of a neighborhood of type
+/// \p nbh_t centered at \p p, using an iterator named \p n
+/// (non-template version).
+# define for_all_in_nbh_(n, nbh_t, p) \
+ for (mln_niter_(nbh_t) n = \
+ mln::internal::make_and_start_iterator(nbh_t(), p); \
+ n.is_valid(); n.next())
+
+/// \brief Loop to browse all the elements of a window of type \p
+/// win_t centered at \p p, using an iterator named \p q (template
+/// version).
+# define for_all_in_win(q, win_t, p) \
+ for (mln_niter(win_t) q = \
+ mln::internal::make_and_start_iterator(win_t(), p); \
+ q.is_valid(); q.next())
+
+/// \brief Loop to browse all the elements of a window of type \p
+/// win_t centered at \p p, using an iterator named \p q (non-template
+/// version).
+# define for_all_in_win_(q, win_t, p) \
+ for (mln_niter_(win_t) q = \
+ mln::internal::make_and_start_iterator(win_t(), p); \
+ q.is_valid(); q.next())
+
+/// \}
+
+
namespace mln
{
@@ -86,6 +134,26 @@ namespace mln
};
+ // Forward declarations.
+ template <typename E> struct Neighborhood;
+ template <typename E> struct Window;
+
+ namespace internal
+ {
+
+ /// \brief Helper for for_all_in_nbh and for_all_in_nbh_ macros.
+ template <typename N, typename P>
+ mln_niter(N)
+ make_and_start_iterator(const Neighborhood<N>& nbh, const P& center);
+
+ /// \brief Helper for for_all_in_win and for_all_in_win_ macros.
+ template <typename W, typename P>
+ mln_niter(W)
+ make_and_start_iterator(const Window<W>& win, const P& center);
+
+ } // end of namespace mln::internal
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -147,6 +215,30 @@ namespace mln
m5 = 0;
}
+
+ namespace internal
+ {
+
+ template <typename N, typename P>
+ mln_niter(N)
+ make_and_start_iterator(const Neighborhood<N>& nbh, const P& center)
+ {
+ mln_niter(N) n(exact(nbh), center);
+ n.start();
+ return n;
+ }
+
+ template <typename W, typename P>
+ mln_niter(W)
+ make_and_start_iterator(const Window<W>& win, const P& center)
+ {
+ mln_niter(W) q(exact(win), center);
+ q.start();
+ return q;
+ }
+
+ } // end of namespace mln::internal
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
diff --git a/milena/tests/core/image/Makefile.am b/milena/tests/core/image/Makefile.am
index cdd52f6..89c9bd7 100644
--- a/milena/tests/core/image/Makefile.am
+++ b/milena/tests/core/image/Makefile.am
@@ -10,6 +10,7 @@ check_PROGRAMS = \
edge_image \
flat_image \
hexa \
+ for_all_in \
graph_image \
image1d \
image2d \
@@ -47,6 +48,7 @@ decorated_image_SOURCES = decorated_image.cc
graph_image_SOURCES = graph_image.cc
flat_image_SOURCES = flat_image.cc
hexa_SOURCES = hexa.cc
+for_all_in_SOURCES = for_all_in.cc
image1d_SOURCES = image1d.cc
image2d_SOURCES = image2d.cc
image2d_h_SOURCES = image2d_h.cc
diff --git a/milena/tests/core/image/for_all_in.cc b/milena/tests/core/image/for_all_in.cc
new file mode 100644
index 0000000..7978d18
--- /dev/null
+++ b/milena/tests/core/image/for_all_in.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file tests/core/image/for_all_in.cc
+/// \brief Tests on for_all_in_* macros.
+
+#include <iostream>
+
+#include <mln/core/image/complex_neighborhoods.hh>
+#include <mln/debug/iota.hh>
+
+#include "tests/core/image/complex_image.hh"
+
+
+int main()
+{
+ typedef mln::int_u8_2complex_image2d ima_t;
+ ima_t ima = make_test_complex_image();
+
+ // FIXME: Update comment.
+
+ /* This for_all_in_nbh_ shortcut is much shorter than the following
+ equivalent lines:
+
+ mln::neighb2d nbh = mln::c4();
+ mln_niter_(mln::neighb2d) n(nbh)
+ for_all_in_nbh_(n)
+ std::cout << n << ' ';
+ std::cout << std::endl;
+
+ However it doesn't work with non default-constructible
+ neighborhoods (yet). */
+ mln_piter_(ima_t) p(ima.domain());
+ for_all(p)
+ {
+ typedef mln::complex_lower_neighborhood< 2, mln_geom_(ima_t) > nbh_t;
+ std::cout << p << std::endl;
+ for_all_in_nbh_(n, nbh_t, p)
+ std::cout << " " << n << std::endl;
+ }
+}
--
1.6.1.2
* mln/core/concept/site_iterator.hh
(for_all_in_nbh for_all_in_nbh_, for_all_in_win, for_all_in_win_):
New macros.
(mln::internal::make_and_start_iterator): New helper functions.
* tests/core/image/for_all_in.cc: New.
* tests/core/image/Makefile.am (check_PROGRAMS): Add for_all_in.
(for_all_in_SOURCES): New.
---
milena/ChangeLog | 12 ++++
milena/mln/core/concept/site_iterator.hh | 92 ++++++++++++++++++++++++++++++
milena/tests/core/image/Makefile.am | 2 +
milena/tests/core/image/for_all_in.cc | 65 +++++++++++++++++++++
4 files changed, 171 insertions(+), 0 deletions(-)
create mode 100644 milena/tests/core/image/for_all_in.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 34bb8a0..b83ee26 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,15 @@
+2008-12-29 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Add sugar macros for iterations on neighborhoods and windows.
+
+ * mln/core/concept/site_iterator.hh
+ (for_all_in_nbh for_all_in_nbh_, for_all_in_win, for_all_in_win_):
+ New macros.
+ (mln::internal::make_and_start_iterator): New helper functions.
+ * tests/core/image/for_all_in.cc: New.
+ * tests/core/image/Makefile.am (check_PROGRAMS): Add for_all_in.
+ (for_all_in_SOURCES): New.
+
2009-05-14 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add morpho reconstruction by_dilation union_find algorithm.
diff --git a/milena/mln/core/concept/site_iterator.hh b/milena/mln/core/concept/site_iterator.hh
index 97cbc57..ef37285 100644
--- a/milena/mln/core/concept/site_iterator.hh
+++ b/milena/mln/core/concept/site_iterator.hh
@@ -40,6 +40,54 @@
# include <mln/core/concept/iterator.hh> // To fetch the macros.
+/// \brief Loop shortcuts for iterations on neighborhood and windows.
+///
+/// These iterations only work with default-constructible
+/// neighborhoods and windows.
+///
+/// If we were using `typeof' (non-standard GNU extension) or `auto'
+/// (C++0x keyword), we could be more flexible w.r.t. the
+/// initialization of the neighborhood/window.
+// \{
+
+// FIXME: Factor neighborhood and window versions.
+// FIXME: What about for_all_in_fwd an for_all_in_bkd?
+
+/// \brief Loop to browse all the elements of a neighborhood of type
+/// \p nbh_t centered at \p p, using an iterator named \p n (template
+/// version).
+# define for_all_in_nbh(n, nbh_t, p) \
+ for (mln_niter(nbh_t) n = \
+ mln::internal::make_and_start_iterator(nbh_t(), p); \
+ n.is_valid(); n.next())
+
+/// \brief Loop to browse all the elements of a neighborhood of type
+/// \p nbh_t centered at \p p, using an iterator named \p n
+/// (non-template version).
+# define for_all_in_nbh_(n, nbh_t, p) \
+ for (mln_niter_(nbh_t) n = \
+ mln::internal::make_and_start_iterator(nbh_t(), p); \
+ n.is_valid(); n.next())
+
+/// \brief Loop to browse all the elements of a window of type \p
+/// win_t centered at \p p, using an iterator named \p q (template
+/// version).
+# define for_all_in_win(q, win_t, p) \
+ for (mln_niter(win_t) q = \
+ mln::internal::make_and_start_iterator(win_t(), p); \
+ q.is_valid(); q.next())
+
+/// \brief Loop to browse all the elements of a window of type \p
+/// win_t centered at \p p, using an iterator named \p q (non-template
+/// version).
+# define for_all_in_win_(q, win_t, p) \
+ for (mln_niter_(win_t) q = \
+ mln::internal::make_and_start_iterator(win_t(), p); \
+ q.is_valid(); q.next())
+
+/// \}
+
+
namespace mln
{
@@ -86,6 +134,26 @@ namespace mln
};
+ // Forward declarations.
+ template <typename E> struct Neighborhood;
+ template <typename E> struct Window;
+
+ namespace internal
+ {
+
+ /// \brief Helper for for_all_in_nbh and for_all_in_nbh_ macros.
+ template <typename N, typename P>
+ mln_niter(N)
+ make_and_start_iterator(const Neighborhood<N>& nbh, const P& center);
+
+ /// \brief Helper for for_all_in_win and for_all_in_win_ macros.
+ template <typename W, typename P>
+ mln_niter(W)
+ make_and_start_iterator(const Window<W>& win, const P& center);
+
+ } // end of namespace mln::internal
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -147,6 +215,30 @@ namespace mln
m5 = 0;
}
+
+ namespace internal
+ {
+
+ template <typename N, typename P>
+ mln_niter(N)
+ make_and_start_iterator(const Neighborhood<N>& nbh, const P& center)
+ {
+ mln_niter(N) n(exact(nbh), center);
+ n.start();
+ return n;
+ }
+
+ template <typename W, typename P>
+ mln_niter(W)
+ make_and_start_iterator(const Window<W>& win, const P& center)
+ {
+ mln_niter(W) q(exact(win), center);
+ q.start();
+ return q;
+ }
+
+ } // end of namespace mln::internal
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
diff --git a/milena/tests/core/image/Makefile.am b/milena/tests/core/image/Makefile.am
index cdd52f6..89c9bd7 100644
--- a/milena/tests/core/image/Makefile.am
+++ b/milena/tests/core/image/Makefile.am
@@ -10,6 +10,7 @@ check_PROGRAMS = \
edge_image \
flat_image \
hexa \
+ for_all_in \
graph_image \
image1d \
image2d \
@@ -47,6 +48,7 @@ decorated_image_SOURCES = decorated_image.cc
graph_image_SOURCES = graph_image.cc
flat_image_SOURCES = flat_image.cc
hexa_SOURCES = hexa.cc
+for_all_in_SOURCES = for_all_in.cc
image1d_SOURCES = image1d.cc
image2d_SOURCES = image2d.cc
image2d_h_SOURCES = image2d_h.cc
diff --git a/milena/tests/core/image/for_all_in.cc b/milena/tests/core/image/for_all_in.cc
new file mode 100644
index 0000000..7978d18
--- /dev/null
+++ b/milena/tests/core/image/for_all_in.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file tests/core/image/for_all_in.cc
+/// \brief Tests on for_all_in_* macros.
+
+#include <iostream>
+
+#include <mln/core/image/complex_neighborhoods.hh>
+#include <mln/debug/iota.hh>
+
+#include "tests/core/image/complex_image.hh"
+
+
+int main()
+{
+ typedef mln::int_u8_2complex_image2d ima_t;
+ ima_t ima = make_test_complex_image();
+
+ // FIXME: Update comment.
+
+ /* This for_all_in_nbh_ shortcut is much shorter than the following
+ equivalent lines:
+
+ mln::neighb2d nbh = mln::c4();
+ mln_niter_(mln::neighb2d) n(nbh)
+ for_all_in_nbh_(n)
+ std::cout << n << ' ';
+ std::cout << std::endl;
+
+ However it doesn't work with non default-constructible
+ neighborhoods (yet). */
+ mln_piter_(ima_t) p(ima.domain());
+ for_all(p)
+ {
+ typedef mln::complex_lower_neighborhood< 2, mln_geom_(ima_t) > nbh_t;
+ std::cout << p << std::endl;
+ for_all_in_nbh_(n, nbh_t, p)
+ std::cout << " " << n << std::endl;
+ }
+}
--
1.6.1.2