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
December 2008
- 12 participants
- 201 discussions
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Add test for big_chess.
* jardonnet/test/big_chess.cc: Here.
big_chess.cc | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
Index: jardonnet/test/big_chess.cc
--- jardonnet/test/big_chess.cc (revision 0)
+++ jardonnet/test/big_chess.cc (revision 0)
@@ -0,0 +1,71 @@
+
+#include <iostream>
+
+# include <mln/core/image/sub_image_if.hh>
+# include <mln/core/image/image_if.hh>
+
+#include <mln/debug/println.hh>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/level/paste.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/fun/p2b/big_chess.hh>
+
+using namespace mln;
+using namespace mln::value;
+
+bool usage(int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ std::cout << argv[0] << " ima1.pgm ima2.pgm" << std::endl;
+ return false;
+ }
+ return true;
+}
+
+
+template <typename B>
+struct is_ima2_t : Function_p2b< is_ima2_t<B> >
+{
+ is_ima2_t(const B& box, const unsigned div)
+ : box(box), div(div)
+ {
+ }
+
+ typedef bool result;
+ bool operator()(const point2d& p) const
+ {
+ return !(p.row() / ((box.pmax().row() - 1) / div) % 2) &&
+ !(p.col() / ((box.pmax().row()-1) / div) % 2);
+ }
+
+ const B& box;
+ const unsigned div;
+};
+
+int main(int argc, char ** argv)
+{
+ if (not usage(argc,argv))
+ return 1;
+
+ typedef image2d<int_u8> I;
+
+ I ima1;
+ I ima2;
+ io::pgm::load(ima1, argv[1]);
+ io::pgm::load(ima2, argv[2]);
+
+ fun::p2b::big_chess<box2d> fun(ima1.domain(), 4);
+
+ image_if< I, fun::p2b::big_chess<box2d> > visio = ima1 | fun;
+
+ debug::println(visio);
+
+ level::paste(visio, ima2);
+
+ io::pgm::save(ima2, "out.ppm");
+}
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Add big_chess functor.
* mln/fun/p2b/big_chess.hh: Add this functor.
big_chess.hh | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
Index: mln/fun/p2b/big_chess.hh
--- mln/fun/p2b/big_chess.hh (revision 0)
+++ mln/fun/p2b/big_chess.hh (revision 0)
@@ -0,0 +1,95 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_FUN_P2B_BIG_CHESS_HH
+# define MLN_FUN_P2B_BIG_CHESS_HH
+
+/*! \file mln/fun/p2b/big_chess.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/function.hh>
+# include <mln/core/alias/point2d.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace p2b
+ {
+
+ // FIXME: Doc!
+ template <typename B>
+ struct big_chess : public Function_p2b< big_chess<B> >
+ {
+ typedef bool result;
+ typedef mln_psite(B) P;
+
+ big_chess(const B& box, const unsigned div);
+
+ bool operator()(const P& p) const;
+
+ const B& box;
+ const unsigned div;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template < typename B>
+ big_chess<B>::big_chess(const B& box, const unsigned div)
+ : box(box), div(div)
+ {
+ }
+
+ template < typename B>
+ inline
+ bool
+ big_chess<B>::operator()(const P& p) const
+ {
+ mln_coord(P) ret = 0;
+
+ for (short i = 0; i < P::dim; i++)
+ ret += p[i] / ((box.pmax()[i] - 1) / div);
+
+ return ret % 2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::p2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_P2B_BIG_CHESS_HH
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix a graph test.
* tests/core/image/graph_image.cc: Fix.
graph_image.cc | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Index: tests/core/image/graph_image.cc
--- tests/core/image/graph_image.cc (revision 2994)
+++ tests/core/image/graph_image.cc (working copy)
@@ -185,11 +185,10 @@
mln_assertion(ima(p) == i++);
typedef graph_elt_window<util::graph, fsite_t> win_t;
- typedef neighb<win_t> neigh_t;
+ win_t win;
{
// Window - Forward iteration
- win_t win;
mln_qiter_(win_t) q(win, p);
for_all (p)
{
@@ -202,7 +201,6 @@
{
// Window - Backward iteration
- win_t win;
mln_bkd_qiter_(win_t) q(win, p);
for_all (p)
{
@@ -213,10 +211,13 @@
}
}
+ typedef neighb<win_t> neigh_t;
+
{
// Neighborhood - Forward iteration
- neigh_t neigh(win_t());
+ neigh_t neigh(win);
mln_niter_(neigh_t) n(neigh, p);
+
for_all (p)
{
std::cout << "neighbors of " << p << " (" << ima(p) << "), " << std::endl;
@@ -230,7 +231,7 @@
{
// Neighborhood - Backward iteration
- neigh_t neigh(win_t());
+ neigh_t neigh(win);
mln_bkd_niter_(neigh_t) n(neigh, p);
for_all (p)
{
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix some extra tests.
* mln/display/remove.hh,
* mln/display/save.hh: Rename as...
* trash/display_remove.hh: ...this and...
* trash/display_save.hh: ...this.
* tests/display/all_headers.cc: Upgrade doc style.
* mln/display/all.hh: Update.
* tests/algebra/vec.cc: Fix.
* tests/morpho/erosion.cc: Cleanup.
Extra tests on specializations are performed by general.cc.
mln/display/all.hh | 16 ++-----
tests/algebra/vec.cc | 13 +++---
tests/display/all_headers.cc | 10 ++--
tests/morpho/erosion.cc | 93 +++++--------------------------------------
trash/display_remove.hh | 26 +++++-------
5 files changed, 40 insertions(+), 118 deletions(-)
Index: trash/display_remove.hh
--- trash/display_remove.hh (revision 2992)
+++ trash/display_remove.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,18 +29,14 @@
#ifndef MLN_DISPLAY_REMOVE_HH
# define MLN_DISPLAY_REMOVE_HH
-/*! \file mln/display/remove.hh
- *
- * \brief Remove all temporary files create by display::save.
- *
- */
-
-# include <mln/trait/image_from_grid.hh>
-# include <mln/core/image/image_if.hh>
-# include <mln/core/image/image2d.hh>
-# include <mln/display/save.hh>
+/// \file mln/display/remove.hh
+///
+/// Remove all temporary files create by display::save.
# include <map>
+# include <string>
+# include <mln/trace/all.hh>
+
namespace mln
{
@@ -47,12 +44,11 @@
namespace display
{
- /*! Remove all temporary images which are created by the routine
- * save.
- *
- */
+ /// Remove all temporary images which are created by the routine
+ /// save.
void remove();
+
# ifndef MLN_INCLUDE_ONLY
namespace impl
Property changes on: trash/display_remove.hh
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/display_save.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: tests/algebra/vec.cc
--- tests/algebra/vec.cc (revision 2993)
+++ tests/algebra/vec.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/algebra/vec.cc
- *
- * \brief Test on mln::algebra::vec.
- */
+/// \file tests/algebra/vec.cc
+///
+/// Test on mln::algebra::vec.
#include <mln/algebra/vec.hh>
#include <mln/value/int_u8.hh>
@@ -49,5 +49,6 @@
value::int_u8 i = 3;
mln_assertion((i * v_f) == (value::scalar(i) * v_f));
- mln_assertion((literal::zero + v_f) == v_f);
+ algebra::vec<3,float> O = literal::zero;
+ mln_assertion((O + v_f) == v_f);
}
Index: tests/morpho/erosion.cc
--- tests/morpho/erosion.cc (revision 2993)
+++ tests/morpho/erosion.cc (working copy)
@@ -51,91 +51,20 @@
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
win::rectangle2d rec(21, 21);
- win::hline2d hline(31);
- win::vline2d vline(31);
- win::diag2d diag2d(31);
- win::backdiag2d backdiag2d(31);
- win::octagon2d oct(6 * 3 + 1);
- image2d<int_u8> out;
- image2d<int_u8> ref;
-
-
-// trace::quiet = false;
-
-
- // Rectangle
-
- {
- ref = morpho::impl::generic::erosion_on_function(lena, rec);
-
- out = morpho::erosion(lena, rec);
- mln_assertion(out == ref);
-
- out = morpho::impl::erosion_arbitrary_2d(lena, rec);
- mln_assertion(out == ref);
- }
-
-
- // Hline
-
- {
- ref = morpho::impl::generic::erosion_on_function(lena, hline);
-
- out = morpho::erosion(lena, hline);
- mln_assertion(out == ref);
-
- out = morpho::impl::erosion_arbitrary_2d(lena, hline);
- mln_assertion(out == ref);
- }
-
-
- // Vline
-
- {
- ref = morpho::impl::generic::erosion_on_function(lena, vline);
-
- out = morpho::erosion(lena, vline);
- mln_assertion(out == ref);
-
- out = morpho::impl::erosion_arbitrary_2d(lena, vline);
- mln_assertion(out == ref);
- }
-
-
- // Diag2d
-
- {
- ref = morpho::impl::generic::erosion_on_function(lena, diag2d);
-
- out = morpho::erosion(lena, diag2d);
- mln_assertion(out == ref);
-
- out = morpho::impl::erosion_arbitrary_2d(lena, diag2d);
- mln_assertion(out == ref);
- }
-
-
- // Backdiag2d
-
- {
- ref = morpho::impl::generic::erosion_on_function(lena, backdiag2d);
-
- out = morpho::erosion(lena, backdiag2d);
- mln_assertion(out == ref);
-
- out = morpho::impl::erosion_arbitrary_2d(lena, backdiag2d);
- mln_assertion(out == ref);
- }
+ morpho::erosion(lena, rec);
+ win::hline2d hline(31);
+ morpho::erosion(lena, hline);
+ win::vline2d vline(31);
+ morpho::erosion(lena, vline);
- // Octagon
+ win::diag2d diag2d(31);
+ morpho::erosion(lena, diag2d);
- {
- ref = morpho::impl::generic::erosion_on_function(lena, oct);
- // io::pgm::save(ref, "out_oct_ref.pgm");
- out = morpho::erosion(lena, oct);
- mln_assertion(out == ref);
- }
+ win::backdiag2d backdiag2d(31);
+ morpho::erosion(lena, backdiag2d);
+ win::octagon2d oct(6 * 3 + 1);
+ morpho::erosion(lena, oct);
}
Index: tests/display/all_headers.cc
--- tests/display/all_headers.cc (revision 2993)
+++ tests/display/all_headers.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/display/all_headers.cc
- *
- * \brief Tests on mln::display.
- */
+/// \file tests/display/all_headers.cc
+///
+/// Tests on mln::display.
#include <mln/display/all.hh>
Index: mln/display/all.hh
--- mln/display/all.hh (revision 2993)
+++ mln/display/all.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_DISPLAY_ALL_HH
# define MLN_DISPLAY_ALL_HH
-/*! \file mln/display/all.hh
- *
- * \brief File that includes all display routines.
- */
+/// \file mln/display/all.hh
+///
+/// File that includes all display routines.
namespace mln
@@ -52,10 +52,6 @@
}
-# include <mln/display/color_pretty.hh>
-# include <mln/display/remove.hh>
-# include <mln/display/save_and_show.hh>
-# include <mln/display/save.hh>
-# include <mln/display/show.hh>
+
#endif // ! MLN_DISPLAY_ALL_HH
1
0
* tests/all_headers.cc,
* mln/all.hh: Add new 'all' header and update the related test.
* mln/core/neighb.hh,
* mln/core/internal/site_relative_iterator_base.hh,
* mln/core/internal/neighborhood_base.hh,
* mln/core/alias/neighb2d.hh: Fix comments.
* mln/core/internal/graph_neighborhood_base.hh,
* mln/core/image/line_graph_neighborhood_piter.hh,
* mln/core/image/line_graph_elt_neighborhood.hh,
* mln/core/image/graph_neighborhood_piter.hh,
* mln/core/image/graph_elt_neighborhood.hh: removed. Not needed
anymore. The neighborhood is deduced from the window.
* mln/core/image/line_graph_window_piter.hh,
* mln/core/image/line_graph_elt_window.hh,
* mln/core/image/graph_window_piter.hh,
* mln/core/image/graph_elt_window.hh: revamp. Use the new graph
iterators correctly.
* mln/core/internal/graph_psite_base.hh: add a new method element().
* mln/core/internal/line_graph_vicinity_piter.hh,
* mln/core/internal/graph_relative_piter.hh: removed. Not needed
anymore since graph and line graph share the same piter object.
* mln/core/internal/graph_window_base.hh: revamp and cleanup.
* mln/core/site_set/p_graph_piter.hh: add new methods such as graph().
* mln/core/site_set/p_edges.hh,
* mln/core/site_set/p_vertices.hh: add a new typedef for the function
type.
* mln/util/internal/graph_nbh_iter.hh: add default constructor.
* mln/util/internal/graph_nbh_iter_base.hh: fix invalidate_().
* tests/core/image/graph_image.cc,
* tests/core/image/line_graph_image.cc: fix tests.
* tests/unit_test/Makefile.am,
* tests/unit_test/mln_all.cc,
* tests/unit_test/mln_canvas_distance_front.cc,
* tests/unit_test/mln_core_image_graph_elt_neighborhood.cc,
* tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc,
* tests/unit_test/mln_core_image_line_graph_elt_piter.cc,
* tests/unit_test/mln_core_internal_graph_neighborhood_base.cc,
* tests/unit_test/mln_core_internal_graph_relative_piter.cc,
* tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc,
* tests/unit_test/mln_transform_distance.cc,
* tests/unit_test/mln_transform_distance_front.cc,
* tests/unit_test/mln_transform_influence_zone_front.cc,
* tests/unit_test/mln_transform_internal_all.cc,
* tests/unit_test/mln_transform_internal_distance_functor.cc,
* tests/unit_test/mln_transform_internal_influence_zone_functor.cc:
Update unit tests.
* tests/util/line_graph.cc: remove useless debug.
---
milena/ChangeLog | 65 +++++
milena/{tests/all_headers.cc => mln/all.hh} | 14 +-
milena/mln/core/alias/neighb2d.hh | 86 ++++----
milena/mln/core/image/graph_elt_neighborhood.hh | 119 ---------
milena/mln/core/image/graph_elt_window.hh | 71 ++----
milena/mln/core/image/graph_neighborhood_piter.hh | 267 --------------------
milena/mln/core/image/graph_window_piter.hh | 197 ++++-----------
.../mln/core/image/line_graph_elt_neighborhood.hh | 119 ---------
milena/mln/core/image/line_graph_elt_window.hh | 70 ++----
.../core/image/line_graph_neighborhood_piter.hh | 267 --------------------
milena/mln/core/image/line_graph_window_piter.hh | 265 -------------------
.../mln/core/internal/graph_neighborhood_base.hh | 95 -------
milena/mln/core/internal/graph_psite_base.hh | 12 +
milena/mln/core/internal/graph_relative_piter.hh | 113 ---------
milena/mln/core/internal/graph_window_base.hh | 44 ++--
.../mln/core/internal/line_graph_vicinity_piter.hh | 138 ----------
milena/mln/core/internal/neighborhood_base.hh | 2 +-
.../core/internal/site_relative_iterator_base.hh | 4 +-
milena/mln/core/neighb.hh | 5 +-
milena/mln/core/site_set/p_edges.hh | 3 +
milena/mln/core/site_set/p_graph_piter.hh | 24 ++-
milena/mln/core/site_set/p_vertices.hh | 2 +
milena/mln/util/internal/graph_nbh_iter.hh | 119 ++++-----
milena/mln/util/internal/graph_nbh_iter_base.hh | 11 +-
milena/tests/all_headers.cc | 68 +-----
milena/tests/core/image/graph_image.cc | 16 +-
milena/tests/core/image/line_graph_image.cc | 39 ++-
milena/tests/unit_test/Makefile.am | 28 ++-
milena/tests/unit_test/mln_all.cc | 8 +
.../tests/unit_test/mln_canvas_distance_front.cc | 8 +
.../mln_core_image_graph_elt_neighborhood.cc | 8 -
.../mln_core_image_line_graph_elt_neighborhood.cc | 8 -
.../mln_core_image_line_graph_elt_piter.cc | 8 +
.../mln_core_internal_graph_neighborhood_base.cc | 8 -
.../mln_core_internal_graph_relative_piter.cc | 8 -
.../mln_core_internal_line_graph_vicinity_piter.cc | 8 -
milena/tests/unit_test/mln_transform_distance.cc | 8 -
.../unit_test/mln_transform_distance_front.cc | 8 +
.../mln_transform_influence_zone_front.cc | 8 +
.../tests/unit_test/mln_transform_internal_all.cc | 8 +
.../mln_transform_internal_distance_functor.cc | 8 +
...ln_transform_internal_influence_zone_functor.cc | 8 +
milena/tests/util/line_graph.cc | 3 -
43 files changed, 451 insertions(+), 1927 deletions(-)
copy milena/{tests/all_headers.cc => mln/all.hh} (94%)
delete mode 100644 milena/mln/core/image/graph_elt_neighborhood.hh
delete mode 100644 milena/mln/core/image/graph_neighborhood_piter.hh
delete mode 100644 milena/mln/core/image/line_graph_elt_neighborhood.hh
delete mode 100644 milena/mln/core/image/line_graph_neighborhood_piter.hh
delete mode 100644 milena/mln/core/image/line_graph_window_piter.hh
delete mode 100644 milena/mln/core/internal/graph_neighborhood_base.hh
delete mode 100644 milena/mln/core/internal/graph_relative_piter.hh
delete mode 100644 milena/mln/core/internal/line_graph_vicinity_piter.hh
create mode 100644 milena/tests/unit_test/mln_all.cc
create mode 100644 milena/tests/unit_test/mln_canvas_distance_front.cc
delete mode 100644 milena/tests/unit_test/mln_core_image_graph_elt_neighborhood.cc
delete mode 100644 milena/tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc
create mode 100644 milena/tests/unit_test/mln_core_image_line_graph_elt_piter.cc
delete mode 100644 milena/tests/unit_test/mln_core_internal_graph_neighborhood_base.cc
delete mode 100644 milena/tests/unit_test/mln_core_internal_graph_relative_piter.cc
delete mode 100644 milena/tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc
delete mode 100644 milena/tests/unit_test/mln_transform_distance.cc
create mode 100644 milena/tests/unit_test/mln_transform_distance_front.cc
create mode 100644 milena/tests/unit_test/mln_transform_influence_zone_front.cc
create mode 100644 milena/tests/unit_test/mln_transform_internal_all.cc
create mode 100644 milena/tests/unit_test/mln_transform_internal_distance_functor.cc
create mode 100644 milena/tests/unit_test/mln_transform_internal_influence_zone_functor.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 2105013..bf954d2 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,68 @@
+2008-12-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Revamp neighborhoods and windows based on graph.
+
+ * tests/all_headers.cc,
+ * mln/all.hh: Add new 'all' header and update the related test.
+
+ * mln/core/neighb.hh,
+ * mln/core/internal/site_relative_iterator_base.hh,
+ * mln/core/internal/neighborhood_base.hh,
+ * mln/core/alias/neighb2d.hh: Fix comments.
+
+ * mln/core/internal/graph_neighborhood_base.hh,
+ * mln/core/image/line_graph_neighborhood_piter.hh,
+ * mln/core/image/line_graph_elt_neighborhood.hh,
+ * mln/core/image/graph_neighborhood_piter.hh,
+ * mln/core/image/graph_elt_neighborhood.hh: removed. Not needed
+ anymore. The neighborhood is deduced from the window.
+
+ * mln/core/image/line_graph_window_piter.hh,
+ * mln/core/image/line_graph_elt_window.hh,
+ * mln/core/image/graph_window_piter.hh,
+ * mln/core/image/graph_elt_window.hh: revamp. Use the new graph
+ iterators correctly.
+
+ * mln/core/internal/graph_psite_base.hh: add a new method element().
+
+ * mln/core/internal/line_graph_vicinity_piter.hh,
+ * mln/core/internal/graph_relative_piter.hh: removed. Not needed
+ anymore since graph and line graph share the same piter object.
+
+ * mln/core/internal/graph_window_base.hh: revamp and cleanup.
+
+ * mln/core/site_set/p_graph_piter.hh: add new methods such as graph().
+
+ * mln/core/site_set/p_edges.hh,
+ * mln/core/site_set/p_vertices.hh: add a new typedef for the function
+ type.
+
+ * mln/util/internal/graph_nbh_iter.hh: add default constructor.
+
+ * mln/util/internal/graph_nbh_iter_base.hh: fix invalidate_().
+
+ * tests/core/image/graph_image.cc,
+ * tests/core/image/line_graph_image.cc: fix tests.
+
+ * tests/unit_test/Makefile.am,
+ * tests/unit_test/mln_all.cc,
+ * tests/unit_test/mln_canvas_distance_front.cc,
+ * tests/unit_test/mln_core_image_graph_elt_neighborhood.cc,
+ * tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc,
+ * tests/unit_test/mln_core_image_line_graph_elt_piter.cc,
+ * tests/unit_test/mln_core_internal_graph_neighborhood_base.cc,
+ * tests/unit_test/mln_core_internal_graph_relative_piter.cc,
+ * tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc,
+ * tests/unit_test/mln_transform_distance.cc,
+ * tests/unit_test/mln_transform_distance_front.cc,
+ * tests/unit_test/mln_transform_influence_zone_front.cc,
+ * tests/unit_test/mln_transform_internal_all.cc,
+ * tests/unit_test/mln_transform_internal_distance_functor.cc,
+ * tests/unit_test/mln_transform_internal_influence_zone_functor.cc:
+ Update unit tests.
+
+ * tests/util/line_graph.cc: remove useless debug.
+
2008-12-04 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make tests compile without warnings.
diff --git a/milena/tests/all_headers.cc b/milena/mln/all.hh
similarity index 94%
copy from milena/tests/all_headers.cc
copy to milena/mln/all.hh
index 34da33b..f095601 100644
--- a/milena/tests/all_headers.cc
+++ b/milena/mln/all.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -26,9 +25,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/all_headers.cc
+#ifndef MLN_ALL_HH_
+# define MLN_ALL_HH_
+
+/// \file mln/all.hh
///
-/// Tests with all headers. (check norris tests)
+/// File that includes all the headers.
#include <mln/util/all.hh>
#include <mln/fun/p2v/all.hh>
@@ -98,7 +100,5 @@
#include <mln/essential/2d.hh>
#include <mln/essential/3d.hh>
-int main ()
-{
+#endif // ! MLN_ALL_HH_
-}
diff --git a/milena/mln/core/alias/neighb2d.hh b/milena/mln/core/alias/neighb2d.hh
index de5971f..6f78450 100644
--- a/milena/mln/core/alias/neighb2d.hh
+++ b/milena/mln/core/alias/neighb2d.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,13 +28,13 @@
#ifndef MLN_CORE_ALIAS_NEIGHB2D_HH
# define MLN_CORE_ALIAS_NEIGHB2D_HH
-/*! \file mln/core/alias/neighb2d.hh
- *
- * \brief Definition of the mln::neighb2d alias and of some classical
- * 2D neighborhoods.
- *
- * \todo Add symmetry and non-centering tests in conversion.
- */
+/// \file mln/core/alias/neighb2d.hh
+///
+/// Definition of the mln::neighb2d alias and of some classical
+/// 2D neighborhoods.
+///
+/// \todo Add symmetry and non-centering tests in conversion.
+
# include <cmath>
# include <mln/core/alias/window2d.hh>
@@ -45,9 +45,9 @@
namespace mln
{
- /*! \brief Type alias for a neighborhood defined on the 2D square
- * grid with integer coordinates.
- */
+ /// Type alias for a neighborhood defined on the 2D square
+ /// grid with integer coordinates.
+ ///
typedef neighb<window2d> neighb2d;
}
@@ -56,47 +56,47 @@ namespace mln
namespace mln
{
- /*! \brief 4-connectivity neighborhood on the 2D grid.
- *
- * - o -
- * o x o
- * - o -
- *
- * \return A neighb2d.
- */
+ /// 4-connectivity neighborhood on the 2D grid.
+ ///
+ /// - o -
+ /// o x o
+ /// - o -
+ ///
+ /// \return A neighb2d.
+ ///
const neighb2d& c4();
- /*! \brief 8-connectivity neighborhood on the 2D grid.
- *
- * o o o
- * o x o
- * o o o
- *
- * \return A neighb2d.
- */
+ /// 8-connectivity neighborhood on the 2D grid.
+ ///
+ /// o o o
+ /// o x o
+ /// o o o
+ ///
+ /// \return A neighb2d.
+ ///
const neighb2d& c8();
- /*! \brief Horizontal 2-connectivity neighborhood on the 2D grid.
- *
- * - - -
- * o x o
- * - - -
- *
- * \return A neighb2d.
- */
+ /// Horizontal 2-connectivity neighborhood on the 2D grid.
+ ///
+ /// - - -
+ /// o x o
+ /// - - -
+ ///
+ /// \return A neighb2d.
+ ///
const neighb2d& c2_row();
- /*! \brief Vertical 2-connectivity neighborhood on the 2D grid.
- *
- * - o -
- * - x -
- * - o -
- *
- * \return A neighb2d.
- */
+ /// Vertical 2-connectivity neighborhood on the 2D grid.
+ ///
+ /// - o -
+ /// - x -
+ /// - o -
+ ///
+ /// \return A neighb2d.
+ ///
const neighb2d& c2_col();
diff --git a/milena/mln/core/image/graph_elt_neighborhood.hh b/milena/mln/core/image/graph_elt_neighborhood.hh
deleted file mode 100644
index 8ec022b..0000000
--- a/milena/mln/core/image/graph_elt_neighborhood.hh
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// 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_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH
-# define MLN_CORE_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH
-
-/// \file mln/core/image/graph_elt_neighborhood.hh
-/// Definition of the elementary ``neighborhood'' on a graph.
-
-# include <set>
-
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/internal/graph_neighborhood_base.hh>
-# include <mln/core/site_set/p_vertices_psite.hh>
-# include <mln/core/image/graph_neighborhood_piter.hh>
-
-# include <mln/core/image/graph_elt_window.hh>
-
-
-namespace mln
-{
- // Fwd decls.
- template <typename G, typename F, typename N> class graph_neighborhood_fwd_piter;
- template <typename G, typename F, typename N> class graph_neighborhood_bkd_piter;
-
-
- /// Elementary neighborhood on graph class.
- template <typename G, typename F>
- class graph_elt_neighborhood
- : public graph_neighborhood_base<G,
- F,
- p_vertices_psite<G, F>,
- graph_elt_neighborhood<G, F> >
- {
- typedef graph_elt_neighborhood<G, F> self_;
-
- public:
- /// Associated types.
- /// \{
- /// The type of psite corresponding to the neighborhood.
- typedef p_vertices_psite<G, F> psite;
-
- /// Site_Iterator type to browse the psites of the
- /// neighborhood w.r.t. the ordering of vertices.
- typedef graph_neighborhood_fwd_piter<G, F, self_> fwd_niter;
-
- /// Site_Iterator type to browse the psites of the
- /// neighborhood w.r.t. the reverse ordering of vertices.
- typedef graph_neighborhood_bkd_piter<G, F, self_> bkd_niter;
-
- /// The default niter type.
- typedef fwd_niter niter;
- /// \}
-
-
- /// Services for iterators.
- /// \{
- /// Compute the set of sites for this neighborhood around \a piter.
- template <typename Piter>
- void compute_sites_(Site_Iterator<Piter>& piter) const;
- /// \}
-
- protected:
- typedef graph_neighborhood_base<G, F, psite, self_> super_;
- typedef typename super_::sites_t sites_t;
- };
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename G, typename F>
- template <typename Piter>
- inline
- void
- graph_elt_neighborhood<G, F>::compute_sites_(Site_Iterator<Piter>& piter_) const
- {
- Piter& piter = exact(piter_);
- unsigned central_vertex = piter.center().v().id();
- const G& g = piter.center().graph();
-
- sites_t& sites = piter.sites();
- sites.clear();
-
- // Adjacent vertices.
- for (unsigned i = 0; i < g.v_nmax_nbh_vertices(central_vertex); ++i)
- sites.insert(g.v_ith_nbh_vertex(central_vertex, i));
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
-} // end of namespace mln
-
-
-#endif // ! MLN_CORE_IMAGE_GRAPH_ELT_NEIGHBORHOOD_HH
diff --git a/milena/mln/core/image/graph_elt_window.hh b/milena/mln/core/image/graph_elt_window.hh
index f33b90a..b48d668 100644
--- a/milena/mln/core/image/graph_elt_window.hh
+++ b/milena/mln/core/image/graph_elt_window.hh
@@ -30,12 +30,14 @@
# define MLN_CORE_IMAGE_GRAPH_ELT_WINDOW_HH
/// \file mln/core/image/graph_elt_window.hh
+///
/// Definition of the elementary ``window'' on a graph.
# include <mln/core/concept/window.hh>
+# include <mln/core/internal/neighborhood_base.hh>
# include <mln/core/internal/graph_window_base.hh>
-# include <mln/core/site_set/p_vertices_psite.hh>
# include <mln/core/image/graph_window_piter.hh>
+# include <mln/core/site_set/p_vertices.hh>
namespace mln
@@ -44,10 +46,21 @@ namespace mln
/// Forward declaration
template <typename G, typename F> class graph_elt_window;
+ namespace internal
+ {
+
+ template <typename G, typename F, typename E>
+ struct neighborhood_impl<graph_elt_window<G,F>,E>
+ : public neighborhood_extra_impl<graph_elt_window<G,F>,E>
+ {
+ };
+
+ } // end of namespace mln::internal
+
+
namespace trait
{
- ///FIXME: check that!
template <typename G, typename F>
struct window_< mln::graph_elt_window<G, F> >
{
@@ -61,68 +74,36 @@ namespace mln
/// \brief Elementary window on graph class.
template <typename G, typename F>
- class graph_elt_window : public graph_window_base<
- G,
- F,
- p_vertices_psite<G, F>,
- graph_elt_window<G, F> >
+ class graph_elt_window : public graph_window_base<mln_result(F),
+ graph_elt_window<G,F> >
{
typedef graph_elt_window<G, F> self_;
+ typedef mln_vertex_nbh_vertex_fwd_iter(G) nbh_fwd_iter_;
+ typedef mln_vertex_nbh_vertex_bkd_iter(G) nbh_bkd_iter_;
+
public:
/// Associated types.
/// \{
+ typedef p_vertices<G,F> S;
/// The type of psite corresponding to the window.
- typedef p_vertices_psite<G, F> psite;
+ typedef mln_psite(S) psite;
- /// \brief Site_Iterator type to browse the psites of the window
+ /// Site_Iterator type to browse the psites of the window
/// w.r.t. the ordering of vertices.
- typedef graph_window_fwd_piter<G, F, self_> fwd_qiter;
+ typedef graph_window_piter<S,self_,nbh_fwd_iter_> fwd_qiter;
- /// \brief Site_Iterator type to browse the psites of the window
+ /// Site_Iterator type to browse the psites of the window
/// w.r.t. the reverse ordering of vertices.
- typedef graph_window_bkd_piter<G, F, self_> bkd_qiter;
+ typedef graph_window_piter<S,self_,nbh_bkd_iter_> bkd_qiter;
/// The default qiter type.
typedef fwd_qiter qiter;
/// \}
- /// Services for iterators.
- /// \{
- /// Compute the set of sites for this window around \a piter.
- template <typename Piter>
- void compute_sites_(Site_Iterator<Piter>& piter) const;
- /// \}
-
- protected:
- typedef graph_window_base<G, F, psite, self_> super_;
- typedef typename super_::sites_t sites_t;
};
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename G, typename F>
- template <typename Piter>
- inline
- void
- graph_elt_window<G, F>::compute_sites_(Site_Iterator<Piter>& piter_) const
- {
- Piter& piter = exact(piter_);
- const G& g = piter.center().graph();
-
- unsigned central_vertex = piter.center().v().id();
- sites_t& sites = piter.sites();
- sites.clear();
-
- sites.insert(central_vertex);
- for (unsigned i = 0; i < g.v_nmax_nbh_vertices(central_vertex); ++i)
- sites.insert(g.v_ith_nbh_vertex(central_vertex, i));
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln
diff --git a/milena/mln/core/image/graph_neighborhood_piter.hh b/milena/mln/core/image/graph_neighborhood_piter.hh
deleted file mode 100644
index 5c8d1c8..0000000
--- a/milena/mln/core/image/graph_neighborhood_piter.hh
+++ /dev/null
@@ -1,267 +0,0 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// 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_IMAGE_GRAPH_NEIGHBORHOOD_PITER_HH
-# define MLN_CORE_IMAGE_GRAPH_NEIGHBORHOOD_PITER_HH
-
-/// \file mln/core/image/graph_neighborhood_piter.hh
-/// \brief Definition of a point iterator on a graph neighborhood.
-
-# include <mln/core/internal/graph_relative_piter.hh>
-
-namespace mln
-{
-
- /*----------------------------------------.
- | graph_neighborhood_fwd_piter<G, F, N>. |
- `----------------------------------------*/
-
- /// \p G Graph type.
- /// \p F function i2p used in the p_vertices<G, F>.
- /// \p N Type of the neighborhood.
- template <typename G, typename F, typename N>
- class graph_neighborhood_fwd_piter :
- public internal::graph_relative_piter< mln_result(F), N,
- graph_neighborhood_fwd_piter<G, F, N> >
- {
- typedef graph_neighborhood_fwd_piter<G, F, N> self_;
- typedef internal::graph_relative_piter<mln_result(F), N, self_> super_;
-
- public:
- /// The Point_Site type.
- typedef mln_psite(N) psite;
-
- public:
- /// Construction.
- /// \{
- graph_neighborhood_fwd_piter();
- template <typename Pref>
- graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh,
- const Pref& p_ref);
- /// \}
-
- /// Manipulation.
- /// \{
- /// Test if the iterator is valid.
- bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
-
- /// Start an iteration.
- void do_start_();
- /// Go to the next point.
- void do_next_();
-
- /// Compute the current psite.
- psite compute_p_() const;
- /// \}
-
- private:
- /// An iterator on the set of adjacent edges.
- typename super_::sites_t::const_iterator i_;
- };
-
-
- /*----------------------------------------.
- | graph_neighborhood_bkd_piter<G, F, N>. |
- `----------------------------------------*/
-
- template <typename G, typename F, typename N>
- class graph_neighborhood_bkd_piter :
- public internal::graph_relative_piter< mln_result(F), N,
- graph_neighborhood_bkd_piter<G, F, N> >
- {
- typedef graph_neighborhood_bkd_piter<G, F, N> self_;
- typedef internal::graph_relative_piter<mln_result(F), N, self_> super_;
-
- /// The Point_Site type.
- typedef mln_psite(N) psite;
-
- public:
- /// Construction.
- /// \{
- graph_neighborhood_bkd_piter();
- template <typename Pref>
- graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh,
- const Pref& p_ref);
- /// \}
-
- /// Manipulation.
- /// \{
- /// Test if the iterator is valid.
- bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
-
- /// Start an iteration.
- void do_start_();
- /// Go to the next point.
- void do_next_();
-
- /// Compute the current psite.
- psite compute_p_() const;
- /// \}
-
- private:
- /// An iterator on the set of adjacent edges.
- typename super_::sites_t::const_reverse_iterator i_;
- };
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- /*----------------------------------------.
- | graph_neighborhood_fwd_piter<G, F, N>. |
- `----------------------------------------*/
-
- template <typename G, typename F, typename N>
- inline
- graph_neighborhood_fwd_piter<G, F, N>::graph_neighborhood_fwd_piter()
- {
- }
-
- template <typename G, typename F, typename N>
- template <typename Pref>
- inline
- graph_neighborhood_fwd_piter<G, F, N>::graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh,
- const Pref& p_ref)
- : super_(p_ref)
- {
- this->change_target(exact(nbh));
- }
-
- template <typename G, typename F, typename N>
- inline
- bool
- graph_neighborhood_fwd_piter<G, F, N>::is_valid_() const
- {
- return i_ != this->sites_.end();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- graph_neighborhood_fwd_piter<G, F, N>::invalidate_()
- {
- i_ = this->sites_.end();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- graph_neighborhood_fwd_piter<G, F, N>::do_start_()
- {
- this->site_set().compute_sites_(*this);
- i_ = this->sites_.begin();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- graph_neighborhood_fwd_piter<G, F, N>::do_next_()
- {
- ++i_;
- }
-
- template <typename G, typename F, typename N>
- inline
- mln_psite(N)
- graph_neighborhood_fwd_piter<G, F, N>::compute_p_() const
- {
- return p_vertices_psite<G, F>(this->center().site_set(), *i_);
- }
-
-
- /*----------------------------------------.
- | graph_neighborhood_bkd_piter<G, F, N>. |
- `----------------------------------------*/
-
- template <typename G, typename F, typename N>
- inline
- graph_neighborhood_bkd_piter<G, F, N>::graph_neighborhood_bkd_piter()
- {
- }
-
- template <typename G, typename F, typename N>
- template <typename Pref>
- inline
- graph_neighborhood_bkd_piter<G, F, N>::graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh,
- const Pref& p_ref)
- : super_(p_ref)
- {
- this->change_target(exact(nbh));
- }
-
- template <typename G, typename F, typename N>
- inline
- bool
- graph_neighborhood_bkd_piter<G, F, N>::is_valid_() const
- {
- return i_ != this->sites_.rend();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- graph_neighborhood_bkd_piter<G, F, N>::invalidate_()
- {
- i_ = this->sites_.rend();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- graph_neighborhood_bkd_piter<G, F, N>::do_start_()
- {
- this->site_set().compute_sites_(*this);
- i_ = this->sites_.rbegin();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- graph_neighborhood_bkd_piter<G, F, N>::do_next_()
- {
- ++i_;
- }
-
- template <typename G, typename F, typename N>
- inline
- mln_psite(N)
- graph_neighborhood_bkd_piter<G, F, N>::compute_p_() const
- {
- return p_vertices_psite<G, F>(this->center().site_set(), *i_);
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
-} // end of namespace mln
-
-#endif // ! MLN_CORE_IMAGE_GRAPH_NEIGHBORHOOD_PITER_HH
diff --git a/milena/mln/core/image/graph_window_piter.hh b/milena/mln/core/image/graph_window_piter.hh
index 33d9a9a..d95963f 100644
--- a/milena/mln/core/image/graph_window_piter.hh
+++ b/milena/mln/core/image/graph_window_piter.hh
@@ -30,81 +30,43 @@
# define MLN_CORE_IMAGE_GRAPH_WINDOW_PITER_HH
/// \file mln/core/image/graph_window_piter.hh
-/// \brief Definition of a point iterator on a graph window.
+///
+/// Definition of a point iterator on a line_graph window.
+
+
+# include <mln/core/internal/site_relative_iterator_base.hh>
-# include <mln/core/internal/graph_relative_piter.hh>
namespace mln
{
- /*----------------------------------.
- | graph_window_fwd_piter<G, F, W>. |
- `----------------------------------*/
-
- /// \brief Forward iterator on graph window.
- template <typename G, typename F, typename W>
- class graph_window_fwd_piter :
- public internal::graph_relative_piter< mln_result(F), W, graph_window_fwd_piter<G, F, W> >
+ /// Forward iterator on line graph window.
+ template <typename S, typename W, typename I>
+ class graph_window_piter
+ : public internal::site_relative_iterator_base< W,
+ graph_window_piter<S,W,I> >
{
- typedef graph_window_fwd_piter<G, F, W> self_;
- typedef internal::graph_relative_piter<mln_result(F), W, self_> super_;
-
- public:
- /// The Point_Site type.
- typedef mln_psite(W) psite;
+ typedef graph_window_piter<S,W,I> self_;
+ typedef internal::site_relative_iterator_base<W,self_> super_;
public:
- /// Construction.
- /// \{
- graph_window_fwd_piter();
- template <typename Pref>
- graph_window_fwd_piter(const Window<W>& win, const Pref& p_ref);
- /// \}
-
- /// Manipulation.
+ /// Associated types
/// \{
- /// Test if the iterator is valid.
- bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
+ typedef mln_result(S::fun_t) P;
+ enum { dim = P::dim };
- /// Start an iteration.
- void do_start_();
- /// Go to the next point.
- void do_next_();
-
- /// Compute the current psite.
- psite compute_p_() const;
+ // FIXME: Dummy typedef.
+ typedef void dpoint;
+ // FIXME: Dummy value.
+ typedef void mesh;
/// \}
- private:
- /// An iterator on the set of adjacent vertices.
- typename super_::sites_t::const_iterator i_;
- };
-
-
- /*----------------------------------.
- | graph_window_bkd_piter<G, F, W>. |
- `----------------------------------*/
-
- /// \brief Backward iterator on graph window.
- template <typename G, typename F, typename W>
- class graph_window_bkd_piter :
- public internal::graph_relative_piter< mln_result(F), W, graph_window_bkd_piter<G, F, W> >
- {
- typedef graph_window_bkd_piter<G, F, W> self_;
- typedef internal::graph_relative_piter<mln_result(F), W, self_> super_;
-
- public:
- /// The Point_Site type.
- typedef mln_psite(W) psite;
-
- public:
/// Construction.
/// \{
- graph_window_bkd_piter();
+ graph_window_piter();
template <typename Pref>
- graph_window_bkd_piter(const Window<W>& win, const Pref& p_ref);
+ graph_window_piter(const Window<W>& win,
+ const Pref& p_ref);
/// \}
/// Manipulation.
@@ -120,139 +82,72 @@ namespace mln
void do_next_();
/// Compute the current psite.
- psite compute_p_() const;
+ mln_psite(W) compute_p_() const;
/// \}
private:
- /// An iterator on the set of adjacent vertices.
- typename super_::sites_t::const_reverse_iterator i_;
+ I iter_;
};
-
# ifndef MLN_INCLUDE_ONLY
- /*-------------------------------.
- | graph_window_fwd_piter<G, F, W>. |
- `-------------------------------*/
-
- template <typename G, typename F, typename W>
- inline
- graph_window_fwd_piter<G, F, W>::graph_window_fwd_piter()
- {
- }
-
- template <typename G, typename F, typename W>
- template <typename Pref>
- inline
- graph_window_fwd_piter<G, F, W>::graph_window_fwd_piter(const Window<W>& win,
- const Pref& p_ref)
- : super_(p_ref)
- {
- this->change_target(exact(win));
- }
-
- template <typename G, typename F, typename W>
- inline
- bool
- graph_window_fwd_piter<G, F, W>::is_valid_() const
- {
- return i_ != this->sites_.end();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- graph_window_fwd_piter<G, F, W>::invalidate_()
- {
- i_ = this->sites_.end();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- graph_window_fwd_piter<G, F, W>::do_start_()
- {
- this->site_set().compute_sites_(*this);
- i_ = this->sites_.begin();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- graph_window_fwd_piter<G, F, W>::do_next_()
- {
- ++i_;
- }
-
- template <typename G, typename F, typename W>
- inline
- mln_psite(W)
- graph_window_fwd_piter<G, F, W>::compute_p_() const
- {
- return p_vertices_psite<G, F>(this->center().site_set(), *i_);
- }
-
-
- /*-------------------------------.
- | graph_window_bkd_piter<G, F, W>. |
- `-------------------------------*/
- template <typename G, typename F, typename W>
+ template <typename S, typename W, typename I>
inline
- graph_window_bkd_piter<G, F, W>::graph_window_bkd_piter()
+ graph_window_piter<S,W,I>::graph_window_piter()
{
}
- template <typename G, typename F, typename W>
+ template <typename S, typename W, typename I>
template <typename Pref>
inline
- graph_window_bkd_piter<G, F, W>::graph_window_bkd_piter(const Window<W>& win,
- const Pref& p_ref)
- : super_(p_ref)
+ graph_window_piter<S,W,I>::graph_window_piter(const Window<W>& win,
+ const Pref& p_ref)
+ : iter_(p_ref.hook_iter_())
{
this->change_target(exact(win));
+ center_at(p_ref);
}
- template <typename G, typename F, typename W>
+ template <typename S, typename W, typename I>
inline
bool
- graph_window_bkd_piter<G, F, W>::is_valid_() const
+ graph_window_piter<S,W,I>::is_valid_() const
{
- return i_ != this->sites_.rend();
+ return iter_.is_valid();
}
- template <typename G, typename F, typename W>
+ template <typename S, typename W, typename I>
inline
void
- graph_window_bkd_piter<G, F, W>::invalidate_()
+ graph_window_piter<S,W,I>::invalidate_()
{
- i_ = this->sites_.rend();
+ iter_.invalidate();
}
- template <typename G, typename F, typename W>
+ template <typename S, typename W, typename I>
inline
void
- graph_window_bkd_piter<G, F, W>::do_start_()
+ graph_window_piter<S,W,I>::do_start_()
{
- this->site_set().compute_sites_(*this);
- i_ = this->sites_.rbegin();
+ iter_.start();
}
- template <typename G, typename F, typename W>
+ template <typename S, typename W, typename I>
inline
void
- graph_window_bkd_piter<G, F, W>::do_next_()
+ graph_window_piter<S,W,I>::do_next_()
{
- ++i_;
+ iter_.next();
}
- template <typename G, typename F, typename W>
+ template <typename S, typename W, typename I>
inline
mln_psite(W)
- graph_window_bkd_piter<G, F, W>::compute_p_() const
+ graph_window_piter<S,W,I>::compute_p_() const
{
- return p_vertices_psite<G, F>(this->center().site_set(), *i_);
+ return mln_psite(S)(this->center().site_set(), iter_.id());
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/core/image/line_graph_elt_neighborhood.hh b/milena/mln/core/image/line_graph_elt_neighborhood.hh
deleted file mode 100644
index 99dabe4..0000000
--- a/milena/mln/core/image/line_graph_elt_neighborhood.hh
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// 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_IMAGE_LINE_GRAPH_ELT_NEIGHBORHOOD_HH
-# define MLN_CORE_IMAGE_LINE_GRAPH_ELT_NEIGHBORHOOD_HH
-
-/// \file mln/core/image/line_graph_elt_neighborhood.hh
-///
-/// Definition of the elementary ``neighborhood'' on a line graph.
-
-# include <set>
-
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/core/internal/graph_neighborhood_base.hh>
-# include <mln/core/site_set/p_edges_psite.hh>
-# include <mln/core/image/line_graph_neighborhood_piter.hh>
-
-# include <mln/core/image/line_graph_elt_window.hh>
-
-
-namespace mln
-{
-
- /// Elementary neighborhood on line graph class.
- template <typename G, typename F>
- class line_graph_elt_neighborhood
- : public graph_neighborhood_base<G,
- F,
- p_edges_psite<G, F>,
- line_graph_elt_neighborhood<G, F> >
- {
- typedef line_graph_elt_neighborhood<G, F> self_;
-
- public:
- /// Associated types.
- /// \{
- /// The type of psite corresponding to the neighborhood.
- typedef p_edges_psite<G, F> psite;
-
- /// Site_Iterator type to browse the psites of the
- /// neighborhood w.r.t. the ordering of edges.
- typedef line_graph_neighborhood_fwd_piter<G, F, self_> fwd_niter;
-
- /// Site_Iterator type to browse the psites of the
- /// neighborhood w.r.t. the reverse ordering of edges.
- typedef line_graph_neighborhood_bkd_piter<G, F, self_> bkd_niter;
-
- /// The default niter type.
- typedef fwd_niter niter;
- /// \}
-
- /// Services for iterators.
- /// \{
- /// Compute the set of sites for this neighborhood around \a piter.
- template <typename Piter>
- void compute_sites_(Site_Iterator<Piter>& piter) const;
- /// \}
-
- protected:
- typedef graph_neighborhood_base<G, F, psite, self_> super_;
- typedef typename super_::sites_t sites_t;
- };
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename G, typename F>
- template <typename Piter>
- inline
- void
- line_graph_elt_neighborhood<G, F>::compute_sites_(Site_Iterator<Piter>& piter_) const
- {
- Piter& piter = exact(piter_);
- unsigned central_edge = piter.center().e().id();
- sites_t& sites = piter.sites();
- sites.clear();
-
- const G& g = piter.center().site_set().graph();
-
- for (unsigned i = 0; i < g.e_nmax_nbh_edges(central_edge); ++i)
- {
- unsigned n = g.e_ith_nbh_edge(central_edge, i);
- if (n != central_edge)
- sites.insert(g.e_ith_nbh_edge(central_edge, i));
- }
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
-} // end of namespace mln
-
-
-#endif // ! MLN_CORE_IMAGE_LINE_GRAPH_ELT_NEIGHBORHOOD_HH
diff --git a/milena/mln/core/image/line_graph_elt_window.hh b/milena/mln/core/image/line_graph_elt_window.hh
index fa88558..c1b910c 100644
--- a/milena/mln/core/image/line_graph_elt_window.hh
+++ b/milena/mln/core/image/line_graph_elt_window.hh
@@ -34,9 +34,10 @@
/// Definition of the elementary ``window'' on a line graph.
# include <mln/core/concept/window.hh>
+# include <mln/core/internal/neighborhood_base.hh>
# include <mln/core/internal/graph_window_base.hh>
-# include <mln/core/site_set/p_edges_psite.hh>
-# include <mln/core/image/line_graph_window_piter.hh>
+# include <mln/core/image/graph_window_piter.hh>
+# include <mln/core/site_set/p_edges.hh>
namespace mln
@@ -45,10 +46,20 @@ namespace mln
/// Forward declaration
template <typename G, typename F> class line_graph_elt_window;
+ namespace internal
+ {
+
+ template <typename G, typename F, typename E>
+ struct neighborhood_impl<line_graph_elt_window<G,F>,E>
+ : public neighborhood_extra_impl<line_graph_elt_window<G,F>,E>
+ {
+ };
+
+ } // end of namespace mln::internal
+
namespace trait
{
- ///FIXME: check that!
template <typename G, typename F>
struct window_< mln::line_graph_elt_window<G, F> >
{
@@ -60,69 +71,36 @@ namespace mln
} // end of namespace mln::trait
- /// \brief Elementary window on line graph class.
+ /// Elementary window on line graph class.
template <typename G, typename F>
- class line_graph_elt_window : public graph_window_base<
- G,
- F,
- p_edges_psite<G, F>,
- line_graph_elt_window<G, F> >
+ class line_graph_elt_window : public graph_window_base<mln_result(F),
+ line_graph_elt_window<G, F> >
{
typedef line_graph_elt_window<G, F> self_;
+ typedef mln_edge_nbh_edge_fwd_iter(G) nbh_fwd_iter_;
+ typedef mln_edge_nbh_edge_bkd_iter(G) nbh_bkd_iter_;
public:
/// Associated types.
/// \{
- /// The type of psite corresponding to the window.
- typedef p_edges_psite<G, F> psite;
+ typedef p_edges<G,F> S;
+ // The type of psite corresponding to the window.
+ typedef mln_psite(S) psite;
/// Site_Iterator type to browse the psites of the window
/// w.r.t. the ordering of edges.
- typedef line_graph_window_fwd_piter<G, F, self_> fwd_qiter;
+ typedef graph_window_piter<S,self_,nbh_fwd_iter_> fwd_qiter;
/// Site_Iterator type to browse the psites of the window
/// w.r.t. the reverse ordering of edges.
- typedef line_graph_window_bkd_piter<G, F, self_> bkd_qiter;
+ typedef graph_window_piter<S,self_,nbh_bkd_iter_> bkd_qiter;
/// The default qiter type.
typedef fwd_qiter qiter;
-
-
- /// Services for iterators.
- /// \{
- /// Compute the set of sites for this window around \a piter.
- template <typename Piter>
- void compute_sites_(Site_Iterator<Piter>& piter) const;
/// \}
- protected:
- typedef graph_window_base<G, F, psite, self_> super_;
- typedef typename super_::sites_t sites_t;
};
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename G, typename F>
- template <typename Piter>
- inline
- void
- line_graph_elt_window<G, F>::compute_sites_(Site_Iterator<Piter>& piter_) const
- {
- Piter& piter = exact(piter_);
- unsigned central_edge = piter.center().e().id();
- sites_t& sites = piter.sites();
- sites.clear();
-
- const G& g = piter.center().site_set().graph();
-
- sites.insert(central_edge);
- for (unsigned i = 0; i < g.e_nmax_nbh_edges(central_edge); ++i)
- sites.insert(g.e_ith_nbh_edge(central_edge, i));
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln
diff --git a/milena/mln/core/image/line_graph_neighborhood_piter.hh b/milena/mln/core/image/line_graph_neighborhood_piter.hh
deleted file mode 100644
index 26a258b..0000000
--- a/milena/mln/core/image/line_graph_neighborhood_piter.hh
+++ /dev/null
@@ -1,267 +0,0 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// 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_IMAGE_LINE_GRAPH_NEIGHBORHOOD_PITER_HH
-# define MLN_CORE_IMAGE_LINE_GRAPH_NEIGHBORHOOD_PITER_HH
-
-/// \file mln/core/image/line_graph_neighborhood_piter.hh
-/// \brief Definition of a point iterator on a line graph neighborhood.
-
-# include <mln/core/internal/line_graph_vicinity_piter.hh>
-
-namespace mln
-{
-
- /*------------------------------------------.
- | line_graph_neighborhood_fwd_piter<G, F, N>. |
- `------------------------------------------*/
-
- /// \brief Forward iterator on line graph neighborhood.
- template <typename G, typename F, typename N>
- class line_graph_neighborhood_fwd_piter :
- public internal::line_graph_vicinity_piter_< mln_result(F), N,
- line_graph_neighborhood_fwd_piter<G, F, N> >
- {
- typedef line_graph_neighborhood_fwd_piter<G, F, N> self_;
- typedef internal::line_graph_vicinity_piter_<mln_result(F), N, self_> super_;
-
- public:
- /// The Point_Site type.
- typedef mln_psite(N) psite;
-
- public:
- /// Construction.
- /// \{
- line_graph_neighborhood_fwd_piter();
- template <typename Pref>
- line_graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh,
- const Pref& p_ref);
- /// \}
-
- /// Manipulation.
- /// \{
- /// Test if the iterator is valid.
- bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
-
- /// Start an iteration.
- void do_start_();
- /// Go to the next point.
- void do_next_();
-
- /// Compute the current psite.
- psite compute_p_() const;
- /// \}
-
- private:
- /// An iterator on the set of adjacent edges.
- typename super_::sites_t::const_iterator i_;
- };
-
-
- /*------------------------------------------.
- | line_graph_neighborhood_bkd_piter<G, F, N>. |
- `------------------------------------------*/
-
- /// \brief Backward iterator on line graph neighborhood.
- template <typename G, typename F, typename N>
- class line_graph_neighborhood_bkd_piter :
- public internal::line_graph_vicinity_piter_< mln_result(F), N,
- line_graph_neighborhood_bkd_piter<G, F, N> >
- {
- typedef line_graph_neighborhood_bkd_piter<G, F, N> self_;
- typedef internal::line_graph_vicinity_piter_<mln_result(F), N, self_> super_;
-
- public:
- /// The Point_Site type.
- typedef mln_psite(N) psite;
-
- public:
- /// Construction.
- /// \{
- line_graph_neighborhood_bkd_piter();
- template <typename Pref>
- line_graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh,
- const Pref& p_ref);
- /// \}
-
- /// Manipulation.
- /// \{
- /// Test if the iterator is valid.
- bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
-
- /// Start an iteration.
- void do_start_();
- /// Go to the next point.
- void do_next_();
-
- /// Compute the current psite.
- psite compute_p_() const;
- /// \}
-
- private:
- /// An iterator on the set of adjacent edges.
- typename super_::sites_t::const_reverse_iterator i_;
- };
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- /*------------------------------------------.
- | line_graph_neighborhood_fwd_piter<G, F, N>. |
- `------------------------------------------*/
-
- template <typename G, typename F, typename N>
- inline
- line_graph_neighborhood_fwd_piter<G, F, N>::line_graph_neighborhood_fwd_piter()
- {
- }
-
- template <typename G, typename F, typename N>
- template <typename Pref>
- inline
- line_graph_neighborhood_fwd_piter<G, F, N>::line_graph_neighborhood_fwd_piter(const Neighborhood<N>& nbh,
- const Pref& p_ref)
- : super_(p_ref)
- {
- this->change_target(exact(nbh));
- }
-
- template <typename G, typename F, typename N>
- inline
- bool
- line_graph_neighborhood_fwd_piter<G, F, N>::is_valid_() const
- {
- return i_ != this->sites_.end();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- line_graph_neighborhood_fwd_piter<G, F, N>::invalidate_()
- {
- i_ = this->sites_.end();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- line_graph_neighborhood_fwd_piter<G, F, N>::do_start_()
- {
- this->site_set().compute_sites_(*this);
- i_ = this->sites_.begin();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- line_graph_neighborhood_fwd_piter<G, F, N>::do_next_()
- {
- ++i_;
- }
-
- template <typename G, typename F, typename N>
- inline
- mln_psite(N)
- line_graph_neighborhood_fwd_piter<G, F, N>::compute_p_() const
- {
- return p_edges_psite<G, F>(this->center().site_set(), *i_);
- }
-
-
- /*------------------------------------------.
- | line_graph_neighborhood_bkd_piter<G, F, N>. |
- `------------------------------------------*/
-
- template <typename G, typename F, typename N>
- inline
- line_graph_neighborhood_bkd_piter<G, F, N>::line_graph_neighborhood_bkd_piter()
- {
- }
-
- template <typename G, typename F, typename N>
- template <typename Pref>
- inline
- line_graph_neighborhood_bkd_piter<G, F, N>::line_graph_neighborhood_bkd_piter(const Neighborhood<N>& nbh,
- const Pref& p_ref)
- : super_(p_ref)
- {
- this->change_target(exact(nbh));
- }
-
- template <typename G, typename F, typename N>
- inline
- bool
- line_graph_neighborhood_bkd_piter<G, F, N>::is_valid_() const
- {
- return i_ != this->sites_.rend();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- line_graph_neighborhood_bkd_piter<G, F, N>::invalidate_()
- {
- i_ = this->sites_.rend();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- line_graph_neighborhood_bkd_piter<G, F, N>::do_start_()
- {
- this->site_set().compute_sites_(*this);
- i_ = this->sites_.rbegin();
- }
-
- template <typename G, typename F, typename N>
- inline
- void
- line_graph_neighborhood_bkd_piter<G, F, N>::do_next_()
- {
- ++i_;
- }
-
- template <typename G, typename F, typename N>
- inline
- mln_psite(N)
- line_graph_neighborhood_bkd_piter<G, F, N>::compute_p_() const
- {
- return p_edges_psite<G, F>(this->center().site_set(), *i_);
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
-} // end of namespace mln
-
-
-#endif // ! MLN_CORE_IMAGE_LINE_GRAPH_NEIGHBORHOOD_PITER_HH
diff --git a/milena/mln/core/image/line_graph_window_piter.hh b/milena/mln/core/image/line_graph_window_piter.hh
deleted file mode 100644
index 0ddc48f..0000000
--- a/milena/mln/core/image/line_graph_window_piter.hh
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// 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_IMAGE_LINE_GRAPH_WINDOW_PITER_HH
-# define MLN_CORE_IMAGE_LINE_GRAPH_WINDOW_PITER_HH
-
-/// \file mln/core/image/line_graph_window_piter.hh
-/// \brief Definition of a point iterator on a line_graph window.
-
-# include <mln/core/internal/line_graph_vicinity_piter.hh>
-
-namespace mln
-{
-
- /*------------------------------------.
- | line_graph_window_fwd_piter<G, F, W>. |
- `------------------------------------*/
-
- /// \brief Forward iterator on line graph window.
- template <typename G, typename F, typename W>
- class line_graph_window_fwd_piter
- : public internal::line_graph_vicinity_piter_<mln_result(F), W,
- line_graph_window_fwd_piter<G, F, W> >
- {
- typedef line_graph_window_fwd_piter<G, F, W> self_;
- typedef internal::line_graph_vicinity_piter_<mln_result(F), W, self_> super_;
-
- public:
- /// The Point_Site type.
- typedef mln_psite(W) psite;
-
- public:
- /// Construction.
- /// \{
- line_graph_window_fwd_piter();
- template <typename Pref>
- line_graph_window_fwd_piter(const Window<W>& win,
- const Pref& p_ref);
- /// \}
-
- /// Manipulation.
- /// \{
- /// Test if the iterator is valid.
- bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
-
- /// Start an iteration.
- void do_start_();
- /// Go to the next point.
- void do_next_();
-
- /// Compute the current psite.
- psite compute_p_() const;
- /// \}
-
- private:
- /// An iterator on the set of adjacent edges.
- typename super_::sites_t::const_iterator i_;
- };
-
-
- /*------------------------------------.
- | line_graph_window_bkd_piter<G, F, W>. |
- `------------------------------------*/
-
- /// \brief Backward iterator on line graph window.
- template <typename G, typename F, typename W>
- class line_graph_window_bkd_piter
- : public internal::line_graph_vicinity_piter_<mln_result(F), W, line_graph_window_bkd_piter<G, F, W> >
- {
- typedef line_graph_window_bkd_piter<G, F, W> self_;
- typedef internal::line_graph_vicinity_piter_<mln_result(F), W, self_> super_;
-
- public:
- /// The Point_Site type.
- typedef mln_psite(W) psite;
-
- public:
- /// Construction.
- /// \{
- line_graph_window_bkd_piter();
- template <typename Pref>
- line_graph_window_bkd_piter(const Window<W>& win,
- const Pref& p_ref);
- /// \}
-
- /// Manipulation.
- /// \{
- /// Test if the iterator is valid.
- bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
-
- /// Start an iteration.
- void do_start_();
- /// Go to the next point.
- void do_next_();
-
- /// Compute the current psite.
- psite compute_p_() const;
- /// \}
-
- private:
- /// An iterator on the set of adjacent edges.
- typename super_::sites_t::const_reverse_iterator i_;
- };
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- /*------------------------------------.
- | line_graph_window_fwd_piter<G, F, W>. |
- `------------------------------------*/
-
- template <typename G, typename F, typename W>
- inline
- line_graph_window_fwd_piter<G, F, W>::line_graph_window_fwd_piter()
- {
- }
-
- template <typename G, typename F, typename W>
- template <typename Pref>
- inline
- line_graph_window_fwd_piter<G, F, W>::line_graph_window_fwd_piter(const Window<W>& win,
- const Pref& p_ref)
- : super_(p_ref)
- {
- this->change_target(exact(win));
- }
-
- template <typename G, typename F, typename W>
- inline
- bool
- line_graph_window_fwd_piter<G, F, W>::is_valid_() const
- {
- return i_ != this->sites_.end();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- line_graph_window_fwd_piter<G, F, W>::invalidate_()
- {
- i_ = this->sites_.end();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- line_graph_window_fwd_piter<G, F, W>::do_start_()
- {
- this->site_set().compute_sites_(*this);
- i_ = this->sites_.begin();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- line_graph_window_fwd_piter<G, F, W>::do_next_()
- {
- ++i_;
- }
-
- template <typename G, typename F, typename W>
- inline
- mln_psite(W)
- line_graph_window_fwd_piter<G, F, W>::compute_p_() const
- {
- return p_edges_psite<G, F>(this->center().site_set(), *i_);
- }
-
-
- /*------------------------------------.
- | line_graph_window_bkd_piter<G, F, W>. |
- `------------------------------------*/
-
- template <typename G, typename F, typename W>
- inline
- line_graph_window_bkd_piter<G, F, W>::line_graph_window_bkd_piter()
- {
- }
-
- template <typename G, typename F, typename W>
- template <typename Pref>
- inline
- line_graph_window_bkd_piter<G, F, W>::line_graph_window_bkd_piter(const Window<W>& win,
- const Pref& p_ref)
- : super_(p_ref)
- {
- this->change_target(exact(win));
- }
-
- template <typename G, typename F, typename W>
- inline
- bool
- line_graph_window_bkd_piter<G, F, W>::is_valid_() const
- {
- return i_ != this->sites_.rend();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- line_graph_window_bkd_piter<G, F, W>::invalidate_()
- {
- i_ = this->sites_.rend();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- line_graph_window_bkd_piter<G, F, W>::do_start_()
- {
- this->site_set().compute_sites_(*this);
- i_ = this->sites_.rbegin();
- }
-
- template <typename G, typename F, typename W>
- inline
- void
- line_graph_window_bkd_piter<G, F, W>::do_next_()
- {
- ++i_;
- }
-
- template <typename G, typename F, typename W>
- inline
- mln_psite(W)
- line_graph_window_bkd_piter<G, F, W>::compute_p_() const
- {
- return p_edges_psite<G, F>(this->center().site_set(), *i_);
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
-} // end of namespace mln
-
-#endif // ! MLN_CORE_IMAGE_LINE_GRAPH_WINDOW_PITER_HH
diff --git a/milena/mln/core/internal/graph_neighborhood_base.hh b/milena/mln/core/internal/graph_neighborhood_base.hh
deleted file mode 100644
index 451e527..0000000
--- a/milena/mln/core/internal/graph_neighborhood_base.hh
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
-//
-// 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_INTERNAL_GRAPH_NEIGHBORHOOD_BASE_HH
-# define MLN_CORE_INTERNAL_GRAPH_NEIGHBORHOOD_BASE_HH
-
-/// \file mln/internal/graph_neighborhood_base.hh
-///
-/// FIXME: doc
-
-# include <set>
-# include <mln/core/concept/neighborhood.hh>
-
-namespace mln
-{
-
- template <typename G, typename F, typename P, typename E>
- class graph_neighborhood_base : public Neighborhood< E >
- {
- typedef graph_neighborhood_base<G, F, P, E> self_;
-
- public:
- /// Associated types.
- /// \{
- /// The type of site corresponding to the neighborhood.
- typedef mln_site(P) site;
-
- // The type of the set of neighborhood sites (ids adjacent to the
- // reference psite).
- typedef std::set<unsigned> sites_t;
- /// \}
-
- /// Conversions.
- /// \{
- /// The window type corresponding to this neighborhood.
- typedef E window;
- /// Create a window corresponding to this neighborhood.
- E win() const;
- /// \}
-
- protected:
- graph_neighborhood_base();
- };
-
-} // end of namespace mln
-
-# ifndef MLN_INCLUDE_ONLY
-
-namespace mln
-{
-
- template <typename G, typename F, typename P, typename E>
- inline
- graph_neighborhood_base<G, F, P, E>::graph_neighborhood_base()
- {
- }
-
- template <typename G, typename F, typename P, typename E>
- inline
- E
- graph_neighborhood_base<G, F, P, E>::win() const
- {
- return E();
- }
-
-} // end of namespace mln
-
-# endif // !MLN_INCLUDE_ONLY
-
-#endif // !MLN_CORE_INTERNAL_GRAPH_NEIGHBORHOOD_BASE_HH
-
diff --git a/milena/mln/core/internal/graph_psite_base.hh b/milena/mln/core/internal/graph_psite_base.hh
index c42e145..2309862 100644
--- a/milena/mln/core/internal/graph_psite_base.hh
+++ b/milena/mln/core/internal/graph_psite_base.hh
@@ -93,6 +93,9 @@ namespace mln
/// Conversion towards the graph element (vertex or edge).
operator const typename S::graph_element&() const;
+ /// Explicit conversion towards the graph element (vertex or edge).
+ const typename S::graph_element& element() const;
+
protected:
/// Constructors.
@@ -257,6 +260,15 @@ namespace mln
return elt_;
}
+ template <typename S, typename E>
+ inline
+ const typename S::graph_element&
+ graph_psite_base<S,E>::element() const
+ {
+ mln_precondition(is_valid());
+ return elt_;
+ }
+
/*--------------.
| Comparisons. |
diff --git a/milena/mln/core/internal/graph_relative_piter.hh b/milena/mln/core/internal/graph_relative_piter.hh
deleted file mode 100644
index 5b09421..0000000
--- a/milena/mln/core/internal/graph_relative_piter.hh
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
-//
-// 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_INTERNAL_GRAPH_RELATIVE_PITER_HH
-# define MLN_CORE_INTERNAL_GRAPH_RELATIVE_PITER_HH
-
-/// \file mln/core/internal/graph_relative_piter.hh
-/// \brief Factored implementation for point iterators on a graph windows
-/// and graph neighborhoods.
-
-# include <set>
-
-# include <mln/core/internal/site_relative_iterator_base.hh>
-
-/* FIXME: Factor those classes:
-
- - mln::internal::graph_relative_piter.hh
- - mln::internal::line_graph_relative_piter.hh */
-
-namespace mln
-{
-
- namespace internal
- {
-
- /// \brief Base for iterator on a graph vicinity.
- template <typename P, typename S, typename E>
- class graph_relative_piter
- : public internal::site_relative_iterator_base< S, E >
- {
- public:
- enum { dim = P::dim };
-
- // FIXME: Dummy typedef.
- typedef void dpoint;
- // FIXME: Dummy value.
- typedef void mesh;
-
- // The type of the set of sites (adjacent vertex ids).
- typedef std::set<unsigned> sites_t;
-
- public:
- /// Return the set of sites (adjacent vertex ids).
- sites_t& sites();
-
- protected:
- /// Construction.
- /// \{
- graph_relative_piter();
- template <typename Pref>
- graph_relative_piter(const Pref& p_ref);
- /// \}
-
- protected:
- /// The set of edge ids adjacent to the reference psite.
- sites_t sites_;
- };
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename P, typename S, typename E>
- inline
- graph_relative_piter<P, S, E>::graph_relative_piter()
- {
- }
-
- template <typename P, typename S, typename E>
- template <typename Pref>
- inline
- graph_relative_piter<P, S, E>::graph_relative_piter(const Pref& p_ref)
- {
- center_at(p_ref);
- }
-
- template <typename P, typename S, typename E>
- inline
- std::set<unsigned>&
- graph_relative_piter<P, S, E>::sites()
- {
- return sites_;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::internal
-
-} // end of namespace mln
-
-#endif // ! MLN_CORE_INTERNAL_GRAPH_RELATIVE_PITER_HH
diff --git a/milena/mln/core/internal/graph_window_base.hh b/milena/mln/core/internal/graph_window_base.hh
index 0ea95ec..115e680 100644
--- a/milena/mln/core/internal/graph_window_base.hh
+++ b/milena/mln/core/internal/graph_window_base.hh
@@ -28,7 +28,6 @@
#ifndef MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
# define MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
-# include <set>
# include <mln/core/concept/window.hh>
/// \file mln/internal/graph_window_base.hh
@@ -38,10 +37,10 @@
namespace mln
{
- template <typename G, typename F, typename P, typename E>
- class graph_window_base : public Window< E >
+ template <typename P, typename E>
+ class graph_window_base : public Window<E>
{
- typedef graph_window_base<G, F, P, E> self_;
+ typedef graph_window_base<P, E> self_;
public:
/// Associated types.
@@ -49,10 +48,6 @@ namespace mln
/// The type of site corresponding to the window.
typedef mln_site(P) site;
- // The type of the set of window sites (ids adjacent to the
- // reference psite).
- typedef std::set<unsigned> sites_t;
-
// FIXME: This is a dummy value.
typedef void dpsite;
/// \}
@@ -87,63 +82,62 @@ namespace mln
graph_window_base();
};
-} // end of namespace mln
# ifndef MLN_INCLUDE_ONLY
-namespace mln
-{
- template <typename G, typename F, typename P, typename E>
+
+ template <typename P, typename E>
inline
- graph_window_base<G, F, P, E>::graph_window_base()
+ graph_window_base<P,E>::graph_window_base()
{
}
- template <typename G, typename F, typename P, typename E>
+ template <typename P, typename E>
inline
bool
- graph_window_base<G, F, P, E>::is_empty() const
+ graph_window_base<P,E>::is_empty() const
{
return false;
}
- template <typename G, typename F, typename P, typename E>
+ template <typename P, typename E>
inline
bool
- graph_window_base<G, F, P, E>::is_centered() const
+ graph_window_base<P,E>::is_centered() const
{
return false;
}
- template <typename G, typename F, typename P, typename E>
+ template <typename P, typename E>
inline
bool
- graph_window_base<G, F, P, E>::is_symmetric() const
+ graph_window_base<P,E>::is_symmetric() const
{
return true;
}
- template <typename G, typename F, typename P, typename E>
+ template <typename P, typename E>
inline
unsigned
- graph_window_base<G, F, P, E>::delta() const
+ graph_window_base<P,E>::delta() const
{
// Dummy value (see the interface of the method above).
return 0;
}
- template <typename G, typename F, typename P, typename E>
+ template <typename P, typename E>
inline
- graph_window_base<G, F, P, E>&
- graph_window_base<G, F, P, E>::sym()
+ graph_window_base<P,E>&
+ graph_window_base<P,E>::sym()
{
return *this;
}
-} // end of namespace mln
# endif // !MLN_INCLUDE_ONLY
+} // end of namespace mln
+
#endif // !MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
diff --git a/milena/mln/core/internal/line_graph_vicinity_piter.hh b/milena/mln/core/internal/line_graph_vicinity_piter.hh
deleted file mode 100644
index 9ef41e6..0000000
--- a/milena/mln/core/internal/line_graph_vicinity_piter.hh
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
-//
-// 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_INTERNAL_LINE_GRAPH_VICINITY_PITER_HH
-# define MLN_CORE_INTERNAL_LINE_GRAPH_VICINITY_PITER_HH
-
-/// \file mln/core/internal/line_graph_vicinity_piter.hh
-/// \brief Factored implementation for point iterators on a line graph windows
-/// and line graph neighborhoods, called "vicinities".
-
-# include <set>
-
-# include <mln/core/internal/site_relative_iterator_base.hh>
-
-/* FIXME: Factor those classes:
-
- - mln::internal::graph_vicinity_piter.hh
- - mln::internal::line_graph_vicinity_piter.hh */
-
-
-namespace mln
-{
-
- // FIXME: Consider renaming line_graph_vicinity_piter_ as
- // line_graph_relative_piter_.
-
-
- namespace internal
- {
-
- /// \brief Base for iterator on a line graph vicinity.
- template <typename P, typename S, typename E>
- class line_graph_vicinity_piter_
- : public internal::site_relative_iterator_base< S, E >
- {
- public:
- enum { dim = P::dim };
-
- // FIXME: Dummy typedef.
- typedef void dpoint;
- // FIXME: Dummy typedef.
- typedef void mesh;
-
- // The type of the set of vicinity sites (adjacent edge ids).
- typedef std::set<unsigned> sites_t;
-
- public:
- /// Return the set of sites (adjacent edge ids).
- sites_t& sites();
-
- protected:
- /// Construction.
- /// \{
- line_graph_vicinity_piter_();
- template <typename Pref>
- line_graph_vicinity_piter_(const Pref& p_ref);
- /// \}
-
- protected:
- /// The set of edge ids adjacent to the reference psite.
- sites_t sites_;
- };
-
-
- /// Print an mln::line_graph_vicinity_piter_<P, S, E>.
- template <typename P, typename S, typename E>
- inline
- std::ostream&
- operator<<(std::ostream& ostr,
- const line_graph_vicinity_piter_<P, S, E>& p);
-
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename P, typename S, typename E>
- inline
- line_graph_vicinity_piter_<P, S, E>::line_graph_vicinity_piter_()
- {
- }
-
- template <typename P, typename S, typename E>
- template <typename Pref>
- inline
- line_graph_vicinity_piter_<P, S, E>::line_graph_vicinity_piter_(const Pref& p_ref)
- {
- center_at(p_ref);
- }
-
- template <typename P, typename S, typename E>
- inline
- std::set<unsigned>&
- line_graph_vicinity_piter_<P, S, E>::sites()
- {
- return sites_;
- }
-
-
- template <typename P, typename S, typename E>
- inline
- std::ostream&
- operator<<(std::ostream& ostr, const line_graph_vicinity_piter_<P, S, E>& p)
- {
- return ostr << p.unproxy_();
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::internal
-
-} // end of namespace mln
-
-#endif // ! MLN_CORE_INTERNAL_LINE_GRAPH_VICINITY_PITER_HH
diff --git a/milena/mln/core/internal/neighborhood_base.hh b/milena/mln/core/internal/neighborhood_base.hh
index 13feebf..4879fc1 100644
--- a/milena/mln/core/internal/neighborhood_base.hh
+++ b/milena/mln/core/internal/neighborhood_base.hh
@@ -159,7 +159,7 @@ namespace mln
neighborhood_impl<W,E>::size() const
{
mlc_is(mln_trait_window_size(W),
- trait::window::size::fixed)::check();
+ trait::window::size::fixed)::check();
return exact(this)->win().size();
}
diff --git a/milena/mln/core/internal/site_relative_iterator_base.hh b/milena/mln/core/internal/site_relative_iterator_base.hh
index 9b3a7d4..01e5f19 100644
--- a/milena/mln/core/internal/site_relative_iterator_base.hh
+++ b/milena/mln/core/internal/site_relative_iterator_base.hh
@@ -94,7 +94,7 @@ namespace mln
/// Hook to the current location.
const mln_psite(S)& p_hook_() const;
- /// Change the site set targeted by this iterator.
+ /// Change the site set targeted by this iterator.
void change_target(const S& s);
/// Warning: this method is an advanced tool provided for very
@@ -111,7 +111,7 @@ namespace mln
const mln_psite(S)* c_;
private:
-
+
/// The psite designated by this iterator.
mln_psite(S) p_;
};
diff --git a/milena/mln/core/neighb.hh b/milena/mln/core/neighb.hh
index ffc8699..d54b229 100644
--- a/milena/mln/core/neighb.hh
+++ b/milena/mln/core/neighb.hh
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -178,7 +179,7 @@ protected:
mln_bkd_qiter(W) i_;
};
-
+
# ifndef MLN_INCLUDE_ONLY
@@ -363,7 +364,7 @@ protected:
{
return i_.compute_p_();
}
-
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
diff --git a/milena/mln/core/site_set/p_edges.hh b/milena/mln/core/site_set/p_edges.hh
index a5ef4b1..b1d46f2 100644
--- a/milena/mln/core/site_set/p_edges.hh
+++ b/milena/mln/core/site_set/p_edges.hh
@@ -72,6 +72,9 @@ namespace mln
/// Graph associated type.
typedef G graph_t;
+ /// Function associated type.
+ typedef F fun_t;
+
/// Type of graph edge.
typedef util::edge<G> edge;
diff --git a/milena/mln/core/site_set/p_graph_piter.hh b/milena/mln/core/site_set/p_graph_piter.hh
index 37c3ed3..543a817 100644
--- a/milena/mln/core/site_set/p_graph_piter.hh
+++ b/milena/mln/core/site_set/p_graph_piter.hh
@@ -82,6 +82,12 @@ namespace mln
/// Return the underlying graph element.
mln_q_subject(iter) element();
+ /// Return the graph associated to the target S.
+ const typename S::graph_t& graph() const;
+
+ /// Return the underlying iterator.
+ const iter& hook_iter_() const;
+
private:
/// Update the psite corresponding to this iterator.
@@ -162,7 +168,23 @@ namespace mln
mln_q_subject(I)
p_graph_piter<S,I>::element()
{
- return iter_.subj_();
+ return this->subj_();
+ }
+
+ template <typename S, typename I>
+ inline
+ const typename S::graph_t&
+ p_graph_piter<S,I>::graph() const
+ {
+ return this->site_set().graph();
+ }
+
+ template <typename S, typename I>
+ inline
+ const I&
+ p_graph_piter<S,I>::hook_iter_() const
+ {
+ return iter_;
}
template <typename S, typename I>
diff --git a/milena/mln/core/site_set/p_vertices.hh b/milena/mln/core/site_set/p_vertices.hh
index 4fe0fa2..adbe55d 100644
--- a/milena/mln/core/site_set/p_vertices.hh
+++ b/milena/mln/core/site_set/p_vertices.hh
@@ -76,6 +76,8 @@ namespace mln
/// Graph associated type.
typedef G graph_t;
+ /// Function associated type.
+ typedef F fun_t;
/// Type of graph vertex.
typedef util::vertex<G> vertex;
diff --git a/milena/mln/util/internal/graph_nbh_iter.hh b/milena/mln/util/internal/graph_nbh_iter.hh
index 0780cab..d06a008 100644
--- a/milena/mln/util/internal/graph_nbh_iter.hh
+++ b/milena/mln/util/internal/graph_nbh_iter.hh
@@ -60,6 +60,7 @@ namespace mln
public:
/// Construction and assignment.
/// \{
+ vertex_nbh_vertex_fwd_iterator();
template <typename C>
vertex_nbh_vertex_fwd_iterator(const C& c);
/// \}
@@ -69,8 +70,6 @@ namespace mln
/// \{
/// Test if the iterator is valid.
bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
/// \}
/// Start an iteration.
@@ -98,6 +97,7 @@ namespace mln
public:
/// Construction and assignment.
/// \{
+ vertex_nbh_vertex_bkd_iterator();
template <typename C>
vertex_nbh_vertex_bkd_iterator(const C& c);
/// \}
@@ -107,8 +107,6 @@ namespace mln
/// \{
/// Test if the iterator is valid.
bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
/// \}
/// Start an iteration.
@@ -142,6 +140,7 @@ namespace mln
public:
/// Construction and assignment.
/// \{
+ vertex_nbh_edge_fwd_iterator();
template <typename C>
vertex_nbh_edge_fwd_iterator(const C& c);
/// \}
@@ -151,8 +150,6 @@ namespace mln
/// \{
/// Test if the iterator is valid.
bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
/// \}
/// Start an iteration.
@@ -182,6 +179,7 @@ namespace mln
public:
/// Construction and assignment.
/// \{
+ vertex_nbh_edge_bkd_iterator();
template <typename C>
vertex_nbh_edge_bkd_iterator(const C& c);
/// \}
@@ -191,8 +189,6 @@ namespace mln
/// \{
/// Test if the iterator is valid.
bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
/// \}
/// Start an iteration.
@@ -225,6 +221,7 @@ namespace mln
public:
/// Construction and assignment.
/// \{
+ edge_nbh_edge_fwd_iterator();
template <typename C>
edge_nbh_edge_fwd_iterator(const C& c);
/// \}
@@ -234,8 +231,6 @@ namespace mln
/// \{
/// Test if the iterator is valid.
bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
/// \}
/// Start an iteration.
@@ -264,6 +259,7 @@ namespace mln
public:
/// Construction and assignment.
/// \{
+ edge_nbh_edge_bkd_iterator();
template <typename C>
edge_nbh_edge_bkd_iterator(const C& c);
/// \}
@@ -273,8 +269,6 @@ namespace mln
/// \{
/// Test if the iterator is valid.
bool is_valid_() const;
- /// Invalidate the iterator.
- void invalidate_();
/// \}
/// Start an iteration.
@@ -294,6 +288,11 @@ namespace mln
| vertex_nbh_vertex_fwd_iterator |
\-------------------------------*/
+ template <typename G>
+ inline
+ vertex_nbh_vertex_fwd_iterator<G>::vertex_nbh_vertex_fwd_iterator()
+ {
+ }
template <typename G>
template <typename C>
@@ -308,15 +307,7 @@ namespace mln
bool
vertex_nbh_vertex_fwd_iterator<G>::is_valid_() const
{
- return this->i_ < this->c_->nmax_nbh_vertices();
- }
-
- template <typename G>
- inline
- void
- vertex_nbh_vertex_fwd_iterator<G>::invalidate_()
- {
- this->i_ = this->p_.graph().v_nmax();
+ return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_vertices();
}
template <typename G>
@@ -347,6 +338,11 @@ namespace mln
| vertex_nbh_vertex_bkd_iterator |
\-------------------------------*/
+ template <typename G>
+ inline
+ vertex_nbh_vertex_bkd_iterator<G>::vertex_nbh_vertex_bkd_iterator()
+ {
+ }
template <typename G>
template <typename C>
@@ -361,15 +357,7 @@ namespace mln
bool
vertex_nbh_vertex_bkd_iterator<G>::is_valid_() const
{
- return this->i_ < this->c_->nmax_nbh_vertices();
- }
-
- template <typename G>
- inline
- void
- vertex_nbh_vertex_bkd_iterator<G>::invalidate_()
- {
- this->i_ = this->p_.graph().v_nmax();
+ return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_vertices();
}
template <typename G>
@@ -402,27 +390,25 @@ namespace mln
\-----------------------------*/
template <typename G>
- template <typename C>
inline
- vertex_nbh_edge_fwd_iterator<G>::vertex_nbh_edge_fwd_iterator(const C& c)
- : super_(c)
+ vertex_nbh_edge_fwd_iterator<G>::vertex_nbh_edge_fwd_iterator()
{
}
template <typename G>
+ template <typename C>
inline
- bool
- vertex_nbh_edge_fwd_iterator<G>::is_valid_() const
+ vertex_nbh_edge_fwd_iterator<G>::vertex_nbh_edge_fwd_iterator(const C& c)
+ : super_(c)
{
- return this->i_ < this->c_->nmax_nbh_edges();
}
template <typename G>
inline
- void
- vertex_nbh_edge_fwd_iterator<G>::invalidate_()
+ bool
+ vertex_nbh_edge_fwd_iterator<G>::is_valid_() const
{
- this->i_ = this->p_.graph().e_nmax();
+ return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_edges();
}
template <typename G>
@@ -454,27 +440,25 @@ namespace mln
\-----------------------------*/
template <typename G>
- template <typename C>
inline
- vertex_nbh_edge_bkd_iterator<G>::vertex_nbh_edge_bkd_iterator(const C& c)
- : super_(c)
+ vertex_nbh_edge_bkd_iterator<G>::vertex_nbh_edge_bkd_iterator()
{
}
template <typename G>
+ template <typename C>
inline
- bool
- vertex_nbh_edge_bkd_iterator<G>::is_valid_() const
+ vertex_nbh_edge_bkd_iterator<G>::vertex_nbh_edge_bkd_iterator(const C& c)
+ : super_(c)
{
- return this->i_ < this->c_->nmax_nbh_edges();
}
template <typename G>
inline
- void
- vertex_nbh_edge_bkd_iterator<G>::invalidate_()
+ bool
+ vertex_nbh_edge_bkd_iterator<G>::is_valid_() const
{
- this->i_ = this->p_.graph().e_nmax();
+ return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_edges();
}
template <typename G>
@@ -508,27 +492,25 @@ namespace mln
\-----------------------------*/
template <typename G>
- template <typename C>
inline
- edge_nbh_edge_fwd_iterator<G>::edge_nbh_edge_fwd_iterator(const C& c)
- : super_(c)
+ edge_nbh_edge_fwd_iterator<G>::edge_nbh_edge_fwd_iterator()
{
}
template <typename G>
+ template <typename C>
inline
- bool
- edge_nbh_edge_fwd_iterator<G>::is_valid_() const
+ edge_nbh_edge_fwd_iterator<G>::edge_nbh_edge_fwd_iterator(const C& c)
+ : super_(c)
{
- return this->i_ < this->c_->nmax_nbh_edges();
}
template <typename G>
inline
- void
- edge_nbh_edge_fwd_iterator<G>::invalidate_()
+ bool
+ edge_nbh_edge_fwd_iterator<G>::is_valid_() const
{
- this->i_ = this->p_.graph().e_nmax();
+ return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_edges();
}
template <typename G>
@@ -552,9 +534,10 @@ namespace mln
void
edge_nbh_edge_fwd_iterator<G>::update_()
{
- // We shall encounter vertices which are part of the
- // current edge.
- // We do not want them to be part of the edge neighbors.
+ // We shall encounter the current edge in its neighborhood
+ // since it is computed thanks to the edge neighboors of its
+ // two vertices.
+ // We do not want the current edge to be part of its neighbors.
unsigned e_id = this->c_->ith_nbh_edge(this->i_);
while (e_id == this->c_->id())
{
@@ -570,27 +553,25 @@ namespace mln
\-----------------------------*/
template <typename G>
- template <typename C>
inline
- edge_nbh_edge_bkd_iterator<G>::edge_nbh_edge_bkd_iterator(const C& c)
- : super_(c)
+ edge_nbh_edge_bkd_iterator<G>::edge_nbh_edge_bkd_iterator()
{
}
template <typename G>
+ template <typename C>
inline
- bool
- edge_nbh_edge_bkd_iterator<G>::is_valid_() const
+ edge_nbh_edge_bkd_iterator<G>::edge_nbh_edge_bkd_iterator(const C& c)
+ : super_(c)
{
- return this->i_ < this->c_->nmax_nbh_edges();
}
template <typename G>
inline
- void
- edge_nbh_edge_bkd_iterator<G>::invalidate_()
+ bool
+ edge_nbh_edge_bkd_iterator<G>::is_valid_() const
{
- this->i_ = this->p_.graph().e_nmax();
+ return this->c_->is_valid() && this->i_ < this->c_->nmax_nbh_edges();
}
template <typename G>
diff --git a/milena/mln/util/internal/graph_nbh_iter_base.hh b/milena/mln/util/internal/graph_nbh_iter_base.hh
index f6f02ea..11fbadd 100644
--- a/milena/mln/util/internal/graph_nbh_iter_base.hh
+++ b/milena/mln/util/internal/graph_nbh_iter_base.hh
@@ -75,6 +75,7 @@ namespace mln
protected:
/// Construction and assignment.
/// \{
+ nbh_iterator_base();
template <typename C2>
nbh_iterator_base(const C2& c);
/// \}
@@ -90,6 +91,12 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
template <typename G, typename C, typename P, typename E>
+ inline
+ nbh_iterator_base<G, C, P, E>::nbh_iterator_base()
+ {
+ }
+
+ template <typename G, typename C, typename P, typename E>
template <typename C2>
inline
nbh_iterator_base<G, C, P, E>::nbh_iterator_base(const C2& c)
@@ -112,7 +119,7 @@ namespace mln
void
nbh_iterator_base<G, C, P, E>::invalidate()
{
- exact(this)->invalidate_();
+ i_ = mln_max(unsigned);
}
template <typename G, typename C, typename P, typename E>
@@ -168,7 +175,7 @@ namespace mln
nbh_iterator_base<G, C, P, E>::center_at(const C2& c)
{
internal::get_adr(c_, c);
- mln_precondition(c_ != 0);
+ mln_postcondition(c_ != 0);
invalidate();
}
diff --git a/milena/tests/all_headers.cc b/milena/tests/all_headers.cc
index 34da33b..7e7071e 100644
--- a/milena/tests/all_headers.cc
+++ b/milena/tests/all_headers.cc
@@ -30,73 +30,7 @@
///
/// Tests with all headers. (check norris tests)
-#include <mln/util/all.hh>
-#include <mln/fun/p2v/all.hh>
-#include <mln/fun/x2x/all.hh>
-#include <mln/fun/v2v/all.hh>
-#include <mln/fun/i2v/all.hh>
-#include <mln/fun/all.hh>
-#include <mln/fun/x2v/all.hh>
-#include <mln/fun/p2b/all.hh>
-#include <mln/extension/all.hh>
-#include <mln/histo/all.hh>
-#include <mln/trait/op/all.hh>
-#include <mln/trait/all.hh>
-#include <mln/trait/value/all.hh>
-#include <mln/win/all.hh>
-#include <mln/core/routine/all.hh>
-#include <mln/core/trait/all.hh>
-#include <mln/core/def/all.hh>
-#include <mln/core/internal/check/image_all.hh>
-#include <mln/core/image/all.hh>
-#include <mln/core/site_set/all.hh>
-#include <mln/io/pbm/all.hh>
-#include <mln/io/pfm/all.hh>
-#include <mln/io/pgm/all.hh>
-#include <mln/io/all.hh>
-#include <mln/io/fits/all.hh>
-#include <mln/io/pnm/all.hh>
-#include <mln/io/ppm/all.hh>
-#include <mln/make/all.hh>
-#include <mln/canvas/morpho/all.hh>
-#include <mln/canvas/all.hh>
-#include <mln/canvas/browsing/all.hh>
-#include <mln/estim/all.hh>
-#include <mln/arith/all.hh>
-#include <mln/display/all.hh>
-#include <mln/test/all.hh>
-#include <mln/border/all.hh>
-#include <mln/trace/all.hh>
-#include <mln/debug/all.hh>
-#include <mln/morpho/elementary/all.hh>
-#include <mln/morpho/all.hh>
-#include <mln/accu/all.hh>
-#include <mln/pw/all.hh>
-#include <mln/linear/all.hh>
-#include <mln/metal/all.hh>
-#include <mln/metal/math/all.hh>
-#include <mln/set/all.hh>
-#include <mln/convert/impl/all.hh>
-#include <mln/convert/all.hh>
-#include <mln/geom/all.hh>
-#include <mln/literal/all.hh>
-#include <mln/level/approx/all.hh>
-#include <mln/level/all.hh>
-#include <mln/level/naive/all.hh>
-#include <mln/math/all.hh>
-#include <mln/norm/all.hh>
-#include <mln/logical/all.hh>
-#include <mln/draw/all.hh>
-#include <mln/value/builtin/all.hh>
-#include <mln/value/all.hh>
-#include <mln/value/internal/all.hh>
-#include <mln/value/concept/all.hh>
-#include <mln/tag/all.hh>
-#include <mln/labeling/all.hh>
-
-#include <mln/essential/1d.hh>
-#include <mln/essential/2d.hh>
-#include <mln/essential/3d.hh>
+#include <mln/all.hh>
int main ()
{
diff --git a/milena/tests/core/image/graph_image.cc b/milena/tests/core/image/graph_image.cc
index 3614807..5055387 100644
--- a/milena/tests/core/image/graph_image.cc
+++ b/milena/tests/core/image/graph_image.cc
@@ -26,7 +26,8 @@
// Public License.
/// \file tests/core/image/graph_image.cc
-/// \brief Tests on mln::graph_image.
+///
+/// Tests on mln::graph_image.
#include <vector>
@@ -43,7 +44,6 @@
#include <mln/fun/ops.hh>
#include <mln/value/ops.hh>
#include <mln/core/image/graph_elt_window.hh>
-#include <mln/core/image/graph_elt_neighborhood.hh>
#include <mln/fun/i2v/array.hh>
@@ -52,6 +52,7 @@
#include <mln/debug/draw_graph.hh>
#include <mln/debug/println.hh>
#include <mln/core/concept/function.hh>
+#include <mln/core/neighb.hh>
template <typename S>
struct viota_t : public mln::Function_p2v< viota_t<S> >
@@ -183,9 +184,11 @@ int main()
for_all (p)
mln_assertion(ima(p) == i++);
+ typedef graph_elt_window<util::graph, fsite_t> win_t;
+ typedef neighb<win_t> neigh_t;
+
{
// Window - Forward iteration
- typedef graph_elt_window<util::graph, fsite_t> win_t;
win_t win;
mln_qiter_(win_t) q(win, p);
for_all (p)
@@ -199,7 +202,6 @@ int main()
{
// Window - Backward iteration
- typedef graph_elt_window<util::graph, fsite_t> win_t;
win_t win;
mln_bkd_qiter_(win_t) q(win, p);
for_all (p)
@@ -213,8 +215,7 @@ int main()
{
// Neighborhood - Forward iteration
- typedef graph_elt_neighborhood<util::graph, fsite_t> neigh_t;
- neigh_t neigh;
+ neigh_t neigh(win_t());
mln_niter_(neigh_t) n(neigh, p);
for_all (p)
{
@@ -229,8 +230,7 @@ int main()
{
// Neighborhood - Backward iteration
- typedef graph_elt_neighborhood<util::graph, fsite_t> neigh_t;
- neigh_t neigh;
+ neigh_t neigh(win_t());
mln_bkd_niter_(neigh_t) n(neigh, p);
for_all (p)
{
diff --git a/milena/tests/core/image/line_graph_image.cc b/milena/tests/core/image/line_graph_image.cc
index 360623c..e40055a 100644
--- a/milena/tests/core/image/line_graph_image.cc
+++ b/milena/tests/core/image/line_graph_image.cc
@@ -26,7 +26,8 @@
// Public License.
/// \file tests/core/image/graph_image.cc
-/// \brief Tests on mln::graph_image.
+///
+/// Tests on mln::graph_image.
#include <vector>
@@ -35,8 +36,8 @@
//#include <mln/core/image/line_graph_image.hh>
#include <mln/core/image/line_graph_elt_window.hh>
-#include <mln/core/image/line_graph_elt_neighborhood.hh>
#include <mln/core/site_set/p_edges.hh>
+#include <mln/core/neighb.hh>
#include <mln/fun/i2v/array.hh>
@@ -130,17 +131,30 @@ int main()
| Iterators. |
`------------*/
+ mln_edge_iter_(util::graph) ei(g);
+ mln_edge_nbh_edge_iter_(util::graph) en(ei);
+
+ for_all(ei)
+ {
+ std::cout << ei << std::endl;
+ for_all(en)
+ std::cout << en << std::endl;
+ std::cout << "-----" << std::endl;
+ }
+
// Manual iteration over the domain of IMA.
mln_piter_(ima_t) p(ima.domain());
unsigned i = 10;
for_all (p)
mln_assertion(ima(p) == i++);
+ typedef line_graph_elt_window<util::graph, fsite_t> win_t;
+ typedef neighb<win_t> neigh_t;
+
{
// Window - Forward iteration
- typedef line_graph_elt_window<util::graph, fsite_t> win_t;
win_t win;
- mln_qiter_(win_t) q(win, p);
+ mln_fwd_qiter_(win_t) q(win, p);
for_all (p)
{
std::cout << "neighbors of " << p << " (" << ima(p) << "), "
@@ -148,11 +162,11 @@ int main()
for_all (q)
std::cout << " " << q << " (level = " << ima(q) << ")" << std::endl;
}
+ std::cout << std::endl;
}
{
// Window - Backward iteration
- typedef line_graph_elt_window<util::graph, fsite_t> win_t;
win_t win;
mln_bkd_qiter_(win_t) q(win, p);
for_all (p)
@@ -162,37 +176,38 @@ int main()
for_all (q)
std::cout << " " << q << " (level = " << ima(q) << ")" << std::endl;
}
+ std::cout << std::endl;
}
{
// Neighborhood - Forward iteration
- typedef line_graph_elt_neighborhood<util::graph, fsite_t> neigh_t;
- neigh_t neigh;
- mln_niter_(neigh_t) n(neigh, p);
+ neigh_t neigh(win_t());
+ mln_fwd_niter_(neigh_t) n(neigh, p);
for_all (p)
{
std::cout << "neighbors of " << p << " (" << ima(p) << "), " << std::endl;
for_all (n)
{
- mln_assertion(n != p);
std::cout << " " << n << " (level = " << ima(n) << ")" << std::endl;
+ mln_assertion(n != p);
}
}
+ std::cout << std::endl;
}
{
// Neighborhood - Backward iteration
- typedef line_graph_elt_neighborhood<util::graph, fsite_t> neigh_t;
- neigh_t neigh;
+ neigh_t neigh(win_t());
mln_bkd_niter_(neigh_t) n(neigh, p);
for_all (p)
{
std::cout << "neighbors of " << p << " (" << ima(p) << "), " << std::endl;
for_all (n)
{
- mln_assertion(n != p);
std::cout << " " << n << " (level = " << ima(n) << ")" << std::endl;
+ mln_assertion(n != p);
}
}
+ std::cout << std::endl;
}
std::cout << std::endl;
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index 469cce2..ebd8c53 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -231,6 +231,7 @@ mln_fun_x2v_l1_norm\
mln_fun_x2v_nneighbor\
mln_fun_x2v_essential\
mln_fun_essential\
+mln_all\
mln_convert_to_p_set\
mln_convert_to\
mln_convert_to_upper_window\
@@ -473,6 +474,7 @@ mln_canvas_browsing_essential\
mln_canvas_chamfer\
mln_canvas_distance_geodesic\
mln_canvas_all\
+mln_canvas_distance_front\
mln_canvas_morpho_all\
mln_canvas_morpho_algebraic_union_find\
mln_canvas_morpho_essential\
@@ -711,14 +713,12 @@ mln_core_internal_force_exact\
mln_core_internal_image_base\
mln_core_internal_check_image_fastest\
mln_core_internal_check_image_all\
-mln_core_internal_line_graph_vicinity_piter\
mln_core_internal_fixme\
mln_core_internal_morpher_lvalue\
mln_core_internal_image_domain_morpher\
mln_core_internal_image_primary\
mln_core_internal_set_of\
mln_core_internal_complex_window_p_base\
-mln_core_internal_graph_relative_piter\
mln_core_internal_graph_window_base\
mln_core_internal_piter_adaptor\
mln_core_internal_weighted_window_base\
@@ -730,7 +730,6 @@ mln_core_internal_image_identity\
mln_core_internal_pseudo_site_base\
mln_core_internal_window_base\
mln_core_internal_box_impl\
-mln_core_internal_graph_neighborhood_base\
mln_core_internal_site_set_iterator_base\
mln_core_contract\
mln_core_all\
@@ -857,7 +856,6 @@ mln_core_image_lazy_image\
mln_core_image_t_image\
mln_core_image_hexa_piter\
mln_core_image_value_enc_image\
-mln_core_image_graph_elt_neighborhood\
mln_core_image_sub_image_if\
mln_core_image_all\
mln_core_image_mono_rle_image\
@@ -882,8 +880,8 @@ mln_core_image_image1d\
mln_core_image_extension_val\
mln_core_image_image_if\
mln_core_image_hexa\
-mln_core_image_line_graph_elt_neighborhood\
mln_core_image_extended\
+mln_core_image_line_graph_elt_piter\
mln_core_image_image2d_h\
mln_core_image_line_graph_neighborhood_piter\
mln_core_image_line_graph_window_piter\
@@ -915,9 +913,13 @@ mln_test_all\
mln_test_positive\
mln_test_essential\
mln_transform_distance_geodesic\
+mln_transform_internal_all\
+mln_transform_internal_distance_functor\
+mln_transform_internal_influence_zone_functor\
mln_transform_all\
+mln_transform_influence_zone_front\
+mln_transform_distance_front\
mln_transform_influence_zone_geodesic\
-mln_transform_distance\
mln_transform_essential\
mln_arith_includes\
mln_arith_plus\
@@ -1238,6 +1240,7 @@ mln_fun_x2v_l1_norm_SOURCES = mln_fun_x2v_l1_norm.cc
mln_fun_x2v_nneighbor_SOURCES = mln_fun_x2v_nneighbor.cc
mln_fun_x2v_essential_SOURCES = mln_fun_x2v_essential.cc
mln_fun_essential_SOURCES = mln_fun_essential.cc
+mln_all_SOURCES = mln_all.cc
mln_convert_to_p_set_SOURCES = mln_convert_to_p_set.cc
mln_convert_to_SOURCES = mln_convert_to.cc
mln_convert_to_upper_window_SOURCES = mln_convert_to_upper_window.cc
@@ -1480,6 +1483,7 @@ mln_canvas_browsing_essential_SOURCES = mln_canvas_browsing_essential.cc
mln_canvas_chamfer_SOURCES = mln_canvas_chamfer.cc
mln_canvas_distance_geodesic_SOURCES = mln_canvas_distance_geodesic.cc
mln_canvas_all_SOURCES = mln_canvas_all.cc
+mln_canvas_distance_front_SOURCES = mln_canvas_distance_front.cc
mln_canvas_morpho_all_SOURCES = mln_canvas_morpho_all.cc
mln_canvas_morpho_algebraic_union_find_SOURCES = mln_canvas_morpho_algebraic_union_find.cc
mln_canvas_morpho_essential_SOURCES = mln_canvas_morpho_essential.cc
@@ -1718,14 +1722,12 @@ mln_core_internal_force_exact_SOURCES = mln_core_internal_force_exact.cc
mln_core_internal_image_base_SOURCES = mln_core_internal_image_base.cc
mln_core_internal_check_image_fastest_SOURCES = mln_core_internal_check_image_fastest.cc
mln_core_internal_check_image_all_SOURCES = mln_core_internal_check_image_all.cc
-mln_core_internal_line_graph_vicinity_piter_SOURCES = mln_core_internal_line_graph_vicinity_piter.cc
mln_core_internal_fixme_SOURCES = mln_core_internal_fixme.cc
mln_core_internal_morpher_lvalue_SOURCES = mln_core_internal_morpher_lvalue.cc
mln_core_internal_image_domain_morpher_SOURCES = mln_core_internal_image_domain_morpher.cc
mln_core_internal_image_primary_SOURCES = mln_core_internal_image_primary.cc
mln_core_internal_set_of_SOURCES = mln_core_internal_set_of.cc
mln_core_internal_complex_window_p_base_SOURCES = mln_core_internal_complex_window_p_base.cc
-mln_core_internal_graph_relative_piter_SOURCES = mln_core_internal_graph_relative_piter.cc
mln_core_internal_graph_window_base_SOURCES = mln_core_internal_graph_window_base.cc
mln_core_internal_piter_adaptor_SOURCES = mln_core_internal_piter_adaptor.cc
mln_core_internal_weighted_window_base_SOURCES = mln_core_internal_weighted_window_base.cc
@@ -1737,7 +1739,6 @@ mln_core_internal_image_identity_SOURCES = mln_core_internal_image_identity.cc
mln_core_internal_pseudo_site_base_SOURCES = mln_core_internal_pseudo_site_base.cc
mln_core_internal_window_base_SOURCES = mln_core_internal_window_base.cc
mln_core_internal_box_impl_SOURCES = mln_core_internal_box_impl.cc
-mln_core_internal_graph_neighborhood_base_SOURCES = mln_core_internal_graph_neighborhood_base.cc
mln_core_internal_site_set_iterator_base_SOURCES = mln_core_internal_site_set_iterator_base.cc
mln_core_contract_SOURCES = mln_core_contract.cc
mln_core_all_SOURCES = mln_core_all.cc
@@ -1864,7 +1865,6 @@ mln_core_image_lazy_image_SOURCES = mln_core_image_lazy_image.cc
mln_core_image_t_image_SOURCES = mln_core_image_t_image.cc
mln_core_image_hexa_piter_SOURCES = mln_core_image_hexa_piter.cc
mln_core_image_value_enc_image_SOURCES = mln_core_image_value_enc_image.cc
-mln_core_image_graph_elt_neighborhood_SOURCES = mln_core_image_graph_elt_neighborhood.cc
mln_core_image_sub_image_if_SOURCES = mln_core_image_sub_image_if.cc
mln_core_image_all_SOURCES = mln_core_image_all.cc
mln_core_image_mono_rle_image_SOURCES = mln_core_image_mono_rle_image.cc
@@ -1889,8 +1889,8 @@ mln_core_image_image1d_SOURCES = mln_core_image_image1d.cc
mln_core_image_extension_val_SOURCES = mln_core_image_extension_val.cc
mln_core_image_image_if_SOURCES = mln_core_image_image_if.cc
mln_core_image_hexa_SOURCES = mln_core_image_hexa.cc
-mln_core_image_line_graph_elt_neighborhood_SOURCES = mln_core_image_line_graph_elt_neighborhood.cc
mln_core_image_extended_SOURCES = mln_core_image_extended.cc
+mln_core_image_line_graph_elt_piter_SOURCES = mln_core_image_line_graph_elt_piter.cc
mln_core_image_image2d_h_SOURCES = mln_core_image_image2d_h.cc
mln_core_image_line_graph_neighborhood_piter_SOURCES = mln_core_image_line_graph_neighborhood_piter.cc
mln_core_image_line_graph_window_piter_SOURCES = mln_core_image_line_graph_window_piter.cc
@@ -1922,9 +1922,13 @@ mln_test_all_SOURCES = mln_test_all.cc
mln_test_positive_SOURCES = mln_test_positive.cc
mln_test_essential_SOURCES = mln_test_essential.cc
mln_transform_distance_geodesic_SOURCES = mln_transform_distance_geodesic.cc
+mln_transform_internal_all_SOURCES = mln_transform_internal_all.cc
+mln_transform_internal_distance_functor_SOURCES = mln_transform_internal_distance_functor.cc
+mln_transform_internal_influence_zone_functor_SOURCES = mln_transform_internal_influence_zone_functor.cc
mln_transform_all_SOURCES = mln_transform_all.cc
+mln_transform_influence_zone_front_SOURCES = mln_transform_influence_zone_front.cc
+mln_transform_distance_front_SOURCES = mln_transform_distance_front.cc
mln_transform_influence_zone_geodesic_SOURCES = mln_transform_influence_zone_geodesic.cc
-mln_transform_distance_SOURCES = mln_transform_distance.cc
mln_transform_essential_SOURCES = mln_transform_essential.cc
mln_arith_includes_SOURCES = mln_arith_includes.cc
mln_arith_plus_SOURCES = mln_arith_plus.cc
diff --git a/milena/tests/unit_test/mln_all.cc b/milena/tests/unit_test/mln_all.cc
new file mode 100644
index 0000000..f266315
--- /dev/null
+++ b/milena/tests/unit_test/mln_all.cc
@@ -0,0 +1,8 @@
+// Unit test for mln/all.hh.
+// Generated file, do not modify.
+#include <mln/all.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_canvas_distance_front.cc b/milena/tests/unit_test/mln_canvas_distance_front.cc
new file mode 100644
index 0000000..cc59ee1
--- /dev/null
+++ b/milena/tests/unit_test/mln_canvas_distance_front.cc
@@ -0,0 +1,8 @@
+// Unit test for mln/canvas/distance_front.hh.
+// Generated file, do not modify.
+#include <mln/canvas/distance_front.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_core_image_graph_elt_neighborhood.cc b/milena/tests/unit_test/mln_core_image_graph_elt_neighborhood.cc
deleted file mode 100644
index caf3e89..0000000
--- a/milena/tests/unit_test/mln_core_image_graph_elt_neighborhood.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-// Unit test for mln/core/image/graph_elt_neighborhood.hh.
-// Generated file, do not modify.
-#include <mln/core/image/graph_elt_neighborhood.hh>
-
-int main()
-{
- // Nothing.
-}
diff --git a/milena/tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc b/milena/tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc
deleted file mode 100644
index 1a11c81..0000000
--- a/milena/tests/unit_test/mln_core_image_line_graph_elt_neighborhood.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-// Unit test for mln/core/image/line_graph_elt_neighborhood.hh.
-// Generated file, do not modify.
-#include <mln/core/image/line_graph_elt_neighborhood.hh>
-
-int main()
-{
- // Nothing.
-}
diff --git a/milena/tests/unit_test/mln_core_image_line_graph_elt_piter.cc b/milena/tests/unit_test/mln_core_image_line_graph_elt_piter.cc
new file mode 100644
index 0000000..7d83066
--- /dev/null
+++ b/milena/tests/unit_test/mln_core_image_line_graph_elt_piter.cc
@@ -0,0 +1,8 @@
+// Unit test for mln/core/image/line_graph_elt_piter.hh.
+// Generated file, do not modify.
+#include <mln/core/image/line_graph_elt_piter.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_core_internal_graph_neighborhood_base.cc b/milena/tests/unit_test/mln_core_internal_graph_neighborhood_base.cc
deleted file mode 100644
index 868f61a..0000000
--- a/milena/tests/unit_test/mln_core_internal_graph_neighborhood_base.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-// Unit test for mln/core/internal/graph_neighborhood_base.hh.
-// Generated file, do not modify.
-#include <mln/core/internal/graph_neighborhood_base.hh>
-
-int main()
-{
- // Nothing.
-}
diff --git a/milena/tests/unit_test/mln_core_internal_graph_relative_piter.cc b/milena/tests/unit_test/mln_core_internal_graph_relative_piter.cc
deleted file mode 100644
index 8237c21..0000000
--- a/milena/tests/unit_test/mln_core_internal_graph_relative_piter.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-// Unit test for mln/core/internal/graph_relative_piter.hh.
-// Generated file, do not modify.
-#include <mln/core/internal/graph_relative_piter.hh>
-
-int main()
-{
- // Nothing.
-}
diff --git a/milena/tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc b/milena/tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc
deleted file mode 100644
index 7f0afa8..0000000
--- a/milena/tests/unit_test/mln_core_internal_line_graph_vicinity_piter.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-// Unit test for mln/core/internal/line_graph_vicinity_piter.hh.
-// Generated file, do not modify.
-#include <mln/core/internal/line_graph_vicinity_piter.hh>
-
-int main()
-{
- // Nothing.
-}
diff --git a/milena/tests/unit_test/mln_transform_distance.cc b/milena/tests/unit_test/mln_transform_distance.cc
deleted file mode 100644
index 32bfcb4..0000000
--- a/milena/tests/unit_test/mln_transform_distance.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-// Unit test for mln/transform/distance.hh.
-// Generated file, do not modify.
-#include <mln/transform/distance.hh>
-
-int main()
-{
- // Nothing.
-}
diff --git a/milena/tests/unit_test/mln_transform_distance_front.cc b/milena/tests/unit_test/mln_transform_distance_front.cc
new file mode 100644
index 0000000..b938d12
--- /dev/null
+++ b/milena/tests/unit_test/mln_transform_distance_front.cc
@@ -0,0 +1,8 @@
+// Unit test for mln/transform/distance_front.hh.
+// Generated file, do not modify.
+#include <mln/transform/distance_front.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_transform_influence_zone_front.cc b/milena/tests/unit_test/mln_transform_influence_zone_front.cc
new file mode 100644
index 0000000..48bcfa3
--- /dev/null
+++ b/milena/tests/unit_test/mln_transform_influence_zone_front.cc
@@ -0,0 +1,8 @@
+// Unit test for mln/transform/influence_zone_front.hh.
+// Generated file, do not modify.
+#include <mln/transform/influence_zone_front.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_transform_internal_all.cc b/milena/tests/unit_test/mln_transform_internal_all.cc
new file mode 100644
index 0000000..f4429cb
--- /dev/null
+++ b/milena/tests/unit_test/mln_transform_internal_all.cc
@@ -0,0 +1,8 @@
+// Unit test for mln/transform/internal/all.hh.
+// Generated file, do not modify.
+#include <mln/transform/internal/all.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_transform_internal_distance_functor.cc b/milena/tests/unit_test/mln_transform_internal_distance_functor.cc
new file mode 100644
index 0000000..e802447
--- /dev/null
+++ b/milena/tests/unit_test/mln_transform_internal_distance_functor.cc
@@ -0,0 +1,8 @@
+// Unit test for mln/transform/internal/distance_functor.hh.
+// Generated file, do not modify.
+#include <mln/transform/internal/distance_functor.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/unit_test/mln_transform_internal_influence_zone_functor.cc b/milena/tests/unit_test/mln_transform_internal_influence_zone_functor.cc
new file mode 100644
index 0000000..0a84c0b
--- /dev/null
+++ b/milena/tests/unit_test/mln_transform_internal_influence_zone_functor.cc
@@ -0,0 +1,8 @@
+// Unit test for mln/transform/internal/influence_zone_functor.hh.
+// Generated file, do not modify.
+#include <mln/transform/internal/influence_zone_functor.hh>
+
+int main()
+{
+ // Nothing.
+}
diff --git a/milena/tests/util/line_graph.cc b/milena/tests/util/line_graph.cc
index 655007c..1a65dee 100644
--- a/milena/tests/util/line_graph.cc
+++ b/milena/tests/util/line_graph.cc
@@ -111,9 +111,6 @@ int main()
mln_assertion((v.nmax_nbh_edges() == 0 && i == 0) || i != v.nmax_nbh_edges());
}
}
- std::cout << g << std::endl;
- std::cout << "----" << std::endl;
- std::cout << lg << std::endl;
{
mln_edge_fwd_iter_(LG) e(lg);
mln_edge_nbh_edge_fwd_iter_(LG) n(e);
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make tests compile without warnings.
* trash: New directory.
Trash mln::neighb stuff.
* mln/neighb/essential.hh: Remove.
* mln/neighb/all.hh: Remove.
* mln/neighb/image.hh: Rename as...
* trash/neighb_image.hh: ...this.
* tests/neighb/image.cc: Rename as...
* trash/neighb_image.cc: ...this.
* mln/neighb/get.hh: Rename as...
* trash/neighb_get.hh: ...this.
* tests/neighb/Makefile.am: Remove.
* tests/neighb: Remove directory.
* mln/neighb: Remove directory.
Trash convert/to_tiles.
* mln/convert/to_tiles.hh: Rename as...
* trash/to_tiles.hh: ...this.
* tests/convert/to_tiles.cc: Rename as...
* trash/to_tiles.cc: ...this.
Trash display stuff.
* mln/display/show.hh: Rename as....
* trash/display_show.hh: ...this.
* tests/display/show.cc: Rename as....
* trash/display_show.cc: ...this.
* mln/display/save_and_show.hh: Rename as....
* trash/display_save_and_show.hh: ...this.
* tests/display/save_and_show.cc: Rename as....
* trash/save_and_show.cc: ...this.
* mln/display/color_pretty.hh: Rename as....
* trash/display_color_pretty.hh: ...this.
* tests/display/color_pretty.cc: Rename as....
* trash/display_color_pretty.cc: ...this.
Trash translate image.
* mln/core/image/translate_image.hh: Rename as...
* trash/translate_image.hh: ...this.
* mln/core/image/all.hh: Update.
* tests/core/image/translate_image.cc: Rename as...
* trash/translate_image.cc: ...this.
Remove obsolete files.
* mln/draw/label.hh: Remove.
* mln/draw/all.hh: Update.
* tests/draw/label.cc: Remove.
* mln/morpho/erosion_fast.hh: Remove.
* mln/morpho/dilation_fast.hh: Remove.
* mln/morpho/all.hh: Update.
* mln/morpho/essential.hh: Update.
* tests/morpho/dilation_max_h.cc: Remove.
* tests/morpho/erosion_min_h.cc: Remove.
* tests/morpho/temp.erosion.cc: Remove.
* tests/logical/or_full.cc: Remove.
* tests/logical/not_full.cc: Remove.
* tests/logical/and_not_full.cc: Remove.
* tests/logical/and_full.cc: Remove.
Update Makefiles.
* tests/convert/Makefile.am: Update.
* tests/core/image/Makefile.am: Update.
* tests/display/Makefile.am: Update.
* tests/morpho/Makefile.am: Update.
Fix some tests warnings and errors.
* mln/trait/value_.hh,
* mln/metal/converts_to.hh,
* mln/level/replace.hh,
* mln/accu/line.hh,
* mln/convert/all.hh,
* mln/win/inter.hh,
* mln/morpho/meyer_wst.hh,
* mln/util/tree_fast.hh,
* mln/util/lemmings.hh,
* mln/labeling/blobs.hh,
* tests/literal/zero.cc,
* tests/literal/one.cc,
* tests/draw/graph.cc,
* tests/arith/revert_full.cc,
* tests/level/compute_full.cc,
* tests/border/fill_full.cc,
* tests/win/inter.cc,
* tests/morpho/meyer_wst.cc,
* tests/morpho/meyer_wst_long.cc,
* tests/Makefile.am,
* tests/util/ord_pair.cc,
* tests/util/lemmings.cc,
* tests/util/tree_fast_to_image.cc: Fix.
* mln/literal/all.hh: Add a commentary about g++ warning.
Eventually use -Wignore_qualifiers.
mln/accu/line.hh | 12 ++-
mln/convert/all.hh | 13 ++-
mln/core/image/all.hh | 11 +--
mln/draw/all.hh | 13 ++-
mln/labeling/blobs.hh | 7 +-
mln/level/replace.hh | 28 +++++---
mln/literal/all.hh | 21 ++++--
mln/metal/converts_to.hh | 18 +++--
mln/morpho/all.hh | 2
mln/morpho/essential.hh | 12 +--
mln/morpho/meyer_wst.hh | 4 -
mln/trait/value_.hh | 4 -
mln/util/lemmings.hh | 21 +++---
mln/util/tree_fast.hh | 21 +++---
mln/win/inter.hh | 8 +-
tests/Makefile.am | 1
tests/arith/revert_full.cc | 48 ++------------
tests/border/fill_full.cc | 128 ++-------------------------------------
tests/convert/Makefile.am | 2
tests/core/image/Makefile.am | 2
tests/display/Makefile.am | 11 ---
tests/draw/graph.cc | 2
tests/level/compute_full.cc | 9 +-
tests/literal/one.cc | 14 ++--
tests/literal/zero.cc | 14 ++--
tests/morpho/Makefile.am | 5 -
tests/morpho/meyer_wst.cc | 11 +--
tests/morpho/meyer_wst_long.cc | 28 +++-----
tests/util/lemmings.cc | 51 ++++++++-------
tests/util/ord_pair.cc | 16 ++--
tests/util/tree_fast_to_image.cc | 18 ++---
tests/win/inter.cc | 4 -
32 files changed, 215 insertions(+), 344 deletions(-)
Property changes on: trash/to_tiles.hh
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/neighb_image.cc
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/translate_image.cc
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/display_show.hh
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/display_save_and_show.hh
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/save_and_show.cc
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/to_tiles.cc
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/display_color_pretty.hh
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/display_show.cc
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/neighb_get.hh
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/neighb_image.hh
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/translate_image.hh
___________________________________________________________________
Added: svn:mergeinfo
Property changes on: trash/display_color_pretty.cc
___________________________________________________________________
Added: svn:mergeinfo
Index: tests/core/image/Makefile.am
--- tests/core/image/Makefile.am (revision 2991)
+++ tests/core/image/Makefile.am (working copy)
@@ -28,7 +28,6 @@
sub_image \
t_image \
tr_image
-## translate_image \
## value_enc_image
##bgraph_image_SOURCES = bgraph_image.cc
@@ -55,7 +54,6 @@
sub_image_SOURCES = sub_image.cc
t_image_SOURCES = t_image.cc
tr_image_SOURCES = tr_image.cc
-##translate_image_SOURCES = translate_image.cc
##value_enc_image_SOURCES = value_enc_image.cc
# Tests depending on the FreeImagePlus library.
Index: tests/literal/zero.cc
--- tests/literal/zero.cc (revision 2991)
+++ tests/literal/zero.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/literal/zero.cc
- *
- * \brief Tests on mln::literal::zero.
- */
+/// \file tests/literal/zero.cc
+///
+/// Tests on mln::literal::zero.
#include <mln/literal/zero.hh>
#include <mln/literal/one.hh>
@@ -43,7 +43,7 @@
unsigned char c;
c = literal::zero;
- mln_assertion(c == 0);
+ mln_assertion(c == 0u);
double d;
d = literal::zero;
@@ -54,5 +54,5 @@
value::int_u8 u(literal::zero), uu;
uu = literal::zero;
- mln_assertion(u == 0 && 0 == u);
+ mln_assertion(u == 0u && 0u == u);
}
Index: tests/literal/one.cc
--- tests/literal/one.cc (revision 2991)
+++ tests/literal/one.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/literal/one.cc
- *
- * \brief Tests on mln::literal::one.
- */
+/// \file tests/literal/one.cc
+///
+/// Tests on mln::literal::one.
#include <mln/literal/one.hh>
#include <mln/literal/zero.hh>
@@ -43,7 +43,7 @@
unsigned char c;
c = literal::one;
- mln_assertion(c == 1);
+ mln_assertion(c == 1u);
double d;
d = literal::one;
@@ -54,5 +54,5 @@
value::int_u8 u(literal::one), uu;
uu = literal::one;
- mln_assertion(u == 1 && 1 == u);
+ mln_assertion(u == 1u && 1u == u);
}
Index: tests/draw/graph.cc
--- tests/draw/graph.cc (revision 2991)
+++ tests/draw/graph.cc (working copy)
@@ -74,7 +74,7 @@
mln::p_vertices<G, F> pg(g, fpoints);
image2d<int> ima(nrows, ncols);
- level::fill(ima, literal::zero);
+ level::fill(ima, 0);
debug::draw_graph(ima, pg, 2, 1);
mln_assertion(ima == ref);
}
Index: tests/level/compute_full.cc
--- tests/level/compute_full.cc (revision 2991)
+++ tests/level/compute_full.cc (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/level/compute_full.cc
- *
- * \brief Tests on mln::level::compute.
- */
+/// \file tests/level/compute_full.cc
+///
+/// Tests on mln::level::compute.
#include <mln/core/image/image1d.hh>
#include <mln/core/image/image2d.hh>
@@ -194,7 +194,6 @@
image3d<I> ima (slis, rows, cols);
debug::iota (ima);
I real_min = 1;
- I real_min2 = 1;
I real_max;
if (slis * rows * cols >= (unsigned)mln_max(I))
{
Index: tests/arith/revert_full.cc
--- tests/arith/revert_full.cc (revision 2991)
+++ tests/arith/revert_full.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,31 +26,24 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/arith/revert_full.cc
- *
- * \brief Tests on mln::arith::revert.
- */
-
-
-
-
+/// \file tests/arith/revert_full.cc
+///
+/// Tests on mln::arith::revert.
+///
+/// \todo Rewrite this non-sense test file!!!
#include <mln/core/image/image1d.hh>
#include <mln/core/image/image2d.hh>
#include <mln/core/image/image3d.hh>
#include <mln/core/image/sub_image.hh>
-
#include <mln/core/image/image_if.hh>
-#include <mln/fun/p2b/chess.hh>
+#include <mln/fun/p2b/chess.hh>
#include <mln/literal/origin.hh>
-
#include <mln/value/int_s8.hh>
#include <mln/value/int_s16.hh>
-
#include <mln/debug/iota.hh>
-
#include <mln/arith/revert.hh>
@@ -108,7 +102,7 @@
mln_piter(I) p (ima.domain ());
for_all(p)
- mln_assertion (ima(p) == mln_min(V) + mln_max(V) - ref(p));
+ mln_assertion (ima(p) == mln_value(J)(mln_min(V) + mln_max(V) - ref(p)));
}
template <typename V>
@@ -126,7 +120,6 @@
unsigned col = 100;
- (std::cerr << "in 1d ... ").flush ();
{
typedef image1d<V> I;
@@ -141,9 +134,6 @@
chck (ref, ima);
}
}
- std::cerr << "OK" << std::endl;
-
- (std::cerr << "in 2d ... ").flush ();
{
typedef image2d<V> I;
@@ -159,9 +149,6 @@
chck (ref, ima);
}
}
- std::cerr << "OK" << std::endl;
-
- (std::cerr << "in 3d ... ").flush ();
{
typedef image3d<V> I;
@@ -178,10 +165,6 @@
chck (ref, ima);
}
}
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << "in subimage 1d ... ").flush ();
{
typedef image1d<V> I;
typedef sub_image<I, box1d> J;
@@ -201,9 +184,6 @@
chck (ref, ima);
}
}
- std::cerr << "OK" << std::endl;
-
- (std::cerr << "in subimage 2d ... ").flush ();
{
typedef image2d<V> I;
typedef sub_image<I, box2d> J;
@@ -223,9 +203,6 @@
chck (ref, ima);
}
}
- std::cerr << "OK" << std::endl;
-
- (std::cerr << "in subimage 3d ... ").flush ();
{
typedef image3d<V> I;
typedef sub_image<I, box3d> J;
@@ -246,7 +223,6 @@
chck (ref, ima);
}
}
- std::cerr << "OK" << std::endl;
}
}
@@ -259,16 +235,10 @@
{
using namespace mln;
- std::cerr << "Tests arith::revert:" << std::endl;
- std::cerr << "on int:" << std::endl;
chk<int>();
- std::cerr << "on int_s8:" << std::endl;
chk<value::int_s8>();
- std::cerr << "on int_s16:" << std::endl;
chk<value::int_s16>();
- std::cerr << "on int_u8:" << std::endl;
chk<value::int_u8>();
- std::cerr << "on unsigned:" << std::endl;
chk<unsigned>();
}
Index: tests/border/fill_full.cc
--- tests/border/fill_full.cc (revision 2991)
+++ tests/border/fill_full.cc (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,10 +26,11 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/border/fill_full.cc
- *
- * \brief Tests on mln::border::fill.
- */
+/// \file tests/border/fill_full.cc
+///
+/// Tests on mln::border::fill.
+///
+/// \todo Rewrite this non-sense test file!!!
#include <mln/border/fill.hh>
#include <mln/level/fill.hh>
@@ -49,7 +51,7 @@
template <typename T>
-int
+void
check1d(unsigned row, unsigned border, T& value, T& v)
{
image1d<T> ima(row, border);
@@ -68,7 +70,7 @@
}
template <typename T>
-int
+void
check2d(unsigned row, unsigned col, unsigned border, T& value, T& v)
{
image2d<T> ima(row, col, border);
@@ -98,7 +100,7 @@
}
template <typename T>
-int
+void
check3d(unsigned sli, unsigned row, unsigned col, unsigned border, T& value, T& v)
{
image3d<T> ima(sli, row, col, border);
@@ -133,267 +135,155 @@
{
int limits = 10;
- std::cerr << "Tests border::fill:" << std::endl;
-
{
- std::cerr << " on int:" << std::endl;
-
typedef int T;
T value = (T) -1;
T v = 42;
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on unsigned:" << std::endl;
-
typedef unsigned T;
T value = (T) -1;
T v = 42;
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on int_u8:" << std::endl;
-
typedef value::int_u8 T;
T value = 255;
T v = 42;
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on int_u16:" << std::endl;
-
typedef value::int_u16 T;
T value = 65535;
T v = 42;
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on int_s8:" << std::endl;
-
typedef value::int_s8 T;
T value = 127;
T v = 42;
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on int_s16:" << std::endl;
-
typedef value::int_s16 T;
T value = 32767;
T v = 42;
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on rgb8:" << std::endl;
-
typedef value::rgb8 T;
T value = T(255, 255, 255);
T v = T(42, 0, 0);
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on rgb16:" << std::endl;
-
typedef value::rgb16 T;
T value = T(65535, 65535, 65535);
T v = T(42, 0, 0);
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on float01_8:" << std::endl;
-
typedef value::float01_8 T;
T value = T(0.9999);
T v = T(0.111);
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
{
- std::cerr << " on float01_16:" << std::endl;
-
typedef value::float01_16 T;
T value = T(0.9999);
T v = T(0.111);
- (std::cerr << " in 1d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
check1d(i, j, value, v);
- std::cerr << "OK" << std::endl;
-
-
- (std::cerr << " in 2d ... ").flush ();
-
for (int i = 1; i < limits; ++i)
for (int j = 1; j < limits; ++j)
for (int k = 1; k < limits; ++k)
check2d(i, j, k, value, v);
-
- std::cerr << "OK" << std::endl;
}
Index: tests/convert/Makefile.am
--- tests/convert/Makefile.am (revision 2991)
+++ tests/convert/Makefile.am (working copy)
@@ -7,13 +7,11 @@
to_image \
to_p_array \
to_p_set \
-## to_tiles \
to_window
to_image_SOURCES = to_image.cc
to_p_array_SOURCES = to_p_array.cc
to_p_set_SOURCES = to_p_set.cc
-#to_tiles_SOURCES = to_tiles.cc
to_window_SOURCES = to_window.cc
TESTS = $(check_PROGRAMS)
Index: tests/win/inter.cc
--- tests/win/inter.cc (revision 2991)
+++ tests/win/inter.cc (working copy)
@@ -28,7 +28,7 @@
/// \file tests/win/inter.cc
///
-/// Tests on mln::set::inter.
+/// Tests on mln::win::inter.
#include <mln/win/inter.hh>
#include <mln/core/alias/dpoint2d.hh>
@@ -53,7 +53,7 @@
win2.insert(-4, 0);
win2.insert( 1,-1);
win2.insert( 6, 5);
- window2d win3 = set::inter(win1, win2);
+ window2d win3 = win1 && win2;
mln_assertion(!win3.has(dpoint2d( 2, 1)));
mln_assertion(!win3.has(dpoint2d( 0, 0)));
mln_assertion(!win3.has(dpoint2d( 1, 1)));
Index: tests/morpho/meyer_wst.cc
--- tests/morpho/meyer_wst.cc (revision 2991)
+++ tests/morpho/meyer_wst.cc (working copy)
@@ -26,7 +26,8 @@
// Public License.
/// \file tests/morpho/meyer_wst.cc
-// /\brief Test on mln::morpho::extrema_components
+///
+/// Test on mln::morpho::meyer_wst.
#include <iostream>
@@ -52,9 +53,9 @@
image2d<int_u8> input;
io::pgm::load(input, MLN_IMG_DIR "/squares.pgm");
- typedef int_u8 wst_val;
- wst_val nbasins;
- image2d<int_u8> output = morpho::meyer_wst(input, c4(), nbasins);
- std::cout << "nbasins = " << nbasins << std::endl;
+ typedef int_u8 L;
+ L nbasins;
+ image2d<L> output = morpho::meyer_wst(input, c4(), nbasins);
+
io::pgm::save(output, "out.pgm");
}
Index: tests/morpho/meyer_wst_long.cc
--- tests/morpho/meyer_wst_long.cc (revision 2991)
+++ tests/morpho/meyer_wst_long.cc (working copy)
@@ -26,7 +26,8 @@
// Public License.
/// \file tests/morpho/meyer_wst_long.cc
-// /\brief Test on mln::morpho::extrema_components
+///
+/// Test on mln::morpho::meyer_wst.
#include <iostream>
@@ -36,7 +37,7 @@
#include <mln/core/alias/neighb2d.hh>
#include <mln/value/int_u8.hh>
-#include <mln/value/int_u16.hh>
+#include <mln/value/label_16.hh>
#include <mln/morpho/gradient.hh>
#include <mln/morpho/closing_area.hh>
@@ -47,9 +48,9 @@
#include <mln/pw/cst.hh>
#include <mln/pw/value.hh>
-#include <mln/display/color_pretty.hh>
#include <mln/io/pgm/load.hh>
#include <mln/io/ppm/save.hh>
+#include <mln/debug/colorize.hh>
#include "tests/data.hh"
@@ -58,26 +59,19 @@
{
using namespace mln;
using value::int_u8;
- using value::int_u16;
image2d<int_u8> input;
io::pgm::load(input, MLN_IMG_DIR "/lena.pgm");
- image2d<int_u8> gradient =
- morpho::gradient (input, convert::to_window(c4()));
-
- // Simplify the input image.
- image2d<int_u8> work(input.domain());
- morpho::closing_area(gradient, c4(), 200, work);
+ image2d<int_u8>
+ grad = morpho::gradient(input, c4().win()),
+ clo = morpho::closing_area(grad, c4(), 200);
// Perform a Watershed Transform.
- typedef int_u16 wst_val;
- wst_val nbasins;
- image2d<wst_val> ws = morpho::meyer_wst(work, c4(), nbasins);
- std::cout << "nbasins = " << nbasins << std::endl;
+ typedef value::label16 L;
+ L nbasins;
+ image2d<L> ws = morpho::meyer_wst(clo, c4(), nbasins);
// Save the image in color.
- image2d<value::rgb8> input_plus_ws =
- display::color_pretty(input | (pw::value(ws) != pw::cst(0)));
- io::ppm::save(input_plus_ws, "out.ppm");
+ io::ppm::save(debug::colorize(value::rgb8(), ws, nbasins), "out.ppm");
}
Index: tests/morpho/Makefile.am
--- tests/morpho/Makefile.am (revision 2991)
+++ tests/morpho/Makefile.am (working copy)
@@ -17,9 +17,7 @@
complex_image_wst \
contrast \
dilation \
-## dilation_max_h \
erosion \
-## erosion_min_h \
general \
gradient \
## graph_image_morpho \
@@ -46,9 +44,6 @@
# FIXME: Have erosion and dilation perform symmetric tests.
erosion_SOURCES = erosion.cc
-##dilation_max_h_SOURCES = dilation_max_h.cc
-##erosion_min_h_SOURCES = erosion_min_h.cc
-
opening_area_SOURCES = opening_area.cc
closing_area_SOURCES = closing_area.cc
closing_height_SOURCES = closing_height.cc
Index: tests/display/Makefile.am
--- tests/display/Makefile.am (revision 2991)
+++ tests/display/Makefile.am (working copy)
@@ -2,17 +2,12 @@
include $(top_srcdir)/milena/tests/tests.mk
-check_PROGRAMS = \
- show \
- save_and_show \
- color_pretty
+check_PROGRAMS =
-show_SOURCES = show.cc
-save_and_show_SOURCES = save_and_show.cc
-color_pretty_SOURCES = color_pretty.cc
# FIXME: Don't execute `save' and `save_and_show' by default! These
# tests require a running X11 server (as well as a `pkill' binary...).
# Perform the necessary checks at configure time first.
#TESTS = $(check_PROGRAMS)
-TESTS = color_pretty
+
+TESTS =
Index: tests/Makefile.am
--- tests/Makefile.am (revision 2991)
+++ tests/Makefile.am (working copy)
@@ -30,7 +30,6 @@
math \
metal \
morpho \
- neighb \
norm \
pw \
set \
Index: tests/util/ord_pair.cc
--- tests/util/ord_pair.cc (revision 2991)
+++ tests/util/ord_pair.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -26,10 +27,11 @@
// Public License.
/// \file util/ord_pair.cc
-/// \brief Tests on mln::util::ord_pair.
+///
+/// Tests on mln::util::ord_pair.
#include <mln/core/alias/point2d.hh>
-#include <mln/util/ordpair.hh>
+#include <mln/util/ord_pair.hh>
int main()
@@ -38,8 +40,8 @@
point2d p1(5,6), p2(5,7), p3(4,2);
- mln_assertion(make::ordpair (p2, p1) == make::ordpair (p1, p2));
- mln_assertion(make::ordpair (p1, p3) < make::ordpair (p1, p2));
- mln_assertion(make::ordpair (p1, p2) <= make::ordpair (p1, p2));
- mln_assertion(make::ordpair (p1, p3) <= make::ordpair (p1, p2));
+ mln_assertion(make::ord_pair(p2, p1) == make::ord_pair(p1, p2));
+ mln_assertion(make::ord_pair(p1, p3) < make::ord_pair(p1, p2));
+ mln_assertion(make::ord_pair(p1, p2) <= make::ord_pair(p1, p2));
+ mln_assertion(make::ord_pair(p1, p3) <= make::ord_pair(p1, p2));
}
Index: tests/util/lemmings.cc
--- tests/util/lemmings.cc (revision 2991)
+++ tests/util/lemmings.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,16 +26,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*!
- * \file tests/util/lemmings.cc
- *
- * \brief test of mln::util::lemmings
- *
- */
+///
+/// \file tests/util/lemmings.cc
+///
+/// test of mln::util::lemmings
#include <mln/util/lemmings.hh>
#include <mln/core/image/image2d.hh>
+
int main ()
{
using namespace mln;
@@ -48,23 +48,26 @@
I ima = make::image<int>(vals);
- mln_site_(I) pt1(1, 0);
- mln_site_(I) pt2(0, 2);
- mln_site_(I) pt3(2, 3);
- mln_site_(I) pt4(3, 1);
- mln_site_(I) pt5(1, 1);
-
- mln_value_(I) vl1 = ima(pt1);
- mln_value_(I) vl2 = ima(pt2);
- mln_value_(I) vl3 = ima(pt3);
- mln_value_(I) vl4 = ima(pt4);
- mln_value_(I) vl5 = ima(pt5);
-
- mln_site_(I) ptl1 = util::lemmings(ima, pt1, right, vl1);
- mln_site_(I) ptl2 = util::lemmings(ima, pt2, down, vl2);
- mln_site_(I) ptl3 = util::lemmings(ima, pt3, left, vl3);
- mln_site_(I) ptl4 = util::lemmings(ima, pt4, up, vl4);
- mln_site_(I) ptl5 = util::lemmings(ima, pt5, up, vl5);
+ point2d
+ pt1(1, 0),
+ pt2(0, 2),
+ pt3(2, 3),
+ pt4(3, 1),
+ pt5(1, 1);
+
+ int
+ vl1 = ima(pt1),
+ vl2 = ima(pt2),
+ vl3 = ima(pt3),
+ vl4 = ima(pt4),
+ vl5 = ima(pt5);
+
+ point2d
+ ptl1 = util::lemmings(ima, pt1, right, vl1),
+ ptl2 = util::lemmings(ima, pt2, down, vl2),
+ ptl3 = util::lemmings(ima, pt3, left, vl3),
+ ptl4 = util::lemmings(ima, pt4, up, vl4),
+ ptl5 = util::lemmings(ima, pt5, up, vl5);
mln_assertion(ptl1 == point2d(1, 2));
mln_assertion(ptl2 == point2d(2, 2));
Index: tests/util/tree_fast_to_image.cc
--- tests/util/tree_fast_to_image.cc (revision 2991)
+++ tests/util/tree_fast_to_image.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,12 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*!
- * \file tests/util/tree_fast_to_image.cc
- *
- * \brief test of mln::util::tree_fast_to_image
- *
- */
+/// \file tests/util/tree_fast_to_image.cc
+///
+/// Test of mln::util::tree_fast_to_image.
#include <mln/util/tree_fast.hh>
#include <mln/core/contract.hh>
@@ -45,6 +43,7 @@
#include <mln/util/tree_fast_to_image.hh>
#include <mln/debug/println.hh>
+
template <typename P, typename V>
struct fllt_node
{
@@ -54,14 +53,13 @@
};
-int main (void)
+int main()
{
using namespace mln;
using value::int_u8;
typedef fllt_node<point2d , int_u8> I;
-
I s1;
I s2;
I s3;
@@ -131,7 +129,7 @@
};
- debug::printl (output);
+ debug::println(output);
image2d<int_u8> ref (make::image(vs));
mln_assertion(ref == output);
}
Index: mln/trait/value_.hh
--- mln/trait/value_.hh (revision 2991)
+++ mln/trait/value_.hh (working copy)
@@ -71,8 +71,8 @@
/// FIXME: check that the -1 is correct
# define mln_value_quant_from_(C) \
mlc_if(mln::metal::bool_<( int(C) > int(mlc_pow_int(2, mln::def::low_quant_nbits)) \
- || C == 0 \
- || C == -1)>, \
+ || int(C) == 0 \
+ || int(C) == -1)>, \
mln::trait::value::quant::high, \
mln::trait::value::quant::low)
Index: mln/core/image/all.hh
--- mln/core/image/all.hh (revision 2991)
+++ mln/core/image/all.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,11 +28,9 @@
#ifndef MLN_CORE_IMAGE_ALL_HH
# define MLN_CORE_IMAGE_ALL_HH
-/*! \file mln/core/image/all.hh
- *
- * \brief File that includes all image types.
- *
- */
+/// \file mln/core/image/all.hh
+///
+/// File that includes all image types.
//# include <mln/core/image/bgraph_image.hh>
@@ -91,7 +89,6 @@
# include <mln/core/image/sub_image.hh>
# include <mln/core/image/sub_image_if.hh>
# include <mln/core/image/t_image.hh>
-# include <mln/core/image/translate_image.hh>
# include <mln/core/image/tr_image.hh>
# include <mln/core/image/tr_mesh.hh>
//# include <mln/core/image/value_enc_image.hh>
Index: mln/literal/all.hh
--- mln/literal/all.hh (revision 2991)
+++ mln/literal/all.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,20 @@
#ifndef MLN_LITERAL_ALL_HH
# define MLN_LITERAL_ALL_HH
-/*! \file mln/literal/all.hh
- *
- * \brief File that includes all literals.
- */
+/// \file mln/literal/all.hh
+///
+/// File that includes all literals.
+
+// Technical note:
+//
+// With some recent g++ versions, we have a warning due to literal
+// conversions (namely: "type qualifiers ignored on function return
+// type"). This warning comes from the "operator T()" method
+// instantiated with T being a const type, for instance, when
+// literal::zero is given to a procedure expecting a "const int&"
+// object. This warning will be avoided in very recent versions
+// of C++ thanks to the new compiling option -Wignore_qualifiers.
+
namespace mln
{
Index: mln/draw/all.hh
--- mln/draw/all.hh (revision 2991)
+++ mln/draw/all.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_DRAW_ALL_HH
# define MLN_DRAW_ALL_HH
-/*! \file mln/draw/all.hh
- *
- * \brief File that includes all draw-related routines.
- */
+/// \file mln/draw/all.hh
+///
+/// File that includes all draw-related routines.
namespace mln
@@ -42,9 +42,10 @@
}
+
# include <mln/draw/box.hh>
-# include <mln/draw/label.hh>
# include <mln/draw/line.hh>
# include <mln/draw/plot.hh>
+
#endif // ! MLN_DRAW_ALL_HH
Index: mln/metal/converts_to.hh
--- mln/metal/converts_to.hh (revision 2991)
+++ mln/metal/converts_to.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_METAL_CONVERTS_TO_HH
# define MLN_METAL_CONVERTS_TO_HH
-/*! \file mln/metal/converts_to.hh
- *
- * \brief Definition of a type that means "converts to".
- */
+/// \file mln/metal/converts_to.hh
+///
+/// Definition of a type that means "converts to".
# include <mln/metal/is_a.hh>
# include <mln/metal/const.hh>
@@ -71,6 +71,14 @@
sizeof(internal::yes_) )>
{};
+ template <typename T, typename U>
+ struct converts_to<T*, U*> : converts_to<T, U>
+ {};
+
+ template <typename T, typename U>
+ struct converts_to<T**, U**> : false_
+ {};
+
} // end of namespace mln::metal
} // end of namespace mln
Index: mln/level/replace.hh
--- mln/level/replace.hh (revision 2991)
+++ mln/level/replace.hh (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,11 +29,9 @@
#ifndef MLN_LEVEL_REPLACE_HH
# define MLN_LEVEL_REPLACE_HH
-/*! \file mln/level/replace.hh
- *
- * \brief Replace the contents of an image into another one.
- *
- */
+/// \file mln/level/replace.hh
+///
+/// Replace the contents of an image into another one.
# include <mln/core/concept/image.hh>
# include <mln/core/image/image_if.hh>
@@ -41,6 +40,7 @@
# include <mln/pw/value.hh>
# include <mln/pw/cst.hh>
+
namespace mln
{
@@ -52,11 +52,11 @@
* \param[in] input The input image.
* \param[in] old_value The value to be replaced...
* \param[in] new_value ...by this one.
- *
*/
template <typename I>
- void replace(Image<I>& input, const mln_value(I)& old_value,
- const mln_value(I)& new_value);
+ void replace(Image<I>& input,
+ const mln_value(I)& old_value, const mln_value(I)& new_value);
+
# ifndef MLN_INCLUDE_ONLY
@@ -72,7 +72,11 @@
const mln_value(I)& new_value)
{
trace::entering("level::impl::generic::replace");
- level::fill((exact(input_) | pw::value(input_) == pw::cst(old_value)).rw(), new_value);
+ I& input = exact(input_);
+
+ level::fill((input | (pw::value(input) == pw::cst(old_value))).rw(),
+ new_value);
+
trace::exiting("level::impl::generic::replace");
}
@@ -81,16 +85,18 @@
} // end of namespace mln::level::impl
+
// Facade.
template <typename I>
- void replace(Image<I>& input, const mln_value(I)& old_value,
- const mln_value(I)& new_value)
+ void replace(Image<I>& input,
+ const mln_value(I)& old_value, const mln_value(I)& new_value)
{
trace::entering("level::replace");
mln_precondition(exact(input).has_data());
impl::generic::replace_<I>(exact(input), old_value, new_value);
+
trace::exiting("level::replace");
}
Index: mln/accu/line.hh
--- mln/accu/line.hh (revision 2991)
+++ mln/accu/line.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -29,6 +30,7 @@
# define MLN_ACCU_LINE_HH
/// \file mln/accu/line.hh
+///
/// Run an accumulator on a line of images.
///
/// \todo Suppress integer manipulations (redundant with ptr arith).
@@ -112,8 +114,8 @@
typename I, typename O>
void
line(const Image<I>& input_,
- const mln_site(I)& p_start, unsigned len,
- unsigned half_length,
+ const mln_site(I)& p_start, unsigned len_,
+ unsigned half_length_,
Image<O>& output_)
{
typedef mln_site(I) P;
@@ -122,6 +124,10 @@
const I& input = exact(input_);
O& output = exact(output_);
+ // Avoid warning in signed/unsigned comparison.
+ const def::coord len = len_;
+ const def::coord half_length = half_length_;
+
// Checks and tests.
internal::line_tests<Meta_Accu, Dir>(input,
p_start, len,
Index: mln/convert/all.hh
--- mln/convert/all.hh (revision 2991)
+++ mln/convert/all.hh (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,18 +29,20 @@
#ifndef MLN_CONVERT_ALL_HH
# define MLN_CONVERT_ALL_HH
-/*! \file mln/convert/all.hh
- *
- * \brief File that includes all conversion-related routines.
- */
+/// \file mln/convert/all.hh
+///
+/// File that includes all conversion-related routines.
namespace mln
{
+
/// Namespace of conversion routines.
namespace convert {}
+
}
+
# include <mln/convert/from_to.hh>
# include <mln/convert/to.hh>
@@ -48,8 +51,8 @@
# include <mln/convert/to_image.hh>
# include <mln/convert/to_rgb.hh>
# include <mln/convert/to_std_set.hh>
-# include <mln/convert/to_tiles.hh>
# include <mln/convert/to_p_array.hh>
# include <mln/convert/to_window.hh>
+
#endif // ! MLN_CONVERT_ALL_HH
Index: mln/win/inter.hh
--- mln/win/inter.hh (revision 2991)
+++ mln/win/inter.hh (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_WIN_INTER_HH
# define MLN_WIN_INTER_HH
-/*! \file mln/win/inter.hh
- *
- * \brief Define a function which inters a window with a delta-point.
- */
+/// \file mln/win/inter.hh
+///
+/// \brief Define a function which inters a window with a delta-point.
# include <mln/core/window.hh>
Index: mln/morpho/all.hh
--- mln/morpho/all.hh (revision 2991)
+++ mln/morpho/all.hh (working copy)
@@ -59,9 +59,7 @@
# include <mln/morpho/closing.hh>
# include <mln/morpho/complementation.hh>
# include <mln/morpho/contrast.hh>
-# include <mln/morpho/dilation_fast.hh>
# include <mln/morpho/dilation.hh>
-# include <mln/morpho/erosion_fast.hh>
# include <mln/morpho/erosion.hh>
# include <mln/morpho/general.hh>
# include <mln/morpho/gradient.hh>
Index: mln/morpho/essential.hh
--- mln/morpho/essential.hh (revision 2991)
+++ mln/morpho/essential.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,15 +28,13 @@
#ifndef MLN_MORPHO_ESSENTIAL_HH
# define MLN_MORPHO_ESSENTIAL_HH
-/*! \file mln/morpho/essential.hh
- *
- * \brief File that includes essential morpho-related routines.
- */
+/// \file mln/morpho/essential.hh
+///
+/// File that includes essential morpho-related routines.
+
# include <mln/morpho/closing.hh>
-# include <mln/morpho/dilation_fast.hh>
# include <mln/morpho/dilation.hh>
-# include <mln/morpho/erosion_fast.hh>
# include <mln/morpho/erosion.hh>
# include <mln/morpho/gradient.hh>
# include <mln/morpho/hit_or_miss.hh>
Index: mln/morpho/meyer_wst.hh
--- mln/morpho/meyer_wst.hh (revision 2991)
+++ mln/morpho/meyer_wst.hh (working copy)
@@ -75,7 +75,7 @@
\li \p I is the exact type of the input image.
\li \p N is the exact type of the neighborhood used to express
\a input's connexity. */
- template <typename L, typename I, typename N>
+ template <typename I, typename N, typename L>
mln_ch_value(I, L)
meyer_wst(const Image<I>& input, const Neighborhood<N>& nbh,
L& nbasins);
@@ -103,7 +103,7 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename L, typename I, typename N>
+ template <typename I, typename N, typename L>
mln_ch_value(I, L)
meyer_wst(const Image<I>& input_, const Neighborhood<N>& nbh_,
L& nbasins)
Index: mln/util/tree_fast.hh
--- mln/util/tree_fast.hh (revision 2991)
+++ mln/util/tree_fast.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -29,15 +30,12 @@
# define MLN_UTIL_TREE_FAST_HH
# include <vector>
-
# include <mln/core/contract.hh>
-/*!
- * \file mln/util/tree_fast.hh
- *
- * \brief Definition of a fast generic general fast tree.
- *
- */
+/// \file mln/util/tree_fast.hh
+///
+/// Definition of a fast generic general fast tree.
+
namespace mln
{
@@ -63,7 +61,7 @@
*
* \return the number of node of the tree.
*/
- const unsigned size() const;
+ unsigned size() const;
/*! \brief Check if the tree has \p elt.
@@ -115,6 +113,8 @@
unsigned root_;
};
+
+
# ifndef MLN_INCLUDE_ONLY
template <typename T>
@@ -136,7 +136,7 @@
template <typename T>
inline
- const unsigned
+ unsigned
tree_fast<T>::size() const
{
return (data_.size ());
@@ -213,7 +213,6 @@
} // end of namespace mln::util
-
} // end of namespace mln
Index: mln/util/lemmings.hh
--- mln/util/lemmings.hh (revision 2991)
+++ mln/util/lemmings.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,10 +29,9 @@
#ifndef MLN_UTIL_LEMMINGS_HH
# define MLN_UTIL_LEMMINGS_HH
-/*! \file mln/util/lemmings.hh
- *
- * \brief Definition of an "lemmings" object.
- */
+/// \file mln/util/lemmings.hh
+///
+/// Definition of an "lemmings" object.
# include <mln/core/concept/image.hh>
# include <mln/set/is_subset_of.hh>
@@ -50,13 +50,13 @@
struct lemmings_ : public Object< lemmings_<I> >
{
lemmings_(const Image<I>& ima, const mln_psite(I)& pt,
- const mln_dpsite(I)& dpt, const mln_value(I)& val);
+ const mln_deduce(I, psite, delta)& dpt, const mln_value(I)& val);
mln_psite(I) operator()();
const I& ima_;
mln_psite(I) pt_;
- const mln_dpsite(I)& dpt_;
+ const mln_deduce(I, psite, delta)& dpt_;
const mln_value(I)& val_;
};
@@ -76,7 +76,8 @@
template <typename I>
mln_psite(I)
lemmings(const Image<I>& ima, const mln_psite(I)& pt,
- const mln_dpsite(I)& dpt, const mln_value(I)& val);
+ const mln_deduce(I, psite, delta)& dpt, const mln_value(I)& val);
+
# ifndef MLN_INCLUDE_ONLY
@@ -85,7 +86,7 @@
template <typename I>
inline
lemmings_<I>::lemmings_(const Image<I>& ima, const mln_psite(I)& pt,
- const mln_dpsite(I)& dpt, const mln_value(I)& val)
+ const mln_deduce(I, psite, delta)& dpt, const mln_value(I)& val)
: ima_(exact(ima)),
pt_(pt),
dpt_(dpt),
@@ -105,7 +106,7 @@
template <typename I>
mln_psite(I)
lemmings(const Image<I>& ima, const mln_psite(I)& pt,
- const mln_dpsite(I)& dpt, const mln_value(I)& val)
+ const mln_deduce(I, psite, delta)& dpt, const mln_value(I)& val)
{
lemmings_<I> lm(ima, pt, dpt, val);
return lm();
Index: mln/labeling/blobs.hh
--- mln/labeling/blobs.hh (revision 2991)
+++ mln/labeling/blobs.hh (working copy)
@@ -85,17 +85,18 @@
P cur;
mln_niter(N) n(nbh, cur);
p_queue_fast<P> qu;
+ const L zero = literal::zero;
// Initialization.
nlabels = literal::zero;
mln_ch_value(I, L) output;
initialize(output, input);
- level::fill(output, literal::zero);
+ level::fill(output, zero);
// Loop.
mln_piter(I) p(input.domain());
for_all(p)
- if (input(p) && output(p) == literal::zero) // Object point, not labeled yet.
+ if (input(p) && output(p) == zero) // Object point, not labeled yet.
{
// Label this point component.
if (nlabels == mln_max(L))
@@ -112,7 +113,7 @@
cur = qu.front();
qu.pop();
for_all(n) if (input.has(n))
- if (input(n) && output(n) == literal::zero)
+ if (input(n) && output(n) == zero)
{
mln_invariant(! qu.compute_has(n));
qu.push(n);
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Fix registration test. Add multiscale test.
* tests/registration/multiscale.cc: Add this test.
* tests/registration/registration.cc: Fix this one.
* mln/registration/multiscale.hh: Pseudo fix it.
* mln/registration/registration.hh: Fix it.
* mln/registration/icp.hh: Fix signature.
mln/registration/icp.hh | 2 -
mln/registration/multiscale.hh | 46 +++++++++++++++++++++++++++++++-
mln/registration/registration.hh | 1
tests/registration/multiscale.cc | 52 +++++++++++++++++++++++++++++++++++++
tests/registration/registration.cc | 13 +++------
5 files changed, 102 insertions(+), 12 deletions(-)
Index: tests/registration/multiscale.cc
--- tests/registration/multiscale.cc (revision 0)
+++ tests/registration/multiscale.cc (revision 0)
@@ -0,0 +1,52 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// 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/registration/registration.cc
+ *
+ * \brief Test on mln::registration::registration.cc
+ */
+
+#include <mln/io/pbm/all.hh>
+
+#include <mln/registration/multiscale.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d< bool > img1;
+ image2d< bool > img2;
+
+ //load images
+ io::pbm::load(img1, MLN_IMG_DIR "/lena.pbm");
+ io::pbm::load(img2, MLN_IMG_DIR "/lena.pbm");
+
+ //FIXME: Auto test result
+ //FIXME: Make it pass
+ registration::multiscale(img1,img2, 5, 2);
+}
Index: tests/registration/registration.cc
--- tests/registration/registration.cc (revision 2990)
+++ tests/registration/registration.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -31,11 +31,7 @@
*/
#include <mln/io/pbm/all.hh>
-
-#include "registration.hh"
-#include "multiscale.hh"
-#include "icp.hh"
-
+#include <mln/registration/registration.hh>
int main(int argc, char ** argv)
{
@@ -45,8 +41,9 @@
image2d< bool > img2;
//load images
- io::pbm::load(img1, argv[1]);
- io::pbm::load(img2, argv[2]);
+ io::pbm::load(img1, MLN_IMG_DIR "/lena.pbm");
+ io::pbm::load(img2, MLN_IMG_DIR "/lena.pbm");
registration::registration(img1,img2);
+ //FIXME: Auto test result
}
Index: mln/registration/multiscale.hh
--- mln/registration/multiscale.hh (revision 2990)
+++ mln/registration/multiscale.hh (working copy)
@@ -32,7 +32,6 @@
# include <mln/core/image/lazy_image.hh>
# include <mln/core/site_set/p_array.hh>
# include <mln/registration/icp.hh>
-# include <mln/registration/registration.hh>
# include <mln/fun/x2p/closest_point.hh>
namespace mln
@@ -55,6 +54,49 @@
namespace impl
{
+ // FIXME: move elsewhere
+ template <typename P>
+ void shuffle(p_array<P>& a)
+ {
+ for (unsigned int i = 0; i < a.nsites(); i++)
+ {
+ unsigned int r = rand() % a.nsites();
+ P tmp;
+ tmp = a[i];
+ a[i] = a[r];
+ a[r] = tmp;
+ }
+ }
+
+ template <typename P>
+ box<P> bigger(const box<P>& a, const box<P>& b)
+ {
+ P pmin,pmax;
+
+ for (unsigned i = 0; i < P::dim; i++)
+ {
+ pmin[i] = (a.pmin()[i] < b.pmin()[i]) ? a.pmin()[i] : b.pmin()[i];
+ pmax[i] = (a.pmax()[i] > b.pmax()[i]) ? a.pmax()[i] : b.pmax()[i];
+ }
+
+ return box<P>(pmin, pmax);
+ }
+
+ template <typename P>
+ inline
+ box<P> //dif
+ enlarge(const box<P>& box, unsigned b)
+ {
+ mln::box<P> nbox(box);
+
+ for (unsigned i = 0; i < P::dim; ++i)
+ {
+ nbox.pmin()[i] -= b;
+ nbox.pmax()[i] += b;
+ }
+ return nbox;
+ }
+
template <typename I, typename J>
inline
composed< rotation<I::site::dim, float>, translation<I::site::dim, float> >
@@ -86,7 +128,7 @@
{
unsigned l = cloud.nsites() / std::pow(q, e);
l = (l<1) ? 1 : l;
- impl::registration_(cloud, map, qk, l, 1e-3);
+ registration::impl::icp_(cloud, l, map, qk, 1e-3);
}
return qk;
}
Index: mln/registration/registration.hh
--- mln/registration/registration.hh (revision 2990)
+++ mln/registration/registration.hh (working copy)
@@ -83,7 +83,6 @@
lazy_image<I, fun::x2p::closest_point<mln_psite(I)>, box2d>
map(fun, fun.domain());
-
//run registration
return registration::icp(c, map, 1e-3);
Index: mln/registration/icp.hh
--- mln/registration/icp.hh (revision 2990)
+++ mln/registration/icp.hh (working copy)
@@ -215,7 +215,7 @@
T& qk,
const float epsilon = 1e-3)
{
- impl::icp_(c, map, qk, c_length, epsilon);
+ impl::icp_(c, c_length, map, qk, epsilon);
}
# endif // ! MLN_INCLUDE_ONLY
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Add mirror function.
* mln/fun/p2p: Add p2p function.
* mln/fun/p2p/mirror.hh: Revert first dim.
* mln/accu/maj_h.hh: default value.
accu/maj_h.hh | 2 +
fun/p2p/mirror.hh | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+)
Index: mln/accu/maj_h.hh
--- mln/accu/maj_h.hh (revision 2989)
+++ mln/accu/maj_h.hh (working copy)
@@ -118,6 +118,8 @@
{
init();
valid_ = true;
+ //FIXME: Not generic
+ t_ = literal::zero;
}
template <typename T>
Index: mln/fun/p2p/mirror.hh
--- mln/fun/p2p/mirror.hh (revision 0)
+++ mln/fun/p2p/mirror.hh (revision 0)
@@ -0,0 +1,84 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_FUN_P2P_MIRROR_HH
+# define MLN_FUN_P2P_MIRROR_HH
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace p2p
+ {
+
+ template <typename B>
+ struct mirror : public Function_p2p< mirror<B> >
+ {
+ typedef mln_psite(B) result;
+
+ mirror(const B& box);
+
+ mln_psite(B)
+ operator()(const mln_psite(B)&) const;
+
+ const B& box_;
+ };
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename B>
+ inline
+ mirror<B>::mirror(const B& box)
+ : box_(box)
+ {
+ }
+
+ template <typename B>
+ inline
+ mln_psite(B)
+ mirror<B>::operator()(const mln_psite(B)& p) const
+ {
+ mln_precondition(box_.has(p));
+
+ mln_psite(B) r(p);
+ r[0] = box_.max()[0] - p[0];
+
+ return r;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::p2p
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+#endif /* MLN_FUN_P2P_MIRROR_HH */
+
1
0
* scribo/demat.hh: Use graph to find relationships between text
bboxes.
Fix few bugs.
---
milena/sandbox/ChangeLog | 8 ++
milena/sandbox/scribo/demat.hh | 266
+++++++++++++++++++++++++++-------------
2 files changed, 191 insertions(+), 83 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 682a51e..5af4826 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,11 @@
+2008-12-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ [Scribo] Use graph.
+
+ * scribo/demat.hh: Use graph to find relationships between text
+ bboxes.
+ Fix few bugs.
+
2008-12-03 Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Update n_cmpt3.
diff --git a/milena/sandbox/scribo/demat.hh b/milena/sandbox/scribo/demat.hh
index 88ae58a..7b99765 100644
--- a/milena/sandbox/scribo/demat.hh
+++ b/milena/sandbox/scribo/demat.hh
@@ -45,6 +45,11 @@
# include <mln/essential/2d.hh>
# include <mln/morpho/elementary/dilation.hh>
# include <mln/labeling/background.hh>
+# include <mln/transform/influence_zone_geodesic.hh>
+# include <mln/debug/draw_graph.hh>
+# include <mln/make/graph.hh>
+# include <mln/util/graph.hh>
+# include <mln/util/line_graph.hh>
#include <tesseract/baseapi.h>
@@ -72,6 +77,7 @@ namespace scribo
max_comp_size = 1000;
max_dist_lines = 10;
max_txt_box_height = 100;
+ max_cos = 0.994;
}
unsigned bbox_enlarge;
@@ -83,6 +89,7 @@ namespace scribo
int max_txt_box_height;
unsigned rank_filter;
bool treat_tables;
+ float max_cos;
};
@@ -415,68 +422,6 @@ namespace scribo
draw::line(ima, point2d(0, line), point2d(ima.nrows(), line), v);
}
-/*
- void
- extract_matrix(const image2d<bool>& in,
- std::pair<util::array<box2d>, util::array<box2d> >
tboxes)
- {
- std::cout << "Extracting matrix..." << std::endl;
-
- image1d<unsigned> hend(in.ncols()),
- hrow(in.nrows()),
- vend(in.nrows()),
- vcol(in.ncols());
-
- level::fill(hend, 0);
- level::fill(hrow, 0);
- level::fill(vend, 0);
- level::fill(vcol, 0);
-
- for_all_components(i, tboxes.first)
- {
- ++vend.at(tboxes.first[i].pmin().row());
- ++vend.at(tboxes.first[i].pmax().row());
- ++vcol.at(tboxes.first[i].center().col());
- }
-
- for_all_components(i, tboxes.second)
- {
- ++hend.at(tboxes.second[i].pmin().col());
- ++hend.at(tboxes.second[i].pmax().col());
- ++hrow.at(tboxes.second[i].center().row());
- }
-
-#ifndef NOUT
- image2d<rgb8> tmp(in.domain());
- level::fill(tmp, literal::black);
-
- for (unsigned i = 1; i < in.ncols(); ++i)
- {
- if (hend.at(i) > 0)
- draw_col(tmp, i, literal::orange);
- if (vcol.at(i) > 0)
- draw_col(tmp, i, literal::orange);
- }
-
- for (unsigned i = 1; i < in.nrows(); ++i)
- {
- if (hrow.at(i) > 0)
- draw_row(tmp, i, literal::magenta);
- if (vend.at(i) > 0)
- draw_row(tmp, i, literal::magenta);
- }
-
- for_all_components(i, tboxes.first)
- draw_line(tmp, 0, tboxes.first[i], literal::green);
-
- for_all_components(i, tboxes.second)
- draw_line(tmp, 1, tboxes.second[i], literal::red);
-
- io::ppm::save(tmp, output_file("matrix.ppm"));
-#endif
-
- }
-*/
/// \}
//-****************************************************
/// End of functions related to the table extraction
@@ -581,18 +526,20 @@ namespace scribo
//-***************************************
/// \{
- fun::i2v::array<label16>
+ fun::l2l::relabel<label16>
make_relabel_fun(const util::graph& g)
{
- fun::i2v::array<label16> fun(g.v_nmax(), mln_max(label16));
+ fun::l2l::relabel<label16> fun(g.v_nmax(), mln_max(label16));
+ // The first vertex (id 0) IS the background (component 0).
+ unsigned ncomp = 0;
mln_vertex_iter_(util::graph) v(g);
for_all(v)
if (fun(v.id()) == mln_max(label16))
{
std::queue<unsigned> queue;
queue.push(v.id());
- fun(v.id()) = v.id();
+ fun(v.id()) = ncomp;
while (!queue.empty())
{
util::vertex<util::graph> current_v = g.vertex(queue.front());
@@ -600,10 +547,11 @@ namespace scribo
for (unsigned nv = 0; nv < current_v.nmax_nbh_vertices(); ++nv)
if (fun(current_v.ith_nbh_vertex(nv)) == mln_max(label16))
{
- fun(current_v.ith_nbh_vertex(nv)) = v.id();
+ fun(current_v.ith_nbh_vertex(nv)) = ncomp;
queue.push(current_v.ith_nbh_vertex(nv));
}
}
+ ++ncomp;
}
return fun;
@@ -687,29 +635,29 @@ namespace scribo
/// Merge bboxes according to their left box neighbor.
util::array< box2d >
group_bboxes(const util::graph& g, image2d<label16>& lbl,
- util::array<box2d>& cboxes, unsigned ncomp)
+ util::array<box2d>& cboxes, label16& nlabels)
{
- fun::i2v::array<label16> relabel_fun = make_relabel_fun(g);
+ fun::l2l::relabel<label16> relabel_fun = make_relabel_fun(g);
util::array< accu::bbox<point2d> > tboxes;
- tboxes.resize(ncomp + 1);
- for_all_ncomponents(i, ncomp)
+ tboxes.resize(nlabels.next());
+ for_all_ncomponents(i, nlabels)
tboxes[relabel_fun(i)].take(cboxes[i]);
//Update labels
- //FIXME: use labeling::Relabel
- level::transform_inplace(lbl, relabel_fun);
+ labeling::relabel_inplace(lbl, nlabels, relabel_fun);
#ifndef NOUT
- save_lbl_image(lbl, ncomp, "lbl-grouped-boxes.pgm");
+ save_lbl_image(lbl, nlabels, "lbl-grouped-boxes.pgm");
#endif
- //FIXME: use from_to
- util::array<box2d> result;
- for_all_ncomponents(i, ncomp)
+ util::array<box2d> result(1);
+ for_all_ncomponents(i, nlabels)
if (tboxes[i].is_valid())
result.append(tboxes[i].to_result());
+ nlabels = result.nelements();
+
#ifndef NOUT
image2d<label16> lbl2 = clone(lbl);
util::array<unsigned> treated(g.v_nmax(), mln_max(unsigned));
@@ -738,11 +686,11 @@ namespace scribo
comp_vertices.clear();
}
- for_all_ncomponents(i, ncomp)
+ for_all_ncomponents(i, nlabels)
if (tboxes[i].is_valid())
if (treated[i] < 3)
level::fill((lbl2 | (tboxes[i].to_result() |
(pw::value(lbl2) == pw::cst(i)))).rw(), 0u);
- save_lbl_image(lbl2, ncomp, "lbl-grouped-boxes-cleaned.pgm");
+ save_lbl_image(lbl2, nlabels, "lbl-grouped-boxes-cleaned.ppm");
#endif
return result;
@@ -796,7 +744,7 @@ namespace scribo
util::array<box2d>
extract_text(image2d<bool>& in,
image2d<label16>& lbl,
- const label16& nlabels)
+ label16& nlabels)
{
std::cout << "extract text" << std::endl;
@@ -812,8 +760,6 @@ namespace scribo
io::ppm::save(tmp, output_file("character-bboxes.ppm"));
#endif
- //merge_bboxes(cboxes, lbl, nlabels);
-
//Link character bboxes to their left neighboor if possible.
util::graph g = link_character_bboxes(lbl, cboxes, nlabels);
@@ -825,6 +771,89 @@ namespace scribo
+ struct gcolor_t : public mln::Function< gcolor_t >
+ {
+ typedef mln::value::rgb8 result;
+
+ template <typename G>
+ mln::value::rgb8
+ operator()(const mln::util::vertex<G>&) const
+ {
+ return mln::literal::cyan;
+ }
+
+ template <typename G>
+ mln::value::rgb8
+ operator()(const mln::util::edge<G>&) const
+ {
+ return mln::literal::magenta;
+ }
+
+ };
+
+ struct gcolorarr_t : public mln::Function< gcolorarr_t >
+ {
+ typedef mln::value::rgb8 result;
+
+ gcolorarr_t(unsigned n, const mln::value::rgb8& val)
+ : v_(n, val)
+ {
+ }
+
+ template <typename G>
+ const mln::value::rgb8&
+ operator()(const mln::util::vertex<G>& v) const
+ {
+ return v_[v.id()];
+ }
+
+ template <typename G>
+ const mln::value::rgb8&
+ operator()(const mln::util::edge<G>& e) const
+ {
+ return v_[e.id()];
+ }
+
+ template <typename G>
+ mln::value::rgb8&
+ operator()(const mln::util::vertex<G>& v)
+ {
+ return v_[v.id()];
+ }
+
+ template <typename G>
+ mln::value::rgb8&
+ operator()(const mln::util::edge<G>& e)
+ {
+ return v_[e.id()];
+ }
+
+ std::vector<mln::value::rgb8> v_;
+ };
+
+
+
+ template <typename P>
+ struct lg_vertex_values : public mln::Function_p2v<
lg_vertex_values<P> >
+ {
+ typedef float result;
+
+ float operator()(const P& p) const
+ {
+ mln::algebra::vec<2,float> v;
+ v[0] = 0;
+ v[1] = 1;
+ float norm = mln::math::sqrt(std::pow(p.to_vec()[0], 2)
+ + std::pow(p.to_vec()[1], 2));
+ // FIXME: missing proxy_impl for point and line2d?
+ float res = (v * p.to_vec()) / norm;
+ return res;
+ }
+
+ };
+
+
+
void maptext_to_cells(const image2d<bool>& in, const
image2d<bool>& table, const util::array<box2d>& tboxes)
{
std::cout << "map text to cells" << std::endl;
@@ -845,6 +874,71 @@ namespace scribo
}
+ void merge_aligned_text_boxes(const image2d<bool>& in,
util::array<box2d>& tboxes,
+ image2d<label16>& lbl, label16& nlabels)
+ {
+ std::cout << "Merging aligned text boxes" << std::endl;
+
+ image2d<label16> lbl_iz = clone(lbl);
+ io::ppm::save(debug::colorize(rgb8(), lbl, nlabels),
output_file("tboxes-lbl.ppm"));
+
+ image2d<label16> iz = transform::influence_zone_geodesic(lbl_iz,
c8(), settings.bbox_distance);
+#ifndef NOUT
+ io::ppm::save(debug::colorize(rgb8(), iz, nlabels),
output_file("tboxes-iz.ppm"));
+#endif
+
+ typedef util::graph G;
+ G g = make::graph(iz | (pw::value(iz) != pw::cst(0u)), nlabels);
+
+ // Compute the component centers and use them as vertex.
+ //FIXME: Add fun::vertex2p
+ typedef fun::i2v::array<point2d> fv2p_t;
+ fv2p_t fv2p(nlabels.next());
+
+ for_all_elements(i, tboxes)
+ fv2p(i) = tboxes[i].center();
+// util::array<point2d> centers =
labeling::compute(accu::center<point2d>(), iz, nlabels);
+// fv2p_t fv2p = convert::to<fv2p_t>(centers);
+
+ // Create a p_vertices.
+ p_vertices<G, fv2p_t> pv(g, fv2p);
+
+ typedef util::line_graph<G> LG;
+ LG lg(g);
+
+ // Find lines (sites) associated to edges in g.
+ typedef fun::i2v::array<p_line2d> i2e_t;
+ util::array<p_line2d> lines;
+ mln_edge_iter_(G) e(g);
+ for_all(e)
+ lines.append(p_line2d(fv2p(e.v1()), fv2p(e.v2())));
+
+ // Map lines to vertices in lg.
+ typedef p_vertices<LG, i2e_t> pvlg_t;
+ pvlg_t pvlg(lg, convert::to<i2e_t>(lines));
+
+ // Construct an image from a p_edges and a function mapping
+ // lines to angles.
+ typedef lg_vertex_values<p_line2d> lgv2v_t;
+ lgv2v_t lgv2v;
+
+ mln_VAR(lg_ima, lgv2v | pvlg);
+
+ gcolorarr_t ecolor(pvlg.nsites(), literal::olive);
+ mln_piter_(lg_ima_t) p(lg_ima.domain());
+ for_all (p)
+ if ((lg_ima(p) > settings.max_cos) || (lg_ima(p) < -
settings.max_cos))
+ ecolor(p.element()) = literal::cyan;
+
+#ifndef NOUT
+ image2d<rgb8> output = level::convert(rgb8(), in);
+ internal::draw_component_boxes(output, tboxes);
+ debug::draw_graph(output, pvlg, gcolor_t(), ecolor);
+ io::ppm::save(output,
internal::output_file("aligned-bboxes-merged.ppm"));
+#endif
+
+ }
+
/// \}
//-----------------------------------------------
/// End of functions related to text extraction
@@ -890,7 +984,10 @@ namespace scribo
//Label and remove small components.
label16 nlabels;
image2d<label16> lbl = labeling::blobs(in, c8(), nlabels);
- internal::cleanup_components(lbl, nlabels);
+
+ /// Do we really want to cleanup before removing tables?
+ if (!treat_tables)
+ internal::cleanup_components(lbl, nlabels);
std::pair<util::array<box2d>,
util::array<box2d> > tblboxes;
@@ -899,10 +996,11 @@ namespace scribo
if (treat_tables)
{
tblboxes = internal::extract_tables(in);
-// internal::extract_matrix(in, tblboxes);
table = internal::rebuild_table(in, tblboxes);
+ /// relabel since the table has been removed.
lbl = labeling::blobs(in, c8(), nlabels);
+ /// Do we really want to cleanup again?
internal::cleanup_components(lbl, nlabels);
#ifndef NOUT
@@ -913,6 +1011,8 @@ namespace scribo
util::array<box2d> tboxes =
internal::extract_text(in, lbl, nlabels);
+ internal::merge_aligned_text_boxes(in, tboxes, lbl, nlabels);
+
if (treat_tables)
internal::maptext_to_cells(in, table, tboxes);
--
1.5.6.5
1
0
03 Dec '08
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Turn the low/high quant nbits threshold into a definition.
* mln/core/def/low_quant_nbits.hh: New.
* mln/core/def/all.hh: Update.
* mln/trait/value_.hh (mln_value_quant_from_): Update.
(mln_value_card_from_): Update. Add tech doc.
0 files changed
1
0