URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-16 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Review the mln/canvas/browsing directory.
* mln/canvas/browsing/dir_ricard51.hh: Rename as...
* mln/canvas/browsing/dir_struct_elt_incr_update.hh: ...this, Document.
* mln/canvas/browsing/directional.hh: Document.
* mln/canvas/browsing/fwd.hh: Document.
* mln/canvas/browsing/snake_fwd.hh: Document.
* tests/canvas/browsing/dir_struct_elt_incr_update.cc: New.
* tests/canvas/browsing/directional.cc: New.
* tests/canvas/browsing/fwd.cc: New.
* tests/canvas/browsing/snake_fwd.cc: New.
* tests/canvas/browsing: New.
* tests/canvas: New.
* tests/canvas_browsing_fwd.cc: Remove.
---
mln/canvas/browsing/dir_struct_elt_incr_update.hh | 227 ++++++++++++++++++++
mln/canvas/browsing/directional.hh | 27 ++
mln/canvas/browsing/fwd.hh | 23 +-
mln/canvas/browsing/snake_fwd.hh | 39 +++
tests/canvas/browsing/dir_struct_elt_incr_update.cc | 37 +++
tests/canvas/browsing/directional.cc | 120 ++++++++++
tests/canvas/browsing/fwd.cc | 93 ++++++++
tests/canvas/browsing/snake_fwd.cc | 96 ++++++++
8 files changed, 653 insertions(+), 9 deletions(-)
Index: trunk/milena/tests/canvas_browsing_fwd.cc (deleted)
===================================================================
Index: trunk/milena/tests/canvas/browsing/directional.cc
===================================================================
--- trunk/milena/tests/canvas/browsing/directional.cc (revision 0)
+++ trunk/milena/tests/canvas/browsing/directional.cc (revision 1495)
@@ -0,0 +1,120 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/canvas/browsing/directional.cc
+ *
+ * \brief Tests on mln::canvas::browsing::directional.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/canvas/browsing/directional.hh>
+#include <mln/fun/p2v/iota.hh>
+#include <mln/debug/println.hh>
+#include <mln/level/fill.hh>
+
+// FIXME: Move code below into mln/canvas/browsing/iota.hh.
+
+
+template <typename I_, typename F>
+struct assign_browsing_functor
+{
+ typedef I_ I;
+ enum { dim = I::point::dim };
+
+
+ I input;
+ F f;
+ int dir;
+
+ assign_browsing_functor(I& input, F f = F(), int dir_ = 0)
+ : input(input),
+ f(f),
+ dir(dir_)
+ {}
+
+ mln_psite(I) p;
+
+ void init() {}
+ void final() {}
+ void next()
+ {
+ input(p) = f(p);
+ mln_assertion(p[dir] == 0);
+ }
+ void fwd() { next(); }
+ void bkd() { next(); }
+ void down() { next(); }
+};
+
+namespace mln
+{
+
+ template <typename I, typename F, typename B>
+ void my_test(Image<I>& ima_,
+ const Function_p2v<F>& f_,
+ const Browsing<B>& browse_,
+ int dir = 0)
+ {
+ I& ima = exact(ima_);
+ const F& f = exact(f_);
+ const B& browse = exact(browse_);
+
+ assign_browsing_functor<I, F> fun(ima, f, dir);
+ browse(fun);
+ }
+
+}
+
+
+int main()
+{
+ using namespace mln;
+ image2d<unsigned> ima2(3, 3);
+ image3d<unsigned> ima3(3, 3, 3);
+
+ level::fill(ima2, 0);
+ my_test(ima2, fun::p2v::iota, canvas::browsing::directional, 0);
+ debug::println(ima2);
+
+ level::fill(ima2, 0);
+ my_test(ima2, fun::p2v::iota, canvas::browsing::directional, 1);
+ debug::println(ima2);
+
+
+ level::fill(ima3, 0);
+ my_test(ima3, fun::p2v::iota, canvas::browsing::directional, 0);
+ debug::println(ima3);
+
+ level::fill(ima3, 0);
+ my_test(ima3, fun::p2v::iota, canvas::browsing::directional, 1);
+ debug::println(ima3);
+
+ level::fill(ima3, 0);
+ my_test(ima3, fun::p2v::iota, canvas::browsing::directional, 2);
+ debug::println(ima3);
+}
Index: trunk/milena/tests/canvas/browsing/fwd.cc
===================================================================
--- trunk/milena/tests/canvas/browsing/fwd.cc (revision 0)
+++ trunk/milena/tests/canvas/browsing/fwd.cc (revision 1495)
@@ -0,0 +1,93 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/canvas/browsing/fwd.cc
+ *
+ * \brief Tests on mln::canvas::browsing::fwd.hh
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/canvas/browsing/fwd.hh>
+#include <mln/fun/p2v/iota.hh>
+#include <mln/debug/println.hh>
+
+// FIXME: Move code below into mln/canvas/browsing/iota.hh.
+
+
+template <typename I_, typename F>
+struct assign_browsing_functor
+{
+ typedef I_ I;
+ enum { dim = I::point::dim };
+
+
+ I input;
+ F f;
+
+ assign_browsing_functor(I& input, F f = F())
+ : input(input),
+ f(f)
+ {}
+
+ mln_psite(I) p;
+
+ void init() {}
+ void final() {}
+ void next()
+ {
+ input(p) = f(p);
+ mln_assertion(input(p) - 1 == p[0] * input.domain().ncols() + p[1]);
+ }
+};
+
+namespace mln
+{
+
+ template <typename I, typename F, typename B>
+ void my_test(Image<I>& ima_,
+ const Function_p2v<F>& f_,
+ const Browsing<B>& browse_)
+ {
+ I& ima = exact(ima_);
+ const F& f = exact(f_);
+ const B& browse = exact(browse_);
+
+ assign_browsing_functor<I, F> fun(ima, f);
+ browse(fun);
+ }
+
+}
+
+
+int main()
+{
+ using namespace mln;
+ image2d<unsigned> ima2(3, 3);
+
+ my_test(ima2, fun::p2v::iota, canvas::browsing::fwd);
+ debug::println(ima2);
+}
Index: trunk/milena/tests/canvas/browsing/snake_fwd.cc
===================================================================
--- trunk/milena/tests/canvas/browsing/snake_fwd.cc (revision 0)
+++ trunk/milena/tests/canvas/browsing/snake_fwd.cc (revision 1495)
@@ -0,0 +1,96 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/canvas/browsing/snake_fwd.cc
+ *
+ * \brief Tests on mln::canvas::browsing::snake_fwd.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/canvas/browsing/snake_fwd.hh>
+#include <mln/fun/p2v/iota.hh>
+#include <mln/debug/println.hh>
+
+// FIXME: Move code below into mln/canvas/browsing/iota.hh.
+
+
+template <typename I, typename F>
+struct assign_browsing_functor
+{
+ enum { dim = I::point::dim };
+
+
+ I input;
+ F f;
+
+ assign_browsing_functor(I& input, F f = F())
+ : input(input),
+ f(f)
+ {}
+
+ mln_psite(I) p;
+
+ void init() {}
+ void final() {}
+ void next()
+ {
+ input(p) = f(p);
+ mln_assertion(input(p) - 1 == p[0] * input.domain().ncols()
+ + ( (p[0] % 2) ? input.domain().ncols() - 1 - p[1] : p[1]));
+ }
+ void fwd() { next(); }
+ void bkd() { next(); }
+ void down() { next(); }
+};
+
+namespace mln
+{
+
+ template <typename I, typename F, typename B>
+ void my_test(Image<I>& ima_,
+ const Function_p2v<F>& f_,
+ const Browsing<B>& browse_)
+ {
+ I& ima = exact(ima_);
+ const F& f = exact(f_);
+ const B& browse = exact(browse_);
+
+ assign_browsing_functor<I, F> fun(ima, f);
+ browse(fun);
+ }
+
+}
+
+
+int main()
+{
+ using namespace mln;
+ image2d<unsigned> ima2(3, 3);
+
+ my_test(ima2, fun::p2v::iota, canvas::browsing::snake_fwd);
+ debug::println(ima2);
+}
Index: trunk/milena/tests/canvas/browsing/dir_struct_elt_incr_update.cc
===================================================================
--- trunk/milena/tests/canvas/browsing/dir_struct_elt_incr_update.cc (revision 0)
+++ trunk/milena/tests/canvas/browsing/dir_struct_elt_incr_update.cc (revision 1495)
@@ -0,0 +1,37 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/canvas/browsing/dir_struct_elt_incr_update.cc
+ *
+ * \brief Tests on mln::canvas::browsing::dir_struct_elt_incr_update
+ */
+
+
+int main()
+{
+ //FIXME: Make a more relevant test.
+}
Index: trunk/milena/mln/canvas/browsing/dir_ricard51.hh (deleted)
===================================================================
Index: trunk/milena/mln/canvas/browsing/snake_fwd.hh
===================================================================
--- trunk/milena/mln/canvas/browsing/snake_fwd.hh (revision 1494)
+++ trunk/milena/mln/canvas/browsing/snake_fwd.hh (revision 1495)
@@ -34,7 +34,6 @@
*/
# include <mln/core/concept/browsing.hh>
-# include <mln/core/dpoint2d.hh> // for "up"
# include <mln/geom/size2d.hh>
@@ -47,8 +46,29 @@
namespace browsing
{
- /*! FIXME: Doc!
+ /*!
+ * \brief Browsing in a snake-way, forward.
*
+ * This canvas browse all the point of an image 'input' like
+ * this :
+ *
+ * ------->
+ * <------'
+ * '------>
+ *
+ * The fonctor should provide (In addition to 'input') four
+ * methods :
+ *
+ * - init() : Will be called at the beginning.
+ * - down() : Will be called after each moving down. (will
+ * also be called once at the first point).
+ * - fwd() : Will be called after each moving right.
+ * - bwd() : Will ba called after each moving left.
+ *
+ * This methods should acces to the current working point 'p'
+ * also provided by the functor.
+ *
+ * Warning: This canvas works only on 2D.
*
* F shall feature: \n
* { \n
@@ -73,49 +93,62 @@
snake_fwd;
+
# ifndef MLN_INCLUDE_ONLY
template <typename F>
void
snake_fwd_t::operator()(F& f) const
{
+ // FIXME: Check the dimension (2D) or generalize.
+ trace::entering("canvas::browsing::snake_fwd");
mln_precondition(f.input.has_data());
int
min_row = geom::min_row(f.input), max_row = geom::max_row(f.input),
min_col = geom::min_col(f.input), max_col = geom::max_col(f.input);
// p
- f.p = f.input.bbox().pmin() + up;
+ f.p = f.input.bbox().pmin();
int& row = f.p.row();
int& col = f.p.col();
// initialization
+ trace::entering("canvas::browsing::snake_fwd::init");
f.init();
+ trace::exiting("canvas::browsing::snake_fwd::init");
bool fwd = true;
for (row = min_row; row <= max_row; ++row)
+ // FIXME: Add "if (f.input.has(p))"?
{
// go down
+ trace::entering("canvas::browsing::snake_fwd::init");
f.down();
+ trace::exiting("canvas::browsing::snake_fwd::init");
if (fwd)
// browse line fwd
while (col < max_col)
{
++col;
+ trace::entering("canvas::browsing::snake_fwd::fwd");
f.fwd();
+ trace::exiting("canvas::browsing::snake_fwd::fwd");
}
else
// browse line bkd
while (col > min_col)
{
--col;
+ trace::entering("canvas::browsing::snake_fwd");
f.bkd();
+ trace::exiting("canvas::browsing::snake_fwd");
}
// change browsing
fwd = ! fwd;
}
+ trace::exiting("canvas::browsing::snake_fwd");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/canvas/browsing/dir_struct_elt_incr_update.hh
===================================================================
--- trunk/milena/mln/canvas/browsing/dir_struct_elt_incr_update.hh (revision 0)
+++ trunk/milena/mln/canvas/browsing/dir_struct_elt_incr_update.hh (revision 1495)
@@ -0,0 +1,227 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CANVAS_BROWSING_DIR_STRUCT_ELT_INCR_UPDATE_HH
+# define MLN_CANVAS_BROWSING_DIR_STRUCT_ELT_INCR_UPDATE_HH
+
+/*! \file mln/canvas/browsing/dir_struct_elt_incr_update.hh
+ *
+ * \brief Directional browsing of an image with structuring element.
+ */
+
+# include <mln/core/concept/browsing.hh>
+# include <mln/core/concept/image.hh>
+
+namespace mln
+{
+
+ namespace canvas
+ {
+
+ namespace browsing
+ {
+
+ /*!
+ * \brief Browsing in a certain direction with a segment.
+ *
+ * This canvas browse all the point of an image 'input' of type
+ * 'I', of dimension 'dim' in the direction 'dir' with
+ * considering weigh the 'length' nearest points.
+ *
+ * The functor should provide (In addition to 'input', 'I',
+ * 'dim', 'dir' and 'length') six methods :
+ *
+ * - init() : Will be called at the beginning.
+ * - init_line() : Will be called at the beginning of each
+ * line.
+ * - add_point(q) : Will be called for taking the new point
+ * 'q' into account.
+ * - remove_point(q): Will be called for untaking the new point
+ * 'q' into account.
+ * - next() : Will be called at each point 'p' (also
+ * provided by the functor).
+ * - final() : Will be called at the end.
+ *
+ * F shall features : \n
+ * { \n
+ * --- as types: \n
+ * I; \n
+ * --- as attributes: \n
+ * dim; \n
+ * dir; // and test dir < dim \n
+ * input; \n
+ * p; \n
+ * length; \n
+ * --- as methods: \n
+ * void init(); \n
+ * void init_line(); \n
+ * void add_point(q) \n
+ * void remove_point(q) \n
+ * void next(); \n
+ * void final(); \n
+ * } \n
+ *
+ */
+ struct dir_struct_elt_incr_update_t : public Browsing<
dir_struct_elt_incr_update_t >
+ {
+ template <typename F>
+ void operator()(F& f) const;
+ }
+
+ dir_struct_elt_incr_update;
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename F>
+ void
+ dir_struct_elt_incr_update_t::operator()(F& f) const
+ {
+ trace::entering("canvas::browsing::dir_struct_elt_incr_update");
+ mln_precondition(f.dir < f.dim);
+ typedef typename F::I I;
+
+ const mln_point(I)
+ pmin = f.input.domain().pmin(),
+ pmax = f.input.domain().pmax();
+
+ const mln_coord(I)
+ pmin_dir = pmin[f.dir],
+ pmax_dir = pmax[f.dir],
+ pmin_dir_plus_half_length = pmin_dir + f.length / 2,
+ pmax_dir_minus_half_length = pmax_dir - f.length / 2;
+
+ mln_point(I) pt, pu;
+
+ typedef mln_coord(I)& coord_ref;
+ coord_ref
+ ct = pt[f.dir],
+ cu = pu[f.dir],
+ p_dir = f.p[f.dir];
+
+ f.p = pmin;
+
+ trace::entering("canvas::browsing::dir_struct_elt_incr_update::init");
+ f.init();
+ trace::exiting("canvas::browsing::dir_struct_elt_incr_update::init");
+
+ do
+ {
+ pt = f.p;
+ pu = f.p;
+
+ trace::entering("canvas::browsing::dir_struct_elt_incr_update::init_line");
+ f.init_line();
+ trace::exiting("canvas::browsing::dir_struct_elt_incr_update::init_line");
+
+ // initialization (before first point of the line)
+ for (ct = pmin_dir; ct < pmin_dir_plus_half_length; ++ ct)
+ if (f.input.has(pt))
+ {
+
trace::entering("canvas::browsing::dir_struct_elt_incr_update::add_point");
+ f.add_point(pt);
+
trace::exiting("canvas::browsing::dir_struct_elt_incr_update::add_point");
+ }
+
+ // left columns (just take new points)
+ for (p_dir = pmin_dir; p_dir <= pmin_dir_plus_half_length; ++p_dir, ++ct)
+ {
+ if (f.input.has(pt))
+ {
+
trace::entering("canvas::browsing::dir_struct_elt_incr_update::add_point");
+ f.add_point(pt);
+
trace::exiting("canvas::browsing::dir_struct_elt_incr_update::add_point");
+ }
+ trace::entering("canvas::browsing::dir_struct_elt_incr_update::next");
+ f.next();
+ trace::exiting("canvas::browsing::dir_struct_elt_incr_update::next");
+ }
+
+ // middle columns (both take and untake)
+ cu = pmin_dir;
+ for (; p_dir <= pmax_dir_minus_half_length; ++cu, ++p_dir, ++ct)
+ {
+ if (f.input.has(pt))
+ {
+
trace::entering("canvas::browsing::dir_struct_elt_incr_update::add_point");
+ f.add_point(pt);
+
trace::exiting("canvas::browsing::dir_struct_elt_incr_update::add_point");
+ }
+ if (f.input.has(pu))
+ {
+
trace::entering("canvas::browsing::dir_struct_elt_incr_update::remove_point");
+ f.remove_point(pu);
+
trace::exiting("canvas::browsing::dir_struct_elt_incr_update::remove_point");
+ }
+ trace::entering("canvas::browsing::dir_struct_elt_incr_update::next");
+ f.next();
+ trace::exiting("canvas::browsing::dir_struct_elt_incr_update::next");
+ }
+
+ // right columns (now just untake old points)
+ for (; p_dir <= pmax_dir; ++cu, ++p_dir)
+ {
+ if (f.input.has(pu))
+ {
+
trace::entering("canvas::browsing::dir_struct_elt_incr_update::remove_point");
+ f.remove_point(pu);
+
trace::exiting("canvas::browsing::dir_struct_elt_incr_update::remove_point");
+ }
+ trace::entering("canvas::browsing::dir_struct_elt_incr_update::next");
+ f.next();
+ trace::exiting("canvas::browsing::dir_struct_elt_incr_update::next");
+ }
+
+ p_dir = pmin_dir;
+
+ for (int c = F::dim - 1; c >= 0; --c)
+ {
+ if (c == int(f.dir))
+ continue;
+ if (f.p[c] != pmax[c])
+ {
+ ++f.p[c];
+ break;
+ }
+ f.p[c] = pmin[c];
+ }
+ } while (f.p != pmin);
+
+ trace::entering("canvas::browsing::dir_struct_elt_incr_update::final");
+ f.final();
+ trace::exiting("canvas::browsing::dir_struct_elt_incr_update::final");
+ trace::exiting("canvas::browsing::dir_struct_elt_incr_update");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::canvas::browsing
+
+ } // end of namespace mln::canvas
+
+} // end of namespace mln
+
+#endif // ! MLN_CANVAS_BROWSING_DIR_STRUCT_ELT_INCR_UPDATE_HH
Index: trunk/milena/mln/canvas/browsing/directional.hh
===================================================================
--- trunk/milena/mln/canvas/browsing/directional.hh (revision 1494)
+++ trunk/milena/mln/canvas/browsing/directional.hh (revision 1495)
@@ -45,7 +45,20 @@
namespace browsing
{
- /*! FIXME : DOC
+ /*!
+ * \brief Browsing in a certain direction.
+ *
+ * This canvas browse all the point of an image 'input' of type
+ * 'I' and of dimension 'dim' in the direction 'dir'.
+ *
+ * The functor should provide (In addition to 'input', 'I',
+ * 'dim' and 'dir') three methods :
+ *
+ * - init() : Will be called at the beginning.
+ * - next() : Will be called at each point 'p' (also provided by
+ * the fonctor).
+ * - final(): Will be called at the end.
+ *
* F shall features : \n
* { \n
* --- as types: \n
@@ -57,8 +70,8 @@
* p; \n
* --- as methods: \n
* void init(); \n
- * void next() \n
- * void final() \n
+ * void next(); \n
+ * void final(); \n
* } \n
*
*/
@@ -76,6 +89,7 @@
void
directional_t::operator()(F& f) const
{
+ trace::entering("canvas::browsing::directional");
mln_precondition(f.dir < f.dim);
typedef typename F::I I;
@@ -85,11 +99,15 @@
f.p = pmin;
+ trace::entering("canvas::browsing::directional::init");
f.init();
+ trace::exiting("canvas::browsing::directional::init");
do
{
+ trace::entering("canvas::browsing::directional::next");
f.next();
+ trace::exiting("canvas::browsing::directional::next");
for (int c = F::dim - 1; c >= 0; --c)
{
@@ -104,7 +122,10 @@
}
} while (f.p != pmin);
+ trace::entering("canvas::browsing::directional::final");
f.final();
+ trace::exiting("canvas::browsing::directional::final");
+ trace::exiting("canvas::browsing::directional");
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/canvas/browsing/fwd.hh
===================================================================
--- trunk/milena/mln/canvas/browsing/fwd.hh (revision 1494)
+++ trunk/milena/mln/canvas/browsing/fwd.hh (revision 1495)
@@ -30,7 +30,7 @@
/*! \file mln/canvas/browsing/fwd.hh
*
- * \brief Canvas for browsing forward.
+ * \brief Canvas for forward browsing.
*/
# include <mln/core/concept/browsing.hh>
@@ -46,8 +46,18 @@
namespace browsing
{
- /*! FIXME: Doc!
+ /*!
+ * \brief Canvas for forward browsing
*
+ * This canvas browse all the points of an image 'input' of type
+ * 'I' from left to right and from top to bottom
+ *
+ * The fonctor should provide (In addition of 'I' and 'input')
+ * three methods :
+ * - init() : Will be called at the beginning.
+ * - next() : Will be called at each point 'p' (also provided by
+ * the functor).
+ * - final(): Will be called at the end.
*
* F shall feature: \n
* { \n
@@ -63,7 +73,6 @@
* } \n
*
*/
-
struct fwd_t : public Browsing< fwd_t >
{
template <typename F>
@@ -79,16 +88,24 @@
void
fwd_t::operator()(F& f) const
{
+ trace::entering("canvas::browsing::fwd");
mln_precondition(f.input.has_data());
typedef typename F::I I;
mln_fwd_piter(I) p(f.input.domain());
+ trace::entering("canvas::browsing::fwd::init");
f.init();
+ trace::exiting("canvas::browsing::fwd::init");
for_all(p)
{
f.p = p;
+ trace::entering("canvas::browsing::fwd::next");
f.next();
+ trace::exiting("canvas::browsing::fwd::next");
}
+ trace::entering("canvas::browsing::fwd::final");
f.final();
+ trace::exiting("canvas::browsing::fwd::final");
+ trace::exiting("canvas::browsing::fwd");
}
# endif // ! MLN_INCLUDE_ONLY