Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-12 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add new test for convert::to_p_set.
* tests/core_pset_if.cc: New test for convert::to_p_set.
---
core_pset_if.cc | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
Index: trunk/milena/tests/core_pset_if.cc
===================================================================
--- trunk/milena/tests/core_pset_if.cc (revision 0)
+++ trunk/milena/tests/core_pset_if.cc (revision 1467)
@@ -0,0 +1,53 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/pset_if.cc
+ *
+ * \brief Tests on mln::pset_if.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/p_set.hh>
+#include <mln/core/pset_if.hh>
+#include <mln/fun/p2b/chess.hh>
+#include <mln/convert/to_image.hh>
+#include <mln/convert/to_p_set.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ box2d box_8x8 = make::box2d(8, 8);
+ mln_assertion((box_8x8 | fun::p2b::chess).npoints() == 32);
+
+ {
+ p_set<point2d> s = convert::to_p_set(box_8x8 | fun::p2b::chess);
+ std::cout << (box_8x8 | fun::p2b::chess) << std::endl;
+ std::cout << s << std::endl;
+ }
+}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-12 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update convert::to_p_set.
* mln/convert/to_p_set.hh: Update.
---
to_p_set.hh | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
Index: trunk/milena/mln/convert/to_p_set.hh
===================================================================
--- trunk/milena/mln/convert/to_p_set.hh (revision 1465)
+++ trunk/milena/mln/convert/to_p_set.hh (revision 1466)
@@ -40,6 +40,7 @@
# include <mln/core/p_set.hh>
# include <mln/pw/image.hh>
# include <mln/pw/cst.hh>
+# include <mln/metal/templated_by.hh>
# include <mln/metal/is_a.hh>
@@ -62,8 +63,12 @@
p_set<mln_point(W)> to_p_set(const Window<W>& win);
/// Convert an std::set \p s of points into a point set.
- template <typename D>
- p_set<D> to_p_set(const std::set<D>& s);
+ template <typename P>
+ p_set<P> to_p_set(const std::set<P>& s);
+
+ /// Convert any point set \p ps into a 'mln::p_set' point set.
+ template <typename S>
+ p_set<mln_psite(S)> to_p_set(const Point_Set<S>& ps);
# ifndef MLN_INCLUDE_ONLY
@@ -86,7 +91,10 @@
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
+
// FIXME: Check that ima is binary!
+// mln::metal::templated_by<mln_value(I), bool >::check();
+
typedef mln_dpoint(I) D;
typedef mln_point(I) P;
p_set<P> pset;
@@ -120,6 +128,18 @@
return pset;
}
+
+ template <typename S>
+ p_set<mln_psite(S)> to_p_set(const Point_Set<S>& ps_)
+ {
+ const S& ps = exact(ps_);
+ p_set<mln_psite(S)> tmp;
+ mln_piter(S) p(ps);
+ for_all(p)
+ tmp.insert(p);
+ return tmp;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::convert
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-12 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Clean and optimise FLLT.
* sandbox/garrigues/fllt_doc.hh: New, Notes for FLLT.
* sandbox/garrigues/fllt_merge.hh: New, merge algorithm.
* sandbox/garrigues/fllt_optimized.hh: Update.
* sandbox/garrigues/fllt_types.hh: New, types used in FLLT.
* sandbox/garrigues/level_set.hh: New, compute lower/upper level set
algorithm
* sandbox/garrigues/lower.hh: New, informations about how to compute
the lower level set.
* sandbox/garrigues/upper.hh: New, informations about how to compute
the lower level set.
* sandbox/garrigues/test_fllt12.cc: Cleaning, (fllt2.hh) replaced by...
(fllt_optimized.hh) ...this.
* sandbox/garrigues/test_fllt13.cc: Likewise.
* sandbox/garrigues/test_fllt2.cc: Likewise.
* sandbox/garrigues/test_fllt3.cc: Likewise.
* sandbox/garrigues/test_fllt_lena_tiles.cc: Likewise.
* mln/util/branch_iter_ind.hh: Check if the tree has not
been subject to updates which can invalidate the iterator.
* sandbox/garrigues/fllt2.hh: (set_p) replaced by...
{p_set} ...this.
---
mln/util/branch_iter_ind.hh | 3
sandbox/garrigues/fllt2.hh | 48 -
sandbox/garrigues/fllt_doc.hh | 86 +++
sandbox/garrigues/fllt_merge.hh | 200 +++++++
sandbox/garrigues/fllt_optimized.hh | 800 +-----------------------------
sandbox/garrigues/fllt_types.hh | 71 ++
sandbox/garrigues/level_set.hh | 463 +++++++++++++++++
sandbox/garrigues/lower.hh | 89 +++
sandbox/garrigues/test_fllt12.cc | 11
sandbox/garrigues/test_fllt13.cc | 11
sandbox/garrigues/test_fllt2.cc | 13
sandbox/garrigues/test_fllt3.cc | 29 -
sandbox/garrigues/test_fllt_lena_tiles.cc | 4
sandbox/garrigues/upper.hh | 89 +++
14 files changed, 1090 insertions(+), 827 deletions(-)
Index: trunk/milena/mln/util/branch_iter_ind.hh
===================================================================
--- trunk/milena/mln/util/branch_iter_ind.hh (revision 1463)
+++ trunk/milena/mln/util/branch_iter_ind.hh (revision 1464)
@@ -172,7 +172,7 @@
else
{
s_.top().pos_++;
- if (s_.top().list_->size() <= s_.top().pos_)
+ if (s_.top().list_->size() == s_.top().pos_)
{
s_.pop();
next();
@@ -180,6 +180,7 @@
}
else
{
+ mln_assertion(s_.top().list_->size() > s_.top().pos_);
if (s_.top().previous_ != 0)
mln_assertion(s_.top().previous_ == (*(s_.top().list_))[s_.top().pos_ - 1]);
// if (s_.top().previous_ > 0)
Index: trunk/milena/sandbox/garrigues/test_fllt_lena_tiles.cc
===================================================================
--- trunk/milena/sandbox/garrigues/test_fllt_lena_tiles.cc (revision 1463)
+++ trunk/milena/sandbox/garrigues/test_fllt_lena_tiles.cc (revision 1464)
@@ -1,4 +1,4 @@
-# include "fllt2.hh"
+# include "fllt_optimized.hh"
# include <mln/core/image2d.hh>
# include <mln/core/clone.hh>
# include <mln/value/int_u8.hh>
@@ -26,7 +26,7 @@
image2d<value::int_u8> ima = io::pgm::load(path.str());
image2d<int> ima_int(ima.domain());
level::fill(ima_int, ima);
- debug::println(ima_int);
fllt::fllt(ima_int);
}
}
+
Index: trunk/milena/sandbox/garrigues/lower.hh
===================================================================
--- trunk/milena/sandbox/garrigues/lower.hh (revision 0)
+++ trunk/milena/sandbox/garrigues/lower.hh (revision 1464)
@@ -0,0 +1,89 @@
+// 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_FIXME_FLLT_LOWER_HH
+# define MLN_FIXME_FLLT_LOWER_HH
+
+/*! \file fllt.hh
+ *
+ * \brief Informations about how to compute the lower level set.
+ *
+ */
+
+# include <mln/core/neighb2d.hh>
+
+# include <mln/accu/min.hh>
+# include <mln/labeling/regional_minima.hh>
+
+# include "fllt_types.hh"
+
+namespace mln
+{
+ namespace fllt
+ {
+
+ //Fwd declaration.
+ template <typename V> struct upper;
+
+ // LOWER LEVEL SET : region = c4, border = c8
+ template <typename V>
+ struct lower
+ {
+ typedef upper<V> opposite;
+ typedef lower_t tag;
+ static bool
+ compare(const V& u, const V& v)
+ {
+ return u < v;
+ }
+
+ template <typename I, typename N, typename O>
+ static bool
+ regional_extremum(const Image<I>& input, const Neighborhood<N>& nbh,
+ Image<O>& output, unsigned& nlabels)
+ {
+ return labeling::regional_minima(input, nbh,
+ output, nlabels);
+ }
+
+ static const int inc = 1;
+ static const bool parent_is_brighter = true;
+ typedef accu::min accu_for_gn;
+
+ static const neighb2d& bdr_nbh() { return c8(); }
+ static const neighb2d& reg_nbh() { return c4(); }
+
+ };
+
+ } // end of namespace mln::fllt
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_FIXME_FLLT_LOWER_HH
Index: trunk/milena/sandbox/garrigues/test_fllt12.cc
===================================================================
--- trunk/milena/sandbox/garrigues/test_fllt12.cc (revision 1463)
+++ trunk/milena/sandbox/garrigues/test_fllt12.cc (revision 1464)
@@ -19,20 +19,11 @@
using namespace mln;
using typename value::int_u8;
-// int vs[3][6] = { {0, 0, 0, 1, 1, 1},
-// {0, 1, 0, 1, 0, 1},
-// {0, 0, 0, 1, 1, 1} };
-
-
- int vs[4][5] = {
- { 4, 4, 2, 2, 2},
+ int vs[4][5] = { {4, 4, 2, 2, 2},
{ 4, 3, 1, 2, 2},
{ 4, 1, 1, 4, 2},
{ 4, 1, 1, 1, 2} };
image2d<int> ima(make::image2d(vs));
- image2d<int_u8> out(ima.domain());
-
- level::fill(out, ima);
fllt::fllt(ima);
}
Index: trunk/milena/sandbox/garrigues/upper.hh
===================================================================
--- trunk/milena/sandbox/garrigues/upper.hh (revision 0)
+++ trunk/milena/sandbox/garrigues/upper.hh (revision 1464)
@@ -0,0 +1,89 @@
+// 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_FIXME_FLLT_UPPER_HH
+# define MLN_FIXME_FLLT_UPPER_HH
+
+/*! \file upper.hh
+ *
+ * \brief Informations about how to compute the upper level set.
+ *
+ */
+
+# include <mln/core/neighb2d.hh>
+
+# include <mln/accu/max.hh>
+# include <mln/labeling/regional_maxima.hh>
+
+# include "fllt_types.hh"
+
+namespace mln
+{
+ namespace fllt
+ {
+
+ //Fwd declaration.
+ template <typename V> struct lower;
+
+ // UPPER LEVEL SET : region = c8, border = c4
+ template <typename V>
+ struct upper
+ {
+ typedef lower<V> opposite;
+ typedef upper_t tag;
+
+ static bool
+ compare(const V& u, const V& v)
+ {
+ return u > v;
+ }
+
+ template <typename I, typename N, typename O>
+ static bool
+ regional_extremum(const Image<I>& input, const Neighborhood<N>& nbh,
+ Image<O>& output, unsigned& nlabels)
+ {
+ return labeling::regional_maxima(input, nbh,
+ output, nlabels);
+ }
+
+ static const int inc = -1;
+ static const bool parent_is_brighter = false;
+ typedef accu::max accu_for_gn;
+
+ static const neighb2d& bdr_nbh() { return c4(); }
+ static const neighb2d& reg_nbh() { return c8(); }
+ };
+
+ } // end of namespace mln::fllt
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_FIXME_FLLT_UPPER_HH
Index: trunk/milena/sandbox/garrigues/test_fllt3.cc
===================================================================
--- trunk/milena/sandbox/garrigues/test_fllt3.cc (revision 1463)
+++ trunk/milena/sandbox/garrigues/test_fllt3.cc (revision 1464)
@@ -15,26 +15,17 @@
using namespace mln;
- int ws[81] = {2,2,2,2,2,2,2,2,2,
- 2,2,2,2,2,2,2,2,2,
- 2,1,1,1,1,1,1,1,2,
- 2,1,2,2,1,0,0,1,2,
- 2,1,2,2,1,0,0,1,2,
- 2,1,2,2,1,0,0,1,2,
- 2,1,1,1,1,1,1,1,2,
- 2,1,1,1,1,1,1,1,2,
- 2,2,2,2,2,2,2,2,2};
+ int vs[9][9] = { {2,2,2,2,2,2,2,2,2},
+ {2,2,2,2,2,2,2,2,2},
+ {2,1,1,1,1,1,1,1,2},
+ {2,1,2,2,1,0,0,1,2},
+ {2,1,2,2,1,0,0,1,2},
+ {2,1,2,2,1,0,0,1,2},
+ {2,1,1,1,1,1,1,1,2},
+ {2,1,1,1,1,1,1,1,2},
+ {2,2,2,2,2,2,2,2,2} };
- w_window2d_int w_win = make::w_window2d(ws);
- image2d<int> ima = convert::to_image(w_win);
+ image2d<int> ima(make::image2d(vs));
fllt::fllt(ima);
-
-// image2d<value::int_u8> ima = io::pgm::load("../../img/tiny.pgm");
-
-// image2d<int> ima_int(ima.domain());
-
-// level::fill(ima_int, ima);
-// debug::println(ima);
-// fllt::fllt(ima_int);
}
Index: trunk/milena/sandbox/garrigues/fllt_merge.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt_merge.hh (revision 0)
+++ trunk/milena/sandbox/garrigues/fllt_merge.hh (revision 1464)
@@ -0,0 +1,200 @@
+// 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_FIXME_FLLT_MERGE_HH
+# define MLN_FIXME_FLLT_MERGE_HH
+
+/*! \file fllt_merge.hh
+ *
+ * \brief merge the upper and lower level set.
+ *
+ */
+
+# include <mln/core/image2d.hh>
+
+# include <mln/set/is_subset_of.hh>
+
+# include "fllt_types.hh"
+
+namespace mln
+{
+ namespace fllt
+ {
+ // Fwd declarations.
+ template <typename P, typename V, typename F>
+ void
+ fill_a_shape(fllt_node(P, V)& node,
+ fllt_tree(P, V)& tree,
+ const image2d<fllt_node(P, V)*>& node_reg,
+ const image2d<fllt_node(P, V)*>& hole_reg);
+
+ template <typename P, typename V, typename F>
+ void
+ move_shape(fllt_node(P, V)& node,
+ fllt_node(P, V)& hole,
+ fllt_tree(P, V)& tree,
+ const image2d<fllt_node(P, V)*>& hole_reg,
+ const image2d<fllt_node(P, V)*>& other_reg)
+ {
+ node.add_child(&hole);
+ fill_a_shape<P,V,typename F::opposite>(hole, tree, hole_reg, other_reg);
+ }
+
+ template <typename P, typename V, typename F>
+ fllt_node(P, V)*
+ find_the_hole(fllt_node(P, V)& node,
+ const P p,
+ const image2d<fllt_node(P, V)*>& other_reg)
+ {
+ fllt_node(P, V)* s = other_reg(p);
+ mln_assertion(s);
+ while (s->parent() && F::opposite::compare(s->parent()->elt().value, node.elt().value))
+ {
+ mln_assertion(s);
+ s = s->parent();
+ mln_assertion(s);
+ }
+ return s;
+ }
+
+ template <typename P, typename V, typename F>
+ void
+ fill_a_shape(fllt_node(P, V)& node,
+ fllt_tree(P, V)& tree,
+ const image2d<fllt_node(P, V)*>& node_reg,
+ const image2d<fllt_node(P, V)*>& hole_reg)
+ {
+ if (node.elt().holes.npoints() == 0)
+ {
+ return;
+ }
+ mln_piter(p_set<P>) p(node.elt().holes);
+ for_all(p)
+ {
+ bool h = true;
+
+ fllt_node(P, V)* hole;
+ if (node.elt().brighter == F::parent_is_brighter)
+ hole = find_the_hole<P,V,F>(node, point2d(p), hole_reg);
+ else
+ hole = find_the_hole<P,V,typename F::opposite>(node, point2d(p), node_reg);
+
+ mln_assertion(hole);
+
+ typename fllt_node(P, V)::children_t::iterator it;
+ for (it = node.children().begin();
+ it != node.children().end();
+ it++)
+ {
+ // Browse the holes of each child.
+ mln_piter(p_set<P>) q((*it)->elt().holes);
+ for_all(q)
+ {
+ fllt_node(P, V)* child_hole = find_the_hole<P,V,F>((**it), point2d(q), hole_reg);
+ if (set::is_subset_of(hole->elt().points,
+ child_hole->elt().points))
+ {
+ h = false;
+ break;
+ }
+
+ }
+ if (!h)
+ break;
+ }
+ if (h)
+ move_shape<P,V,F>(node, *hole, tree, hole_reg, node_reg);
+ }
+
+ node.elt().holes.clear();
+ }
+
+ template <typename P, typename V>
+ fllt_tree(P, V)
+ merge_trees(fllt_tree(P, V)& lower_tree,
+ fllt_tree(P, V)& upper_tree,
+ const image2d<fllt_node(P, V)*>& low_reg,
+ const image2d<fllt_node(P, V)*>& upp_reg,
+ const image2d<V>& ima)
+ {
+
+ // In order to merge the trees, we only have to find for each shape S
+ // with a hole H in it whether one of its children has a hole HŽ
+ // containing H. If it is the case, we do nothing. Otherwise, we
+ // put the shape of the hole H (and all its descendants) as child of
+ // the shape .
+ {
+ fllt_branch_iter(P, V) p(lower_tree.main_branch());
+ for_all(p)
+ {
+ fllt_node(P, V)& n(p);
+ fill_a_shape< P, V, lower<V> >(n, lower_tree, low_reg, upp_reg);
+ mln_assertion(lower_tree.check_consistency());
+ mln_assertion(upper_tree.check_consistency());
+ }
+
+ }
+
+ {
+ fllt_branch_iter(P, V) p(upper_tree.main_branch());
+ for_all(p)
+ {
+ fllt_node(P, V)& n(p);
+ fill_a_shape< P, V, upper<V> >(n, upper_tree, upp_reg, low_reg);
+ mln_assertion(lower_tree.check_consistency());
+ mln_assertion(upper_tree.check_consistency());
+ }
+ }
+
+ // FIXME : this is a wrong way to choose the root of the result
+ // tree. lower and upper root doesn't have the same level, we
+ // want the right level for the background.
+ fllt_tree(P, V)* main_tree = &lower_tree;
+ fllt_tree(P, V)* other_tree = &upper_tree;
+
+ if (lower_tree.root()->elt().points.npoints() >= ima.domain().npoints())
+ {
+ main_tree = &upper_tree;
+ other_tree = &lower_tree;
+ }
+
+ typename fllt_node(P, V)::children_t::iterator it;
+ for (it = other_tree->root()->children().begin();
+ it != other_tree->root()->children().end(); )
+ {
+ main_tree->root()->add_child(*it);
+ }
+ mln_assertion(main_tree->check_consistency());
+ return *main_tree;
+ }
+
+ } // end of namespace mln::fllt
+
+} // end of namespace mln
+
+#endif // ! MLN_FIXME_FLLT_MERGE_HH
Index: trunk/milena/sandbox/garrigues/level_set.hh
===================================================================
--- trunk/milena/sandbox/garrigues/level_set.hh (revision 0)
+++ trunk/milena/sandbox/garrigues/level_set.hh (revision 1464)
@@ -0,0 +1,463 @@
+// 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_FIXME_LEVEL_SET_HH
+# define MLN_FIXME_LEVEL_SET_HH
+
+/*! \file level_set.hh
+ *
+ * \brief Algorithm to compulte the upper or lower level set.
+ *
+ */
+
+# include "fllt_types.hh"
+# include "lower.hh"
+# include "upper.hh"
+
+# include <mln/core/image2d.hh>
+# include <mln/core/point2d.hh>
+
+# include <mln/core/p_set.hh>
+# include <mln/core/inplace.hh>
+# include <mln/core/neighb2d.hh>
+# include <mln/core/clock_neighb2d.hh>
+# include <mln/core/pset_if_piter.hh>
+# include <mln/core/pset_if.hh>
+# include <mln/core/sub_image.hh>
+# include <mln/core/image_if.hh>
+# include <mln/core/clone.hh>
+# include <mln/core/a_point_of.hh>
+
+# include <mln/debug/println.hh>
+# include <mln/debug/println_with_border.hh>
+
+# include <mln/convert/to_image.hh>
+
+# include <mln/border/fill.hh>
+
+# include <mln/level/compute.hh>
+# include <mln/level/fill.hh>
+# include <mln/accu/min.hh>
+# include <mln/accu/max.hh>
+
+# include <mln/set/uni.hh>
+# include <mln/set/diff.hh>
+# include <mln/set/inter.hh>
+# include <mln/set/is_subset_of.hh>
+
+# include <mln/util/tree.hh>
+# include <mln/util/branch_iter_ind.hh>
+
+# include <mln/labeling/regional_minima.hh>
+# include <mln/labeling/regional_maxima.hh>
+# include <mln/labeling/level.hh>
+
+# include <mln/fun/ops.hh>
+# include <mln/pw/value.hh>
+# include <mln/pw/cst.hh>
+
+# include <mln/util/tree_to_image.hh>
+# include <mln/value/int_u8.hh>
+# include <mln/level/stretch.hh>
+# include <mln/level/compare.hh>
+# include <mln/io/pgm/save.hh>
+
+namespace mln
+{
+ namespace fllt
+ {
+
+ template <typename P, typename V>
+ struct ls_env
+ {
+ const image2d<V>& input;
+ image2d<V> u;
+ image2d<bool> tagged;
+ image2d<bool> shape;
+ int n_cc;
+
+ fllt_node(P, V)* current_region;
+ image2d<fllt_node(P, V)*>& regions;
+ p_set<P> A;
+ p_set<P> R;
+ p_set<P> N;
+ V g,gn;
+ point2d x0;
+
+ ls_env(const image2d<V>& input,
+ image2d<fllt_node(P, V)*>& regions_)
+ : input(input),
+ regions(regions_),
+ tagged(input.domain()),
+ shape(input.domain()),
+ g(0),
+ gn(0),
+ n_cc(0),
+ current_region(0)
+ {
+ // INIT
+ R.clear();
+ N.clear();
+ A.clear();
+
+ level::fill(regions, 0);
+ level::fill(tagged, false);
+
+ u = clone(input);
+ border::fill(u, 0);
+ }
+
+ };
+
+ template <typename P, typename V>
+ void update_n_cc(lower_t,
+ ls_env<P, V>& env,
+ point2d p)
+ {
+ // region in c4.
+ bool previous_is_false;
+ unsigned res = 0;
+
+ dpoint2d dp(-1,-1);
+ clock_neighb2d nbh = cc8(dp);
+
+ mln_fwd_niter(clock_neighb2d) n(nbh , p);
+
+ // just to get the last previous_is_false.
+ // FIXME replace it with bkd_niter.
+ for_all(n)
+ previous_is_false = !env.shape(n);
+
+ for_all(n)
+ {
+ //y in c4
+ bool x = env.shape(n);
+ n.next();
+ mln_assertion(n.is_valid());
+ bool y = env.shape(n);
+
+ if (!x && y)
+ ++res;
+ else
+ if (x && y && previous_is_false)
+ ++res;
+
+ previous_is_false = !y;
+
+ }
+ env.n_cc += (res == 0 ? 0 : (res - 1));
+
+ }
+
+ template <typename P, typename V>
+ void update_n_cc(upper_t,
+ ls_env<P, V>& env,
+ point2d p)
+ {
+ // region in c8.
+ bool previous_is_false;
+ unsigned res = 0;
+
+ dpoint2d dp(-1,0);
+ clock_neighb2d nbh = cc8(dp);
+
+ mln_fwd_niter(clock_neighb2d) n(nbh , p);
+
+ // just to get the last previous_is_false.
+ // FIXME optimise it with bkd_niter.
+ for_all(n)
+ {
+ bool x = env.shape(n);
+ n.next();
+ mln_assertion(n.is_valid());
+ bool y = env.shape(n);
+ previous_is_false = !y && !x;
+ }
+
+
+ for_all(n)
+ {
+ //y in c4
+ bool x = env.shape(n);
+ n.next();
+ mln_assertion(n.is_valid());
+ bool y = env.shape(n);
+
+ if (!x && y)
+ ++res;
+ else
+ if (x && previous_is_false)
+ ++res;
+
+ previous_is_false = !y && !x;
+
+ }
+ env.n_cc += (res == 0 ? 0 : (res - 1));
+ }
+
+ template <typename P, typename V>
+ void step1 (ls_env<P, V>& env,
+ point2d p)
+ {
+ // x0 <- a not tagged local mininum of ima.
+ env.x0 = p;
+ // g <- u(x0)
+ env.g = env.input(env.x0);
+ }
+
+ template <typename P, typename V>
+ void step2 (ls_env<P, V>& env)
+ {
+ // A <- {x0}
+ env.A.clear();
+ env.A.insert(env.x0);
+ // R <- {}
+ env.R.clear();
+ // N <- {}
+ env.N.clear();
+ }
+
+
+ template <typename V, typename P, typename F>
+ void step3 (ls_env<P, V>& env)
+ {
+ static bool finished = false;
+
+ // Stop the algorithm.
+ if (finished)
+ { finished = false; env.gn -= 2 * F::inc; return; }
+
+ // N <- N union {x neighbor of a pixel in a\R}
+ mln_piter(p_set<P>) qa(env.A);
+ for_all(qa)
+ {
+ mln_niter(neighb2d) n(F::reg_nbh(), qa);
+ for_all (n)
+ if (!env.R.has (n))
+ env.N.insert (n);
+ }
+
+ // gn <- min u(x) x belongs to N.
+ if ((env.u | set::inter(env.N, env.u.domain())).npoints() > 0)
+ env.gn = level::compute< typename F::accu_for_gn >(env.u | set::inter(env.N, env.u.domain()));
+ else
+ {
+ finished = true;
+ env.gn += F::inc;
+ }
+
+ // R <- R union A
+ // tag the pixels of A.
+ for_all(qa)
+ {
+ env.R.insert(qa);
+ env.tagged(qa) = true;
+ //Update the number of connected components.
+ update_n_cc(typename F::tag(), env, qa);
+ }
+ }
+
+ /// IF g < gn.
+ template <typename V, typename P, typename F>
+ void step4_1 (ls_env<P, V>& env)
+ {
+ // If the region is bounded
+ // Create a new conected component.
+ // FIXME : we can make it faster.
+
+ if ((env.R.bbox() < env.u.domain()) || (env.R.npoints() == env.u.domain().npoints()))
+ {
+ mln_piter(p_set<P>) p(env.R);
+ env.current_region = new fllt_node(P, V)();
+ env.current_region->elt().brighter = F::parent_is_brighter;
+ env.current_region->elt().value = env.g;
+ for_all(p)
+ {
+ env.current_region->elt().points.insert(p);
+
+ if (env.regions(p) == 0)
+ {
+ env.regions(p) = env.current_region;
+ }
+ else
+ {
+ if (env.regions(p)->parent() == 0)
+ env.regions(p)->set_parent(env.current_region);
+ }
+ }
+
+
+ // Count the number of conected components of the border of R.
+ static image2d<int> tmp(env.u.domain().to_larger(1));
+ static image2d<bool> border_ima(tmp.domain());
+ level::fill(border_ima, false);
+
+ mln_piter(p_set<P>) z(env.N);
+ for_all(z)
+ {
+ mln_assertion(border_ima.owns_(z));
+ border_ima(z) = true;
+ }
+ unsigned n;
+ labeling::level(border_ima, true, F::bdr_nbh(), tmp, n);
+
+ if (n > 1)
+ {
+
+ // IF number of conected components of the border > 1
+ for (int i = 2; i <= n; i++)
+ {
+ // follow each border to find which is the exterior border
+ // and which are the holes. Keep one pixel of each holes.
+
+ // WARNING : We trust labeling::level to label the exterior border with 1.
+ env.current_region->elt().holes.insert(a_point_of(tmp | pw::value(tmp) == pw::cst(i)));
+
+ // FIXME : [optimisation] Remove from N border of holes???.
+ // Recompute gn <- min u(x) x belongs to A
+ }
+ }
+
+ }
+ env.g = env.gn;
+ // A <- {x belongs to N / u(x) == g}
+ env.A.clear();
+ env.A = set::uni(env.A, set::inter(env.N, env.u.domain()) | pw::value(env.u) == pw::cst(env.g));
+ // N <- N\{x belongs to N / u(x) == g}
+ env.N = set::diff(env.N, set::inter(env.N, env.u.domain()) | pw::value(env.u) == pw::cst(env.g));
+ }
+
+
+ /// IF g == gn.
+ template <typename V, typename P>
+ void step4_2 (ls_env<P, V>& env)
+ {
+ // A <- {x belongs to N / u(x) == g}
+ env.A = set::uni(env.A, set::inter(env.N, env.u.domain()) | pw::value(env.u) == pw::cst(env.g));
+ // N <- N\{x belongs to N / u(x) == g}
+ env.N = set::diff(env.N, set::inter(env.N, env.u.domain()) | pw::value(env.u) == pw::cst(env.g));
+ }
+
+ /// IF g > gn.
+ template <typename V, typename P>
+ void step4_3 (ls_env<P, V>& env)
+ {
+ // set the gray-level of the pixels of R to g.
+ mln_piter(p_set<P>) p(env.R);
+ for_all(p)
+ {
+ mln_assertion (env.tagged(p));
+ env.u (p) = env.g;
+ }
+ }
+
+
+ template <typename V, typename F>
+ fllt_tree(point2d, V)&
+ compute_level_set(const image2d<V>& input,
+ image2d< fllt_node(point2d, V)* >& regions)
+ {
+ typedef point2d P;
+ typedef image2d<V> I;
+
+ // FIXME: not nice.
+ typedef mln::image_if<
+ mln::image2d<V>,
+ mln::fun::greater_p2b_expr_<mln::pw::value_<mln::image2d<V> >,
+ mln::pw::cst_<int> >
+ > I_IF;
+
+ // Check
+ mln_assertion(input.domain() == regions.domain());
+
+ // FIXME : rename it.
+ ls_env<P,V> env(input, regions);
+
+ // Declarations.
+ image2d<V> min_locals(input.domain());
+
+
+ // Get the locals extremums
+ unsigned nlabels;
+ F::regional_extremum(input, F::reg_nbh(), min_locals, nlabels);
+
+ /// Algorithm.
+ {
+ // For all locals extremums
+ I_IF min_locals_list(min_locals | (pw::value(min_locals) > pw::cst(0)));
+ mln_piter(I_IF) p(min_locals_list.domain());
+ for_all(p)
+ {
+ if (env.tagged(p))
+ continue;
+
+ step1(env, p);
+ step2(env);
+ while (1)
+ {
+ step3<V, P, F>(env);
+ /// step4.
+ if (F::compare(env.g, env.gn))
+ {
+ step4_1<V, P, F>(env);
+ // GO TO 3)
+ continue;
+ }
+
+
+ if (env.g == env.gn)
+ {
+ step4_2(env);
+ // GO TO 3)
+ continue;
+ }
+
+
+ if (!F::compare(env.g, env.gn))
+ {
+ step4_3(env);
+ // GO TO 1)
+ break;
+ }
+ }
+ }
+ } // end of Algorithm
+
+ image2d<value::int_u8> output (input.domain ());
+ fllt_tree(P, V)& tree = *new fllt_tree(P, V)(env.current_region);
+ util::tree_to_image (tree, output);
+
+ return (tree);
+
+ } // end of compute_level_set
+
+ } // end of namespace mln::fllt
+
+} // end of namespace mln
+
+#endif // ! MLN_FIXME_LEVEL_SET_HH
Index: trunk/milena/sandbox/garrigues/fllt2.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt2.hh (revision 1463)
+++ trunk/milena/sandbox/garrigues/fllt2.hh (revision 1464)
@@ -36,7 +36,7 @@
*/
# include <mln/core/image2d.hh>
-# include <mln/core/set_p.hh>
+# include <mln/core/p_set.hh>
# include <mln/core/inplace.hh>
# include <mln/core/neighb2d.hh>
# include <mln/core/pset_if_piter.hh>
@@ -89,8 +89,8 @@
struct fllt_node_elt
{
V value;
- set_p<P> points;
- set_p<P> holes;
+ p_set<P> points;
+ p_set<P> holes;
/// Tell if his parent if brighter or not. Nb : if the parent
/// if brighter, the node come from the lower level set
bool brighter;
@@ -161,9 +161,9 @@
}
template <typename P>
- void step2 (set_p<P>& A,
- set_p<P>& R,
- set_p<P>& N,
+ void step2 (p_set<P>& A,
+ p_set<P>& R,
+ p_set<P>& N,
point2d& x0)
{
//std::cout << "entering step 2" << std::endl;
@@ -181,9 +181,9 @@
template <typename V, typename P, typename F>
void step3 (const image2d<V>& u,
image2d<bool>& tagged,
- set_p<P>& A,
- set_p<P>& R,
- set_p<P>& N,
+ p_set<P>& A,
+ p_set<P>& R,
+ p_set<P>& N,
V& gn)
{
static bool finished = false;
@@ -194,7 +194,7 @@
{ finished = false; gn -= 2 * F::inc; return; }
// N <- N union {x neighbor of a pixel in a\R}
- mln_piter(set_p<P>) qa(A);
+ mln_piter(p_set<P>) qa(A);
for_all(qa)
{
mln_niter(neighb2d) n(F::reg_nbh(), qa);
@@ -239,9 +239,9 @@
/// IF g < gn.
template <typename V, typename P, typename F>
void step4_1 (image2d<V>& u,
- set_p<P>& A,
- set_p<P>& R,
- set_p<P>& N,
+ p_set<P>& A,
+ p_set<P>& R,
+ p_set<P>& N,
V& g,
V& gn,
fllt_node(P, V)*& current_region,
@@ -256,7 +256,7 @@
if ((R.bbox() < u.domain()) || (R.npoints() == u.domain().npoints()))
{
- mln_piter(set_p<P>) p(R);
+ mln_piter(p_set<P>) p(R);
current_region = new fllt_node(P, V)();
current_region->elt().brighter = F::parent_is_brighter;
current_region->elt().value = g;
@@ -285,7 +285,7 @@
// level::fill(inplace(border_ima | N), true);
// std::cout << "tmp border = " << tmp.border () << std::endl;
// std::cout << "ima border = " << border_ima.border () << std::endl;
- mln_piter(set_p<P>) z(N);
+ mln_piter(p_set<P>) z(N);
for_all(z)
{
mln_assertion(border_ima.owns_(z));
@@ -336,8 +336,8 @@
/// IF g == gn.
template <typename V, typename P>
void step4_2 (const image2d<V>& u,
- set_p<P>& A,
- set_p<P>& N,
+ p_set<P>& A,
+ p_set<P>& N,
V& g,
fllt_node(P, V)* current_region,
image2d<fllt_node(P, V)*>& regions
@@ -364,13 +364,13 @@
template <typename V, typename P>
void step4_3 (image2d<V>& u,
const image2d<bool>& tagged,
- const set_p<P>& R,
+ const p_set<P>& R,
const V& g)
{
//std::cout << "entering step 4_3" << std::endl;
// set the gray-level of the pixels of R to g.
- mln_piter(set_p<P>) p(R);
+ mln_piter(p_set<P>) p(R);
for_all(p)
{
mln_assertion (tagged(p));
@@ -401,7 +401,7 @@
mln_assertion(ima.domain() == regions.domain());
// Declarations.
- set_p<P> R, N, A;
+ p_set<P> R, N, A;
V g, gn;
point2d x0;
image2d<V> min_locals(ima.domain());
@@ -629,7 +629,7 @@
// std::cout << "[End fill_a_shape]" << std::endl;
return;
}
- mln_piter(set_p<P>) p(node.elt().holes);
+ mln_piter(p_set<P>) p(node.elt().holes);
for_all(p)
{
bool h = true;
@@ -648,7 +648,7 @@
it++)
{
// Browse the hole of each child.
- mln_piter(set_p<P>) q((*it)->elt().holes);
+ mln_piter(p_set<P>) q((*it)->elt().holes);
for_all(q)
{
fllt_node(P, V)* child_hole = find_the_hole<P,V,F>((**it), point2d(q), hole_reg);
@@ -744,7 +744,7 @@
for_all(p)
{
//std::cout << (&*p) << ":" << p.deepness() << std::endl;
- mln_piter(set_p<point2d>) q((*p).elt().points);
+ mln_piter(p_set<point2d>) q((*p).elt().points);
for_all(q)
{
if (output(q) < p.deepness())
@@ -766,7 +766,7 @@
{
if ((*p).elt().points.npoints() > limit)
{
- mln_piter(set_p<point2d>) q((*p).elt().points);
+ mln_piter(p_set<point2d>) q((*p).elt().points);
for_all(q)
{
mln_niter(neighb2d) n(c4(), q);
Index: trunk/milena/sandbox/garrigues/fllt_optimized.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt_optimized.hh (revision 1463)
+++ trunk/milena/sandbox/garrigues/fllt_optimized.hh (revision 1464)
@@ -35,44 +35,12 @@
*
*/
-# include <mln/core/image2d.hh>
-# include <mln/core/set_p.hh>
-# include <mln/core/inplace.hh>
-# include <mln/core/neighb2d.hh>
-# include <mln/core/pset_if_piter.hh>
-# include <mln/core/pset_if.hh>
-# include <mln/core/sub_image.hh>
-# include <mln/core/image_if.hh>
-# include <mln/core/clone.hh>
-# include <mln/core/a_point_of.hh>
-
-# include <mln/debug/println.hh>
-# include <mln/debug/println_with_border.hh>
-
-# include <mln/convert/to_image.hh>
-
-# include <mln/border/fill.hh>
-
-# include <mln/level/compute.hh>
-# include <mln/level/fill.hh>
-# include <mln/accu/min.hh>
-# include <mln/accu/max.hh>
-
-# include <mln/set/uni.hh>
-# include <mln/set/diff.hh>
-# include <mln/set/inter.hh>
-# include <mln/set/is_subset_of.hh>
-
-# include <mln/util/tree.hh>
-# include <mln/util/branch_iter_ind.hh>
-
-# include <mln/labeling/regional_minima.hh>
-# include <mln/labeling/regional_maxima.hh>
-# include <mln/labeling/level.hh>
-
-# include <mln/fun/ops.hh>
-# include <mln/pw/value.hh>
-# include <mln/pw/cst.hh>
+
+# include "fllt_types.hh"
+# include "level_set.hh"
+# include "fllt_merge.hh"
+# include "lower.hh"
+# include "upper.hh"
# include <mln/util/tree_to_image.hh>
# include <mln/value/int_u8.hh>
@@ -86,654 +54,6 @@
{
template <typename P, typename V>
- struct fllt_node_elt
- {
- V value;
- set_p<P> points;
- set_p<P> holes;
- /// Tell if his parent if brighter or not. Nb : if the parent
- /// if brighter, the node come from the lower level set
- bool brighter;
- };
-
-# define fllt_tree(P, V) util::tree< fllt_node_elt<P, V> >
-# define fllt_node(P, V) util::node< fllt_node_elt<P, V> >
-# define fllt_branch(P, V) util::branch< fllt_node_elt<P, V> >
-# define fllt_branch_iter(P, V) util::branch_iter< fllt_node_elt<P, V> >
-
- // # define fllt_node(P, V) typename fllt_tree(P, V)::node_t
-
-
-
- // LOWER LEVEL SET : region = c4, border = c8
- // UPPER LEVEL SET : region = c8, border = c4
-
- // 1)
- // x0 <- a not tagged local mininum of ima.
- // g <- u(x0)
-
- // 2)
- // A <- {x0}
- // R <- {}
- // N <- {}
-
- // 3)
- // N <- N union {x neighbor of a pixel in a}
- // gn <- min u(x) x belongs to N.
- // R <- R union A
- // tag the pixels of A.
-
- // 4)
- // IF g < gn
- // IF number of conected components of the border > 1
- // follow each border to find which is the exterior border
- // and which are the holes. Keep one pixel of each holes.
- //
- // Remove from N border of holes.
- // Recompute gn <- min u(x) x belongs to A
- //
- // g <- gn
- // A <- {x belongs to N / u(x) == g}
- // N <- N\{x belongs to N / u(x) == g}
- // GO TO 3)
- // IF g == gn
- // A <- {x belongs to N / u(x) == g}
- // N <- N\{x belongs to N / u(x) == g}
- // GO TO 3)
- // IF g > gn
- // set the gray-level of the pixels of R to g.
- // GO TO 1)
-
- template <typename P, typename V>
- struct fllt_env
- {
- const image2d<V>& input;
- image2d<V> u;
- image2d<bool> tagged;
- fllt_node(P, V)* current_region;
- image2d<fllt_node(P, V)*>& regions;
- set_p<P> A;
- set_p<P> R;
- set_p<P> N;
- V g,gn;
- point2d x0;
-
- fllt_env(const image2d<V>& input,
- image2d<fllt_node(P, V)*>& regions_)
- : input(input),
- regions(regions_),
- tagged(input.domain())
- {
-
- // INIT
- R.clear();
- N.clear();
- A.clear();
- g= 0;
- gn = 0;
- current_region = 0;
-
- level::fill(regions, 0);
- level::fill(tagged, false);
-
- u = clone(input);
- border::fill(u, 0);
- }
-
- };
-
- template <typename P, typename V>
- void step1 (fllt_env<P, V>& env,
- point2d p)
- {
- //std::cout << "entering step 1" << std::endl;
- // x0 <- a not tagged local mininum of ima.
- //std::cout << std::endl << "x0 = " << p << std::endl;
- env.x0 = p;
- // g <- u(x0)
- env.g = env.input(env.x0);
- //std::cout << "g = " << g << std::endl;
- //std::cout << "exiting step 1" << std::endl;
- }
-
- template <typename P, typename V>
- void step2 (fllt_env<P, V>& env)
- {
- //std::cout << "entering step 2" << std::endl;
- // A <- {x0}
- env.A.clear();
- env.A.insert(env.x0);
- // R <- {}
- env.R.clear();
- // N <- {}
- env.N.clear();
- //std::cout << "exiting step 2" << std::endl;
- }
-
-
- template <typename V, typename P, typename F>
- void step3 (fllt_env<P, V>& env)
- {
- static bool finished = false;
- //std::cout << "entering step 3" << std::endl;
-
- // Stop the algorithm.
- if (finished)
- { finished = false; env.gn -= 2 * F::inc; return; }
-
- // N <- N union {x neighbor of a pixel in a\R}
- mln_piter(set_p<P>) qa(env.A);
- for_all(qa)
- {
- mln_niter(neighb2d) n(F::reg_nbh(), qa);
- for_all (n)
- if (!env.R.has (n))
- env.N.insert (n);
- }
-
- // debug::println(u);
-
- // //std::cout << "A :" << std::endl;
- // if (A.npoints())
- // //debug::println(u | A);
- // //std::cout << "N :" << std::endl;
- // if (N.npoints())
- // //debug::println(u | N);
- // //std::cout << "R :" << std::endl;
- // if (R.npoints())
- // //debug::println(u | R);
-
- // gn <- min u(x) x belongs to N.
- if ((env.u | set::inter(env.N, env.u.domain())).npoints() > 0)
- env.gn = level::compute< typename F::accu_for_gn >(env.u | set::inter(env.N, env.u.domain()));
- else
- {
- finished = true;
- env.gn += F::inc;
- }
- //std::cout << std::endl << "gN = " << gn << std::endl;
- // R <- R union A
- // tag the pixels of A.
-
- for_all(qa)
- {
- env.R.insert(qa);
- env.tagged(qa) = true;
- //Update the number of connected components.
- }
- //std::cout << "exiting step 3" << std::endl;
- }
-
-
- /// IF g < gn.
- template <typename V, typename P, typename F>
- void step4_1 (fllt_env<P, V>& env)
- {
- //std::cout << "entering step 4_1" << std::endl;
-
- // If the region is bounded
- // Create a new conected component.
- // FIXME : we can make it faster.
-
- if ((env.R.bbox() < env.u.domain()) || (env.R.npoints() == env.u.domain().npoints()))
- {
- mln_piter(set_p<P>) p(env.R);
- env.current_region = new fllt_node(P, V)();
- env.current_region->elt().brighter = F::parent_is_brighter;
- env.current_region->elt().value = env.g;
- for_all(p)
- {
- env.current_region->elt().points.insert(p);
-
- if (env.regions(p) == 0)
- {
- //current_region->elt().points.insert(p);
- env.regions(p) = env.current_region;
- }
- else
- {
- if (env.regions(p)->parent() == 0)
- env.regions(p)->set_parent(env.current_region);
- }
- }
-
-
- // Count the number of conected components of the border of R.
- static image2d<int> tmp(env.u.domain().to_larger(1));
- static image2d<bool> border_ima(tmp.domain());
- level::fill(border_ima, false);
-
- // level::fill(inplace(border_ima | N), true);
- // std::cout << "tmp border = " << tmp.border () << std::endl;
- // std::cout << "ima border = " << border_ima.border () << std::endl;
- mln_piter(set_p<P>) z(env.N);
- for_all(z)
- {
- mln_assertion(border_ima.owns_(z));
- border_ima(z) = true;
- }
- std::cout << "labeling::level" << std::endl;
- unsigned n;
- labeling::level(border_ima, true, F::bdr_nbh(), tmp, n);
-
- // debug::println(border_ima);
- //std::cout << "nb composantes :" << n << std::endl;
- // debug::println(tmp);
- if (n > 1)
- {
-
- // IF number of conected components of the border > 1
- for (int i = 2; i <= n; i++)
- {
- // follow each border to find which is the exterior border
- // and which are the holes. Keep one pixel of each holes.
-
- // WARNING : We trust labeling::level to label the exterior border with 1.
- env.current_region->elt().holes.insert(a_point_of(tmp | pw::value(tmp) == pw::cst(i)));
-
- // FIXME : [optimisation] Remove from N border of holes???.
- // Recompute gn <- min u(x) x belongs to A
- }
- }
-
- }
- env.g = env.gn;
- // A <- {x belongs to N / u(x) == g}
- env.A.clear();
- env.A = set::uni(env.A, set::inter(env.N, env.u.domain()) | pw::value(env.u) == pw::cst(env.g));
- // N <- N\{x belongs to N / u(x) == g}
- env.N = set::diff(env.N, set::inter(env.N, env.u.domain()) | pw::value(env.u) == pw::cst(env.g));
-
- // std::cout << "A :" << std::endl;
- // if (A.npoints())
- // debug::println(u | A);
- // std::cout << "N :" << std::endl;
- // if (N.npoints())
- // debug::println(u | N);
-
- //std::cout << "exiting step 4_1" << std::endl;
- }
-
-
- /// IF g == gn.
- template <typename V, typename P>
- void step4_2 (fllt_env<P, V>& env)
- {
- //std::cout << "entering step 4_2" << std::endl;
-
- // A <- {x belongs to N / u(x) == g}
- env.A = set::uni(env.A, set::inter(env.N, env.u.domain()) | pw::value(env.u) == pw::cst(env.g));
- // N <- N\{x belongs to N / u(x) == g}
- env.N = set::diff(env.N, set::inter(env.N, env.u.domain()) | pw::value(env.u) == pw::cst(env.g));
-
- // std::cout << "A :" << std::endl;
- // if (A.npoints())
- // debug::println(u | A);
- // std::cout << "N :" << std::endl;
- // if (N.npoints())
- // debug::println(u | N);
-
- //std::cout << "exiting step 4_2" << std::endl;
- }
-
- /// IF g > gn.
- template <typename V, typename P>
- void step4_3 (fllt_env<P, V>& env)
- {
- //std::cout << "entering step 4_3" << std::endl;
-
- // set the gray-level of the pixels of R to g.
- mln_piter(set_p<P>) p(env.R);
- for_all(p)
- {
- mln_assertion (env.tagged(p));
- env.u (p) = env.g;
- }
-
- //std::cout << "exiting step 4_3" << std::endl;
-
- }
-
-
- template <typename V, typename F>
- fllt_tree(point2d, V)&
- compute_level_set(const image2d<V>& input,
- image2d< fllt_node(point2d, V)* >& regions)
- {
- typedef point2d P;
- typedef image2d<V> I;
-
- // FIXME: not nice.
- typedef mln::image_if<
- mln::image2d<V>,
- mln::fun::greater_p2b_expr_<mln::pw::value_<mln::image2d<V> >,
- mln::pw::cst_<int> >
- > I_IF;
-
- // Check
- mln_assertion(input.domain() == regions.domain());
-
- // FIXME : rename it.
- fllt_env<P,V> env(input, regions);
-
- // Declarations.
-// set_p<P> R, N, A;
-// V g, gn;
-// point2d x0;
- image2d<V> min_locals(input.domain());
-
-
- // Get the locals extremums
- unsigned nlabels;
- F::regional_extremum(input, F::reg_nbh(), min_locals, nlabels);
-
- // debug::println(min_locals);
- // debug::println(min_locals | (pw::value(min_locals) > pw::cst(0)));
-
- /// Algorithm.
- {
- // For all locals extremums
- //void* x = min_locals | (pw::value(min_locals) > pw::cst(0));
- I_IF min_locals_list(min_locals | (pw::value(min_locals) > pw::cst(0)));
- mln_piter(I_IF) p(min_locals_list.domain());
- for_all(p)
- {
- if (env.tagged(p))
- continue;
-
- step1(env, p);
- step2(env);
- while (1)
- {
- //std::cout << "g = " << g << std::endl;
- step3<V, P, F>(env);
- /// step4.
- if (F::compare(env.g, env.gn))
- {
- step4_1<V, P, F>(env);
- // GO TO 3)
- continue;
- }
-
-
- if (env.g == env.gn)
- {
- step4_2(env);
- // GO TO 3)
- continue;
- }
-
-
- if (!F::compare(env.g, env.gn))
- {
- step4_3(env);
- // GO TO 1)
- break;
- }
- }
- //std::cout << "current_region = " << current_region << std::endl;
- }
- } // end of Algorithm
-
- image2d<value::int_u8> output (input.domain ());
- fllt_tree(P, V)& tree = *new fllt_tree(P, V)(env.current_region);
- util::tree_to_image (tree, output);
-
- // util::display_tree(input, tree);
-
- // debug::println(output);
- // std::cout << std::endl;
- // debug::println(input);
-
- // if (output != input)
- // {
- // std::cerr << "BUG!!!" << std::endl;
- // abort();
- // }
-
- // io::pgm::save(output, "out.pgm");
- // std::cout << "out.pgm generate"
- // << std::endl;
-
-
- // debug::println(regions);
- //debug::println(input | regions(make:defined reference to `mln::fllt::lower<mln::value::int_u<8u> >::inc':point2d(-4,-1))->elt().points);
-
- return (tree);
-
- } // end of compute_level_set
-
- //Fwd declarations.
- template <typename V> struct lower;
- template <typename V> struct upper;
-
- // LOWER LEVEL SET : region = c4, border = c8
- template <typename V>
- struct lower
- {
- typedef upper<V> opposite;
- static bool
- compare(const V& u, const V& v)
- {
- return u < v;
- }
-
- template <typename I, typename N, typename O>
- static bool
- regional_extremum(const Image<I>& input, const Neighborhood<N>& nbh,
- Image<O>& output, unsigned& nlabels)
- {
- return labeling::regional_minima(input, nbh,
- output, nlabels);
- }
-
- static const int inc = 1;
- static const bool parent_is_brighter = true;
- typedef accu::min accu_for_gn;
-
- static const neighb2d& bdr_nbh() { return c8(); }
- static const neighb2d& reg_nbh() { return c4(); }
-
- };
-
-
-
- // UPPER LEVEL SET : region = c8, border = c4
- template <typename V>
- struct upper
- {
- typedef lower<V> opposite;
-
- static bool
- compare(const V& u, const V& v)
- {
- return u > v;
- }
-
- template <typename I, typename N, typename O>
- static bool
- regional_extremum(const Image<I>& input, const Neighborhood<N>& nbh,
- Image<O>& output, unsigned& nlabels)
- {
- return labeling::regional_maxima(input, nbh,
- output, nlabels);
- }
-
- static const int inc = -1;
- static const bool parent_is_brighter = false;
- typedef accu::max accu_for_gn;
-
- static const neighb2d& bdr_nbh() { return c4(); }
- static const neighb2d& reg_nbh() { return c8(); }
- };
-
- // Fwd declarations.
- template <typename P, typename V, typename F>
- void
- fill_a_shape(fllt_node(P, V)& node,
- fllt_tree(P, V)& tree,
- const image2d<fllt_node(P, V)*>& node_reg,
- const image2d<fllt_node(P, V)*>& hole_reg);
-
- template <typename P, typename V, typename F>
- void
- move_shape(fllt_node(P, V)& node,
- fllt_node(P, V)& hole,
- fllt_tree(P, V)& tree,
- const image2d<fllt_node(P, V)*>& hole_reg,
- const image2d<fllt_node(P, V)*>& other_reg)
- {
- // FIXME : debug to remove.
- // std::cout << " [move_shape] "<< &hole << " as son of "<< &node << std::endl;
- //node.elt().points = set::uni(hole.elt().points, node.elt().points);
- node.add_child(&hole);
- fill_a_shape<P,V,typename F::opposite>(hole, tree, hole_reg, other_reg);
- }
-
- template <typename P, typename V, typename F>
- fllt_node(P, V)*
- find_the_hole(fllt_node(P, V)& node,
- const P p,
- const image2d<fllt_node(P, V)*>& other_reg)
- {
- fllt_node(P, V)* s = other_reg(p);
- mln_assertion(s);
- while (s->parent() && F::opposite::compare(s->parent()->elt().value, node.elt().value))
- //FIXME : Was while (s->parent() && (s->parent()->elt().value < node.elt().value))
- {
- mln_assertion(s);
- s = s->parent();
- mln_assertion(s);
- }
-// std::cout << " [Find the hole] of " << p
-// << " from " << &node
-// << " return " << s
-// << std::endl;
- return s;
- }
-
- template <typename P, typename V, typename F>
- void
- fill_a_shape(fllt_node(P, V)& node,
- fllt_tree(P, V)& tree,
- const image2d<fllt_node(P, V)*>& node_reg,
- const image2d<fllt_node(P, V)*>& hole_reg)
- {
-// std::cout << "[Start fill_a_shape] " << &node << " "
-// << node.elt().holes.npoints()
-// << " holes." << std::endl;
-
- if (node.elt().holes.npoints() == 0)
- {
- // std::cout << "[End fill_a_shape]" << std::endl;
- return;
- }
- mln_piter(set_p<P>) p(node.elt().holes);
- for_all(p)
- {
- bool h = true;
-
- fllt_node(P, V)* hole;
- if (node.elt().brighter == F::parent_is_brighter)
- hole = find_the_hole<P,V,F>(node, point2d(p), hole_reg);
- else
- hole = find_the_hole<P,V,typename F::opposite>(node, point2d(p), node_reg);
-
- mln_assertion(hole);
-
- typename fllt_node(P, V)::children_t::iterator it;
- for (it = node.children().begin();
- it != node.children().end();
- it++)
- {
- // Browse the hole of each child.
- mln_piter(set_p<P>) q((*it)->elt().holes);
- for_all(q)
- {
- fllt_node(P, V)* child_hole = find_the_hole<P,V,F>((**it), point2d(q), hole_reg);
- if (set::is_subset_of(hole->elt().points,
- child_hole->elt().points))
-
-// if (hole->elt().points < child_hole->elt().points)
- {
- h = false;
- break;
- }
-
- }
- if (!h)
- break;
- }
- if (h)
- move_shape<P,V,F>(node, *hole, tree, hole_reg, node_reg);
- }
-
- node.elt().holes.clear();
- // std::cout << "[end fill_a_shape]" << std::endl;
- }
-
- template <typename P, typename V>
- fllt_tree(P, V)
- merge_trees(fllt_tree(P, V)& lower_tree,
- fllt_tree(P, V)& upper_tree,
- const image2d<fllt_node(P, V)*>& low_reg,
- const image2d<fllt_node(P, V)*>& upp_reg,
- const image2d<V>& ima)
- {
-
- // In order to merge the trees, we only have to find for each shape S
- // with a hole H in it whether one of its children has a hole HŽ
- // containing H. If it is the case, we do nothing. Otherwise, we
- // put the shape of the hole H (and all its descendants) as child of
- // the shape .
- {
- std::cout << "[Merge first tree]------------" << std::endl;
-
- fllt_branch_iter(P, V) p(lower_tree.main_branch());
- for_all(p)
- {
- fllt_node(P, V)& n(p);
- fill_a_shape< P, V, lower<V> >(n, lower_tree, low_reg, upp_reg);
- mln_assertion(lower_tree.check_consistency());
- mln_assertion(upper_tree.check_consistency());
- }
-
- }
-
- {
- std::cout << "[Merge second tree]------------" << std::endl;
-
- fllt_branch_iter(P, V) p(upper_tree.main_branch());
- for_all(p)
- {
- fllt_node(P, V)& n(p);
- fill_a_shape< P, V, upper<V> >(n, upper_tree, upp_reg, low_reg);
- mln_assertion(lower_tree.check_consistency());
- mln_assertion(upper_tree.check_consistency());
- }
- }
-
- fllt_tree(P, V)* main_tree = &lower_tree;
- fllt_tree(P, V)* other_tree = &upper_tree;
-
- if (lower_tree.root()->elt().points.npoints() >= ima.domain().npoints())
- {
- main_tree = &upper_tree;
- other_tree = &lower_tree;
- }
-
- typename fllt_node(P, V)::children_t::iterator it;
- for (it = other_tree->root()->children().begin();
- it != other_tree->root()->children().end(); )
- {
- main_tree->root()->add_child(*it);
- }
- mln_assertion(main_tree->check_consistency());
- return *main_tree;
- }
-
-
- template <typename P, typename V>
void
visualize_deepness(image2d<value::int_u8>& output,
fllt_tree(P, V)& tree)
@@ -743,7 +63,7 @@
for_all(p)
{
//std::cout << (&*p) << ":" << p.deepness() << std::endl;
- mln_piter(set_p<point2d>) q((*p).elt().points);
+ mln_piter(p_set<point2d>) q((*p).elt().points);
for_all(q)
{
if (output(q) < p.deepness())
@@ -765,7 +85,7 @@
{
if ((*p).elt().points.npoints() > limit)
{
- mln_piter(set_p<point2d>) q((*p).elt().points);
+ mln_piter(p_set<point2d>) q((*p).elt().points);
for_all(q)
{
mln_niter(neighb2d) n(c4(), q);
@@ -803,9 +123,47 @@
}
}
- template <typename V>
- // Fixme : return type
+ template <typename P, typename V>
void
+ debug(const image2d<V>& ima,
+ fllt_tree(P, V)& tree)
+ {
+
+ std::cout << "4/ Generate outputs." << std::endl;
+
+ image2d<value::int_u8> output (ima.domain());
+ util::tree_to_image (tree, output);
+
+ util::display_tree(ima, tree);
+ draw_tree(ima, tree);
+
+ if (output != ima)
+ std::cerr << "Warning: input and output differ." << std::endl;
+
+ image2d<value::int_u8> out(ima.domain());
+ image2d<value::int_u8> out2(ima.domain());
+ visualize_deepness(out, tree);
+ level::stretch(out, out2);
+ io::pgm::save(out2, "fllt_deepnees.pgm");
+
+ visualize_bounds(out, tree, 800);
+ io::pgm::save(out, "fllt_bounds_800.pgm");
+ visualize_bounds(out, tree, 400);
+ io::pgm::save(out, "fllt_bounds_400.pgm");
+ visualize_bounds(out, tree, 200);
+ io::pgm::save(out, "fllt_bounds_200.pgm");
+ visualize_bounds(out, tree, 100);
+ io::pgm::save(out, "fllt_bounds_100.pgm");
+ visualize_bounds(out, tree, 50);
+ io::pgm::save(out, "fllt_bounds_50.pgm");
+ visualize_bounds(out, tree, 20);
+ io::pgm::save(out, "fllt_bounds_20.pgm");
+ visualize_bounds(out, tree, 8);
+ io::pgm::save(out, "fllt_bounds_8.pgm");
+ }
+
+ template <typename V>
+ fllt_tree(mln_point(image2d<V>), V)
fllt(const image2d<V>& ima)
{
typedef point2d P;
@@ -817,73 +175,13 @@
std::cout << "1/ Compute the lower level set." << std::endl;
lower_tree = compute_level_set<V, lower<V> >(ima, low_reg);
- //draw_tree(ima, lower_tree);
std::cout << "2/ Compute the upper level set." << std::endl;
upper_tree = compute_level_set<V, upper<V> >(ima, upp_reg);
- //draw_tree(ima, upper_tree);
-
std::cout << "3/ Merge the two trees." << std::endl;
-
- // FIXME : the algorithm is contrast invariant.
- // -> the both calls have to give the same result
- // -> check it.
- // FIXME : call merge_tree one time will be enough.
- std::cout << "upp_reg = " << &upp_reg << std::endl;
- std::cout << "low_reg = " << &low_reg << std::endl;
-
- //fllt_tree(P, V) result_tree = merge_trees(upper_tree, lower_tree, upp_reg, low_reg, ima);
fllt_tree(P, V) result_tree = merge_trees(lower_tree, upper_tree, low_reg, upp_reg, ima);
-
- std::cout << "4/ Generate outputs." << std::endl;
-
- image2d<value::int_u8> output (ima.domain ());
- util::tree_to_image (result_tree, output);
-
-
- // io::pgm::save(output, "out_final.pgm");
- // std::cout << "out_final.pgm generate"
- // << std::endl;
-
-
- // util::display_tree(ima, lower_tree);
- //draw_tree(ima, result_tree);
-
- // debug::println(ima);
- // debug::println(output);
-
- // if (output != ima)
- // {
- // std::cerr << "BUG!!!" << std::endl;
- // abort();
- // }
-
- image2d<value::int_u8> viz(ima.domain());
- // image2d<value::int_u8> viz2(ima.domain());
-
- // visualize_deepness(viz, lower_tree);
- // level::stretch(viz, viz2);
- // debug::println(viz);
- // debug::println(viz2);
- // io::pgm::save(viz2, "fllt.pgm");
-
- visualize_bounds(viz, result_tree, 200);
- //debug::println(viz);
- io::pgm::save(viz, "fllt_bounds_200.pgm");
-
- visualize_bounds(viz, result_tree, 100);
- io::pgm::save(viz, "fllt_bounds_100.pgm");
-
- visualize_bounds(viz, result_tree, 50);
- io::pgm::save(viz, "fllt_bounds_50.pgm");
-
- visualize_bounds(viz, result_tree, 20);
- io::pgm::save(viz, "fllt_bounds_20.pgm");
-
- visualize_bounds(viz, result_tree, 8);
- io::pgm::save(viz, "fllt_bounds_8.pgm");
-
+ return result_tree;
}
} // end of namespace mln::fllt
Index: trunk/milena/sandbox/garrigues/fllt_types.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt_types.hh (revision 0)
+++ trunk/milena/sandbox/garrigues/fllt_types.hh (revision 1464)
@@ -0,0 +1,71 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+
+#ifndef MLN_FIXME_FLLT_TYPES_HH
+# define MLN_FIXME_FLLT_TYPES_HH
+
+/*! \file fllt_types.hh
+ *
+ * \brief Data types used in FLLT.
+ *
+ */
+
+# include <mln/util/tree.hh>
+# include <mln/core/p_set.hh>
+
+# define fllt_tree(P, V) util::tree< mln::fllt::fllt_node_elt<P, V> >
+# define fllt_node(P, V) util::node< mln::fllt::fllt_node_elt<P, V> >
+# define fllt_branch(P, V) util::branch< mln::fllt::fllt_node_elt<P, V> >
+# define fllt_branch_iter(P, V) util::branch_iter< mln::fllt::fllt_node_elt<P, V> >
+
+namespace mln
+{
+ namespace fllt
+ {
+
+ struct lower_t {};
+ struct upper_t {};
+
+ template <typename P, typename V>
+ struct fllt_node_elt
+ {
+ V value;
+ p_set<P> points;
+ p_set<P> holes;
+ /// Tell if his parent if brighter or not. Nb : if the parent
+ /// if brighter, the node come from the lower level set
+ bool brighter;
+ };
+
+ } // end of namespace mln::fllt
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_FIXME_FLLT_TYPES_HH
Index: trunk/milena/sandbox/garrigues/fllt_doc.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt_doc.hh (revision 0)
+++ trunk/milena/sandbox/garrigues/fllt_doc.hh (revision 1464)
@@ -0,0 +1,86 @@
+// 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_FIXME_FLLT_DOC_HH
+# define MLN_FIXME_FLLT_DOC_HH
+
+/*! \file fllt_doc.hh
+ *
+ * \brief Notes for FLLT.
+ *
+ */
+
+namespace mln
+{
+ namespace fllt
+ {
+
+ // LOWER LEVEL SET : region = c4, border = c8
+ // UPPER LEVEL SET : region = c8, border = c4
+
+ // 1)
+ // x0 <- a not tagged local mininum of ima.
+ // g <- u(x0)
+
+ // 2)
+ // A <- {x0}
+ // R <- {}
+ // N <- {}
+
+ // 3)
+ // N <- N union {x neighbor of a pixel in a}
+ // gn <- min u(x) x belongs to N.
+ // R <- R union A
+ // tag the pixels of A.
+
+ // 4)
+ // IF g < gn
+ // IF number of conected components of the border > 1
+ // follow each border to find which is the exterior border
+ // and which are the holes. Keep one pixel of each holes.
+ //
+ // Remove from N border of holes.
+ // Recompute gn <- min u(x) x belongs to A
+ //
+ // g <- gn
+ // A <- {x belongs to N / u(x) == g}
+ // N <- N\{x belongs to N / u(x) == g}
+ // GO TO 3)
+ // IF g == gn
+ // A <- {x belongs to N / u(x) == g}
+ // N <- N\{x belongs to N / u(x) == g}
+ // GO TO 3)
+ // IF g > gn
+ // set the gray-level of the pixels of R to g.
+ // GO TO 1)
+
+ } // end of namespace mln::fllt
+
+} // end of namespace mln
+
+#endif // ! MLN_FIXME_FLLT_DOC_HH
Index: trunk/milena/sandbox/garrigues/test_fllt13.cc
===================================================================
--- trunk/milena/sandbox/garrigues/test_fllt13.cc (revision 1463)
+++ trunk/milena/sandbox/garrigues/test_fllt13.cc (revision 1464)
@@ -19,21 +19,12 @@
using namespace mln;
using typename value::int_u8;
-// int vs[3][6] = { {0, 0, 0, 1, 1, 1},
-// {0, 1, 0, 1, 0, 1},
-// {0, 0, 0, 1, 1, 1} };
-
-
- int vs[5][8] = {
-{ 1, 1, 1, 1, 1, 1, 1, 4 },
+ int vs[5][8] = { { 1, 1, 1, 1, 1, 1, 1, 4 },
{ 1, 4, 1, 1, 1, 1, 4, 1 },
{ 1, 2, 1, 1, 1, 4, 1, 1 },
{ 1, 3, 1, 1, 4, 1, 1, 1 },
{ 1, 1, 1, 4, 1, 1, 1, 1 } };
image2d<int> ima(make::image2d(vs));
- image2d<int_u8> out(ima.domain());
-
- level::fill(out, ima);
fllt::fllt(ima);
}
Index: trunk/milena/sandbox/garrigues/test_fllt2.cc
===================================================================
--- trunk/milena/sandbox/garrigues/test_fllt2.cc (revision 1463)
+++ trunk/milena/sandbox/garrigues/test_fllt2.cc (revision 1464)
@@ -1,4 +1,4 @@
-# include "fllt2.hh"
+# include "fllt_optimized.hh"
# include <mln/core/image2d.hh>
# include <mln/core/clone.hh>
# include <mln/value/int_u8.hh>
@@ -27,14 +27,7 @@
w_window2d_int w_win = make::w_window2d(ws);
image2d<int> ima = convert::to_image(w_win);
- fllt::fllt(ima);
-
-// image2d<value::int_u8> ima = io::pgm::load("../../img/tiny.pgm");
-
-// image2d<int> ima_int(ima.domain());
-
-// level::fill(ima_int, ima);
-// debug::println(ima);
-// fllt::fllt(ima_int);
+ fllt_tree(point2d, int) t = fllt::fllt(ima);
+ fllt::debug(ima, t);
}
1
0
Je propose de déplacer les composants spécifiques à ``Olena SCOOP 2''
dans un répertoire de branches/ appelé `olena-ng' (pour Next
Generation). C'est une convention utilisée par plusieurs projets pour
conserver une branche de développement/recherche en parallèle du flux
principal.
* État des lieux actuels du dépôt Subversion d'Olena :
trunk/ La branche de développement d'Olena 1.0
dynamic/
extended/
metalic/
milena/
olena/
static/
branches/ (Vide)
prototypes/ Des protos.
atelier/
dynamic-use-of-static-c++/
proto-1.0/
proto-stl-style/
tags/ (Vide)
* Proposition
- création de branches/olena-ng/ ;
- déplacement de trunk/{dynamic,extended,metalic,olena,static} dans
branches/olena-ng/ ;
- on ne touche pas à prototypes/ ;
aussi :
- on renomme éventuellement branches/olena-ng/olena en autre chose
(bien que je ne sois pas trop chaud) ;
- on garde éventuellement une copie de dynamic dans trunk/ (mais je
ne suis pas trop pour non plus ; il vaut mieux le réincorporer
lorsqu'on en aura besoin).
* Divers
J'ai un peu réajusté les composants décrits sur le Trac en
conséquence :
https://trac.lrde.org/olena/admin/ticket/components
Qu'en pensez-vous ?
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-12 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add tests for optimize fllt.
* tests/clock_test.cc: New test for optimize fllt.
---
clock_test.cc | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 204 insertions(+)
Index: trunk/milena/tests/clock_test.cc
===================================================================
--- trunk/milena/tests/clock_test.cc (revision 0)
+++ trunk/milena/tests/clock_test.cc (revision 1463)
@@ -0,0 +1,204 @@
+// 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.
+
+#include <mln/core/image2d.hh>
+#include <mln/core/clock_neighb2d.hh>
+#include <mln/debug/println.hh>
+#include <mln/level/fill.hh>
+#include <mln/labeling/level.hh>
+#include <mln/core/neighb2d.hh>
+
+namespace mln
+{
+ template <typename I>
+ unsigned testc4(const Image<I>& input_,
+ point2d p)
+ {
+ const I& input = exact (input_);
+ bool previous_is_false;
+ unsigned res = 0;
+
+ dpoint2d dp(-1,-1);
+ clock_neighb2d nbh = cc8(dp);
+
+
+ // just to get the last previous_is_false.
+ {
+ mln_bkd_niter(clock_neighb2d) b(nbh , p);
+ b.start();
+ previous_is_false = !input(b);
+ }
+
+ {
+ mln_fwd_niter(clock_neighb2d) n(nbh , p);
+ for_all(n)
+ {
+ //y in c4
+ bool x = input(n);
+ n.next();
+ mln_assertion(n.is_valid());
+ bool y = input(n);
+ if (!x && y)
+ ++res;
+ else
+ if (x && y && previous_is_false)
+ ++res;
+
+ previous_is_false = !y;
+
+ }
+ }
+ return res == 0 ? 1 : res;
+ }
+
+ template <typename I>
+ unsigned testc8(const Image<I>& input_,
+ point2d p)
+ {
+ const I& input = exact (input_);
+ bool previous_is_false;
+ unsigned res = 0;
+
+ dpoint2d dp(-1,0);
+ clock_neighb2d nbh = cc8(dp);
+
+
+ // just to get the last previous_is_false.
+ // FIXME replace it with bkd_niter.
+ {
+ mln_bkd_niter(clock_neighb2d) b(nbh , p);
+ b.start ();
+ bool x = input(b);
+ b.next();
+ mln_assertion(b.is_valid());
+ bool y = input(b);
+ previous_is_false = !y && !x;
+ }
+
+
+ {
+ mln_fwd_niter(clock_neighb2d) n(nbh , p);
+ for_all(n)
+ {
+ //y in c4
+ bool x = input(n);
+ n.next();
+ mln_assertion(n.is_valid());
+ bool y = input(n);
+
+ if (!x && y)
+ ++res;
+ else
+ if (x && previous_is_false)
+ ++res;
+ previous_is_false = !y && !x;
+ }
+ }
+ return res == 0 ? 0 : res - 1;
+ }
+
+}
+
+int main ()
+{
+ using namespace mln;
+
+ unsigned tmp = 0;
+
+ image2d<bool> ima(3,3);
+ dpoint2d dp (1,0);
+ point2d p (1,1);
+
+
+ for (int a0 = 0; a0 < 2; ++a0)
+ for (int a1 = 0; a1 < 2; ++a1)
+ for (int a2 = 0; a2 < 2; ++a2)
+ for (int a3 = 0; a3 < 2; ++a3)
+ for (int a4 = 0; a4 < 2; ++a4)
+ for (int a5 = 0; a5 < 2; ++a5)
+ for (int a6 = 0; a6 < 2; ++a6)
+ for (int a7 = 0; a7 < 2; ++a7)
+
+ {
+ unsigned n;
+ unsigned m;
+ bool t[9] = {a0, a1, a2,
+ a3, 1, a4,
+ a5, a6, a7};
+
+ image2d<value::int_u8> out(ima.domain());
+ image2d<value::int_u8> out2(ima.domain());
+
+ level::fill(ima, t);
+
+ labeling::level(ima, false, c8(), out, n);
+ tmp = testc4(ima, p);
+ if (tmp != n)
+ {
+ std::cout << "C4--------------"<< std::endl;
+ debug::println(ima);
+ debug::println(out);
+ std::cout << "tmp = " << tmp << std::endl;
+ std::cout << "n = " << n << std::endl;
+ std::cout << "C4--------------"<< std::endl;
+ }
+
+
+ bool u[9] = {a0, a1, a2,
+ a3, 0, a4,
+ a5, a6, a7};
+
+
+ /// 0 before
+ level::fill(ima, u);
+ labeling::level(ima, false, c4(), out, m);
+
+ /// 1 after
+ level::fill(ima, t);
+ labeling::level(ima, false, c4(), out2, n);
+
+ int diff = n - m;
+ if (diff < 0)
+ diff = 0;
+ tmp = testc8(ima, p);
+ int temp = tmp;
+ if (temp != diff)
+ {
+ std::cout << "C8--------------"<< std::endl;
+ debug::println(ima);
+ debug::println(out);
+ debug::println(out2);
+ std::cout << "tmp = " << tmp << std::endl;
+
+ std::cout << "n = " << n << std::endl;
+ std::cout << "m = " << m << std::endl;
+ std::cout << "diff = " << diff << std::endl;
+ std::cout << "C8--------------"<< std::endl;
+ }
+
+ }
+}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-12 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add dpoints_bkd_piter.
* mln/core/clock_neighb.hh: Add typo and fix new header.
* mln/core/clock_neighb2d.hh: Fix warnings (int -> unsigned).
* mln/core/dpoints_piter.hh: Add bkf_iterator.
* tests/clock_neighb2d.cc: New test for this.
---
mln/core/clock_neighb.hh | 4 -
mln/core/clock_neighb2d.hh | 8 +-
mln/core/dpoints_piter.hh | 150 +++++++++++++++++++++++++++++++++++++++++++--
tests/clock_neighb2d.cc | 29 +++++++-
4 files changed, 179 insertions(+), 12 deletions(-)
Index: trunk/milena/tests/clock_neighb2d.cc
===================================================================
--- trunk/milena/tests/clock_neighb2d.cc (revision 1461)
+++ trunk/milena/tests/clock_neighb2d.cc (revision 1462)
@@ -32,7 +32,7 @@
namespace mln
{
template <typename I, typename N>
- void test(Image<I>& input_,
+ void test_fwd(Image<I>& input_,
const Neighborhood<N>& nbh)
{
I& input = exact (input_);
@@ -40,9 +40,26 @@
int v = 1;
mln_fwd_niter(N) n (nbh, p);
+ for_all (n)
+ {
+ std::cout << n << std::endl;
+ input(n) = v++;
+ }
+ }
+
+ template <typename I, typename N>
+ void test_bkd(Image<I>& input_,
+ const Neighborhood<N>& nbh)
+ {
+ I& input = exact (input_);
+ point2d p (1,1);
+ int v = 1;
+
+ mln_bkd_niter(N) n (nbh, p);
for_all (n)
{
+ std::cout << n << std::endl;
input(n) = v++;
}
@@ -59,11 +76,17 @@
image2d<int> ima(3,3);
dpoint2d dp (1,0);
- test(ima, cc8(dp));
+ test_fwd(ima, cc4(dp));
debug::println(ima);
+ test_bkd(ima, cc4(dp));
+ debug::println(ima);
+
dpoint2d dp2 (-1,-1);
- test(ima, cc8(dp2));
+ test_fwd(ima, cc8(dp2));
debug::println(ima);
+ test_bkd(ima, cc8(dp2));
+ debug::println(ima);
+
}
Index: trunk/milena/mln/core/dpoints_piter.hh
===================================================================
--- trunk/milena/mln/core/dpoints_piter.hh (revision 1461)
+++ trunk/milena/mln/core/dpoints_piter.hh (revision 1462)
@@ -99,10 +99,63 @@
};
- // FIXME:
- template <typename D>
- class dpoints_bkd_piter : public mln::internal::fixme
- {};
+ /*! \brief A generic backward iterator on points of windows and of
+ * neighborhoods.
+ *
+ * The parameter \c D is the type of delta-points.
+ */
+ template <typename D>
+ class dpoints_bkd_piter : public internal::point_iterator_base_< mln_point(D), dpoints_bkd_piter<D> >
+ {
+ public:
+
+ /*! \brief Constructor.
+ *
+ * \param[in] dps Object that can provide an array of delta-points.
+ * \param[in] p_ref Center point to iterate around.
+ */
+ template <typename Dps, typename Pref>
+ dpoints_bkd_piter(const Dps& dps, // FIXME: explicitly set_of_<D>?
+ const Point_Site<Pref>& p_ref);
+
+ /// Convertion to point.
+ operator mln_point(D) () const;
+
+ /// Reference to the corresponding point.
+ const mln_point(D)& to_point() const;
+
+ /// Test the iterator validity.
+ bool is_valid() const;
+
+ /// Invalidate the iterator.
+ void invalidate();
+
+ /// Start an iteration.
+ void start();
+
+ /// Go to the next point.
+ void next_();
+
+ /// Give the i-th coordinate.
+ mln_coord(D) operator[](unsigned i) const;
+
+ /// The point around which this iterator moves.
+ const mln_point(D)& center_point() const;
+
+ /// Force this iterator to update its location to take into
+ /// account that its center point may have moved.
+ void update();
+
+ protected:
+
+ const std::vector<D>& dps_;
+ const mln_point(D)& p_ref_; // reference point (or "center point")
+
+ int i_;
+ mln_point(D) p_; // location of this iterator; p_ makes this iterator be
+ // itself a potential center point.
+ };
+
# ifndef MLN_INCLUDE_ONLY
@@ -191,6 +244,95 @@
return p_[i];
}
+
+
+ template <typename D>
+ template <typename Dps, typename Pref>
+ dpoints_bkd_piter<D>::dpoints_bkd_piter(const Dps& dps,
+ const Point_Site<Pref>& p_ref)
+ : dps_(exact(dps).vect()),
+ p_ref_(exact(p_ref).to_point())
+ {
+ invalidate();
+ }
+
+ template <typename D>
+ dpoints_bkd_piter<D>::operator mln_point(D) () const
+ {
+ mln_precondition(is_valid());
+ return p_;
+ }
+
+ template <typename D>
+ const mln_point(D)&
+ dpoints_bkd_piter<D>::to_point() const
+ {
+ return p_;
+ }
+
+ template <typename D>
+ bool
+ dpoints_bkd_piter<D>::is_valid() const
+ {
+ unsigned i = i_;
+
+ return i < dps_.size();
+ }
+
+ template <typename D>
+ void
+ dpoints_bkd_piter<D>::invalidate()
+ {
+ i_ = -1;
+ }
+
+ template <typename D>
+ void
+ dpoints_bkd_piter<D>::start()
+ {
+ i_ = dps_.size() - 1;
+ update();
+ }
+
+ template <typename D>
+ void
+ dpoints_bkd_piter<D>::next_()
+ {
+ --i_;
+ update();
+ }
+
+ template <typename D>
+ const mln_point(D)&
+ dpoints_bkd_piter<D>::center_point() const
+ {
+ return p_ref_;
+ }
+
+ template <typename D>
+ void
+ dpoints_bkd_piter<D>::update()
+ {
+ if (is_valid())
+ p_ = p_ref_ + dps_[i_];
+ }
+
+ template <typename D>
+ mln_coord(D)
+ dpoints_bkd_piter<D>::operator[](unsigned i) const
+ {
+ mln_precondition(is_valid());
+
+ // below we test that no update is required
+ // meaning that p_ref_ has not moved or that
+ // the user has explicitly called update()
+ mln_precondition(p_ref_ + dps_[i_] == p_);
+ // FIXME: Explain this issue in the class documentation...
+
+ return p_[i];
+ }
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: trunk/milena/mln/core/clock_neighb.hh
===================================================================
--- trunk/milena/mln/core/clock_neighb.hh (revision 1461)
+++ trunk/milena/mln/core/clock_neighb.hh (revision 1462)
@@ -36,7 +36,7 @@
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/internal/dpoints_base.hh>
# include <mln/core/dpoint.hh>
-# include <mln/core/vec_p.hh>
+# include <mln/core/p_array.hh>
namespace mln
{
@@ -67,6 +67,8 @@
/*! \brief Point_Iterator type to browse the points of a generic
* neighborhood w.r.t. the reverse ordering of delta-points.
+ *
+ * !!! Be careful the start delta point become the last now.
*/
typedef dpoints_bkd_piter<D> bkd_niter;
Index: trunk/milena/mln/core/clock_neighb2d.hh
===================================================================
--- trunk/milena/mln/core/clock_neighb2d.hh (revision 1461)
+++ trunk/milena/mln/core/clock_neighb2d.hh (revision 1462)
@@ -112,9 +112,9 @@
for (; (ite != v.end ()) && (dp != *ite); ++ite, ++begin)
;
mln_assertion (ite != v.end ());
- for (int i = begin; i < v.size(); ++i)
+ for (unsigned i = begin; i < v.size(); ++i)
it.append(v[i]);
- for (int i = 0; i < begin; ++i)
+ for (unsigned i = 0; i < begin; ++i)
it.append(v[i]);
flower = false;
@@ -144,9 +144,9 @@
for (; (ite != v.end ()) && (dp != *ite); ++ite, ++begin)
;
// mln_assertion (*ite != v.end ());
- for (int i = begin; i < v.size(); ++i)
+ for (unsigned i = begin; i < v.size(); ++i)
it.append(v[i]);
- for (int i = 0; i < begin; ++i)
+ for (unsigned i = 0; i < begin; ++i)
it.append(v[i]);
// flower = false;
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-09 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Bad plugin for debugging a segfault.
* sandbox/nivault/plugin-gimp/src/build-image.hh,
* sandbox/nivault/plugin-gimp/src/build-image.hxx,
* sandbox/nivault/plugin-gimp/src/gimp-image.hh,
* sandbox/nivault/plugin-gimp/src/interface.hxx: Some code commented.
---
build-image.hh | 4 -
build-image.hxx | 30 ++------
gimp-image.hh | 191 +++++++++++++++++++++++++++++++-------------------------
interface.hxx | 9 --
4 files changed, 116 insertions(+), 118 deletions(-)
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx (revision 1460)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx (revision 1461)
@@ -40,23 +40,7 @@
{
I tmp(region);
ima = tmp;
- mln_piter_(I) p(ima.domain());
-
-// gimp_pixel_rgn_init(®ion,
-// drawable,
-// 0,
-// 0,
-// drawable->width,
-// drawable->height,
-// FALSE,
-// FALSE);
-
-// gimp_pixel_rgn_get_rect(®ion,
-// (guchar *) ima.buffer(),
-// 0,
-// 0,
-// drawable->width,
-// drawable->height);
+ mln::level::fill(ima, mln::literal::blue);
}
gboolean draw_milena_image(GtkWidget* area,
@@ -76,10 +60,10 @@
FALSE,
FALSE);
- gimp_pixel_rgn_set_rect(®ion,
- (const guchar *) ima.buffer(),
- 0,
- 0,
- drawable->width,
- drawable->height);
+// gimp_pixel_rgn_set_rect(®ion,
+// (const guchar *) ima.buffer(),
+// 0,
+// 0,
+// drawable->width,
+// drawable->height);
}
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/interface.hxx
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/interface.hxx (revision 1460)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/interface.hxx (revision 1461)
@@ -54,8 +54,6 @@
GtkWidget *main_vbox;
GtkWidget *image_layout;
GtkWidget *frame;
-// GtkAdjustment *hadjust = NULL;
-// GtkAdjustment *vadjust = NULL;
GimpRGB color;
gimp_ui_init (PLUGIN_NAME, TRUE);
@@ -80,15 +78,10 @@
drawing_area = gimp_drawable_preview_new(drawable, NULL);
gtk_container_add (GTK_CONTAINER (frame), drawing_area);
-//** Not declared ?? **//
-// gimp_scrolled_preview_set_policy((GimpScrolledPreview *)drawing_area,
-// GTK_POLICY_ALWAYS,
-// GTK_POLICY_ALWAYS);
-
gtk_widget_set_size_request(drawing_area,
500,
500);
- draw_milena_image(drawing_area, NULL, 0);
+// draw_milena_image(drawing_area, NULL, 0);
gtk_widget_show (drawing_area);
gtk_widget_show (main_vbox);
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh (revision 1460)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh (revision 1461)
@@ -54,7 +54,7 @@
/// {
data_(GimpPixelRgn* rgn_);
- data_(box2d* box);
+// data_(box2d* box);
/// }
/// Destructor.
@@ -113,7 +113,7 @@
typedef trait::image::size::regular size;
typedef trait::image::support::aligned support;
- typedef trait::image::border::stored border;
+ typedef trait::image::border::none border;
typedef trait::image::data::raw data;
typedef trait::image::io::read_write io;
typedef trait::image::speed::fast speed;
@@ -198,26 +198,26 @@
/// Read-write access to the image value located at point \p p.
T& operator()(const point& p);
- /// Read-only access to the image value located at offset \p o.
- const T& operator[](unsigned o) const;
+// /// Read-only access to the image value located at offset \p o.
+// const T& operator[](unsigned o) const;
- /// Read-write access to the image value located at offset \p o.
- T& operator[](unsigned o);
+// /// Read-write access to the image value located at offset \p o.
+// T& operator[](unsigned o);
- /// Read-only access to the image value located at (\p row, \p col).
- const T& at(int row, int col) const;
+// /// Read-only access to the image value located at (\p row, \p col).
+// const T& at(int row, int col) const;
- /// Read-write access to the image value located at (\p row, \p col).
- T& at(int row, int col);
+// /// Read-write access to the image value located at (\p row, \p col).
+// T& at(int row, int col);
/// Fast Image method
- /// Give the offset corresponding to the delta-point \p dp.
- int offset(const dpoint2d& dp) const;
+// /// Give the offset corresponding to the delta-point \p dp.
+// int offset(const dpoint2d& dp) const;
- /// Give the point corresponding to the offset \p o.
- point2d point_at_offset(unsigned o) const;
+// /// Give the point corresponding to the offset \p o.
+// point2d point_at_offset(unsigned o) const;
/// Give a hook to the value buffer.
const T* buffer() const;
@@ -225,10 +225,13 @@
/// Give a hook to the value buffer.
T* buffer();
- private:
+ /// Gimp Image method
- /// GimpPixelRgn object.
- GimpPixelRgn* region_;
+ /// Give a hook to the GimpPixelRgn.
+ GimpPixelRgn* gimp_region();
+
+ /// Give a hook to the GimpDrawable.
+ GimpDrawable* gimp_drawable();
};
@@ -236,23 +239,23 @@
namespace internal
{
- template <GimpImageType t>
- data_< gimp_image<t> >::data_(box2d* box)
- : selfcreated_(true),
- b_(box)
- {
- GimpDrawable *gdraw = new GimpDrawable;
- gimp_pixel_rgn_init(rgn_,
- gdraw,
- box->pmin()[1],
- box->pmin()[0],
- box->len(1),
- box->len(0),
- FALSE,
- FALSE);
- buffer_ = rgn_->data;
- allocate_();
- }
+// template <GimpImageType t>
+// data_< gimp_image<t> >::data_(box2d* box)
+// : selfcreated_(true),
+// b_(*box)
+// {
+// GimpDrawable *gdraw = new GimpDrawable;
+// gimp_pixel_rgn_init(rgn_,
+// gdraw,
+// box->pmin()[1],
+// box->pmin()[0],
+// box->len(1),
+// box->len(0),
+// FALSE,
+// FALSE);
+// buffer_ = rgn_->data;
+// allocate_();
+// }
template <GimpImageType t>
data_< gimp_image<t> >::data_(GimpPixelRgn* rgn)
@@ -403,53 +406,57 @@
const mln_value(gimp_image<t>)&
gimp_image<t>::operator()(const point& p) const
{
- mln_precondition(this->owns_(p));
- return this->data_->array_[p.row()][p.col()];
+ // mln_precondition(this->owns_(p));
+ // FIXME HERE value*) this->data_->rgn->data
+ static mln::value::rgb8 c(200,200,200);
+ return c; // this->data_->array_[p.row()][p.col()];
}
template <GimpImageType t>
mln_value(gimp_image<t>)&
gimp_image<t>::operator()(const point& p)
{
- mln_precondition(this->owns_(p));
- return this->data_->array_[p.row()][p.col()];
- }
-
-
- template <GimpImageType t>
- const mln_value(gimp_image<t>)&
- gimp_image<t>::operator[](unsigned o) const
- {
- mln_precondition(o < ncells());
- return *(this->data_->buffer_ + o);
+ // mln_precondition(this->owns_(p));
+ static mln::value::rgb8 c(0,0,0);
+ return c; // this->data_->array_[p.row()][p.col()];
+// return this->data_->array_[p.row()][p.col()];
}
- template <GimpImageType t>
- mln_value(gimp_image<t>)&
- gimp_image<t>::operator[](unsigned o)
- {
- mln_precondition(o < ncells());
- return *(this->data_->buffer_ + o);
- }
-
-
- template <GimpImageType t>
- const mln_value(gimp_image<t>)&
- gimp_image<t>::at(int row, int col) const
- {
- mln_precondition(this->owns_(make::point2d(row, col)));
- return this->data_->array_[row][col];
- }
-
-
- template <GimpImageType t>
- mln_value(gimp_image<t>)&
- gimp_image<t>::at(int row, int col)
- {
- mln_precondition(this->owns_(make::point2d(row, col)));
- return this->data_->array_[row][col];
- }
+// template <GimpImageType t>
+// const mln_value(gimp_image<t>)&
+// gimp_image<t>::operator[](unsigned o) const
+// {
+// mln_precondition(o < ncells());
+// return *(this->data_->buffer_ + o);
+// }
+
+
+// template <GimpImageType t>
+// mln_value(gimp_image<t>)&
+// gimp_image<t>::operator[](unsigned o)
+// {
+// mln_precondition(o < ncells());
+// return *(this->data_->buffer_ + o);
+// }
+
+
+// template <GimpImageType t>
+// const mln_value(gimp_image<t>)&
+// gimp_image<t>::at(int row, int col) const
+// {
+// mln_precondition(this->owns_(make::point2d(row, col)));
+// return this->data_->array_[row][col];
+// }
+
+
+// template <GimpImageType t>
+// mln_value(gimp_image<t>)&
+// gimp_image<t>::at(int row, int col)
+// {
+// mln_precondition(this->owns_(make::point2d(row, col)));
+// return this->data_->array_[row][col];
+// }
template <GimpImageType t>
@@ -470,25 +477,39 @@
}
+// template <GimpImageType t>
+// int
+// gimp_image<t>::offset(const dpoint2d& dp) const
+// {
+// mln_precondition(this->has_data());
+// int o = dp[0] * this->data_->b_.len(1) + dp[1];
+// return o;
+// }
+
+
+// template <GimpImageType t>
+// point2d
+// gimp_image<t>::point_at_offset(unsigned o) const
+// {
+// mln_precondition(o < ncells());
+// point2d p = make::point2d(o / this->data_->b_.len(1) + this->data_->b_.min_row(),
+// o % this->data_->b_.len(1) + this->data_->b_.min_col());
+// mln_postcondition(& this->operator()(p) == this->data_->buffer_ + o);
+// return p;
+// }
+
template <GimpImageType t>
- int
- gimp_image<t>::offset(const dpoint2d& dp) const
+ GimpPixelRgn*
+ gimp_image<t>::gimp_region()
{
- mln_precondition(this->has_data());
- int o = dp[0] * this->data_->b_.len(1) + dp[1];
- return o;
+ return this->data_->rgn_;
}
-
template <GimpImageType t>
- point2d
- gimp_image<t>::point_at_offset(unsigned o) const
+ GimpDrawable*
+ gimp_image<t>::gimp_drawable()
{
- mln_precondition(o < ncells());
- point2d p = make::point2d(o / this->data_->b_.len(1) + this->data_->b_.min_row(),
- o % this->data_->b_.len(1) + this->data_->b_.min_col());
- mln_postcondition(& this->operator()(p) == this->data_->buffer_ + o);
- return p;
+ return this->data_->rgn_->drawable;
}
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh (revision 1460)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh (revision 1461)
@@ -32,10 +32,10 @@
# include <libgimp/gimpui.h>
# include <src/gimp-image.hh>
-
+# include <mln/level/fill.hh>
// # include <mln/core/image2d.hh>
// # include <mln/value/rgb8.hh>
-// # include <mln/literal/black.hh>
+# include <mln/literal/all.hh>
// # include <mln/display/show.hh>
// # include <mln/display/remove.hh>
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Rename point set types after p_something.
* mln/core/queue_p.hh: Rename as...
* mln/core/p_queue.hh: ...this.
* mln/core/queue_p_fast.hh: Rename as...
* mln/core/p_queue_fast.hh: ...this.
* mln/core/queue_p_fast_priority.hh: Rename as...
* mln/core/p_priority_queue_fast.hh: ...this.
* mln/core/vec_p_piter.hh: Rename as...
* mln/core/p_array_piter.hh: ...this.
* mln/core/queue_p_priority.hh: Rename as...
* mln/core/p_priority_queue.hh: ...this.
* mln/core/set_p.hh: Rename as...
* mln/core/p_set.hh: ...this.
* mln/core/vec_p.hh: Rename as...
* mln/core/p_array.hh: ...this.
* mln/convert/to_set_p.hh: Rename as...
* mln/convert/to_p_set.hh: ...this.
* mln/convert/to_vec_p.hh: Rename as...
* mln/convert/to_p_array.hh: ...this.
* tests/queue_p.cc: Rename as...
* tests/core_p_queue.cc: ...this.
* tests/set_p.cc: Rename as...
* tests/core_p_set.cc: ...this.
* tests/queue_p_priority.cc: Rename...
* tests/core_p_priority_queue.cc: ...this.
* tests/queue_p_fast.cc: Rename as...
* tests/core_p_queue_fast.cc: ...this.
* tests/queue_p_fast_priority.cc: Rename as...
* tests/core_p_priority_queue_fast.cc: ...this.
* tests/convert_to_set_p.cc: Rename as...
* tests/convert_to_p_set.cc: ...this.
* tests/convert_to_vec_p.cc: Rename as...
* tests/convert_to_p_array.cc: ...this.
* mln/core/p_queue.hh (queue_p): Rename as...
(p_queue): ...this.
* mln/core/p_queue_fast.hh (queue_p_fast): Rename as...
(p_queue_fast): ...this.
* mln/core/p_priority_queue_fast.hh
(queue_p_fast_priority): Rename as...
(p_priority_queue_fast): ...this.
* mln/core/p_array_piter.hh
(vec_p_fwd_piter, vec_p_bkd_piter): Rename as...
(p_array_fwd_piter, p_array_bkd_piter): ...these.
* mln/core/p_priority_queue.hh
(queue_p_priority): Rename as...
(p_priority_queue): ...this.
* mln/core/p_set.hh (set_p): Rename as...
(p_set): ...this.
* mln/core/p_array.hh (vec_p): Rename as...
(p_array): ...this.
* mln/core/line2d.hh,
* mln/level/sort_points.hh,
* mln/level/fill.hh,
* mln/value/rgb.hh,
* mln/convert/all.hh,
* mln/geom/seeds2tiling.hh,
* mln/geom/seeds2tiling_with_chamfer.hh,
* mln/set/inter.hh,
* mln/set/diff.hh,
* mln/set/uni.hh,
* mln/set/sym_diff.hh,
* mln/morpho/opening_attribute.hh,
* mln/morpho/erosion.spe.hh,
* mln/display/color_pretty.hh,
* mln/display/all.hh,
* mln/util/tree_to_image.hh,
* mln/labeling/regional_minima.hh,
* mln/labeling/regional_maxima.hh,
* tests/morpho_dilation_max_h.cc,
* tests/level_sort_points.cc,
* tests/morpho_erosion.cc,
* tests/morpho_erosion_min_h.cc,
* tests/trait_op_uminus.cc,
* tests/convert_to_window.cc,
* tests/tree_fast_to_image.cc,
* tests/tree_to_image.cc,
* tests/show.cc,
* tests/color_pretty.cc,
* tests/morpho_dilation.cc: Update.
mln/convert/all.hh | 2
mln/convert/to_p_array.hh | 22 ++++-----
mln/convert/to_p_set.hh | 30 ++++++-------
mln/core/line2d.hh | 6 +-
mln/core/p_array.hh | 46 ++++++++++----------
mln/core/p_array_piter.hh | 58 ++++++++++++-------------
mln/core/p_priority_queue.hh | 76 +++++++++++++++++-----------------
mln/core/p_priority_queue_fast.hh | 76 +++++++++++++++++-----------------
mln/core/p_queue.hh | 52 +++++++++++------------
mln/core/p_queue_fast.hh | 52 +++++++++++------------
mln/core/p_set.hh | 36 ++++++++--------
mln/display/all.hh | 1
mln/display/color_pretty.hh | 26 +++++------
mln/geom/seeds2tiling.hh | 4 -
mln/geom/seeds2tiling_with_chamfer.hh | 4 -
mln/labeling/regional_maxima.hh | 2
mln/labeling/regional_minima.hh | 2
mln/level/fill.hh | 8 ++-
mln/level/sort_points.hh | 24 +++++-----
mln/morpho/erosion.spe.hh | 4 +
mln/morpho/opening_attribute.hh | 2
mln/set/diff.hh | 8 +--
mln/set/inter.hh | 8 +--
mln/set/sym_diff.hh | 8 +--
mln/set/uni.hh | 8 +--
mln/util/tree_to_image.hh | 12 ++---
mln/value/rgb.hh | 6 +-
tests/color_pretty.cc | 8 +--
tests/convert_to_p_array.cc | 64 ++++++++++++++++++++++++++++
tests/convert_to_p_set.cc | 18 ++++----
tests/convert_to_window.cc | 6 +-
tests/core_p_priority_queue.cc | 8 +--
tests/core_p_priority_queue_fast.cc | 8 +--
tests/core_p_queue.cc | 8 +--
tests/core_p_queue_fast.cc | 8 +--
tests/core_p_set.cc | 8 +--
tests/level_sort_points.cc | 2
tests/morpho_dilation.cc | 4 -
tests/morpho_dilation_max_h.cc | 4 -
tests/morpho_erosion.cc | 4 -
tests/morpho_erosion_min_h.cc | 4 -
tests/show.cc | 2
tests/trait_op_uminus.cc | 2
tests/tree_fast_to_image.cc | 12 ++---
tests/tree_to_image.cc | 6 +-
45 files changed, 415 insertions(+), 344 deletions(-)
Index: tests/morpho_dilation_max_h.cc
--- tests/morpho_dilation_max_h.cc (revision 1459)
+++ tests/morpho_dilation_max_h.cc (working copy)
@@ -40,7 +40,7 @@
#include <mln/value/int_u8.hh>
#include <mln/morpho/dilation_fast.hh>
-#include <mln/convert/to_vec_p.hh>
+#include <mln/convert/to_p_array.hh>
#include <mln/convert/to_window.hh>
@@ -55,7 +55,7 @@
image2d<int_u8> lena = io::pgm::load("../img/lena.pgm");
{
- vec_p<point2d> vec = convert::to_vec_p(rec, point2d::origin);
+ p_array<point2d> vec = convert::to_p_array(rec, point2d::origin);
window2d win = convert::to_window(vec);
image2d<int_u8> out(lena.domain());
Index: tests/level_sort_points.cc
--- tests/level_sort_points.cc (revision 1459)
+++ tests/level_sort_points.cc (working copy)
@@ -47,7 +47,7 @@
image2d<int_u8> ima(3, 3);
debug::iota(ima);
- vec_p<point2d> vec;
+ p_array<point2d> vec;
{
vec = level::sort_points_increasing(ima);
std::cout << vec << std::endl;
Index: tests/convert_to_p_set.cc
--- tests/convert_to_p_set.cc (revision 1459)
+++ tests/convert_to_p_set.cc (working copy)
@@ -25,9 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/convert_to_set_p.cc
+/*! \file tests/convert_to_p_set.cc
*
- * \brief Tests on mln::convert::to_set_p.
+ * \brief Tests on mln::convert::to_p_set.
*/
#include <mln/core/point2d.hh>
@@ -40,11 +40,11 @@
#include <mln/level/fill.hh>
-#include <mln/convert/to_set_p.hh>
+#include <mln/convert/to_p_set.hh>
using namespace mln;
- void test(set_p<point2d> ref, set_p<point2d> cmp)
+ void test(p_set<point2d> ref, p_set<point2d> cmp)
{
mln_assertion(ref.npoints() = cmp.npoints());
for (unsigned i = 0; i < ref.npoints(); ++i)
@@ -59,20 +59,20 @@
c(-1,0),
d(0,-1);
- set_p<point2d> ref;
+ p_set<point2d> ref;
ref.insert(a).insert(b).insert(c).insert(d);
// Reference constructed.
// Nbh :
neighb2d nbh = c4();
- set_p<point2d> test_nbh = convert::to_set_p(nbh);
+ p_set<point2d> test_nbh = convert::to_p_set(nbh);
test(ref, test_nbh);
// Image :
image2d<bool> ima(make::box2d(-6, -6, 6, 6));
level::fill(ima, false);
level::fill(inplace(ima | ref), true);
- set_p<point2d> test_ima = convert::to_set_p(ima);
+ p_set<point2d> test_ima = convert::to_p_set(ima);
test(ref, test_ima);
// Window :
@@ -82,7 +82,7 @@
.insert(b - point2d::origin)
.insert(c - point2d::origin)
.insert(d - point2d::origin);
- set_p<point2d> test_win = convert::to_set_p(win);
+ p_set<point2d> test_win = convert::to_p_set(win);
test(ref, test_win);
// std::set :
@@ -91,6 +91,6 @@
set.insert(b);
set.insert(c);
set.insert(d);
- set_p<point2d> test_set = convert::to_set_p(set);
+ p_set<point2d> test_set = convert::to_p_set(set);
test(ref, test_set);
}
Index: tests/morpho_erosion.cc
--- tests/morpho_erosion.cc (revision 1459)
+++ tests/morpho_erosion.cc (working copy)
@@ -48,7 +48,7 @@
#include <mln/pw/cst.hh>
#include <mln/fun/ops.hh>
-#include <mln/convert/to_vec_p.hh>
+#include <mln/convert/to_p_array.hh>
#include <mln/convert/to_window.hh>
@@ -91,7 +91,7 @@
}
// {
-// vec_p<point2d> vec = convert::to_vec_p(rec, point2d::zero);
+// p_array<point2d> vec = convert::to_p_array(rec, point2d::zero);
// window2d win = convert::to_window(vec);
// image2d<int_u8> out(lena.domain());
Index: tests/core_p_queue.cc
--- tests/core_p_queue.cc (revision 1451)
+++ tests/core_p_queue.cc (working copy)
@@ -25,13 +25,13 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/queue_p.cc
+/*! \file tests/p_queue.cc
*
- * \brief Tests on mln::queue_p.
+ * \brief Tests on mln::p_queue.
*/
#include <mln/core/point2d.hh>
-#include <mln/core/queue_p.hh>
+#include <mln/core/p_queue.hh>
@@ -39,7 +39,7 @@
{
using namespace mln;
- queue_p<point2d> q;
+ p_queue<point2d> q;
q
.push(make::point2d(6, 9))
.push(make::point2d(5, 1))
Index: tests/morpho_erosion_min_h.cc
--- tests/morpho_erosion_min_h.cc (revision 1459)
+++ tests/morpho_erosion_min_h.cc (working copy)
@@ -40,7 +40,7 @@
#include <mln/value/int_u8.hh>
#include <mln/morpho/erosion_fast.hh>
-#include <mln/convert/to_vec_p.hh>
+#include <mln/convert/to_p_array.hh>
#include <mln/convert/to_window.hh>
@@ -55,7 +55,7 @@
image2d<int_u8> lena = io::pgm::load("../img/lena.pgm");
{
- vec_p<point2d> vec = convert::to_vec_p(rec, point2d::origin);
+ p_array<point2d> vec = convert::to_p_array(rec, point2d::origin);
window2d win = convert::to_window(vec);
image2d<int_u8> out(lena.domain());
Index: tests/core_p_priority_queue.cc
--- tests/core_p_priority_queue.cc (revision 1451)
+++ tests/core_p_priority_queue.cc (working copy)
@@ -25,19 +25,19 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/queue_p_priority.cc
+/*! \file tests/p_priority_queue.cc
*
- * \brief Tests on mln::queue_p_priority.
+ * \brief Tests on mln::p_priority_queue.
*/
#include <mln/core/point2d.hh>
-#include <mln/core/queue_p_priority.hh>
+#include <mln/core/p_priority_queue.hh>
int main ()
{
using namespace mln;
- mln::queue_p_priority<point2d, unsigned> q;
+ mln::p_priority_queue<point2d, unsigned> q;
point2d p1 (6, 9);
point2d p2 (5, 1);
point2d p3 (4, 2);
Index: tests/trait_op_uminus.cc
--- tests/trait_op_uminus.cc (revision 1459)
+++ tests/trait_op_uminus.cc (working copy)
@@ -79,7 +79,7 @@
{
// template <>
-// struct set_precise_unary_< op::uminus, test >
+// struct p_setrecise_unary_< op::uminus, test >
// {
// typedef bool ret;
// };
Index: tests/core_p_set.cc
--- tests/core_p_set.cc (revision 1451)
+++ tests/core_p_set.cc (working copy)
@@ -25,15 +25,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/set_p.cc
+/*! \file tests/p_set.cc
*
- * \brief Tests on mln::set_p.
+ * \brief Tests on mln::p_set.
*/
#include <iterator>
#include <mln/core/point2d.hh>
-#include <mln/core/set_p.hh>
+#include <mln/core/p_set.hh>
@@ -41,7 +41,7 @@
{
using namespace mln;
- set_p<point2d> ps;
+ p_set<point2d> ps;
ps
.insert(make::point2d(6, 9))
.insert(make::point2d(4, 2))
Index: tests/convert_to_window.cc
--- tests/convert_to_window.cc (revision 1459)
+++ tests/convert_to_window.cc (working copy)
@@ -41,7 +41,7 @@
#include <mln/level/fill.hh>
#include <mln/convert/to_window.hh>
-#include <mln/convert/to_set_p.hh>
+#include <mln/convert/to_p_set.hh>
using namespace mln;
@@ -72,12 +72,12 @@
// Image :
image2d<bool> ima(make::box2d(-6, -6, 6, 6));
level::fill(ima, false);
- level::fill(inplace(ima | convert::to_set_p(ref)), true);
+ level::fill(inplace(ima | convert::to_p_set(ref)), true);
window2d test_ima = convert::to_window(ima);
test(ref, test_ima);
// Window :
- set_p<point2d> setp;
+ p_set<point2d> setp;
setp
.insert(point2d::origin + a)
.insert(point2d::origin + b)
Index: tests/core_p_priority_queue_fast.cc
--- tests/core_p_priority_queue_fast.cc (revision 1451)
+++ tests/core_p_priority_queue_fast.cc (working copy)
@@ -25,19 +25,19 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/queue_p_fast_priority.cc
+/*! \file tests/p_priority_queue_fast.cc
*
- * \brief Tests on mln::queue_p_fast_priority.
+ * \brief Tests on mln::p_priority_queue_fast.
*/
#include <mln/core/point2d.hh>
-#include <mln/core/queue_p_fast_priority.hh>
+#include <mln/core/p_priority_queue_fast.hh>
int main ()
{
using namespace mln;
- mln::queue_p_fast_priority<point2d, unsigned> q;
+ mln::p_priority_queue_fast<point2d, unsigned> q;
point2d p1 (6, 9);
point2d p2 (5, 1);
point2d p3 (4, 2);
Index: tests/convert_to_p_array.cc
--- tests/convert_to_p_array.cc (revision 0)
+++ tests/convert_to_p_array.cc (revision 0)
@@ -0,0 +1,64 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/convert_to_p_array.cc
+ *
+ * \brief Tests on mln::convert::to_p_array.
+ */
+
+#include <mln/core/point1d.hh>
+#include <mln/core/point2d.hh>
+#include <mln/core/p_array.hh>
+
+#include <mln/win/segment1d.hh>
+#include <mln/win/rectangle2d.hh>
+
+#include <mln/convert/to_p_array.hh>
+
+int main()
+{
+ using namespace mln;
+
+ typedef p_array<point1d> vec1d;
+ point1d p1 = make::point1d(6);
+ win::segment1d win1d(5);
+ vec1d v1(convert::to_p_array(win1d, p1));
+
+ for (size_t i=0; i < v1.npoints(); i++)
+ std::cout << (v1[i]);
+
+ std::cout << "\n";
+
+ typedef p_array<point2d> vec2d;
+ point2d p2 = make::point2d(10,10);
+ win::rectangle2d win2d(3, 3);
+ vec2d v2(convert::to_p_array(win2d, p2));
+
+ for (size_t i=0; i < v2.npoints(); i++)
+ std::cout << (v2[i]);
+
+}
Index: tests/tree_fast_to_image.cc
--- tests/tree_fast_to_image.cc (revision 1459)
+++ tests/tree_fast_to_image.cc (working copy)
@@ -34,7 +34,7 @@
#include <mln/core/contract.hh>
#include <mln/core/image2d.hh>
-#include <mln/core/set_p.hh>
+#include <mln/core/p_set.hh>
#include <mln/value/int_u8.hh>
#include <mln/level/stretch.hh>
#include <mln/io/pgm/save.hh>
@@ -46,16 +46,16 @@
struct fllt_node
{
V value;
- mln::set_p<P> points;
- mln::set_p<P> holes;
+ mln::p_set<P> points;
+ mln::p_set<P> holes;
};
template <typename P, typename V>
-bool operator=(const mln::set_p<P>& lhs, const mln::set_p<P>& rhs)
+bool operator=(const mln::p_set<P>& lhs, const mln::p_set<P>& rhs)
{
std::size_t n = lhs.npoints ();
- mln::set_p<P> tmp;
+ mln::p_set<P> tmp;
if (n != rhs.npoints ())
return false;
@@ -87,7 +87,7 @@
using namespace mln;
using value::int_u8;
- typedef set_p<point2d > I;
+ typedef p_set<point2d > I;
typedef fllt_node<point2d, int_u8> T;
T s1;
Index: tests/tree_to_image.cc
--- tests/tree_to_image.cc (revision 1459)
+++ tests/tree_to_image.cc (working copy)
@@ -35,7 +35,7 @@
#include <mln/util/tree.hh>
#include <mln/core/contract.hh>
#include <mln/core/image2d.hh>
-#include <mln/core/set_p.hh>
+#include <mln/core/p_set.hh>
#include <mln/value/int_u8.hh>
#include <mln/level/stretch.hh>
#include <mln/level/fill.hh>
@@ -48,8 +48,8 @@
struct fllt_node
{
V value;
- mln::set_p<P> points;
- mln::set_p<P> holes;
+ mln::p_set<P> points;
+ mln::p_set<P> holes;
};
Index: tests/show.cc
--- tests/show.cc (revision 1459)
+++ tests/show.cc (working copy)
@@ -65,7 +65,7 @@
image2d<unsigned> tmp = geom::chamfer(input, w_win, max);
// Call color_pretty for sub_image.
- for (unsigned i = 2; i < 22; i += 2)
+ for (unsigned i = 2; i < 6; i += 2)
{
image_if_value<image2d<unsigned> > t = inplace (tmp | i);
display::save (t);
Index: tests/color_pretty.cc
--- tests/color_pretty.cc (revision 1459)
+++ tests/color_pretty.cc (working copy)
@@ -41,7 +41,7 @@
# include <mln/core/w_window2d_int.hh>
# include <mln/display/color_pretty.hh>
# include <mln/io/ppm/save.hh>
-# include <mln/core/set_p.hh>
+# include <mln/core/p_set.hh>
int main()
@@ -62,9 +62,9 @@
// Call chamfer for a distance image.
image2d<unsigned> tmp = geom::chamfer(input, w_win, max);
- set_p<point2d > s1;
- set_p<point2d > s2;
- set_p<point2d > s3;
+ p_set<point2d > s1;
+ p_set<point2d > s2;
+ p_set<point2d > s3;
// typedef image_if_value<image2d<unsigned> > I;
Index: tests/morpho_dilation.cc
--- tests/morpho_dilation.cc (revision 1459)
+++ tests/morpho_dilation.cc (working copy)
@@ -48,7 +48,7 @@
#include <mln/pw/cst.hh>
#include <mln/fun/ops.hh>
-#include <mln/convert/to_vec_p.hh>
+#include <mln/convert/to_p_array.hh>
#include <mln/convert/to_window.hh>
@@ -76,7 +76,7 @@
}
// {
-// vec_p<point2d> vec = convert::to_vec_p(rec, point2d::zero);
+// p_array<point2d> vec = convert::to_p_array(rec, point2d::zero);
// window2d win = convert::to_window(vec);
// image2d<int_u8> out(lena.domain());
Index: tests/core_p_queue_fast.cc
--- tests/core_p_queue_fast.cc (revision 1451)
+++ tests/core_p_queue_fast.cc (working copy)
@@ -25,13 +25,13 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/queue_p_fast.cc
+/*! \file tests/p_queue_fast.cc
*
- * \brief Tests on mln::queue_p_fast.
+ * \brief Tests on mln::p_queue_fast.
*/
#include <mln/core/point2d.hh>
-#include <mln/core/queue_p_fast.hh>
+#include <mln/core/p_queue_fast.hh>
@@ -39,7 +39,7 @@
{
using namespace mln;
- queue_p_fast<point2d> q;
+ p_queue_fast<point2d> q;
q
.push(make::point2d(6, 9))
.push(make::point2d(5, 1))
Index: mln/core/p_queue.hh
--- mln/core/p_queue.hh (revision 1451)
+++ mln/core/p_queue.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_QUEUE_P_HH
# define MLN_CORE_QUEUE_P_HH
-/*! \file mln/core/queue_p.hh
+/*! \file mln/core/p_queue.hh
*
* \brief Definition of a point set class based on std::deque.
*/
@@ -39,7 +39,7 @@
# include <iterator>
# include <mln/core/internal/point_set_base.hh>
-# include <mln/core/vec_p_piter.hh>
+# include <mln/core/p_array_piter.hh>
# include <mln/accu/bbox.hh>
@@ -47,8 +47,8 @@
{
// Fwd decls.
- template <typename P> struct vec_p_fwd_piter_;
- template <typename P> struct vec_p_bkd_piter_;
+ template <typename P> struct p_array_fwd_piter_;
+ template <typename P> struct p_array_bkd_piter_;
/*! \brief Point queue class (based on std::deque).
@@ -63,18 +63,18 @@
* a call to npoints() when this container is multiple.
*/
template <typename P>
- class queue_p : public internal::point_set_base_< P, queue_p<P> >
+ class p_queue : public internal::point_set_base_< P, p_queue<P> >
{
public:
/// Forward Point_Iterator associated type.
- typedef vec_p_fwd_piter_<P> fwd_piter;
+ typedef p_array_fwd_piter_<P> fwd_piter;
/// Backward Point_Iterator associated type.
- typedef vec_p_bkd_piter_<P> bkd_piter;
+ typedef p_array_bkd_piter_<P> bkd_piter;
/// Constructor.
- queue_p();
+ p_queue();
/// Test is \p p belongs to this point set.
bool has(const P& p) const;
@@ -89,10 +89,10 @@
const box_<P>& bbox() const;
/// Push force a point \p p in the queue.
- queue_p<P>& push_force(const P& p);
+ p_queue<P>& push_force(const P& p);
/// Push a point \p p in the queue.
- queue_p<P>& push(const P& p);
+ p_queue<P>& push(const P& p);
/// Pop (remove) the front point \p p from the queue; \p p is the
/// least recently inserted point.
@@ -130,7 +130,7 @@
# ifndef MLN_INCLUDE_ONLY
template <typename P>
- queue_p<P>::queue_p()
+ p_queue<P>::p_queue()
{
vect_needs_update_ = false;
bb_needs_update_ = false;
@@ -138,7 +138,7 @@
template <typename P>
void
- queue_p<P>::vect_update_() const
+ p_queue<P>::vect_update_() const
{
vect_.clear();
vect_.reserve(q_.size());
@@ -149,7 +149,7 @@
template <typename P>
void
- queue_p<P>::bb_update_() const
+ p_queue<P>::bb_update_() const
{
bb_.init();
for (unsigned i = 0; i < q_.size(); ++i)
@@ -159,7 +159,7 @@
template <typename P>
bool
- queue_p<P>::has(const P& p) const
+ p_queue<P>::has(const P& p) const
{
for (unsigned i = 0; i < q_.size(); ++i)
if (q_[i] = p)
@@ -169,21 +169,21 @@
template <typename P>
bool
- queue_p<P>::empty() const
+ p_queue<P>::empty() const
{
return (q_.empty());
}
template <typename P>
std::size_t
- queue_p<P>::npoints() const
+ p_queue<P>::npoints() const
{
return q_.size();
}
template <typename P>
const box_<P>&
- queue_p<P>::bbox() const
+ p_queue<P>::bbox() const
{
mln_precondition(npoints() != 0);
if (bb_needs_update_)
@@ -192,8 +192,8 @@
}
template <typename P>
- queue_p<P>&
- queue_p<P>::push_force(const P& p)
+ p_queue<P>&
+ p_queue<P>::push_force(const P& p)
{
q_.push_back(p);
if (! vect_needs_update_)
@@ -205,8 +205,8 @@
}
template <typename P>
- queue_p<P>&
- queue_p<P>::push(const P& p)
+ p_queue<P>&
+ p_queue<P>::push(const P& p)
{
mln_precondition(! has(p));
// FIXME: Our choice is "error if multiple insertions"
@@ -215,7 +215,7 @@
template <typename P>
void
- queue_p<P>::pop()
+ p_queue<P>::pop()
{
q_.pop_front();
if (! vect_needs_update_)
@@ -227,7 +227,7 @@
template <typename P>
const P&
- queue_p<P>::front() const
+ p_queue<P>::front() const
{
mln_precondition(! q_.empty());
return q_.front();
@@ -235,7 +235,7 @@
template <typename P>
void
- queue_p<P>::clear()
+ p_queue<P>::clear()
{
q_.clear();
vect_.clear();
@@ -245,7 +245,7 @@
template <typename P>
const std::vector<P>&
- queue_p<P>::vect() const
+ p_queue<P>::vect() const
{
if (vect_needs_update_)
vect_update_();
@@ -254,7 +254,7 @@
template <typename P>
const P&
- queue_p<P>::operator[](unsigned i) const
+ p_queue<P>::operator[](unsigned i) const
{
mln_precondition(i < npoints());
return q_[i];
Index: mln/core/p_priority_queue_fast.hh
--- mln/core/p_priority_queue_fast.hh (revision 1451)
+++ mln/core/p_priority_queue_fast.hh (working copy)
@@ -28,9 +28,9 @@
#ifndef MLN_CORE_QUEUE_P_FAST_PRIORITY_HH
# define MLN_CORE_QUEUE_P_FAST_PRIORITY_HH
-/*! \file mln/core/queue_p_fast_priority.hh
+/*! \file mln/core/p_priority_queue_fast.hh
*
- * \brief Definition of a point set class based on queue_p_fast with
+ * \brief Definition of a point set class based on p_queue_fast with
* priority features.
*/
@@ -41,16 +41,16 @@
# include <iterator>
# include <mln/core/internal/point_set_base.hh>
-# include <mln/core/vec_p_piter.hh>
+# include <mln/core/p_array_piter.hh>
# include <mln/accu/bbox.hh>
-# include <mln/core/queue_p_fast.hh>
+# include <mln/core/p_queue_fast.hh>
namespace mln
{
// Fwd decls.
- template <typename P> struct vec_p_fwd_piter_;
- template <typename P> struct vec_p_bkd_piter_;
+ template <typename P> struct p_array_fwd_piter_;
+ template <typename P> struct p_array_bkd_piter_;
/*! \brief Point queue class (based on std::deque).
@@ -65,18 +65,18 @@
* a call to npoints() when this container is multiple.
*/
template <typename P, typename T>
- class queue_p_fast_priority : public internal::point_set_base_< P, queue_p_fast_priority<P, T> >
+ class p_priority_queue_fast : public internal::point_set_base_< P, p_priority_queue_fast<P, T> >
{
public:
/// Forward Point_Iterator associated type.
- typedef vec_p_fwd_piter_<P> fwd_piter;
+ typedef p_array_fwd_piter_<P> fwd_piter;
/// Backward Point_Iterator associated type.
- typedef vec_p_bkd_piter_<P> bkd_piter;
+ typedef p_array_bkd_piter_<P> bkd_piter;
/// Constructor.
- queue_p_fast_priority();
+ p_priority_queue_fast();
/// Test is \p p belongs to this point set.
bool has(const P& p) const;
@@ -91,10 +91,10 @@
const box_<P>& bbox() const;
/// Push force a point \p p in the queue.
- queue_p_fast_priority<P, T>& push_force(const P& p, T prio = 0);
+ p_priority_queue_fast<P, T>& push_force(const P& p, T prio = 0);
/// Push a point \p p in the queue.
- queue_p_fast_priority<P, T>& push(const P& p, T prio = 0);
+ p_priority_queue_fast<P, T>& push(const P& p, T prio = 0);
/// Pop (remove) the front point \p p from the queue; \p p is the
/// least recently inserted point.
@@ -115,7 +115,7 @@
protected:
- std::map<const T, queue_p_fast<P> > q_;
+ std::map<const T, p_queue_fast<P> > q_;
mutable std::vector<P> vect_;
mutable bool vect_needs_update_;
@@ -132,7 +132,7 @@
# ifndef MLN_INCLUDE_ONLY
template <typename P, typename T>
- queue_p_fast_priority<P, T>::queue_p_fast_priority()
+ p_priority_queue_fast<P, T>::p_priority_queue_fast()
{
vect_needs_update_ = false;
bb_needs_update_ = false;
@@ -140,12 +140,12 @@
template <typename P, typename T>
void
- queue_p_fast_priority<P, T>::vect_update_() const
+ p_priority_queue_fast<P, T>::vect_update_() const
{
vect_.clear();
vect_.reserve(npoints());
- typename std::map<T, queue_p_fast<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
std::copy((*it).second.vect().begin(), (*it).second.vect().end(),
@@ -155,11 +155,11 @@
template <typename P, typename T>
void
- queue_p_fast_priority<P, T>::bb_update_() const
+ p_priority_queue_fast<P, T>::bb_update_() const
{
bb_.init();
- typename std::map<T, queue_p_fast<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
for (unsigned i = 0; i < (*it).second.npoints (); ++i)
@@ -170,9 +170,9 @@
template <typename P, typename T>
bool
- queue_p_fast_priority<P, T>::has(const P& p) const
+ p_priority_queue_fast<P, T>::has(const P& p) const
{
- typename std::map<T, queue_p_fast<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
if ((*it).second.has (p))
@@ -182,9 +182,9 @@
template <typename P, typename T>
bool
- queue_p_fast_priority<P, T>::empty() const
+ p_priority_queue_fast<P, T>::empty() const
{
- typename std::map<T, queue_p_fast<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
if (!(*it).second.empty ())
@@ -194,11 +194,11 @@
template <typename P, typename T>
unsigned
- queue_p_fast_priority<P, T>::npoints() const
+ p_priority_queue_fast<P, T>::npoints() const
{
unsigned res = 0;
- typename std::map<T, queue_p_fast<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
if (!(*it).second.empty ())
@@ -208,7 +208,7 @@
template <typename P, typename T>
const box_<P>&
- queue_p_fast_priority<P, T>::bbox() const
+ p_priority_queue_fast<P, T>::bbox() const
{
mln_precondition(npoints() != 0);
if (bb_needs_update_)
@@ -217,8 +217,8 @@
}
template <typename P, typename T>
- queue_p_fast_priority<P, T>&
- queue_p_fast_priority<P, T>::push_force(const P& p, T prio)
+ p_priority_queue_fast<P, T>&
+ p_priority_queue_fast<P, T>::push_force(const P& p, T prio)
{
q_[prio].push_force (p);
if (! vect_needs_update_)
@@ -230,8 +230,8 @@
}
template <typename P, typename T>
- queue_p_fast_priority<P, T>&
- queue_p_fast_priority<P, T>::push(const P& p, T prio)
+ p_priority_queue_fast<P, T>&
+ p_priority_queue_fast<P, T>::push(const P& p, T prio)
{
if (! has(p))
return this->push_force(p, prio);
@@ -241,9 +241,9 @@
template <typename P, typename T>
void
- queue_p_fast_priority<P, T>::pop()
+ p_priority_queue_fast<P, T>::pop()
{
- typename std::map<T, queue_p_fast<P> >::reverse_iterator it = q_.rbegin ();
+ typename std::map<T, p_queue_fast<P> >::reverse_iterator it = q_.rbegin ();
for (; it != q_.rend (); ++it)
if (!(*it).second.empty ())
@@ -258,11 +258,11 @@
template <typename P, typename T>
const P&
- queue_p_fast_priority<P, T>::front() const
+ p_priority_queue_fast<P, T>::front() const
{
mln_precondition(! q_.empty());
- typename std::map<T, queue_p_fast<P> >::const_reverse_iterator it = q_.rbegin ();
+ typename std::map<T, p_queue_fast<P> >::const_reverse_iterator it = q_.rbegin ();
for (; it != q_.rend (); ++it)
if (!(*it).second.empty ())
@@ -272,9 +272,9 @@
template <typename P, typename T>
void
- queue_p_fast_priority<P, T>::clear()
+ p_priority_queue_fast<P, T>::clear()
{
- typename std::map<T, queue_p_fast<P> >::iterator it = q_.begin ();
+ typename std::map<T, p_queue_fast<P> >::iterator it = q_.begin ();
for (; it != q_.end (); ++it)
(*it).second.clear ();
@@ -285,7 +285,7 @@
template <typename P, typename T>
const std::vector<P>&
- queue_p_fast_priority<P, T>::vect() const
+ p_priority_queue_fast<P, T>::vect() const
{
if (vect_needs_update_)
vect_update_();
@@ -294,11 +294,11 @@
template <typename P, typename T>
const P&
- queue_p_fast_priority<P, T>::operator[](unsigned i) const
+ p_priority_queue_fast<P, T>::operator[](unsigned i) const
{
mln_precondition(i < npoints());
- typename std::map<T, queue_p_fast<P> >::const_reverse_iterator it = q_.rbegin ();
+ typename std::map<T, p_queue_fast<P> >::const_reverse_iterator it = q_.rbegin ();
unsigned cpt = 0;
for (; it != q_.rend (); ++it)
Index: mln/core/p_priority_queue.hh
--- mln/core/p_priority_queue.hh (revision 1459)
+++ mln/core/p_priority_queue.hh (working copy)
@@ -28,9 +28,9 @@
#ifndef MLN_CORE_QUEUE_P_PRIORITY_HH
# define MLN_CORE_QUEUE_P_PRIORITY_HH
-/*! \file mln/core/queue_p_priority.hh
+/*! \file mln/core/p_queue_priority.hh
*
- * \brief Definition of a point set class based on queue_p with
+ * \brief Definition of a point set class based on p_queue with
* priority features.
*/
@@ -41,16 +41,16 @@
# include <iterator>
# include <mln/core/internal/point_set_base.hh>
-# include <mln/core/vec_p_piter.hh>
+# include <mln/core/p_array_piter.hh>
# include <mln/accu/bbox.hh>
-# include <mln/core/queue_p.hh>
+# include <mln/core/p_queue.hh>
namespace mln
{
// Fwd decls.
- template <typename P> struct vec_p_fwd_piter_;
- template <typename P> struct vec_p_bkd_piter_;
+ template <typename P> struct p_array_fwd_piter_;
+ template <typename P> struct p_array_bkd_piter_;
/*! \brief Point queue class (based on std::deque).
@@ -65,18 +65,18 @@
* a call to npoints() when this container is multiple.
*/
template <typename P, typename T>
- class queue_p_priority : public internal::point_set_base_< P, queue_p_priority<P, T> >
+ class p_queue_priority : public internal::point_set_base_< P, p_queue_priority<P, T> >
{
public:
/// Forward Point_Iterator associated type.
- typedef vec_p_fwd_piter_<P> fwd_piter;
+ typedef p_array_fwd_piter_<P> fwd_piter;
/// Backward Point_Iterator associated type.
- typedef vec_p_bkd_piter_<P> bkd_piter;
+ typedef p_array_bkd_piter_<P> bkd_piter;
/// Constructor.
- queue_p_priority();
+ p_queue_priority();
/// Test is \p p belongs to this point set.
bool has(const P& p) const;
@@ -91,10 +91,10 @@
const box_<P>& bbox() const;
/// Push force a point \p p in the queue.
- queue_p_priority<P, T>& push_force(const P& p, T prio = 0);
+ p_queue_priority<P, T>& push_force(const P& p, T prio = 0);
/// Push a point \p p in the queue.
- queue_p_priority<P, T>& push(const P& p, T prio = 0);
+ p_queue_priority<P, T>& push(const P& p, T prio = 0);
/// Pop (remove) the front point \p p from the queue; \p p is the
/// least recently inserted point.
@@ -115,7 +115,7 @@
protected:
- std::map<const T, queue_p<P> > q_;
+ std::map<const T, p_queue<P> > q_;
mutable std::vector<P> vect_;
mutable bool vect_needs_update_;
@@ -132,7 +132,7 @@
# ifndef MLN_INCLUDE_ONLY
template <typename P, typename T>
- queue_p_priority<P, T>::queue_p_priority()
+ p_queue_priority<P, T>::p_queue_priority()
{
vect_needs_update_ = false;
bb_needs_update_ = false;
@@ -140,12 +140,12 @@
template <typename P, typename T>
void
- queue_p_priority<P, T>::vect_update_() const
+ p_queue_priority<P, T>::vect_update_() const
{
vect_.clear();
vect_.reserve(npoints());
- typename std::map<T, queue_p<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
std::copy((*it).second.vect().begin(), (*it).second.vect().end(),
@@ -155,11 +155,11 @@
template <typename P, typename T>
void
- queue_p_priority<P, T>::bb_update_() const
+ p_queue_priority<P, T>::bb_update_() const
{
bb_.init();
- typename std::map<T, queue_p<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
for (unsigned i = 0; i < (*it).second.npoints (); ++i)
@@ -170,9 +170,9 @@
template <typename P, typename T>
bool
- queue_p_priority<P, T>::has(const P& p) const
+ p_queue_priority<P, T>::has(const P& p) const
{
- typename std::map<T, queue_p<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
if ((*it).second.has (p))
@@ -182,9 +182,9 @@
template <typename P, typename T>
bool
- queue_p_priority<P, T>::empty() const
+ p_queue_priority<P, T>::empty() const
{
- typename std::map<T, queue_p<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
if (!(*it).second.empty ())
@@ -194,11 +194,11 @@
template <typename P, typename T>
unsigned
- queue_p_priority<P, T>::npoints() const
+ p_queue_priority<P, T>::npoints() const
{
unsigned res = 0;
- typename std::map<T, queue_p<P> >::const_iterator it = q_.begin ();
+ typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
if (!(*it).second.empty ())
@@ -208,7 +208,7 @@
template <typename P, typename T>
const box_<P>&
- queue_p_priority<P, T>::bbox() const
+ p_queue_priority<P, T>::bbox() const
{
mln_precondition(npoints() != 0);
if (bb_needs_update_)
@@ -217,8 +217,8 @@
}
template <typename P, typename T>
- queue_p_priority<P, T>&
- queue_p_priority<P, T>::push_force(const P& p, T prio)
+ p_queue_priority<P, T>&
+ p_queue_priority<P, T>::push_force(const P& p, T prio)
{
q_[prio].push_force (p);
if (! vect_needs_update_)
@@ -230,8 +230,8 @@
}
template <typename P, typename T>
- queue_p_priority<P, T>&
- queue_p_priority<P, T>::push(const P& p, T prio)
+ p_queue_priority<P, T>&
+ p_queue_priority<P, T>::push(const P& p, T prio)
{
if (! has(p))
return this->push_force(p, prio);
@@ -241,9 +241,9 @@
template <typename P, typename T>
void
- queue_p_priority<P, T>::pop()
+ p_queue_priority<P, T>::pop()
{
- typename std::map<T, queue_p<P> >::reverse_iterator it = q_.rbegin ();
+ typename std::map<T, p_queue<P> >::reverse_iterator it = q_.rbegin ();
for (; it != q_.rend (); ++it)
if (!(*it).second.empty ())
@@ -258,11 +258,11 @@
template <typename P, typename T>
const P&
- queue_p_priority<P, T>::front() const
+ p_queue_priority<P, T>::front() const
{
mln_precondition(! q_.empty());
- typename std::map<T, queue_p<P> >::const_reverse_iterator it = q_.rbegin ();
+ typename std::map<T, p_queue<P> >::const_reverse_iterator it = q_.rbegin ();
for (; it != q_.rend (); ++it)
if (!(*it).second.empty ())
@@ -272,9 +272,9 @@
template <typename P, typename T>
void
- queue_p_priority<P, T>::clear()
+ p_queue_priority<P, T>::clear()
{
- typename std::map<T, queue_p<P> >::iterator it = q_.begin ();
+ typename std::map<T, p_queue<P> >::iterator it = q_.begin ();
for (; it != q_.end (); ++it)
(*it).second.clear ();
@@ -285,7 +285,7 @@
template <typename P, typename T>
const std::vector<P>&
- queue_p_priority<P, T>::vect() const
+ p_queue_priority<P, T>::vect() const
{
if (vect_needs_update_)
vect_update_();
@@ -294,11 +294,11 @@
template <typename P, typename T>
const P&
- queue_p_priority<P, T>::operator[](unsigned i) const
+ p_queue_priority<P, T>::operator[](unsigned i) const
{
mln_precondition(i < npoints());
- typename std::map<T, queue_p<P> >::const_reverse_iterator it = q_.rbegin ();
+ typename std::map<T, p_queue<P> >::const_reverse_iterator it = q_.rbegin ();
unsigned cpt = 0;
for (; it != q_.rend (); ++it)
Index: mln/core/p_set.hh
--- mln/core/p_set.hh (revision 1451)
+++ mln/core/p_set.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_SET_P_HH
# define MLN_CORE_SET_P_HH
-/*! \file mln/core/set_p.hh
+/*! \file mln/core/p_set.hh
*
* \brief Definition of a point set class based on std::set.
*/
@@ -36,7 +36,7 @@
# include <mln/core/internal/point_set_base.hh>
# include <mln/core/internal/set_of.hh>
# include <mln/accu/bbox.hh>
-# include <mln/core/vec_p.hh>
+# include <mln/core/p_array.hh>
namespace mln
@@ -50,7 +50,7 @@
* \todo Test if \p P being a Point_Site is ok.
*/
template <typename P>
- class set_p : public internal::point_set_base_< P, set_p<P> >,
+ class p_set : public internal::point_set_base_< P, p_set<P> >,
private internal::set_of_<P>
{
typedef internal::set_of_<P> super_;
@@ -58,13 +58,13 @@
public:
/// Forward Point_Iterator associated type.
- typedef vec_p_fwd_piter_<P> fwd_piter;
+ typedef p_array_fwd_piter_<P> fwd_piter;
/// Backward Point_Iterator associated type.
- typedef vec_p_bkd_piter_<P> bkd_piter;
+ typedef p_array_bkd_piter_<P> bkd_piter;
/// Constructor.
- set_p();
+ p_set();
/// Test is \p p belongs to this point set.
bool has(const P& p) const;
@@ -76,11 +76,11 @@
std::size_t npoints() const;
/// Insert a point \p p.
- set_p<P>& insert(const P& p);
+ p_set<P>& insert(const P& p);
// FIXME : doesn't compile
// /// Remove a point \p p.
- // set_p<P>& remove(P& p);
+ // p_set<P>& remove(P& p);
/// Return the \p i-th point.
const P& operator[](unsigned i) const;
@@ -101,27 +101,27 @@
# ifndef MLN_INCLUDE_ONLY
template <typename P>
- set_p<P>::set_p()
+ p_set<P>::p_set()
{
}
template <typename P>
bool
- set_p<P>::has(const P& p) const
+ p_set<P>::has(const P& p) const
{
return this->super_::has(p);
}
template <typename P>
std::size_t
- set_p<P>::npoints() const
+ p_set<P>::npoints() const
{
return this->super_::nelements();
}
template <typename P>
- set_p<P>&
- set_p<P>::insert(const P& p)
+ p_set<P>&
+ p_set<P>::insert(const P& p)
{
this->super_::insert(p);
bb_.take(p);
@@ -131,8 +131,8 @@
// FIXME : finish it.
// template <typename P>
- // set_p<P>&
- // set_p<P>::remove(P& p)
+ // p_set<P>&
+ // p_set<P>::remove(P& p)
// {
// this->super_::remove(p);
// // FIXME: need to rebuild bb_ ?
@@ -142,7 +142,7 @@
template <typename P>
const P&
- set_p<P>::operator[](unsigned i) const
+ p_set<P>::operator[](unsigned i) const
{
mln_precondition(i < npoints());
return this->super_::element(i);
@@ -150,7 +150,7 @@
template <typename P>
void
- set_p<P>::clear()
+ p_set<P>::clear()
{
this->super_::clear();
bb_.init();
@@ -158,7 +158,7 @@
template <typename P>
const box_<mln_point(P)>&
- set_p<P>::bbox() const
+ p_set<P>::bbox() const
{
mln_precondition(npoints() != 0);
return bb_.to_result();
Index: mln/core/line2d.hh
--- mln/core/line2d.hh (revision 1459)
+++ mln/core/line2d.hh (working copy)
@@ -36,7 +36,7 @@
# include <vector>
# include <mln/core/internal/point_set_base.hh>
-# include <mln/core/vec_p_piter.hh>
+# include <mln/core/p_array_piter.hh>
# include <mln/core/box2d.hh>
# include <mln/math/all.hh>
@@ -52,10 +52,10 @@
public:
/// Forward Point_Iterator associated type.
- typedef vec_p_fwd_piter_<point2d> fwd_piter;
+ typedef p_array_fwd_piter_<point2d> fwd_piter;
/// Backward Point_Iterator associated type.
- typedef vec_p_bkd_piter_<point2d> bkd_piter;
+ typedef p_array_bkd_piter_<point2d> bkd_piter;
/// Constructor from point \p beg to point \p end.
Index: mln/core/p_queue_fast.hh
--- mln/core/p_queue_fast.hh (revision 1451)
+++ mln/core/p_queue_fast.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_QUEUE_P_FAST_HH
# define MLN_CORE_QUEUE_P_FAST_HH
-/*! \file mln/core/queue_p_fast.hh
+/*! \file mln/core/p_queue_fast.hh
*
* \brief Definition of a point set class faster but needs more memory
* space.
@@ -40,7 +40,7 @@
# include <iterator>
# include <mln/core/internal/point_set_base.hh>
-# include <mln/core/vec_p_piter.hh>
+# include <mln/core/p_array_piter.hh>
# include <mln/accu/bbox.hh>
@@ -48,8 +48,8 @@
{
// Fwd decls.
- template <typename P> struct vec_p_fwd_piter_;
- template <typename P> struct vec_p_bkd_piter_;
+ template <typename P> struct p_array_fwd_piter_;
+ template <typename P> struct p_array_bkd_piter_;
/*! \brief Point queue class (based on std::deque).
@@ -64,18 +64,18 @@
* a call to npoints() when this container is multiple.
*/
template <typename P>
- class queue_p_fast : public internal::point_set_base_< P, queue_p_fast<P> >
+ class p_queue_fast : public internal::point_set_base_< P, p_queue_fast<P> >
{
public:
/// Forward Point_Iterator associated type.
- typedef vec_p_fwd_piter_<P> fwd_piter;
+ typedef p_array_fwd_piter_<P> fwd_piter;
/// Backward Point_Iterator associated type.
- typedef vec_p_bkd_piter_<P> bkd_piter;
+ typedef p_array_bkd_piter_<P> bkd_piter;
/// Constructor.
- queue_p_fast();
+ p_queue_fast();
/// Test is \p p belongs to this point set.
bool has(const P& p) const;
@@ -90,10 +90,10 @@
const box_<P>& bbox() const;
/// Push force a point \p p in the queue.
- queue_p_fast<P>& push_force(const P& p);
+ p_queue_fast<P>& push_force(const P& p);
/// Push a point \p p in the queue.
- queue_p_fast<P>& push(const P& p);
+ p_queue_fast<P>& push(const P& p);
/// Pop (remove) the front point \p p from the queue; \p p is the
/// least recently inserted point.
@@ -132,7 +132,7 @@
# ifndef MLN_INCLUDE_ONLY
template <typename P>
- queue_p_fast<P>::queue_p_fast()
+ p_queue_fast<P>::p_queue_fast()
{
// vect_needs_update_ = false;
bb_needs_update_ = false;
@@ -142,7 +142,7 @@
template <typename P>
void
- queue_p_fast<P>::vect_update_() const
+ p_queue_fast<P>::vect_update_() const
{
vect_.clear();
vect_.reserve(q_.size());
@@ -153,7 +153,7 @@
template <typename P>
void
- queue_p_fast<P>::bb_update_() const
+ p_queue_fast<P>::bb_update_() const
{
bb_.init();
for (std::size_t i = this->begin_; i < this->end_; ++i)
@@ -163,7 +163,7 @@
template <typename P>
bool
- queue_p_fast<P>::has(const P& p) const
+ p_queue_fast<P>::has(const P& p) const
{
for (unsigned i = this->begin_; i < this->end_; ++i)
if (q_[i] = p)
@@ -173,14 +173,14 @@
template <typename P>
bool
- queue_p_fast<P>::empty() const
+ p_queue_fast<P>::empty() const
{
return (this->begin_ = this->end_);
}
template <typename P>
std::size_t
- queue_p_fast<P>::npoints() const
+ p_queue_fast<P>::npoints() const
{
mln_precondition(this->end_ >= this->begin_);
return (this->end_ - this->begin_);
@@ -188,7 +188,7 @@
template <typename P>
const box_<P>&
- queue_p_fast<P>::bbox() const
+ p_queue_fast<P>::bbox() const
{
mln_precondition(npoints() != 0);
if (bb_needs_update_)
@@ -197,8 +197,8 @@
}
template <typename P>
- queue_p_fast<P>&
- queue_p_fast<P>::push_force(const P& p)
+ p_queue_fast<P>&
+ p_queue_fast<P>::push_force(const P& p)
{
q_.push_back(p);
++this->end_;
@@ -211,8 +211,8 @@
}
template <typename P>
- queue_p_fast<P>&
- queue_p_fast<P>::push(const P& p)
+ p_queue_fast<P>&
+ p_queue_fast<P>::push(const P& p)
{
mln_precondition(! this->has(p));
// FIXME: Our choice is "error if multiple insertions"
@@ -221,7 +221,7 @@
template <typename P>
void
- queue_p_fast<P>::pop()
+ p_queue_fast<P>::pop()
{
++this->begin_;
// q_.pop_front();
@@ -234,7 +234,7 @@
template <typename P>
const P&
- queue_p_fast<P>::front() const
+ p_queue_fast<P>::front() const
{
mln_precondition(! this->empty());
return q_[begin_];
@@ -242,7 +242,7 @@
template <typename P>
void
- queue_p_fast<P>::clear()
+ p_queue_fast<P>::clear()
{
this->end_ = begin_;
// q_.clear();
@@ -253,7 +253,7 @@
template <typename P>
const std::vector<P>&
- queue_p_fast<P>::vect() const
+ p_queue_fast<P>::vect() const
{
if (vect_needs_update_)
vect_update_();
@@ -262,7 +262,7 @@
template <typename P>
const P&
- queue_p_fast<P>::operator[](unsigned i) const
+ p_queue_fast<P>::operator[](unsigned i) const
{
mln_precondition(i < npoints());
return q_[begin_ + i];
Index: mln/core/p_array.hh
--- mln/core/p_array.hh (revision 1451)
+++ mln/core/p_array.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_VEC_P_HH
# define MLN_CORE_VEC_P_HH
-/*! \file mln/core/vec_p.hh
+/*! \file mln/core/p_array.hh
*
* \brief Definition of a point set class based on std::vector.
*/
@@ -43,8 +43,8 @@
{
// Fwd decls.
- template <typename P> struct vec_p_fwd_piter_;
- template <typename P> struct vec_p_bkd_piter_;
+ template <typename P> struct p_array_fwd_piter_;
+ template <typename P> struct p_array_bkd_piter_;
/*! \brief Point set class based on std::vector.
@@ -57,21 +57,21 @@
* \todo Make it work with P being a Point_Site.
*/
template <typename P>
- class vec_p : public internal::point_set_base_< P, vec_p<P> >
+ class p_array : public internal::point_set_base_< P, p_array<P> >
{
public:
/// Forward Point_Iterator associated type.
- typedef vec_p_fwd_piter_<P> fwd_piter;
+ typedef p_array_fwd_piter_<P> fwd_piter;
/// Backward Point_Iterator associated type.
- typedef vec_p_bkd_piter_<P> bkd_piter;
+ typedef p_array_bkd_piter_<P> bkd_piter;
/// Constructor.
- vec_p();
+ p_array();
/// Constructor from a vector \p vect.
- vec_p(const std::vector<P>& vect);
+ p_array(const std::vector<P>& vect);
/// Reserve \p n cells.
void reserve(std::size_t n);
@@ -86,7 +86,7 @@
const box_<P>& bbox() const;
/// Append a point \p p.
- vec_p<P>& append(const P& p);
+ p_array<P>& append(const P& p);
/// Clear this set.
void clear();
@@ -115,13 +115,13 @@
# ifndef MLN_INCLUDE_ONLY
template <typename P>
- vec_p<P>::vec_p()
+ p_array<P>::p_array()
{
bb_needs_update_ = false;
}
template <typename P>
- vec_p<P>::vec_p(const std::vector<P>& vect)
+ p_array<P>::p_array(const std::vector<P>& vect)
: vect_(vect)
{
bb_needs_update_ = true;
@@ -129,21 +129,21 @@
template <typename P>
void
- vec_p<P>::reserve(std::size_t n)
+ p_array<P>::reserve(std::size_t n)
{
vect_.reserve(n);
}
template <typename P>
std::vector<P>&
- vec_p<P>::hook_()
+ p_array<P>::hook_()
{
return vect_;
}
template <typename P>
void
- vec_p<P>::update_bb_() const
+ p_array<P>::update_bb_() const
{
bb_.init();
for (unsigned i = 0; i < vect_.size(); ++i)
@@ -153,7 +153,7 @@
template <typename P>
bool
- vec_p<P>::has(const P& p) const
+ p_array<P>::has(const P& p) const
{
for (unsigned i = 0; i < vect_.size(); ++i)
if (vect_[i] = p)
@@ -163,14 +163,14 @@
template <typename P>
std::size_t
- vec_p<P>::npoints() const
+ p_array<P>::npoints() const
{
return vect_.size();
}
template <typename P>
const box_<P>&
- vec_p<P>::bbox() const
+ p_array<P>::bbox() const
{
mln_precondition(npoints() != 0);
if (bb_needs_update_)
@@ -179,8 +179,8 @@
}
template <typename P>
- vec_p<P>&
- vec_p<P>::append(const P& p)
+ p_array<P>&
+ p_array<P>::append(const P& p)
{
vect_.push_back(p);
if (! bb_needs_update_)
@@ -190,7 +190,7 @@
template <typename P>
void
- vec_p<P>::clear()
+ p_array<P>::clear()
{
vect_.clear();
bb_needs_update_ = false;
@@ -198,14 +198,14 @@
template <typename P>
const std::vector<P>&
- vec_p<P>::vect() const
+ p_array<P>::vect() const
{
return vect_;
}
template <typename P>
const P&
- vec_p<P>::operator[](unsigned i) const
+ p_array<P>::operator[](unsigned i) const
{
mln_precondition(i < npoints());
return vect_[i];
@@ -216,7 +216,7 @@
} // end of namespace mln
-# include <mln/core/vec_p_piter.hh>
+# include <mln/core/p_array_piter.hh>
#endif // ! MLN_CORE_VEC_P_HH
Index: mln/core/p_array_piter.hh
--- mln/core/p_array_piter.hh (revision 1451)
+++ mln/core/p_array_piter.hh (working copy)
@@ -28,24 +28,24 @@
#ifndef MLN_CORE_VEC_P_PITER_HH
# define MLN_CORE_VEC_P_PITER_HH
-/*! \file mln/core/vec_p_piter.hh
+/*! \file mln/core/p_array_piter.hh
*
- * \brief Definition of point iterators on mln::vec_p.
+ * \brief Definition of point iterators on mln::p_array.
*/
-# include <mln/core/vec_p.hh>
+# include <mln/core/p_array.hh>
namespace mln
{
- /*! \brief Forward iterator on points of a vec_p<P>.
+ /*! \brief Forward iterator on points of a p_array<P>.
*
*/
template <typename P>
- struct vec_p_fwd_piter_ : public internal::point_iterator_base_< P, vec_p_fwd_piter_<P> >
+ struct p_array_fwd_piter_ : public internal::point_iterator_base_< P, p_array_fwd_piter_<P> >
{
- typedef vec_p_fwd_piter_<P> self_;
+ typedef p_array_fwd_piter_<P> self_;
typedef internal::point_iterator_base_< P, self_ > super_;
public:
@@ -54,7 +54,7 @@
/// Coordinate associated type.
template <typename S>
- vec_p_fwd_piter_(const Point_Set<S>& s);
+ p_array_fwd_piter_(const Point_Set<S>& s);
/// Reference of the corresponding point.
const P& to_point() const;
@@ -85,13 +85,13 @@
- /*! \brief Backward iterator on points of a vec_p<P>.
+ /*! \brief Backward iterator on points of a p_array<P>.
*
*/
template <typename P>
- struct vec_p_bkd_piter_ : public internal::point_iterator_base_< P, vec_p_bkd_piter_<P> >
+ struct p_array_bkd_piter_ : public internal::point_iterator_base_< P, p_array_bkd_piter_<P> >
{
- typedef vec_p_bkd_piter_<P> self_;
+ typedef p_array_bkd_piter_<P> self_;
typedef internal::point_iterator_base_< P, self_ > super_;
public:
@@ -100,7 +100,7 @@
/// Coordinate associated type.
template <typename S>
- vec_p_bkd_piter_(const Point_Set<S>& s);
+ p_array_bkd_piter_(const Point_Set<S>& s);
/// Reference of the corresponding point.
const P& to_point() const;
@@ -133,11 +133,11 @@
# ifndef MLN_INCLUDE_ONLY
- // vec_p_fwd_piter_<P>
+ // p_array_fwd_piter_<P>
template <typename P>
template <typename S>
- vec_p_fwd_piter_<P>::vec_p_fwd_piter_(const Point_Set<S>& s)
+ p_array_fwd_piter_<P>::p_array_fwd_piter_(const Point_Set<S>& s)
: vect_(exact(s).vect())
{
invalidate();
@@ -145,14 +145,14 @@
template <typename P>
const P&
- vec_p_fwd_piter_<P>::to_point() const
+ p_array_fwd_piter_<P>::to_point() const
{
return p_;
}
template <typename P>
mln_coord(P)
- vec_p_fwd_piter_<P>::operator[](unsigned i) const
+ p_array_fwd_piter_<P>::operator[](unsigned i) const
{
mln_precondition(i < dim);
mln_precondition(is_valid());
@@ -161,21 +161,21 @@
template <typename P>
bool
- vec_p_fwd_piter_<P>::is_valid() const
+ p_array_fwd_piter_<P>::is_valid() const
{
return i_ < vect_.size();
}
template <typename P>
void
- vec_p_fwd_piter_<P>::invalidate()
+ p_array_fwd_piter_<P>::invalidate()
{
i_ = vect_.size();
}
template <typename P>
void
- vec_p_fwd_piter_<P>::start()
+ p_array_fwd_piter_<P>::start()
{
i_ = 0;
if (is_valid())
@@ -184,7 +184,7 @@
template <typename P>
void
- vec_p_fwd_piter_<P>::next_()
+ p_array_fwd_piter_<P>::next_()
{
++i_;
if (is_valid())
@@ -192,18 +192,18 @@
}
template <typename P>
- vec_p_fwd_piter_<P>::operator P() const
+ p_array_fwd_piter_<P>::operator P() const
{
mln_precondition(is_valid());
return p_;
}
- // vec_p_bkd_piter_<P>
+ // p_array_bkd_piter_<P>
template <typename P>
template <typename S>
- vec_p_bkd_piter_<P>::vec_p_bkd_piter_(const Point_Set<S>& s)
+ p_array_bkd_piter_<P>::p_array_bkd_piter_(const Point_Set<S>& s)
: vect_(exact(s).vect())
{
invalidate();
@@ -211,14 +211,14 @@
template <typename P>
const P&
- vec_p_bkd_piter_<P>::to_point() const
+ p_array_bkd_piter_<P>::to_point() const
{
return p_;
}
template <typename P>
mln_coord(P)
- vec_p_bkd_piter_<P>::operator[](unsigned i) const
+ p_array_bkd_piter_<P>::operator[](unsigned i) const
{
mln_precondition(i < dim);
mln_precondition(is_valid());
@@ -227,21 +227,21 @@
template <typename P>
bool
- vec_p_bkd_piter_<P>::is_valid() const
+ p_array_bkd_piter_<P>::is_valid() const
{
return i_ >= 0;
}
template <typename P>
void
- vec_p_bkd_piter_<P>::invalidate()
+ p_array_bkd_piter_<P>::invalidate()
{
i_ = -1;
}
template <typename P>
void
- vec_p_bkd_piter_<P>::start()
+ p_array_bkd_piter_<P>::start()
{
i_ = vect_.size() - 1;
if (is_valid())
@@ -250,7 +250,7 @@
template <typename P>
void
- vec_p_bkd_piter_<P>::next_()
+ p_array_bkd_piter_<P>::next_()
{
--i_;
if (is_valid())
@@ -258,7 +258,7 @@
}
template <typename P>
- vec_p_bkd_piter_<P>::operator P() const
+ p_array_bkd_piter_<P>::operator P() const
{
mln_precondition(is_valid());
return p_;
Index: mln/level/sort_points.hh
--- mln/level/sort_points.hh (revision 1459)
+++ mln/level/sort_points.hh (working copy)
@@ -38,7 +38,7 @@
# include <algorithm>
# include <mln/core/concept/image.hh>
-# include <mln/convert/to_vec_p.hh>
+# include <mln/convert/to_p_array.hh>
# include <mln/histo/compute.hh>
@@ -56,7 +56,7 @@
* \pre \p input.has_data
*/
template <typename I>
- vec_p<mln_point(I)> sort_points_increasing(const Image<I>& input);
+ p_array<mln_point(I)> sort_points_increasing(const Image<I>& input);
# ifndef MLN_INCLUDE_ONLY
@@ -106,17 +106,17 @@
// increasing
template <typename I>
- vec_p<mln_point(I)>
+ p_array<mln_point(I)>
sort_points_increasing_(metal::false_, const I& input) // general case
{
- vec_p<mln_point(I)> v = convert::to_vec_p(input.domain());
+ p_array<mln_point(I)> v = convert::to_p_array(input.domain());
std::sort(v.hook_().begin(), v.hook_().end(),
value_point_less_<I>(input));
return v;
}
template <typename I>
- vec_p<mln_point(I)>
+ p_array<mln_point(I)>
sort_points_increasing_(metal::true_, const I& input) // low quantization
{
typedef mln_vset(I) S;
@@ -138,7 +138,7 @@
for_all(p)
vec[loc[vset.index_of(input(p))]++] = p;
- vec_p<mln_point(I)> v;
+ p_array<mln_point(I)> v;
v.hook_() = vec;
return v;
}
@@ -147,17 +147,17 @@
// decreasing
template <typename I>
- vec_p<mln_point(I)>
+ p_array<mln_point(I)>
sort_points_decreasing_(metal::false_, const I& input) // general case
{
- vec_p<mln_point(I)> v = convert::to_vec_p(input.domain());
+ p_array<mln_point(I)> v = convert::to_p_array(input.domain());
std::sort(v.hook_().begin(), v.hook_().end(),
value_point_greater_<I>(input));
return v;
}
template <typename I>
- vec_p<mln_point(I)>
+ p_array<mln_point(I)>
sort_points_decreasing_(metal::true_, const I& input) // low quantization
{
typedef mln_vset(I) S;
@@ -179,7 +179,7 @@
for_all(p)
vec[loc[vset.index_of(input(p))]++] = p;
- vec_p<mln_point(I)> v;
+ p_array<mln_point(I)> v;
v.hook_() = vec;
return v;
}
@@ -191,7 +191,7 @@
// Facades.
template <typename I>
- vec_p<mln_point(I)>
+ p_array<mln_point(I)>
sort_points_increasing(const Image<I>& input)
{
mln_precondition(exact(input).has_data());
@@ -199,7 +199,7 @@
}
template <typename I>
- vec_p<mln_point(I)>
+ p_array<mln_point(I)>
sort_points_decreasing(const Image<I>& input)
{
mln_precondition(exact(input).has_data());
Index: mln/level/fill.hh
--- mln/level/fill.hh (revision 1459)
+++ mln/level/fill.hh (working copy)
@@ -39,6 +39,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/function.hh>
+# include <mln/core/inplace.hh>
# include <mln/level/memset_.hh>
@@ -89,6 +90,9 @@
template <typename I>
void fill(Image<I>& ima, mln_value(I) (*(&f))(const mln_point(I)& p));
+ template <typename I>
+ void fill_f(Image<I>& ima, mln_value(I) (*f)(const mln_point(I)& p));
+
/*! Fill the image \p ima with the values given by the array \p arr.
*
@@ -181,8 +185,8 @@
// with: value f(const point&)
template <typename I>
- void fill(Image<I>& ima_,
- mln_value(I) (*(&f))(const mln_point(I)& p))
+ void fill_f(Image<I>& ima_,
+ mln_value(I) (*f)(const mln_point(I)& p))
{
mln_precondition(f != 0);
I& ima = exact(ima_);
Index: mln/value/rgb.hh
--- mln/value/rgb.hh (revision 1459)
+++ mln/value/rgb.hh (working copy)
@@ -275,9 +275,9 @@
template <unsigned n>
std::ostream& operator<<(std::ostream& ostr, const rgb<n>& v)
{
- return ostr << "(r" << debug::format(v.red())
- << ", g" << debug::format(v.green())
- << ", b" << debug::format(v.blue())
+ return ostr << "(" << debug::format(v.red())
+ << ", " << debug::format(v.green())
+ << ", " << debug::format(v.blue())
<< ")";
}
Index: mln/convert/all.hh
--- mln/convert/all.hh (revision 1459)
+++ mln/convert/all.hh (working copy)
@@ -46,7 +46,7 @@
# include <mln/convert/to_rgb.hh>
# include <mln/convert/to_std_set.hh>
# include <mln/convert/to_tiles.hh>
-# include <mln/convert/to_vec_p.hh>
+# include <mln/convert/to_p_array.hh>
# include <mln/convert/to_window.hh>
# include <mln/convert/to_w_window.hh>
Index: mln/convert/to_p_set.hh
--- mln/convert/to_p_set.hh (revision 1451)
+++ mln/convert/to_p_set.hh (working copy)
@@ -28,16 +28,16 @@
#ifndef MLN_CONVERT_TO_SET_P_HH
# define MLN_CONVERT_TO_SET_P_HH
-/*! \file mln/convert/to_set_p.hh
+/*! \file mln/convert/to_p_set.hh
*
- * \brief Conversions to mln::set_p.
+ * \brief Conversions to mln::p_set.
*/
# include <set>
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/concept/point_site.hh>
-# include <mln/core/set_p.hh>
+# include <mln/core/p_set.hh>
# include <mln/pw/image.hh>
# include <mln/pw/cst.hh>
# include <mln/metal/is_a.hh>
@@ -51,30 +51,30 @@
/// Convert a neighborhood \p nbh into a point set.
template <typename N>
- set_p<mln_point(N)> to_set_p(const Neighborhood<N>& nbh);
+ p_set<mln_point(N)> to_p_set(const Neighborhood<N>& nbh);
/// Convert a binary image \p ima into a point set.
template <typename I>
- set_p<mln_point(I)> to_set_p(const Image<I>& ima);
+ p_set<mln_point(I)> to_p_set(const Image<I>& ima);
/// Convert a Window \p win into a point set.
template <typename W>
- set_p<mln_point(W)> to_set_p(const Window<W>& win);
+ p_set<mln_point(W)> to_p_set(const Window<W>& win);
/// Convert an std::set \p s of points into a point set.
template <typename D>
- set_p<D> to_set_p(const std::set<D>& s);
+ p_set<D> to_p_set(const std::set<D>& s);
# ifndef MLN_INCLUDE_ONLY
template <typename N>
- set_p<mln_point(N)> to_set_p(const Neighborhood<N>& nbh_)
+ p_set<mln_point(N)> to_p_set(const Neighborhood<N>& nbh_)
{
const N& nbh = exact(nbh_);
typedef mln_dpoint(N) D;
typedef mln_point(N) P;
- set_p<P> pset;
+ p_set<P> pset;
mln_niter(N) n(nbh, P::origin);
for_all(n)
pset.insert(n);
@@ -82,14 +82,14 @@
}
template <typename I>
- set_p<mln_point(I)> to_set_p(const Image<I>& ima_)
+ p_set<mln_point(I)> to_p_set(const Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
// FIXME: Check that ima is binary!
typedef mln_dpoint(I) D;
typedef mln_point(I) P;
- set_p<P> pset;
+ p_set<P> pset;
mln_piter(I) p(ima.domain());
for_all(p)
if (ima(p))
@@ -98,11 +98,11 @@
}
template <typename W>
- set_p<mln_point(W)> to_set_p(const Window<W>& win)
+ p_set<mln_point(W)> to_p_set(const Window<W>& win)
{
typedef mln_dpoint(W) D;
typedef mln_point(W) P;
- set_p<P> pset;
+ p_set<P> pset;
mln_qiter(W) q(exact(win), P::origin);
for_all(q)
pset.insert(q);
@@ -110,10 +110,10 @@
}
template <typename P>
- set_p<P> to_set_p(const std::set<P>& s)
+ p_set<P> to_p_set(const std::set<P>& s)
{
mln::metal::is_a<P, Point_Site>::check();
- set_p<P> pset;
+ p_set<P> pset;
for (typename std::set<P>::const_iterator i = s.begin();
i != s.end(); ++i)
pset.insert(*i);
Index: mln/convert/to_p_array.hh
--- mln/convert/to_p_array.hh (revision 1451)
+++ mln/convert/to_p_array.hh (working copy)
@@ -28,12 +28,12 @@
#ifndef MLN_CONVERT_TO_VEC_P_HH
# define MLN_CONVERT_TO_VEC_P_HH
-/*! \file mln/convert/to_vec_p.hh
+/*! \file mln/convert/to_p_array.hh
*
- * \brief Conversions to mln::vec_p.
+ * \brief Conversions to mln::p_array.
*/
-# include <mln/core/vec_p.hh>
+# include <mln/core/p_array.hh>
# include <mln/core/concept/window.hh>
@@ -43,23 +43,23 @@
namespace convert
{
- /// Convert a point set \p pset into a vec_p (point set vector).
+ /// Convert a point set \p pset into a p_array (point set vector).
template <typename S>
- vec_p<mln_point(S)> to_vec_p(const Point_Set<S>& pset);
+ p_array<mln_point(S)> to_p_array(const Point_Set<S>& pset);
- /// Convert a window \p win centered at point \p p into a vec_p (point set vector).
+ /// Convert a window \p win centered at point \p p into a p_array (point set vector).
template <typename W>
- vec_p<mln_point(W)> to_vec_p(const Window<W>& win, const mln_point(W)& p);
+ p_array<mln_point(W)> to_p_array(const Window<W>& win, const mln_point(W)& p);
# ifndef MLN_INCLUDE_ONLY
template <typename S>
- vec_p<mln_point(S)> to_vec_p(const Point_Set<S>& pset_)
+ p_array<mln_point(S)> to_p_array(const Point_Set<S>& pset_)
{
const S& pset = exact(pset_);
- vec_p<mln_point(S)> v;
+ p_array<mln_point(S)> v;
v.reserve(pset.npoints());
mln_fwd_piter(S) p(pset);
for_all(p)
@@ -68,9 +68,9 @@
}
template <typename W>
- vec_p<mln_point(W)> to_vec_p(const Window<W>& win, const mln_point(W)& p)
+ p_array<mln_point(W)> to_p_array(const Window<W>& win, const mln_point(W)& p)
{
- vec_p<mln_point(W)> v;
+ p_array<mln_point(W)> v;
v.reserve(exact(win).ndpoints());
mln_qiter(W) q(win, p);
for_all(q)
Index: mln/geom/seeds2tiling.hh
--- mln/geom/seeds2tiling.hh (revision 1459)
+++ mln/geom/seeds2tiling.hh (working copy)
@@ -36,7 +36,7 @@
# include <map>
-# include <mln/core/queue_p.hh>
+# include <mln/core/p_queue.hh>
# include <mln/core/clone.hh>
# include <mln/accu/mean.hh>
# include <mln/estim/min_max.hh>
@@ -61,7 +61,7 @@
{
I& ima = exact(ima_);
I out = clone(ima_);
- queue_p<mln_psite(I)> q;
+ p_queue<mln_psite(I)> q;
// Init.
{
Index: mln/geom/seeds2tiling_with_chamfer.hh
--- mln/geom/seeds2tiling_with_chamfer.hh (revision 1459)
+++ mln/geom/seeds2tiling_with_chamfer.hh (working copy)
@@ -36,7 +36,7 @@
# include <map>
-# include <mln/core/queue_p_fast_priority.hh>
+# include <mln/core/p_priority_queue_fast.hh>
# include <mln/core/clone.hh>
# include <mln/accu/mean.hh>
# include <mln/estim/min_max.hh>
@@ -67,7 +67,7 @@
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;
+ p_priority_queue_fast<mln_psite(I), unsigned> q;
// Init.
{
Index: mln/set/inter.hh
--- mln/set/inter.hh (revision 1459)
+++ mln/set/inter.hh (working copy)
@@ -36,7 +36,7 @@
# include <mln/convert/to_std_set.hh>
# include <mln/convert/to_window.hh>
-# include <mln/convert/to_set_p.hh>
+# include <mln/convert/to_p_set.hh>
# include <mln/metal/equal.hh>
@@ -60,7 +60,7 @@
* \relates mln::Point_Set
*/
template <typename Wl, typename Wr>
- set_p<mln_point(Wl)>
+ p_set<mln_point(Wl)>
inter(const Point_Set<Wl>& lhs, const Point_Set<Wr>& rhs);
# ifndef MLN_INCLUDE_ONLY
@@ -82,7 +82,7 @@
}
template <typename Wl, typename Wr>
- set_p<mln_point(Wl)>
+ p_set<mln_point(Wl)>
inter(const Point_Set<Wl>& lhs, const Point_Set<Wr>& rhs)
{
mln::metal::equal<mln_point(Wl), mln_point(Wr)>::check();
@@ -94,7 +94,7 @@
std::set_intersection(sl.begin(), sl.end(),
sr.begin(), sr.end(),
std::inserter(s, s.begin()));
- return convert::to_set_p(s);
+ return convert::to_p_set(s);
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/set/diff.hh
--- mln/set/diff.hh (revision 1459)
+++ mln/set/diff.hh (working copy)
@@ -38,7 +38,7 @@
# include <mln/convert/to_std_set.hh>
# include <mln/convert/to_window.hh>
-# include <mln/convert/to_set_p.hh>
+# include <mln/convert/to_p_set.hh>
# include <mln/metal/equal.hh>
@@ -56,7 +56,7 @@
/// Set theoretic difference of \p lhs and \p rhs.
template <typename Wl, typename Wr>
- set_p<mln_point(Wl)>
+ p_set<mln_point(Wl)>
diff(const Point_Set<Wl>& lhs, const Point_Set<Wr>& rhs);
@@ -80,7 +80,7 @@
/// Set theoretic difference of \p lhs and \p rhs.
template <typename Wl, typename Wr>
- set_p<mln_point(Wl)>
+ p_set<mln_point(Wl)>
diff(const Point_Set<Wl>& lhs, const Point_Set<Wr>& rhs)
{
mln::metal::equal<mln_point(Wl), mln_point(Wr)>::check();
@@ -92,7 +92,7 @@
std::set_difference(sl.begin(), sl.end(),
sr.begin(), sr.end(),
std::inserter(s, s.begin()));
- return convert::to_set_p(s);
+ return convert::to_p_set(s);
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/set/uni.hh
--- mln/set/uni.hh (revision 1459)
+++ mln/set/uni.hh (working copy)
@@ -35,7 +35,7 @@
# include <mln/convert/to_std_set.hh>
# include <mln/convert/to_window.hh>
-# include <mln/convert/to_set_p.hh>
+# include <mln/convert/to_p_set.hh>
# include <mln/metal/equal.hh>
@@ -59,7 +59,7 @@
* \relates mln::Point_Set
*/
template <typename Wl, typename Wr>
- set_p<mln_point(Wl)>
+ p_set<mln_point(Wl)>
uni(const Point_Set<Wl>& lhs, const Point_Set<Wr>& rhs);
@@ -82,7 +82,7 @@
}
template <typename Wl, typename Wr>
- set_p<mln_point(Wl)>
+ p_set<mln_point(Wl)>
uni(const Point_Set<Wl>& lhs, const Point_Set<Wr>& rhs)
{
mln::metal::equal<mln_point(Wl), mln_point(Wr)>::check();
@@ -94,7 +94,7 @@
std::set_union(sl.begin(), sl.end(),
sr.begin(), sr.end(),
std::inserter(s, s.begin()));
- return convert::to_set_p(s);
+ return convert::to_p_set(s);
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/set/sym_diff.hh
--- mln/set/sym_diff.hh (revision 1459)
+++ mln/set/sym_diff.hh (working copy)
@@ -35,7 +35,7 @@
# include <mln/convert/to_std_set.hh>
# include <mln/convert/to_window.hh>
-# include <mln/convert/to_set_p.hh>
+# include <mln/convert/to_p_set.hh>
# include <mln/metal/equal.hh>
@@ -53,7 +53,7 @@
/// Set theoretic symmetrical difference of \p lhs and \p rhs.
template <typename Wl, typename Wr>
- set_p<mln_point(Wl)>
+ p_set<mln_point(Wl)>
sym_diff(const Point_Set<Wl>& lhs, const Point_Set<Wr>& rhs);
# ifndef MLN_INCLUDE_ONLY
@@ -75,7 +75,7 @@
}
template <typename Wl, typename Wr>
- set_p<mln_point(Wl)>
+ p_set<mln_point(Wl)>
sym_diff(const Point_Set<Wl>& lhs, const Point_Set<Wr>& rhs)
{
mln::metal::equal<mln_point(Wl), mln_point(Wr)>::check();
@@ -87,7 +87,7 @@
std::set_symmetric_difference(sl.begin(), sl.end(),
sr.begin(), sr.end(),
std::inserter(s, s.begin()));
- return convert::to_set_p(s);
+ return convert::to_p_set(s);
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/morpho/opening_attribute.hh
--- mln/morpho/opening_attribute.hh (revision 1459)
+++ mln/morpho/opening_attribute.hh (working copy)
@@ -70,7 +70,7 @@
typedef I_ I;
typedef N_ N;
typedef O_ O;
- typedef vec_p<P> S;
+ typedef p_array<P> S;
typedef util::pix<I> pix_t;
const I& input;
Index: mln/morpho/erosion.spe.hh
--- mln/morpho/erosion.spe.hh (revision 1459)
+++ mln/morpho/erosion.spe.hh (working copy)
@@ -162,12 +162,13 @@
O output;
mln_pixter(const I) p(input);
- mln_pixter(O) p_out(output);
mln_qixter(const I, W) q(p, win);
if (win.is_centered())
{
output = clone(input);
+
+ mln_pixter(O) p_out(output);
for_all_2(p, p_out)
if (p.val())
for_all(q)
@@ -182,6 +183,7 @@
initialize(output, input);
level::fill(output, input);
+ mln_pixter(O) p_out(output);
for_all_2(p, p_out)
for_all(q)
if (! q.val())
Index: mln/display/color_pretty.hh
--- mln/display/color_pretty.hh (revision 1459)
+++ mln/display/color_pretty.hh (working copy)
@@ -40,7 +40,7 @@
# include <mln/value/rgb8.hh>
# include <mln/level/fill.hh>
# include <mln/level/paste.hh>
-# include <mln/core/set_p.hh>
+# include <mln/core/p_set.hh>
namespace mln
{
@@ -55,9 +55,9 @@
template <typename I>
typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret
color_pretty_rgb(const Image<I>& input_,
- const set_p<mln_point(I) >& s1_,
- const set_p<mln_point(I) >& s2_,
- const set_p<mln_point(I) >& s3_);
+ const p_set<mln_point(I) >& s1_,
+ const p_set<mln_point(I) >& s2_,
+ const p_set<mln_point(I) >& s3_);
# ifndef MLN_INCLUDE_ONLY
@@ -107,9 +107,9 @@
template <typename I>
typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret
color_pretty_rgb(const Image<I>& input_,
- const set_p<mln_point(I) >& s1_,
- const set_p<mln_point(I) >& s2_,
- const set_p<mln_point(I) >& s3_)
+ const p_set<mln_point(I) >& s1_,
+ const p_set<mln_point(I) >& s2_,
+ const p_set<mln_point(I) >& s3_)
{
const I& input = exact (input_);
@@ -117,21 +117,21 @@
level::fill(output, value::rgb8(0, 0, 0));
{
- mln_piter(set_p<mln_point(I) >) p(s1_);
+ mln_piter(p_set<mln_point(I) >) p(s1_);
for_all(p)
output(p).red() = 255;
}
{
- mln_piter(set_p<mln_point(I) >) p(s2_);
+ mln_piter(p_set<mln_point(I) >) p(s2_);
for_all(p)
output(p).green() = 255;
}
{
- mln_piter(set_p<mln_point(I) >) p(s3_);
+ mln_piter(p_set<mln_point(I) >) p(s3_);
for_all(p)
output(p).blue() = 255;
@@ -153,9 +153,9 @@
template <typename I>
typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret
color_pretty_rgb(const Image<I>& input_,
- const set_p<mln_point(I) >& s1_,
- const set_p<mln_point(I) >& s2_,
- const set_p<mln_point(I) >& s3_)
+ const p_set<mln_point(I) >& s1_,
+ const p_set<mln_point(I) >& s2_,
+ const p_set<mln_point(I) >& s3_)
{
return impl::color_pretty_rgb(input_, s1_, s2_, s3_);
}
Index: mln/display/all.hh
--- mln/display/all.hh (revision 1459)
+++ mln/display/all.hh (working copy)
@@ -47,6 +47,7 @@
}
# include <mln/display/color_pretty.hh>
+# include <mln/display/remove.hh>
# include <mln/display/save.hh>
# include <mln/display/show.hh>
Index: mln/util/tree_to_image.hh
--- mln/util/tree_to_image.hh (revision 1459)
+++ mln/util/tree_to_image.hh (working copy)
@@ -37,7 +37,7 @@
*/
# include <mln/util/tree.hh>
-# include <mln/core/set_p.hh>
+# include <mln/core/p_set.hh>
namespace mln
{
@@ -51,7 +51,7 @@
template <typename P, typename J>
void
- display_set(const Image<J>& ima_, set_p<P>& s);
+ display_set(const Image<J>& ima_, p_set<P>& s);
template <typename I, typename J>
void
@@ -69,7 +69,7 @@
{
I& output = exact(output_);
- mln_piter(set_p<point2d>) p(node->elt().points);
+ mln_piter(p_set<point2d>) p(node->elt().points);
for_all(p)
output(p) = node->elt().value;
@@ -96,13 +96,13 @@
template <typename P, typename J>
void
- display_set(const Image<J>& ima_, set_p<P>& s)
+ display_set(const Image<J>& ima_, p_set<P>& s)
{
const J& ima = exact(ima_);
image2d<bool> out (ima.bbox ());
level::fill(out, false);
- mln_piter(set_p<P>) p (s);
+ mln_piter(p_set<P>) p (s);
for_all (p)
out(p) = true;
}
@@ -144,7 +144,7 @@
K& output = exact(output_);
const J& ima = exact(ima_);
- mln_piter(set_p<point2d>) p(node->elt().points);
+ mln_piter(p_set<point2d>) p(node->elt().points);
for_all (p)
output(p) = true;
typename mln::util::node<T>::children_t::iterator it = node->children().begin();
Index: mln/labeling/regional_minima.hh
--- mln/labeling/regional_minima.hh (revision 1459)
+++ mln/labeling/regional_minima.hh (working copy)
@@ -71,7 +71,7 @@
// requirements from mln::canvas::labeling:
- typedef vec_p<P> S;
+ typedef p_array<P> S;
S s;
void init() { mln::level::fill(this->output, 0);
Index: mln/labeling/regional_maxima.hh
--- mln/labeling/regional_maxima.hh (revision 1459)
+++ mln/labeling/regional_maxima.hh (working copy)
@@ -71,7 +71,7 @@
// requirements from mln::canvas::labeling:
- typedef vec_p<P> S;
+ typedef p_array<P> S;
S s;
void init() { mln::level::fill(this->output, 0);
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-09 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Fix bug for tree_to_image.
* mln/util/tree_to_image.hh: Remove println for debug.
* tests/tree_to_image.cc: Add includes.
---
mln/util/tree_to_image.hh | 2 --
tests/tree_to_image.cc | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
Index: trunk/milena/tests/tree_to_image.cc
===================================================================
--- trunk/milena/tests/tree_to_image.cc (revision 1458)
+++ trunk/milena/tests/tree_to_image.cc (revision 1459)
@@ -38,9 +38,11 @@
#include <mln/core/set_p.hh>
#include <mln/value/int_u8.hh>
#include <mln/level/stretch.hh>
+#include <mln/level/fill.hh>
#include <mln/io/pgm/save.hh>
#include <vector>
#include <mln/util/tree_to_image.hh>
+#include <mln/debug/println.hh>
template <typename P, typename V>
struct fllt_node
Index: trunk/milena/mln/util/tree_to_image.hh
===================================================================
--- trunk/milena/mln/util/tree_to_image.hh (revision 1458)
+++ trunk/milena/mln/util/tree_to_image.hh (revision 1459)
@@ -105,7 +105,6 @@
mln_piter(set_p<P>) p (s);
for_all (p)
out(p) = true;
- debug::println(out);
}
@@ -164,7 +163,6 @@
level::fill(output, false);
mln_assertion(node);
display_branch_rec(ima, node, output);
- debug::println(output);
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-09 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Fix bug.
* mln/core/clock_neighb2d.hh: Fix assertion bug.
---
clock_neighb2d.hh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: trunk/milena/mln/core/clock_neighb2d.hh
===================================================================
--- trunk/milena/mln/core/clock_neighb2d.hh (revision 1457)
+++ trunk/milena/mln/core/clock_neighb2d.hh (revision 1458)
@@ -111,7 +111,7 @@
std::vector<dpoint2d>::const_iterator ite = v.begin ();
for (; (ite != v.end ()) && (dp != *ite); ++ite, ++begin)
;
- mln_assertion (*ite != v.end ());
+ mln_assertion (ite != v.end ());
for (int i = begin; i < v.size(); ++i)
it.append(v[i]);
for (int i = 0; i < begin; ++i)
1
0