URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-12 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add seeds2tiling with distance priority (chamfer).
* seeds2tiling_with_chamfer.hh: New.
---
seeds2tiling_with_chamfer.hh | 108 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
Index: trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh (revision 0)
+++ trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh (revision 1326)
@@ -0,0 +1,108 @@
+// 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_GEOM_SEEDS2TILING_WITH_CHAMFER_HH
+# define MLN_GEOM_SEEDS2TILING_WITH_CHAMFER_HH
+
+/*! \file mln/geom/seeds2tiling_with_chamfer.hh
+ *
+ * \brief .
+ */
+
+# include <map>
+
+
+# include <mln/core/queue_p_fast_priority.hh>
+# include <mln/core/clone.hh>
+# include <mln/accu/mean.hh>
+# include <mln/estim/min_max.hh>
+# include <mln/metal/vec.hh>
+# include <mln/geom/chamfer.hh>
+
+
+namespace mln
+{
+ namespace geom
+ {
+
+ template <typename I, typename N>
+ I
+ seeds2tiling_with_chamfer (Image<I>& ima_, const w_window2d_int& w_win,
unsigned max,
+ const Neighborhood<N>& nbh);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename N>
+ I
+ seeds2tiling_with_chamfer (Image<I>& ima_, const w_window2d_int& w_win,
unsigned max,
+ const Neighborhood<N>& nbh)
+
+ {
+ I& ima = exact(ima_);
+ image2d<unsigned> dist = geom::chamfer(ima, w_win, max);
+ I out = clone(ima_);
+ queue_p_fast_priority<mln_psite(I), unsigned> q;
+
+ // Init.
+ {
+ mln_piter(I) p(ima.domain());
+
+ for_all(p)
+ q.push_force(p, max - dist(p));
+ }
+
+
+ // Body: alternative version.
+ {
+ while (! q.empty())
+ {
+ mln_psite(I) p = q.front();
+ q.pop();
+ if (out(p) != 0) // p has already been processed so ignore
+ continue;
+ mln_niter(N) n(nbh, p);
+
+ for_all(n) if (ima.has(n))
+ if (out(n) != 0)
+ out(p) = out(n);
+ }
+ }
+
+ return out;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::geom
+
+} // end of namespace mln
+
+
+#endif // ! MLN_GEOM_SEEDS2TILING_WITH_CHAMFER_HH