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
November 2007
- 9 participants
- 147 discussions
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-13 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Remove debug in display/save.
* mln/display/save.hh: Remove debug.
---
save.hh | 2 --
1 file changed, 2 deletions(-)
Index: trunk/milena/mln/display/save.hh
===================================================================
--- trunk/milena/mln/display/save.hh (revision 1474)
+++ trunk/milena/mln/display/save.hh (revision 1475)
@@ -79,7 +79,6 @@
io::ppm::save(out, path_tmp);
- std::cout << input.id_ () << " = " << path_tmp << std::endl;
map_saved_image_tmp_[(void*)input.id_ ()] = path_tmp;
}
@@ -98,7 +97,6 @@
io::ppm::save(input, path_tmp);
- std::cout << input.id_ () << " = " << path_tmp << std::endl;
map_saved_image_tmp_[(void*)input.id_ ()] = path_tmp;
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-13 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add fast priority queue with array.
* mln/core/p_priority_queue_fast_with_array.hh:
New kind of fast priority queue based on std::vector.
* tests/core_p_priority_queue_fast_with_array.cc:
New test for that.
---
mln/core/p_priority_queue_fast_with_array.hh | 323 +++++++++++++++++++++++++
tests/core_p_priority_queue_fast_with_array.cc | 105 ++++++++
2 files changed, 428 insertions(+)
Index: trunk/milena/tests/core_p_priority_queue_fast_with_array.cc
===================================================================
--- trunk/milena/tests/core_p_priority_queue_fast_with_array.cc (revision 0)
+++ trunk/milena/tests/core_p_priority_queue_fast_with_array.cc (revision 1473)
@@ -0,0 +1,105 @@
+// 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/p_priority_queue_fast_with_array.cc
+ *
+ * \brief Tests on mln::p_priority_queue_fast_with_array.
+ */
+
+#include <mln/core/point2d.hh>
+#include <mln/core/p_priority_queue_fast_with_array.hh>
+
+int main ()
+{
+ using namespace mln;
+
+ p_priority_queue_fast_with_array<point2d, unsigned, 20> q;
+ point2d p1 (6, 9);
+ point2d p2 (5, 1);
+ point2d p3 (4, 2);
+
+ mln_assertion (q.is_empty ());
+ mln_assertion (q.npoints () == 0);
+
+ q.push_force (p3);
+ mln_assertion (!q.is_empty ());
+ mln_assertion (q.npoints () == 1);
+
+ q.push_force (p1, 3);
+ mln_assertion (!q.is_empty ());
+ mln_assertion (q.npoints () == 2);
+
+ q.push_force (p2, 5);
+ mln_assertion (!q.is_empty ());
+ mln_assertion (q.npoints () == 3);
+
+ std::cout << q.bbox () << std::endl;
+ std::cout << q << std::endl;
+
+ mln_assertion (!q.is_empty ());
+
+ mln_assertion (q.has (p1));
+ mln_assertion (q.has (p2));
+ mln_assertion (q.has (p3));
+
+ mln_assertion (q.npoints () == 3);
+ mln_assertion (q.front () == p2);
+ q.pop ();
+
+ mln_assertion (q.has (p1));
+ mln_assertion (!q.has (p2));
+ mln_assertion (q.has (p3));
+
+ mln_assertion (q.npoints () == 2);
+ mln_assertion (q.front () == p1);
+ q.pop ();
+
+ mln_assertion (!q.has (p1));
+ mln_assertion (!q.has (p2));
+ mln_assertion (q.has (p3));
+
+ mln_assertion (q.npoints () == 1);
+ mln_assertion (q.front () == p3);
+ q.pop ();
+
+ mln_assertion (!q.has (p1));
+ mln_assertion (!q.has (p2));
+ mln_assertion (!q.has (p3));
+ mln_assertion (q.npoints () == 0);
+
+ mln_assertion (q.is_empty ());
+
+ q.push_force (p3);
+ q.push_force (p2, 5);
+ q.push_force (p1, 3);
+
+ mln_assertion (q[2] == p3);
+ mln_assertion (q[1] == p1);
+ mln_assertion (q[0] == p2);
+ q.clear ();
+ mln_assertion (q.is_empty ());
+}
Index: trunk/milena/mln/core/p_priority_queue_fast_with_array.hh
===================================================================
--- trunk/milena/mln/core/p_priority_queue_fast_with_array.hh (revision 0)
+++ trunk/milena/mln/core/p_priority_queue_fast_with_array.hh (revision 1473)
@@ -0,0 +1,323 @@
+// 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_CORE_P_PRIORITY_QUEUE_FAST_WITH_ARRAY_HH
+# define MLN_CORE_P_PRIORITY_QUEUE_FAST_WITH_ARRAY_HH
+
+/*! \file mln/core/p_priority_queue_fast_with_array.hh
+ *
+ * \brief Definition of a point set class based on p_queue with
+ * priority features.
+ */
+
+# include <vector>
+# include <deque>
+# include <map>
+# include <algorithm>
+# include <iterator>
+
+# include <mln/core/internal/point_set_base.hh>
+# include <mln/core/p_array_piter.hh>
+# include <mln/accu/bbox.hh>
+# include <mln/core/p_queue_fast.hh>
+
+namespace mln
+{
+
+ // Fwd decls.
+ template <typename P> struct p_array_fwd_piter_;
+ template <typename P> struct p_array_bkd_piter_;
+
+
+ /*! \brief Point queue class (based on std::deque).
+ *
+ * This is a mathematical set of points (unique insertion).
+ *
+ * \todo Make it work with P being a Point_Site.
+ * \todo Add a parameter flag to choose another policy for "push"
+ * (i.e., no-op if multiple or allow multiple insertions).
+ *
+ * \warning We have some troubles with point set comparison based on
+ * a call to npoints() when this container is multiple.
+ */
+ template <typename P, typename T, unsigned S>
+ class p_priority_queue_fast_with_array : public internal::point_set_base_< P, p_priority_queue_fast_with_array<P, T, S> >
+ {
+ public:
+
+ /// Forward Point_Iterator associated type.
+ typedef p_array_fwd_piter_<P> fwd_piter;
+
+ /// Backward Point_Iterator associated type.
+ typedef p_array_bkd_piter_<P> bkd_piter;
+
+ /// Constructor.
+ p_priority_queue_fast_with_array();
+
+ /// Test is \p p belongs to this point set.
+ bool has(const P& p) const;
+
+ /// Test if queue is empty or not.
+ bool is_empty() const;
+
+ /// Give the number of points.
+ unsigned npoints() const;
+
+ /// Give the exact bounding box.
+ const box_<P>& bbox() const;
+
+ /// Push force a point \p p in the queue.
+ p_priority_queue_fast_with_array<P, T, S>& push_force(const P& p, T prio = 0);
+
+ /// Push a point \p p in the queue.
+ p_priority_queue_fast_with_array<P, T, S>& 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.
+ void pop();
+
+ /// Give the front point \p p of the queue; \p p is the least
+ /// recently inserted point.
+ const P& front() const;
+
+ /// Pop (remove) the front point \p p from the queue; \p p is the
+ /// least recently inserted point and give the front point \p p of
+ /// the queue; \p p is the least recently inserted point.
+ const P& pop_front();
+
+ /// Clear the queue.
+ void clear();
+
+ /// Return the corresponding std::vector of points.
+ const std::vector<P>& vect() const;
+
+ /// Return the \p i-th point.
+ const P& operator[](unsigned i) const;
+
+ protected:
+
+ std::vector<p_queue_fast<P> > q_;
+
+ mutable std::vector<P> vect_;
+ mutable bool vect_needs_update_;
+ void vect_update_() const;
+
+ mutable accu::bbox<P> bb_;
+ mutable bool bb_needs_update_;
+ void bb_update_() const;
+
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P, typename T, unsigned S>
+ p_priority_queue_fast_with_array<P, T, S>::p_priority_queue_fast_with_array()
+ {
+ vect_needs_update_ = false;
+ bb_needs_update_ = false;
+ q_.reserve(S);
+ std::copy(q_.begin(), q_.end(),
+ std::back_inserter(q_));
+ for (unsigned i = 0; i < S; ++i)
+ q_[i].clear ();
+ }
+
+ template <typename P, typename T, unsigned S>
+ void
+ p_priority_queue_fast_with_array<P, T, S>::vect_update_() const
+ {
+ vect_.clear();
+ vect_.reserve(npoints());
+
+ for (unsigned i = 0; i < S; ++i)
+ std::copy(q_[i].vect().begin(), q_[i].vect().end(),
+ std::back_inserter(vect_));
+ vect_needs_update_ = false;
+ }
+
+ template <typename P, typename T, unsigned S>
+ void
+ p_priority_queue_fast_with_array<P, T, S>::bb_update_() const
+ {
+ bb_.init();
+
+ for (unsigned i = 0; i < S; ++i)
+ for (unsigned j = 0; j < q_[i].npoints (); ++j)
+ bb_.take(q_[i][j]);
+ bb_needs_update_ = false;
+ }
+
+
+ template <typename P, typename T, unsigned S>
+ bool
+ p_priority_queue_fast_with_array<P, T, S>::has(const P& p) const
+ {
+ for (unsigned i = 0; i < S; ++i)
+ if (q_[i].has (p))
+ return true;
+ return false;
+ }
+
+ template <typename P, typename T, unsigned S>
+ bool
+ p_priority_queue_fast_with_array<P, T, S>::is_empty() const
+ {
+ for (unsigned i = 0; i < S; ++i)
+ if (!q_[i].is_empty ())
+ return false;
+ return true;
+ }
+
+ template <typename P, typename T, unsigned S>
+ unsigned
+ p_priority_queue_fast_with_array<P, T, S>::npoints() const
+ {
+ unsigned res = 0;
+
+ for (unsigned i = 0; i < S; ++i)
+ if (!q_[i].is_empty ())
+ res += q_[i].npoints();
+
+ return res;
+ }
+
+ template <typename P, typename T, unsigned S>
+ const box_<P>&
+ p_priority_queue_fast_with_array<P, T, S>::bbox() const
+ {
+ mln_precondition(npoints() != 0);
+ if (bb_needs_update_)
+ bb_update_();
+ return bb_.to_result();
+ }
+
+ template <typename P, typename T, unsigned S>
+ p_priority_queue_fast_with_array<P, T, S>&
+ p_priority_queue_fast_with_array<P, T, S>::push_force(const P& p, T prio)
+ {
+ q_[prio].push_force (p);
+ if (! vect_needs_update_)
+ {
+ vect_needs_update_ = true;
+ bb_needs_update_ = true;
+ }
+ mln_assertion(!q_[prio].is_empty ());
+ return *this;
+ }
+
+ template <typename P, typename T, unsigned S>
+ p_priority_queue_fast_with_array<P, T, S>&
+ p_priority_queue_fast_with_array<P, T, S>::push(const P& p, T prio)
+ {
+ if (! has(p))
+ return this->push_force(p, prio);
+ else
+ return *this;
+ }
+
+ template <typename P, typename T, unsigned S>
+ void
+ p_priority_queue_fast_with_array<P, T, S>::pop()
+ {
+ for (unsigned i = S - 1; i != UINT_MAX; --i)
+ if (!q_[i].is_empty ())
+ return q_[i].pop ();
+
+ if (! vect_needs_update_)
+ {
+ vect_needs_update_ = true;
+ bb_needs_update_ = true;
+ }
+ }
+
+ template <typename P, typename T, unsigned S>
+ const P&
+ p_priority_queue_fast_with_array<P, T, S>::front() const
+ {
+ mln_precondition(! is_empty());
+
+ for (unsigned i = S - 1; i != UINT_MAX; --i)
+ if (!q_[i].is_empty ())
+ return q_[i].front ();
+ return q_[0].front ();
+ }
+
+ template <typename P, typename T, unsigned S>
+ const P&
+ p_priority_queue_fast_with_array<P, T, S>::pop_front()
+ {
+ const P& res = this->front();
+
+ this->pop();
+ return res;
+ }
+
+ template <typename P, typename T, unsigned S>
+ void
+ p_priority_queue_fast_with_array<P, T, S>::clear()
+ {
+ for (unsigned i = 0; i < S; ++i)
+ q_[i].clear ();
+ q_.clear();
+ vect_needs_update_ = false;
+ bb_needs_update_ = false;
+ }
+
+ template <typename P, typename T, unsigned S>
+ const std::vector<P>&
+ p_priority_queue_fast_with_array<P, T, S>::vect() const
+ {
+ if (vect_needs_update_)
+ vect_update_();
+ return vect_;
+ }
+
+ template <typename P, typename T, unsigned S>
+ const P&
+ p_priority_queue_fast_with_array<P, T, S>::operator[](unsigned n) const
+ {
+ mln_precondition(n < npoints());
+ unsigned i = S - 1;
+ unsigned cpt = 0;
+
+ for (; i != UINT_MAX; --i)
+ if (!q_[i].is_empty ())
+ for (cpt = 0; cpt < q_[i].npoints (); ++cpt, --n)
+ if (n == 0)
+ return q_[i][cpt];
+ mln_assertion (false);
+ return q_[i][cpt];
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_P_PRIORITY_QUEUE_FAST_WITH_ARRAY_HH
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-13 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Fix doxygen expressions.
* mln/core/a_point_of.hh,
* mln/core/mesh_psite.hh,
* mln/core/p_priority_queue.hh,
* mln/fun/p2b/all.hh,
* mln/trait/op/all.hh,
* mln/trait/op/preinc.hh,
* mln/trait/value/print.hh,
* mln/util/branch_iter.hh,
* mln/util/branch_iter_ind.hh,
* mln/value/gray.hh,
* mln/value/graylevel.hh,
* mln/value/int_s.hh,
* mln/value/int_u.hh,
* mln/value/rgb.hh,
* sandbox/duhamel/color_sub.cc,
* sandbox/duhamel/labeling_algo.cc,
* sandbox/duhamel/labeling_level.hh,
* sandbox/duhamel/labeling_level_fast.cc,
* sandbox/duhamel/labeling_level_fast_10000x1000.cc,
* sandbox/duhamel/labeling_level_generic_10000x1000.cc,
* sandbox/garrigues/fllt2.hh,
* tests/convert_to_p_vec.cc,
* tests/core_p_priority_queue.cc,
* tests/core_p_priority_queue_fast.cc,
* tests/core_p_queue.cc,
* tests/core_p_queue_fast.cc,
* tests/core_p_set.cc,
* tests/core_pset_if.cc,
* tests/norm/l1.cc,
* tests/norm/l2.cc,
* tests/norm/linfty.cc,
* tests/pset_if.cc: Remove.
* tests/tree_fast_to_image.cc: Fix.
---
mln/core/a_point_of.hh | 2 -
mln/core/mesh_psite.hh | 2 -
mln/core/p_priority_queue.hh | 6 +--
mln/fun/p2b/all.hh | 2 -
mln/trait/op/all.hh | 2 -
mln/trait/op/preinc.hh | 2 -
mln/trait/value/print.hh | 2 -
mln/util/branch_iter.hh | 7 ++-
mln/util/branch_iter_ind.hh | 35 +++++++++----------
mln/value/gray.hh | 15 +++++++-
mln/value/graylevel.hh | 6 ++-
mln/value/int_s.hh | 14 ++++++-
mln/value/int_u.hh | 14 ++++++-
mln/value/rgb.hh | 4 +-
sandbox/duhamel/color_sub.cc | 4 +-
sandbox/duhamel/labeling_algo.cc | 2 -
sandbox/duhamel/labeling_level.hh | 2 -
sandbox/duhamel/labeling_level_fast.cc | 2 -
sandbox/duhamel/labeling_level_fast_10000x1000.cc | 2 -
sandbox/duhamel/labeling_level_generic_10000x1000.cc | 2 -
sandbox/garrigues/fllt2.hh | 12 +++---
tests/convert_to_p_vec.cc | 2 -
tests/core_p_priority_queue.cc | 2 -
tests/core_p_priority_queue_fast.cc | 2 -
tests/core_p_queue.cc | 2 -
tests/core_p_queue_fast.cc | 2 -
tests/core_p_set.cc | 2 -
tests/core_pset_if.cc | 2 -
tests/norm/l1.cc | 6 ++-
tests/norm/l2.cc | 6 ++-
tests/norm/linfty.cc | 6 ++-
tests/tree_fast_to_image.cc | 4 +-
32 files changed, 108 insertions(+), 67 deletions(-)
Index: trunk/milena/tests/pset_if.cc (deleted)
===================================================================
Index: trunk/milena/tests/core_p_queue.cc
===================================================================
--- trunk/milena/tests/core_p_queue.cc (revision 1471)
+++ trunk/milena/tests/core_p_queue.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/p_queue.cc
+/*! \file tests/core_p_queue.cc
*
* \brief Tests on mln::p_queue.
*/
Index: trunk/milena/tests/core_p_priority_queue.cc
===================================================================
--- trunk/milena/tests/core_p_priority_queue.cc (revision 1471)
+++ trunk/milena/tests/core_p_priority_queue.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/p_priority_queue.cc
+/*! \file tests/core_p_priority_queue.cc
*
* \brief Tests on mln::p_priority_queue.
*/
Index: trunk/milena/tests/core_p_set.cc
===================================================================
--- trunk/milena/tests/core_p_set.cc (revision 1471)
+++ trunk/milena/tests/core_p_set.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/p_set.cc
+/*! \file tests/core_p_set.cc
*
* \brief Tests on mln::p_set.
*/
Index: trunk/milena/tests/convert_to_p_vec.cc
===================================================================
--- trunk/milena/tests/convert_to_p_vec.cc (revision 1471)
+++ trunk/milena/tests/convert_to_p_vec.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/convert_to_vec_p.cc
+/*! \file tests/convert_to_p_vec.cc
*
* \brief Tests on mln::convert::to_vec_p.
*/
Index: trunk/milena/tests/core_pset_if.cc
===================================================================
--- trunk/milena/tests/core_pset_if.cc (revision 1471)
+++ trunk/milena/tests/core_pset_if.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/pset_if.cc
+/*! \file tests/core_pset_if.cc
*
* \brief Tests on mln::pset_if.
*/
Index: trunk/milena/tests/core_p_priority_queue_fast.cc
===================================================================
--- trunk/milena/tests/core_p_priority_queue_fast.cc (revision 1471)
+++ trunk/milena/tests/core_p_priority_queue_fast.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/p_priority_queue_fast.cc
+/*! \file tests/core_p_priority_queue_fast.cc
*
* \brief Tests on mln::p_priority_queue_fast.
*/
Index: trunk/milena/tests/tree_fast_to_image.cc
===================================================================
--- trunk/milena/tests/tree_fast_to_image.cc (revision 1471)
+++ trunk/milena/tests/tree_fast_to_image.cc (revision 1472)
@@ -26,9 +26,9 @@
// Public License.
/*!
- * \file tests/tree_to_image.cc
+ * \file tests/tree_fast_to_image.cc
*
- * \brief test of mln::util::tree_to_image
+ * \brief test of mln::util::tree_fast_to_image
*
*/
Index: trunk/milena/tests/norm/l1.cc
===================================================================
--- trunk/milena/tests/norm/l1.cc (revision 1471)
+++ trunk/milena/tests/norm/l1.cc (revision 1472)
@@ -25,8 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/l1.hh
-/// \brief Test the L1-norm.
+/*! \file tests/norm/l1.hh
+ *
+ * \brief Test the L1-norm.
+ */
#include <cassert>
Index: trunk/milena/tests/norm/l2.cc
===================================================================
--- trunk/milena/tests/norm/l2.cc (revision 1471)
+++ trunk/milena/tests/norm/l2.cc (revision 1472)
@@ -25,8 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/l2.hh
-/// \brief Test the L2-norm.
+/*! \file tests/norm/l2.hh
+ *
+ * \brief Test the L2-norm.
+ */
#include <cmath>
#include <cassert>
Index: trunk/milena/tests/norm/linfty.cc
===================================================================
--- trunk/milena/tests/norm/linfty.cc (revision 1471)
+++ trunk/milena/tests/norm/linfty.cc (revision 1472)
@@ -25,8 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/linfty.hh
-/// \brief Test the L-infinity-norm.
+/*! \file tests/norm/linfty.hh
+ *
+ * \brief Test the L-infinity-norm.
+ */
#include <cmath>
#include <cassert>
Index: trunk/milena/tests/core_p_queue_fast.cc
===================================================================
--- trunk/milena/tests/core_p_queue_fast.cc (revision 1471)
+++ trunk/milena/tests/core_p_queue_fast.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/p_queue_fast.cc
+/*! \file tests/core_p_queue_fast.cc
*
* \brief Tests on mln::p_queue_fast.
*/
Index: trunk/milena/mln/trait/value/print.hh
===================================================================
--- trunk/milena/mln/trait/value/print.hh (revision 1471)
+++ trunk/milena/mln/trait/value/print.hh (revision 1472)
@@ -28,7 +28,7 @@
#ifndef MLN_TRAIT_VALUE_PRINT_HH
# define MLN_TRAIT_VALUE_PRINT_HH
-/*! \file mln/trait/values/print.hh
+/*! \file mln/trait/value/print.hh
*
* \brief Print the collection of traits for an value type.
*/
Index: trunk/milena/mln/trait/op/all.hh
===================================================================
--- trunk/milena/mln/trait/op/all.hh (revision 1471)
+++ trunk/milena/mln/trait/op/all.hh (revision 1472)
@@ -29,7 +29,7 @@
# define MLN_TRAIT_OP_ALL_HH
/*!
- * \file all.hh
+ * \file mln/trait/op/all.hh
*
* \brief FIXME
*
Index: trunk/milena/mln/trait/op/preinc.hh
===================================================================
--- trunk/milena/mln/trait/op/preinc.hh (revision 1471)
+++ trunk/milena/mln/trait/op/preinc.hh (revision 1472)
@@ -28,7 +28,7 @@
#ifndef MLN_TRAIT_OP_PREINC_HH
# define MLN_TRAIT_OP_PREINC_HH
-/*! \file mln/trait/op/predec.hh
+/*! \file mln/trait/op/preinc.hh
*
* \brief Declaration of the "unary pre-decrementation" operator trait.
*/
Index: trunk/milena/mln/core/mesh_psite.hh
===================================================================
--- trunk/milena/mln/core/mesh_psite.hh (revision 1471)
+++ trunk/milena/mln/core/mesh_psite.hh (revision 1472)
@@ -28,7 +28,7 @@
#ifndef MLN_MESH_PSITE_HH
# define MLN_MESH_PSITE_HH
-/*! \file mln/core/mesh_p.hh
+/*! \file mln/core/mesh_psite.hh
*
* \brief Definition of a graph-based point site.
*
Index: trunk/milena/mln/core/p_priority_queue.hh
===================================================================
--- trunk/milena/mln/core/p_priority_queue.hh (revision 1471)
+++ trunk/milena/mln/core/p_priority_queue.hh (revision 1472)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_QUEUE_P_PRIORITY_HH
-# define MLN_CORE_QUEUE_P_PRIORITY_HH
+#ifndef MLN_CORE_P_PRIORITY_QUEUE_HH
+# define MLN_CORE_P_PRIORITY_QUEUE_HH
/*! \file mln/core/p_priority_queue.hh
*
@@ -334,4 +334,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_QUEUE_P_PRIORITY_HH
+#endif // ! MLN_CORE_P_PRIORITY_QUEUE_HH
Index: trunk/milena/mln/core/a_point_of.hh
===================================================================
--- trunk/milena/mln/core/a_point_of.hh (revision 1471)
+++ trunk/milena/mln/core/a_point_of.hh (revision 1472)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_A_POINT_OF_HH
# define MLN_CORE_A_POINT_OF_HH
-/*! \file mln/core/a_point_oft.hh
+/*! \file mln/core/a_point_of.hh
*
* \brief Give a point of an image.
*/
Index: trunk/milena/mln/value/graylevel.hh
===================================================================
--- trunk/milena/mln/value/graylevel.hh (revision 1471)
+++ trunk/milena/mln/value/graylevel.hh (revision 1472)
@@ -50,20 +50,22 @@
namespace mln
{
- /// \{ Fwd decls.
namespace literal
{
+ /// \{ Fwd decls.
struct black_t;
struct medium_gray_t;
struct white_t;
+ /// \}
}
namespace value
{
+ /// \{ Fwd decls.
class gray;
template <unsigned n> struct graylevel;
struct float01_f;
- }
/// \}
+ }
Index: trunk/milena/mln/value/gray.hh
===================================================================
--- trunk/milena/mln/value/gray.hh (revision 1471)
+++ trunk/milena/mln/value/gray.hh (revision 1472)
@@ -43,10 +43,21 @@
namespace mln
{
+ namespace literal
+ {
+ /// \{ Fwd decls.
+ struct black_t;
+ struct white_t;
+ /// \}
+ }
+
+ namespace value
+ {
/// \{ Fwd decls.
- namespace literal { struct black_t; struct white_t; }
- namespace value { template <unsigned N> class graylevel; class gray; }
+ template <unsigned N> class graylevel;
+ class gray;
/// \}
+ }
namespace trait
Index: trunk/milena/mln/value/int_s.hh
===================================================================
--- trunk/milena/mln/value/int_s.hh (revision 1471)
+++ trunk/milena/mln/value/int_s.hh (revision 1472)
@@ -48,10 +48,20 @@
{
+ namespace value
+ {
+ /// \{ Fwd decls.
+ template <unsigned n> struct int_s;
+ /// \}
+ }
+
+ namespace literal
+ {
/// \{ Fwd decls.
- namespace value { template <unsigned n> struct int_s; }
- namespace literal { struct zero_t; struct one_t; }
+ struct zero_t;
+ struct one_t;
/// \}
+ }
Index: trunk/milena/mln/value/int_u.hh
===================================================================
--- trunk/milena/mln/value/int_u.hh (revision 1471)
+++ trunk/milena/mln/value/int_u.hh (revision 1472)
@@ -49,10 +49,20 @@
namespace mln
{
+ namespace value
+ {
+ /// \{ Fwd decls.
+ template <unsigned n> struct int_u;
+ /// \}
+ }
+
+ namespace literal
+ {
/// \{ Fwd decls.
- namespace value { template <unsigned n> struct int_u; }
- namespace literal { struct zero_t; struct one_t; }
+ struct zero_t;
+ struct one_t;
/// \}
+ }
namespace trait
Index: trunk/milena/mln/value/rgb.hh
===================================================================
--- trunk/milena/mln/value/rgb.hh (revision 1471)
+++ trunk/milena/mln/value/rgb.hh (revision 1472)
@@ -44,17 +44,17 @@
namespace mln
{
- /// \{ Fwd decls.
namespace literal
{
+ /// \{ Fwd decls.
struct black_t;
struct white_t;
struct red_t;
struct blue_t;
struct green_t;
- }
/// \}
+ }
namespace value
Index: trunk/milena/mln/fun/p2b/all.hh
===================================================================
--- trunk/milena/mln/fun/p2b/all.hh (revision 1471)
+++ trunk/milena/mln/fun/p2b/all.hh (revision 1472)
@@ -28,7 +28,7 @@
#ifndef MLN_FUN_P2B_ALL_HH
# define MLN_FUN_P2B_ALL_HH
-/*! \file mln/fun_p2b/all.hh
+/*! \file mln/fun/p2b/all.hh
*
* \brief File that includes all functions from point to boolean.
*/
Index: trunk/milena/mln/util/branch_iter_ind.hh
===================================================================
--- trunk/milena/mln/util/branch_iter_ind.hh (revision 1471)
+++ trunk/milena/mln/util/branch_iter_ind.hh (revision 1472)
@@ -25,18 +25,19 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_UTIL_BRANCH_ITER_HH
-# define MLN_UTIL_BRANCH_ITER_HH
+#ifndef MLN_UTIL_BRANCH_ITER_IND_HH
+# define MLN_UTIL_BRANCH_ITER_IND_HH
-# include <stack>
-# include <mln/util/tree.hh>
/*!
- * \file mln/util/branch.hh
+ * \file mln/util/branch_iter_ind.hh
*
* \brief Definition of a iterator on branch.
*
*/
+# include <stack>
+# include <mln/util/tree.hh>
+
namespace mln
{
@@ -59,14 +60,14 @@
/*! \brief Basic 2D image class.
*
- * The parameter \c T is the type of node's data. branch_iter is used to pre-order walk a branch.
+ * The parameter \c T is the type of node's data. branch_iter_ind is used to pre-order walk a branch.
*/
template <typename T>
- class branch_iter
+ class branch_iter_ind
{
public:
- branch_iter(branch<T> branch);
+ branch_iter_ind(branch<T> branch);
/// Convertion to node.
operator util::node<T>&() const;
@@ -100,14 +101,14 @@
template <typename T>
- branch_iter<T>::branch_iter(branch<T> branch)
+ branch_iter_ind<T>::branch_iter_ind(branch<T> branch)
: branch_(branch)
{
invalidate();
}
template <typename T>
- branch_iter<T>::operator node<T>&() const
+ branch_iter_ind<T>::operator node<T>&() const
{
mln_assertion(n_);
return *n_;
@@ -115,7 +116,7 @@
template <typename T>
util::node<T>&
- branch_iter<T>::operator*()
+ branch_iter_ind<T>::operator*()
{
mln_assertion(n_);
return *n_;
@@ -123,7 +124,7 @@
template <typename T>
unsigned
- branch_iter<T>::deepness() const
+ branch_iter_ind<T>::deepness() const
{
mln_assertion(is_valid());
unsigned i = 0;
@@ -138,14 +139,14 @@
template <typename T>
bool
- branch_iter<T>::is_valid() const
+ branch_iter_ind<T>::is_valid() const
{
return n_ != 0;
}
template <typename T>
void
- branch_iter<T>::invalidate()
+ branch_iter_ind<T>::invalidate()
{
n_ = 0;
}
@@ -153,7 +154,7 @@
template <typename T>
void
- branch_iter<T>::start()
+ branch_iter_ind<T>::start()
{
s_.push(bi_elt<T>(&branch_.apex().children()));
@@ -162,7 +163,7 @@
template <typename T>
void
- branch_iter<T>::next()
+ branch_iter_ind<T>::next()
{
// First : list of children.
// Second : i;
@@ -218,4 +219,4 @@
} // end of namespace mln
-#endif // !MLN_UTIL_BRANCH_HH
+#endif // !MLN_UTIL_BRANCH_ITER_IND_HH
Index: trunk/milena/mln/util/branch_iter.hh
===================================================================
--- trunk/milena/mln/util/branch_iter.hh (revision 1471)
+++ trunk/milena/mln/util/branch_iter.hh (revision 1472)
@@ -28,15 +28,16 @@
#ifndef MLN_UTIL_BRANCH_ITER_HH
# define MLN_UTIL_BRANCH_ITER_HH
-# include <stack>
-# include <mln/util/tree.hh>
/*!
- * \file mln/util/branch.hh
+ * \file mln/util/branch_iter.hh
*
* \brief Definition of a iterator on branch.
*
*/
+# include <stack>
+# include <mln/util/tree.hh>
+
namespace mln
{
Index: trunk/milena/sandbox/duhamel/labeling_level_generic_10000x1000.cc
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_level_generic_10000x1000.cc (revision 1471)
+++ trunk/milena/sandbox/duhamel/labeling_level_generic_10000x1000.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/labeling_foreground.cc
+/*! \file sandbox/duhamel/labeling_level_generic_10000x1000.cc
*
* \brief Test on mln::labeling::foreground.
*/
Index: trunk/milena/sandbox/duhamel/labeling_algo.cc
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_algo.cc (revision 1471)
+++ trunk/milena/sandbox/duhamel/labeling_algo.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/labeling_foreground.cc
+/*! \file sandbox/duhamel/labeling_algo.cc
*
* \brief Test on mln::labeling::foreground.
*/
Index: trunk/milena/sandbox/duhamel/color_sub.cc
===================================================================
--- trunk/milena/sandbox/duhamel/color_sub.cc (revision 1471)
+++ trunk/milena/sandbox/duhamel/color_sub.cc (revision 1472)
@@ -25,9 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/sub_image.cc
+/*! \file sandbox/duhamel/color_sub.cc
*
- * \brief Tests on mln::sub_image.
+ * \brief Tests on mln::color_sub.
*/
# include <mln/core/image2d_b.hh>
Index: trunk/milena/sandbox/duhamel/labeling_level_fast_10000x1000.cc
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_level_fast_10000x1000.cc (revision 1471)
+++ trunk/milena/sandbox/duhamel/labeling_level_fast_10000x1000.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/labeling_foreground.cc
+/*! \file sandbox/duhamel/labeling_level_fast_10000x1000.cc
*
* \brief Test on mln::labeling::foreground.
*/
Index: trunk/milena/sandbox/duhamel/labeling_level_fast.cc
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_level_fast.cc (revision 1471)
+++ trunk/milena/sandbox/duhamel/labeling_level_fast.cc (revision 1472)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/labeling_foreground.cc
+/*! \file sandbox/duhamel/labeling_level_fast.cc
*
* \brief Test on mln::labeling::foreground.
*/
Index: trunk/milena/sandbox/duhamel/labeling_level.hh
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_level.hh (revision 1471)
+++ trunk/milena/sandbox/duhamel/labeling_level.hh (revision 1472)
@@ -28,7 +28,7 @@
#ifndef SANDBOX_MLN_LABELING_LEVEL_HH
# define SANDBOX_MLN_LABELING_LEVEL_HH
-/*! \file mln/labeling/level.hh
+/*! \file sandbox/duhamel/labeling_level.hh
*
* \brief Connected component labeling of the image objects at a given
* level.
Index: trunk/milena/sandbox/garrigues/fllt2.hh
===================================================================
--- trunk/milena/sandbox/garrigues/fllt2.hh (revision 1471)
+++ trunk/milena/sandbox/garrigues/fllt2.hh (revision 1472)
@@ -99,7 +99,7 @@
# 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_branch_iter_ind(P, V) util::branch_iter_ind< fllt_node_elt<P, V> >
// # define fllt_node(P, V) typename fllt_tree(P, V)::node_t
@@ -690,7 +690,7 @@
{
std::cout << "[Merge first tree]------------" << std::endl;
- fllt_branch_iter(P, V) p(lower_tree.main_branch());
+ fllt_branch_iter_ind(P, V) p(lower_tree.main_branch());
for_all(p)
{
fllt_node(P, V)& n(p);
@@ -704,7 +704,7 @@
{
std::cout << "[Merge second tree]------------" << std::endl;
- fllt_branch_iter(P, V) p(upper_tree.main_branch());
+ fllt_branch_iter_ind(P, V) p(upper_tree.main_branch());
for_all(p)
{
fllt_node(P, V)& n(p);
@@ -739,7 +739,7 @@
visualize_deepness(image2d<value::int_u8>& output,
fllt_tree(P, V)& tree)
{
- fllt_branch_iter(P, V) p(tree.main_branch());
+ fllt_branch_iter_ind(P, V) p(tree.main_branch());
level::fill(output, 0);
for_all(p)
{
@@ -760,7 +760,7 @@
fllt_tree(P, V)& tree,
unsigned limit)
{
- fllt_branch_iter(P, V) p(tree.main_branch());
+ fllt_branch_iter_ind(P, V) p(tree.main_branch());
level::fill(output, 255);
for_all(p)
{
@@ -786,7 +786,7 @@
draw_tree(const image2d<V>& ima,
fllt_tree(P, V)& tree)
{
- fllt_branch_iter(P, V) p(tree.main_branch());
+ fllt_branch_iter_ind(P, V) p(tree.main_branch());
for_all(p)
{
std::cout << "region mere : " << (*p).parent() << std::endl;
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-13 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Plugin gimp support the undo system.
* sandbox/nivault/plugin-gimp/src/build-image.hh,
* sandbox/nivault/plugin-gimp/src/build-image.hxx,
* sandbox/nivault/plugin-gimp/src/main.cc: Use two image for reading
and writing.
---
build-image.hh | 3 ++-
build-image.hxx | 15 +++++++++------
main.cc | 27 ++++++++++++++++-----------
3 files changed, 27 insertions(+), 18 deletions(-)
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx (revision 1470)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx (revision 1471)
@@ -45,9 +45,10 @@
}
};
-void build_milena_image(GimpPixelRgn *region)
+void build_milena_image(GimpPixelRgn *in,
+ GimpPixelRgn *out)
{
- I tmp(region);
+ I tmp(in);
// g_message(region->dirty ? "saaale" : "pas saaale");
// g_message(region->shadow ? "shadoooow" : "pas shadoooow");
ima = tmp;
@@ -65,13 +66,15 @@
mln::level::transform(ima, fun, tmp2);
mln::border::resize(tmp2, 0);
- gimp_pixel_rgn_set_rect(region,
+ gimp_pixel_rgn_set_rect(out,
(const guchar *) tmp2.buffer(),
0,
0,
- region->w,
- region->h);
- gimp_displays_flush ();
+ out->w,
+ out->h);
+
+ gimp_drawable_flush (out->drawable);
+ gimp_drawable_merge_shadow (out->drawable->drawable_id, TRUE);
}
gboolean draw_milena_image(GtkWidget* area,
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/main.cc
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/main.cc (revision 1470)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/main.cc (revision 1471)
@@ -96,8 +96,10 @@
{
static GimpParam values[1];
GimpDrawable *drawable;
- GimpPixelRgn region;
+ GimpPixelRgn in, out;
gint32 image_ID;
+ gint x1, y1, x2, y2;
+ gint width, height;
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
@@ -107,18 +109,16 @@
run_mode = (GimpRunMode) param[0].data.d_int32;
image_ID = param[1].data.d_int32;
drawable = gimp_drawable_get (param[2].data.d_drawable);
- gimp_image_undo_enable(image_ID);
- gimp_pixel_rgn_init(®ion,
- drawable,
- 0,
- 0,
- drawable->width,
- drawable->height,
- FALSE,
- FALSE);
+ gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
- build_milena_image(®ion);
+ width = drawable->width;
+ height = drawable->height;
+
+ gimp_pixel_rgn_init(&in, drawable, 0, 0, width, height, FALSE, FALSE);
+ gimp_pixel_rgn_init(&out, drawable, 0, 0, width, height, TRUE, TRUE);
+
+ build_milena_image(&in, & out);
if (strcmp (name, PROCEDURE_NAME) == 0)
{
@@ -143,6 +143,11 @@
status = GIMP_PDB_CALLING_ERROR;
}
+ gimp_drawable_update (drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
+
+ gimp_displays_flush ();
+ gimp_drawable_detach (drawable);
+
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
}
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh (revision 1470)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh (revision 1471)
@@ -43,7 +43,8 @@
# include <mln/io/ppm/save.hh>
-void build_milena_image(GimpPixelRgn *region);
+void build_milena_image(GimpPixelRgn *in,
+ GimpPixelRgn *out);
gboolean draw_milena_image(GtkWidget* area,
GdkEventExpose *event,
1
0
milena r1470: Fix queue : rename empty in is_empty and add method pop_front
by Guillaume Duhamel 13 Nov '07
by Guillaume Duhamel 13 Nov '07
13 Nov '07
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-13 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Fix queue : rename empty in is_empty and add method pop_front.
Rename empty in is_empty and add method pop_front, which
return the front element and pop the queue.
* mln/core/p_priority_queue.hh,
* mln/core/p_priority_queue_fast.hh,
* mln/core/p_queue.hh,
* mln/core/p_queue_fast.hh: Update this modification.
Update with these modifications.
* mln/geom/seeds2tiling.hh,
* mln/geom/seeds2tiling_with_chamfer.hh,
* tests/core_p_priority_queue.cc,
* tests/core_p_priority_queue_fast.cc: Update.
---
mln/core/p_priority_queue.hh | 69 ++++++++++++++++++++--------------
mln/core/p_priority_queue_fast.hh | 29 ++++++++++----
mln/core/p_queue.hh | 19 ++++++++-
mln/core/p_queue_fast.hh | 22 +++++++++-
mln/geom/seeds2tiling.hh | 4 -
mln/geom/seeds2tiling_with_chamfer.hh | 2
tests/core_p_priority_queue.cc | 10 ++--
tests/core_p_priority_queue_fast.cc | 8 +--
8 files changed, 112 insertions(+), 51 deletions(-)
Index: trunk/milena/tests/core_p_priority_queue.cc
===================================================================
--- trunk/milena/tests/core_p_priority_queue.cc (revision 1469)
+++ trunk/milena/tests/core_p_priority_queue.cc (revision 1470)
@@ -37,12 +37,12 @@
{
using namespace mln;
- mln::p_priority_queue<point2d, unsigned> q;
+ p_priority_queue<point2d, unsigned> q;
point2d p1 (6, 9);
point2d p2 (5, 1);
point2d p3 (4, 2);
- mln_assertion (q.empty ());
+ mln_assertion (q.is_empty ());
mln_assertion (q.npoints () == 0);
@@ -53,7 +53,7 @@
std::cout << q.bbox () << std::endl;
std::cout << q << std::endl;
- mln_assertion (!q.empty ());
+ mln_assertion (!q.is_empty ());
mln_assertion (q.has (p1));
mln_assertion (q.has (p2));
@@ -84,7 +84,7 @@
mln_assertion (!q.has (p3));
mln_assertion (q.npoints () == 0);
- mln_assertion (q.empty ());
+ mln_assertion (q.is_empty ());
q.push_force (p3);
q.push_force (p2, 5);
@@ -94,5 +94,5 @@
mln_assertion (q[1] == p1);
mln_assertion (q[0] == p2);
q.clear ();
- mln_assertion (q.empty ());
+ mln_assertion (q.is_empty ());
}
Index: trunk/milena/tests/core_p_priority_queue_fast.cc
===================================================================
--- trunk/milena/tests/core_p_priority_queue_fast.cc (revision 1469)
+++ trunk/milena/tests/core_p_priority_queue_fast.cc (revision 1470)
@@ -42,7 +42,7 @@
point2d p2 (5, 1);
point2d p3 (4, 2);
- mln_assertion (q.empty ());
+ mln_assertion (q.is_empty ());
mln_assertion (q.npoints () == 0);
@@ -53,7 +53,7 @@
std::cout << q.bbox () << std::endl;
std::cout << q << std::endl;
- mln_assertion (!q.empty ());
+ mln_assertion (!q.is_empty ());
mln_assertion (q.has (p1));
mln_assertion (q.has (p2));
@@ -84,7 +84,7 @@
mln_assertion (!q.has (p3));
mln_assertion (q.npoints () == 0);
- mln_assertion (q.empty ());
+ mln_assertion (q.is_empty ());
q.push_force (p3);
q.push_force (p2, 5);
@@ -94,5 +94,5 @@
mln_assertion (q[1] == p1);
mln_assertion (q[0] == p2);
q.clear ();
- mln_assertion (q.empty ());
+ mln_assertion (q.is_empty ());
}
Index: trunk/milena/mln/core/p_queue.hh
===================================================================
--- trunk/milena/mln/core/p_queue.hh (revision 1469)
+++ trunk/milena/mln/core/p_queue.hh (revision 1470)
@@ -80,7 +80,7 @@
bool has(const P& p) const;
/// Test if queue is empty or not.
- bool empty() const;
+ bool is_empty() const;
/// Give the number of points.
std::size_t npoints() const;
@@ -102,6 +102,11 @@
/// recently inserted point.
const P& front() const;
+ /// Give the front point \p p of the queue; \p p is the least
+ /// recently inserted point and pop (remove) the front point \p p
+ /// from the queue; \p p is the least recently inserted point.
+ const P& pop_front();
+
/// Clear the queue.
void clear();
@@ -169,7 +174,7 @@
template <typename P>
bool
- p_queue<P>::empty() const
+ p_queue<P>::is_empty() const
{
return (q_.empty());
}
@@ -234,6 +239,16 @@
}
template <typename P>
+ const P&
+ p_queue<P>::pop_front()
+ {
+ const P& res = this->front();
+
+ this->pop();
+ return res;
+ }
+
+ template <typename P>
void
p_queue<P>::clear()
{
Index: trunk/milena/mln/core/p_priority_queue_fast.hh
===================================================================
--- trunk/milena/mln/core/p_priority_queue_fast.hh (revision 1469)
+++ trunk/milena/mln/core/p_priority_queue_fast.hh (revision 1470)
@@ -82,7 +82,7 @@
bool has(const P& p) const;
/// Test if queue is empty or not.
- bool empty() const;
+ bool is_empty() const;
/// Give the number of points.
unsigned npoints() const;
@@ -104,6 +104,11 @@
/// recently inserted point.
const P& front() const;
+ /// Pop (remove) the front point \p p from the queue; \p p is the
+ /// least recently inserted point and give the front point \p p of
+ /// the queue; \p p is the least recently inserted point.
+ const P& pop_front();
+
/// Clear the queue.
void clear();
@@ -182,12 +187,12 @@
template <typename P, typename T>
bool
- p_priority_queue_fast<P, T>::empty() const
+ p_priority_queue_fast<P, T>::is_empty() const
{
typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
return false;
return true;
}
@@ -201,7 +206,7 @@
typename std::map<T, p_queue_fast<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
res += (*it).second.npoints();
return res;
}
@@ -246,7 +251,7 @@
typename std::map<T, p_queue_fast<P> >::reverse_iterator it = q_.rbegin ();
for (; it != q_.rend (); ++it)
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
return (*it).second.pop ();
if (! vect_needs_update_)
@@ -265,12 +270,22 @@
typename std::map<T, p_queue_fast<P> >::const_reverse_iterator it = q_.rbegin ();
for (; it != q_.rend (); ++it)
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
break;
return (*it).second.front ();
}
template <typename P, typename T>
+ const P&
+ p_priority_queue_fast<P, T>::pop_front()
+ {
+ const P& res = this->front();
+
+ this->pop();
+ return res;
+ }
+
+ template <typename P, typename T>
void
p_priority_queue_fast<P, T>::clear()
{
@@ -303,7 +318,7 @@
for (; it != q_.rend (); ++it)
{
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
for (cpt = 0; cpt < (*it).second.npoints (); ++cpt)
{
if (i == 0)
Index: trunk/milena/mln/core/p_priority_queue.hh
===================================================================
--- trunk/milena/mln/core/p_priority_queue.hh (revision 1469)
+++ trunk/milena/mln/core/p_priority_queue.hh (revision 1470)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_QUEUE_P_PRIORITY_HH
# define MLN_CORE_QUEUE_P_PRIORITY_HH
-/*! \file mln/core/p_queue_priority.hh
+/*! \file mln/core/p_priority_queue.hh
*
* \brief Definition of a point set class based on p_queue with
* priority features.
@@ -65,7 +65,7 @@
* a call to npoints() when this container is multiple.
*/
template <typename P, typename T>
- class p_queue_priority : public internal::point_set_base_< P, p_queue_priority<P, T> >
+ class p_priority_queue : public internal::point_set_base_< P, p_priority_queue<P, T> >
{
public:
@@ -76,13 +76,13 @@
typedef p_array_bkd_piter_<P> bkd_piter;
/// Constructor.
- p_queue_priority();
+ p_priority_queue();
/// Test is \p p belongs to this point set.
bool has(const P& p) const;
/// Test if queue is empty or not.
- bool empty() const;
+ bool is_empty() const;
/// Give the number of points.
unsigned npoints() const;
@@ -91,10 +91,10 @@
const box_<P>& bbox() const;
/// Push force a point \p p in the queue.
- p_queue_priority<P, T>& push_force(const P& p, T prio = 0);
+ p_priority_queue<P, T>& push_force(const P& p, T prio = 0);
/// Push a point \p p in the queue.
- p_queue_priority<P, T>& push(const P& p, T prio = 0);
+ p_priority_queue<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.
@@ -104,6 +104,11 @@
/// recently inserted point.
const P& front() const;
+ /// Pop (remove) the front point \p p from the queue; \p p is the
+ /// least recently inserted point and give the front point \p p of
+ /// the queue; \p p is the least recently inserted point.
+ const P& pop_front();
+
/// Clear the queue.
void clear();
@@ -132,7 +137,7 @@
# ifndef MLN_INCLUDE_ONLY
template <typename P, typename T>
- p_queue_priority<P, T>::p_queue_priority()
+ p_priority_queue<P, T>::p_priority_queue()
{
vect_needs_update_ = false;
bb_needs_update_ = false;
@@ -140,7 +145,7 @@
template <typename P, typename T>
void
- p_queue_priority<P, T>::vect_update_() const
+ p_priority_queue<P, T>::vect_update_() const
{
vect_.clear();
vect_.reserve(npoints());
@@ -155,7 +160,7 @@
template <typename P, typename T>
void
- p_queue_priority<P, T>::bb_update_() const
+ p_priority_queue<P, T>::bb_update_() const
{
bb_.init();
@@ -170,7 +175,7 @@
template <typename P, typename T>
bool
- p_queue_priority<P, T>::has(const P& p) const
+ p_priority_queue<P, T>::has(const P& p) const
{
typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
@@ -182,33 +187,33 @@
template <typename P, typename T>
bool
- p_queue_priority<P, T>::empty() const
+ p_priority_queue<P, T>::is_empty() const
{
typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
return false;
return true;
}
template <typename P, typename T>
unsigned
- p_queue_priority<P, T>::npoints() const
+ p_priority_queue<P, T>::npoints() const
{
unsigned res = 0;
typename std::map<T, p_queue<P> >::const_iterator it = q_.begin ();
for (; it != q_.end (); ++it)
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
res += (*it).second.npoints();
return res;
}
template <typename P, typename T>
const box_<P>&
- p_queue_priority<P, T>::bbox() const
+ p_priority_queue<P, T>::bbox() const
{
mln_precondition(npoints() != 0);
if (bb_needs_update_)
@@ -217,8 +222,8 @@
}
template <typename P, typename T>
- p_queue_priority<P, T>&
- p_queue_priority<P, T>::push_force(const P& p, T prio)
+ p_priority_queue<P, T>&
+ p_priority_queue<P, T>::push_force(const P& p, T prio)
{
q_[prio].push_force (p);
if (! vect_needs_update_)
@@ -230,8 +235,8 @@
}
template <typename P, typename T>
- p_queue_priority<P, T>&
- p_queue_priority<P, T>::push(const P& p, T prio)
+ p_priority_queue<P, T>&
+ p_priority_queue<P, T>::push(const P& p, T prio)
{
if (! has(p))
return this->push_force(p, prio);
@@ -241,12 +246,12 @@
template <typename P, typename T>
void
- p_queue_priority<P, T>::pop()
+ p_priority_queue<P, T>::pop()
{
typename std::map<T, p_queue<P> >::reverse_iterator it = q_.rbegin ();
for (; it != q_.rend (); ++it)
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
return (*it).second.pop ();
if (! vect_needs_update_)
@@ -258,21 +263,31 @@
template <typename P, typename T>
const P&
- p_queue_priority<P, T>::front() const
+ p_priority_queue<P, T>::front() const
{
mln_precondition(! q_.empty());
typename std::map<T, p_queue<P> >::const_reverse_iterator it = q_.rbegin ();
for (; it != q_.rend (); ++it)
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
break;
return (*it).second.front ();
}
template <typename P, typename T>
+ const P&
+ p_priority_queue<P, T>::pop_front()
+ {
+ const P& res = this->front();
+
+ this->pop();
+ return res;
+ }
+
+ template <typename P, typename T>
void
- p_queue_priority<P, T>::clear()
+ p_priority_queue<P, T>::clear()
{
typename std::map<T, p_queue<P> >::iterator it = q_.begin ();
@@ -285,7 +300,7 @@
template <typename P, typename T>
const std::vector<P>&
- p_queue_priority<P, T>::vect() const
+ p_priority_queue<P, T>::vect() const
{
if (vect_needs_update_)
vect_update_();
@@ -294,7 +309,7 @@
template <typename P, typename T>
const P&
- p_queue_priority<P, T>::operator[](unsigned i) const
+ p_priority_queue<P, T>::operator[](unsigned i) const
{
mln_precondition(i < npoints());
@@ -303,7 +318,7 @@
for (; it != q_.rend (); ++it)
{
- if (!(*it).second.empty ())
+ if (!(*it).second.is_empty ())
for (cpt = 0; cpt < (*it).second.npoints (); ++cpt)
{
if (i == 0)
Index: trunk/milena/mln/core/p_queue_fast.hh
===================================================================
--- trunk/milena/mln/core/p_queue_fast.hh (revision 1469)
+++ trunk/milena/mln/core/p_queue_fast.hh (revision 1470)
@@ -81,7 +81,7 @@
bool has(const P& p) const;
/// Test if queue is empty or not.
- bool empty() const;
+ bool is_empty() const;
/// Give the number of points.
std::size_t npoints() const;
@@ -103,6 +103,11 @@
/// recently inserted point.
const P& front() const;
+ /// Pop (remove) the front point \p p from the queue; \p p is the
+ /// least recently inserted point and give the front point \p p of
+ /// the queue; \p p is the least recently inserted point.
+ const P& pop_front();
+
/// Clear the queue.
void clear();
@@ -173,7 +178,7 @@
template <typename P>
bool
- p_queue_fast<P>::empty() const
+ p_queue_fast<P>::is_empty() const
{
return (this->begin_ == this->end_);
}
@@ -236,11 +241,22 @@
const P&
p_queue_fast<P>::front() const
{
- mln_precondition(! this->empty());
+ mln_precondition(! this->is_empty());
return q_[begin_];
}
template <typename P>
+ const P&
+ p_queue_fast<P>::pop_front()
+ {
+ const P& res = this->front();
+
+ this->pop();
+ return res;
+ }
+
+
+ template <typename P>
void
p_queue_fast<P>::clear()
{
Index: trunk/milena/mln/geom/seeds2tiling.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling.hh (revision 1469)
+++ trunk/milena/mln/geom/seeds2tiling.hh (revision 1470)
@@ -78,7 +78,7 @@
// // Body.
// {
-// while (! q.empty())
+// while (! q.is_empty())
// {
// mln_psite(I) p = q.front();
// q.pop();
@@ -96,7 +96,7 @@
// Body: alternative version.
{
- while (! q.empty())
+ while (! q.is_empty())
{
mln_psite(I) p = q.front();
q.pop();
Index: trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh (revision 1469)
+++ trunk/milena/mln/geom/seeds2tiling_with_chamfer.hh (revision 1470)
@@ -80,7 +80,7 @@
// Body: alternative version.
{
- while (! q.empty())
+ while (! q.is_empty())
{
mln_psite(I) p = q.front();
q.pop();
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-12 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Plug-in gimp works and compute images.
* 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/main.cc: Update.
* mln/level/transform.hh: Add the "out algo(in)" form.
---
mln/level/transform.hh | 17 ++++++++++++
sandbox/nivault/plugin-gimp/src/build-image.hh | 12 +++++---
sandbox/nivault/plugin-gimp/src/build-image.hxx | 33 +++++++++++++++++++++++-
sandbox/nivault/plugin-gimp/src/gimp-image.hh | 21 +++++++++++----
sandbox/nivault/plugin-gimp/src/main.cc | 1
5 files changed, 74 insertions(+), 10 deletions(-)
Index: trunk/milena/mln/level/transform.hh
===================================================================
--- trunk/milena/mln/level/transform.hh (revision 1468)
+++ trunk/milena/mln/level/transform.hh (revision 1469)
@@ -64,6 +64,11 @@
void transform(const Image<I>& input, const Function_v2v<F>& f, Image<O>& output);
+ template <typename I, typename F>
+ mln_ch_value(I, mln_result(F))
+ transform(const Image<I>& input, const Function_v2v<F>& f);
+
+
# ifndef MLN_INCLUDE_ONLY
namespace impl
@@ -131,6 +136,18 @@
}
+ template <typename I, typename F>
+ mln_ch_value(I, mln_result(F))
+ transform(const Image<I>& input, const Function_v2v<F>& f)
+ {
+ mln_precondition(exact(input).has_data());
+ mln_ch_value(I, mln_result(F)) output;
+ initialize(output, input);
+ transform(input, f, output);
+ return output;
+ }
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::level
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx (revision 1468)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hxx (revision 1469)
@@ -36,11 +36,42 @@
return ima;
}
+struct toto : mln::Function_v2v<toto>
+{
+ typedef mln::value::rgb8 result;
+ mln::value::rgb8 operator()(const mln::value::rgb8& c) const
+ {
+ return mln::value::rgb8(255 - c.red(), 255 - c.green(), 255 - c.blue());
+ }
+};
+
void build_milena_image(GimpPixelRgn *region)
{
I tmp(region);
+// g_message(region->dirty ? "saaale" : "pas saaale");
+// g_message(region->shadow ? "shadoooow" : "pas shadoooow");
ima = tmp;
- mln::level::fill(ima, mln::literal::blue);
+ mln::point2d p1(0,0);
+ mln::point2d p2(0,5);
+ mln::point2d p3(20,50);
+// mln::io::ppm::save(ima, "/goinfre/out.ppm");
+ std::cout << p1 << " : " << ima(p1) << std::endl;
+ std::cout << p2 << " : " << ima(p2) << std::endl;
+ std::cout << p3 << " : " << ima(p3) << std::endl;
+// mln::level::fill(ima, mln::literal::blue);
+
+ toto fun;
+ mln::image2d<mln::value::rgb8> tmp2(ima.domain());
+ mln::level::transform(ima, fun, tmp2);
+ mln::border::resize(tmp2, 0);
+
+ gimp_pixel_rgn_set_rect(region,
+ (const guchar *) tmp2.buffer(),
+ 0,
+ 0,
+ region->w,
+ region->h);
+ gimp_displays_flush ();
}
gboolean draw_milena_image(GtkWidget* area,
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/main.cc
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/main.cc (revision 1468)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/main.cc (revision 1469)
@@ -107,6 +107,7 @@
run_mode = (GimpRunMode) param[0].data.d_int32;
image_ID = param[1].data.d_int32;
drawable = gimp_drawable_get (param[2].data.d_drawable);
+ gimp_image_undo_enable(image_ID);
gimp_pixel_rgn_init(®ion,
drawable,
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh (revision 1468)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/gimp-image.hh (revision 1469)
@@ -37,6 +37,10 @@
# include <mln/value/set.hh>
# include <mln/value/rgb8.hh>
# include <mln/core/line_piter.hh>
+# include <mln/literal/all.hh>
+
+# include <iostream>
+# include <sstream>
namespace mln
{
@@ -265,8 +269,8 @@
mln_assertion(rgn != NULL);
buffer_ = (typename gimp_image<t>::value*) rgn->data;
b_ = make::box2d(rgn->y, rgn->x,
- rgn->y + rgn->h,
- rgn->x + rgn->w);
+ rgn->y + rgn->h - 1,
+ rgn->x + rgn->w - 1);
allocate_();
}
@@ -408,8 +412,12 @@
{
// 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()];
+
+ static mln::value::rgb8 c;
+ gimp_pixel_rgn_get_pixel(this->data_->rgn_,
+ (guchar *) &c,
+ p[1], p[0]);
+ return c;
}
template <GimpImageType t>
@@ -417,7 +425,10 @@
gimp_image<t>::operator()(const point& p)
{
// mln_precondition(this->owns_(p));
- static mln::value::rgb8 c(0,0,0);
+ static mln::value::rgb8 c;
+ gimp_pixel_rgn_get_pixel(this->data_->rgn_,
+ (guchar *) &c,
+ p[1], p[0]);
return c; // this->data_->array_[p.row()][p.col()];
// return this->data_->array_[p.row()][p.col()];
}
Index: trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh
===================================================================
--- trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh (revision 1468)
+++ trunk/milena/sandbox/nivault/plugin-gimp/src/build-image.hh (revision 1469)
@@ -32,12 +32,16 @@
# include <libgimp/gimpui.h>
# include <src/gimp-image.hh>
+# include <mln/core/point2d.hh>
# include <mln/level/fill.hh>
-// # include <mln/core/image2d.hh>
-// # include <mln/value/rgb8.hh>
+# include <mln/core/image2d.hh>
+# include <mln/value/rgb8.hh>
# include <mln/literal/all.hh>
-// # include <mln/display/show.hh>
-// # include <mln/display/remove.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/level/transform.hh>
+# include <mln/border/resize.hh>
+
+# include <mln/io/ppm/save.hh>
void build_milena_image(GimpPixelRgn *region);
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 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