Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
* mln/accu/rank_bool.hh: Add untake() and remove unnecessary
attributes.
* mln/morpho/rank_filter.hh: Add rank_filter_directional. It is used
with win::line.
* mln/morpho/rank_filter.hh: Add rank_filter_directional. It is used
with win::line.
* mln/accu/rank.hh: update constructor and add untake(accu::rank).
* tests/accu/rank.cc,
* tests/morpho/rank_filter.cc: fix tests.
* tests/morpho/Makefile.am: add rank_filter test.
---
milena/ChangeLog | 17 +++++
milena/mln/accu/rank.hh | 60 ++++++++++++-------
milena/mln/accu/rank_bool.hh | 43 ++++++++++----
milena/mln/morpho/rank_filter.hh | 115 ++++++++++++++++++++++++++++--------
milena/tests/accu/rank.cc | 22 ++++----
milena/tests/morpho/Makefile.am | 3 +
milena/tests/morpho/rank_filter.cc | 19 ++----
7 files changed, 197 insertions(+), 82 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 2170ada..d149788 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,20 @@
+2008-11-24 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Update rank_filter.
+
+ * mln/accu/rank_bool.hh: Add untake() and remove unnecessary
+ attributes.
+
+ * mln/morpho/rank_filter.hh: Add rank_filter_directional. It is used
+ with win::line.
+
+ * mln/accu/rank.hh: update constructor and add untake(accu::rank).
+
+ * tests/accu/rank.cc,
+ * tests/morpho/rank_filter.cc: fix tests.
+
+ * tests/morpho/Makefile.am: add rank_filter test.
+
2008-11-21 Guillaume Lazzara <z(a)lrde.epita.fr>
Add reference files for example outputs used in the tutorial.
diff --git a/milena/mln/accu/rank.hh b/milena/mln/accu/rank.hh
index bdd4df0..bd1999d 100644
--- a/milena/mln/accu/rank.hh
+++ b/milena/mln/accu/rank.hh
@@ -51,16 +51,16 @@ namespace mln
/// Generic rank accumulator class.
- /*!
- * The parameter \c T is the type of values.
- */
+ ///
+ /// The parameter \c T is the type of values.
template <typename T>
struct rank : public mln::accu::internal::base< const T&, rank<T> >
{
typedef T argument;
typedef mln::value::set<T> S;
- rank(unsigned k, unsigned n);
+ rank();
+ explicit rank(unsigned k);
/// Manipulators.
/// \{
@@ -68,6 +68,7 @@ namespace mln
void take(const argument& t);
void take(const rank<T>& other);
void untake(const argument& t);
+ void untake(const rank<T>& other);
/// \}
unsigned card() const { return h_.sum(); }
@@ -82,13 +83,9 @@ namespace mln
/// Give the rank.
unsigned k() const;
- /// Give the total number of elements.
- unsigned n() const;
-
protected:
unsigned k_; // 0 <= k_ < n
- unsigned n_;
mutable accu::histo<T> h_;
const S& s_; // derived from h_
@@ -97,7 +94,7 @@ namespace mln
mutable bool valid_;
mutable unsigned i_; // the median index
- mutable argument t_; // the median value
+ mutable argument t_; // the median value
// Auxiliary methods
void update_() const;
@@ -116,7 +113,7 @@ namespace mln
struct rank : public Meta_Accumulator< rank >
{
- rank(unsigned k_, unsigned n_) : k(k_), n(n_) {}
+ rank(unsigned k_) : k(k_) {}
template <typename T>
struct with
@@ -125,7 +122,6 @@ namespace mln
};
unsigned k;
- unsigned n;
};
} // end of namespace mln::accu::meta
@@ -134,7 +130,7 @@ namespace mln
template <typename T>
rank<T> unmeta(const meta::rank& m, T)
{
- rank<T> a(m.k, m.n);
+ rank<T> a(m.k);
return a;
}
@@ -143,32 +139,32 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
+
template <typename T>
inline
- rank<T>::rank(unsigned k, unsigned n)
- : k_(k),
- n_(n),
- h_(),
+ rank<T>::rank()
+ : h_(),
s_(h_.vset())
{
- mln_assertion(k_ < n_);
init();
}
template <typename T>
inline
- unsigned
- rank<T>::k() const
+ rank<T>::rank(unsigned k)
+ : k_(k),
+ h_(),
+ s_(h_.vset())
{
- return k_;
+ init();
}
template <typename T>
inline
unsigned
- rank<T>::n() const
+ rank<T>::k() const
{
- return n_;
+ return k_;
}
template <typename T>
@@ -227,6 +223,26 @@ namespace mln
template <typename T>
inline
void
+ rank<T>::untake(const rank<T>& other)
+ {
+ // h_
+ h_.untake(other.h_);
+
+ // sum_minus_
+ for (unsigned i = 0; i < i_; ++i)
+ sum_minus_ -= other.h_[i];
+
+ // sum_plus_
+ for (unsigned i = i_ + 1; i < h_.nvalues(); ++i)
+ sum_plus_ -= other.h_[i];
+
+ if (valid_)
+ valid_ = false;
+ }
+
+ template <typename T>
+ inline
+ void
rank<T>::update_() const
{
valid_ = true;
diff --git a/milena/mln/accu/rank_bool.hh b/milena/mln/accu/rank_bool.hh
index f5e9b07..597e078 100644
--- a/milena/mln/accu/rank_bool.hh
+++ b/milena/mln/accu/rank_bool.hh
@@ -56,7 +56,8 @@ namespace mln
{
typedef bool argument;
- rank(unsigned k, unsigned n);
+ rank();
+ rank(unsigned k);
/// Manipulators.
/// \{
@@ -64,6 +65,8 @@ namespace mln
void take_as_init(const argument& t);
void take(const argument& t);
void take(const rank<bool>& other);
+ void untake(const argument& t);
+ void untake(const rank<bool>& other);
/// \}
/// Get the value of the accumulator.
@@ -75,22 +78,24 @@ namespace mln
protected:
unsigned nfalse_;
- unsigned k_; // 0 <= k_ < n
- unsigned n_;
+ unsigned k_; // 0 <= k_
};
# ifndef MLN_INCLUDE_ONLY
inline
- rank<bool>::rank(unsigned k, unsigned n)
- : k_(k),
- n_(n)
+ rank<bool>::rank()
{
- mln_assertion(k_ < n_);
init();
}
+ inline
+ rank<bool>::rank(unsigned k)
+ : k_(k)
+ {
+ init();
+ }
inline
void
@@ -99,20 +104,28 @@ namespace mln
nfalse_ = 0;
}
-
inline
void rank<bool>::take_as_init(const argument& t)
{
nfalse_ = t ? 0 : 1;
}
-
inline
void rank<bool>::take(const argument& t)
{
- nfalse_ += !t;
+ if (t == false)
+ ++nfalse_;
}
+ inline
+ void rank<bool>::untake(const argument& t)
+ {
+ if (t == false)
+ {
+ mln_assertion(nfalse_ > 0);
+ --nfalse_;
+ }
+ }
inline
void
@@ -121,12 +134,18 @@ namespace mln
nfalse_ += other.nfalse_;
}
+ inline
+ void
+ rank<bool>::untake(const rank<bool>& other)
+ {
+ mln_precondition(other.nfalse_ <= nfalse_);
+ nfalse_ -= other.nfalse_;
+ }
inline
bool
rank<bool>::to_result() const
{
- mln_assertion(nfalse_ <= n_);
return k_ >= nfalse_;
}
@@ -134,7 +153,7 @@ namespace mln
bool
rank<bool>::is_valid() const
{
- return nfalse_ <= n_;
+ return true;
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/morpho/rank_filter.hh b/milena/mln/morpho/rank_filter.hh
index 94a0a27..eb24567 100644
--- a/milena/mln/morpho/rank_filter.hh
+++ b/milena/mln/morpho/rank_filter.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,10 +28,9 @@
#ifndef MLN_MORPHO_RANK_FILTER_HH
# define MLN_MORPHO_RANK_FILTER_HH
-/*! \file mln/morpho/rank_filter.hh
- *
- * \brief Morphological rank_filter.
- */
+/// \file mln/morpho/rank_filter.hh
+///
+/// Morphological rank_filter.
# include <mln/morpho/includes.hh>
# include <mln/convert/to_p_array.hh>
@@ -42,8 +41,7 @@ namespace mln
namespace morpho
{
- /*! Morphological rank_filter.
- */
+ /// Morphological rank_filter.
template <typename I, typename W>
mln_concrete(I)
rank_filter(const Image<I>& input, const Window<W>& win);
@@ -51,47 +49,116 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
+
+
+ namespace internal
+ {
+
+ template <typename I, typename W>
+ inline
+ void
+ rank_filter_tests(const Image<I>& input_, const Window<W>& win_, unsigned k)
+ {
+ const I& input = exact(input_);
+ const W& win = exact(win_);
+
+ mln_precondition(input.has_data());
+ mln_precondition(! win.is_empty());
+ (void) input;
+ (void) win;
+ (void) k;
+ }
+
+ } // end of namespace mln::morpho::internal
+
+
namespace impl
{
namespace generic
{
- // On function.
-
template <typename I, typename W>
inline
mln_concrete(I)
- rank_filter_(const I& input, const W& win, unsigned k)
+ rank_filter(const Image<I>& input_, const Window<W>& win_, unsigned k)
{
- trace::entering("morpho::impl::generic::rank_filter_");
+ trace::entering("morpho::impl::generic::rank_filter");
+
+ internal::rank_filter_tests(input_, win_, k);
+
+ const I& input = exact(input_);
+ const W& win = exact(win_);
mln_concrete(I) output;
initialize(output, input);
- accu::rank<mln_value(I)> accu(k, convert::to_p_array(win, mln_psite(I)()).nsites());
+ accu::rank<mln_value(I)> accu(k);
+ extension::adjust_fill(input, geom::delta(win) + 1, accu);
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
- {
- accu.init();
- for_all(q)
- if (input.has(q))
- accu.take(input(q));
-// else
-// accu.take(mln_value(I)(literal::zero));
- output(p) = accu;
- }
-
- trace::exiting("morpho::impl::generic::rank_filter_");
+ {
+ accu.init();
+ for_all(q)
+ if (input.has(q))
+ accu.take(input(q));
+ //else
+ // accu.take(mln_value(I)(literal::zero));
+ output(p) = accu;
+ }
+
+ trace::exiting("morpho::impl::generic::rank_filter");
return output;
}
} // end of namespace mln::morpho::impl::generic
+
+ template <typename I, typename W>
+ inline
+ mln_concrete(I)
+ rank_filter_directional(const Image<I>& input, const Window<W>& win, unsigned k, unsigned dir)
+ {
+ trace::entering("morpho::impl::generic::rank_filter_directional");
+
+ internal::rank_filter_tests(input, win, k);
+
+ accu::rank<mln_value(I)> accu(k);
+ extension::adjust_fill(input, geom::delta(win) + 1, accu);
+ mln_concrete(I) output = accu::transform_directional(accu, input, win, dir);
+
+ trace::exiting("morpho::impl::generic::rank_filter_directional");
+ return output;
+ }
+
} // end of namespace mln::morpho::impl
+ namespace internal
+ {
+
+ template <typename I, typename M, unsigned i, typename C>
+ inline
+ mln_concrete(I)
+ rank_filter_dispatch(const Image<I>& input, const win::line<M, i, C> & win, unsigned k)
+ {
+ return impl::rank_filter_directional(input, win, k, i);
+ }
+
+
+
+ template <typename I, typename W>
+ inline
+ mln_concrete(I)
+ rank_filter_dispatch(const Image<I>& input, const Window<W>& win, unsigned k)
+ {
+ return impl::generic::rank_filter(input, win, k);
+ }
+
+ } // end of namespace mln::morpho::internal
+
+
// Facades.
@@ -104,7 +171,7 @@ namespace mln
mln_precondition(exact(input).has_data());
mln_precondition(! exact(win).is_empty());
- mln_concrete(I) output = impl::generic::rank_filter_(exact(input), exact(win), k);
+ mln_concrete(I) output = internal::rank_filter_dispatch(exact(input), exact(win), k);
trace::exiting("morpho::rank_filter");
return output;
diff --git a/milena/tests/accu/rank.cc b/milena/tests/accu/rank.cc
index 9c334a9..0e9b6c8 100644
--- a/milena/tests/accu/rank.cc
+++ b/milena/tests/accu/rank.cc
@@ -55,55 +55,55 @@ int main()
using value::int_u8;
{
- accu::meta::rank r(4, 9);
+ accu::meta::rank r(4);
accu::rank<int_u8> a = accu::unmeta(r, int_u8());
- mln_assertion(a.k() == 4 && a.n() == 9);
+ mln_assertion(a.k() == 4);
// Meta_Accumulator<accu::meta::rank>& R = r;
// accu::unmeta(R, int_u8());
}
{
- accu::rank<int_u8> accu(0, 8);
+ accu::rank<int_u8> accu(0);
fill(accu);
mln_assertion(accu.to_result() == 1u);
}
{
- accu::rank<int_u8> accu(1, 8);
+ accu::rank<int_u8> accu(1);
fill(accu);
mln_assertion(accu.to_result() == 2u);
}
{
- accu::rank<int_u8> accu(2, 8);
+ accu::rank<int_u8> accu(2);
fill(accu);
mln_assertion(accu.to_result() == 2u);
}
{
- accu::rank<int_u8> accu(3, 8);
+ accu::rank<int_u8> accu(3);
fill(accu);
mln_assertion(accu.to_result() == 3u);
}
{
- accu::rank<int_u8> accu(4, 8);
+ accu::rank<int_u8> accu(4);
fill(accu);
mln_assertion(accu.to_result() == 4u);
}
{
- accu::rank<int_u8> accu(5, 8);
+ accu::rank<int_u8> accu(5);
fill(accu);
mln_assertion(accu.to_result() == 5u);
}
{
- accu::rank<int_u8> accu(6, 8);
+ accu::rank<int_u8> accu(6);
fill(accu);
mln_assertion(accu.to_result() == 5u);
}
{
- accu::rank<int_u8> accu(7, 8);
+ accu::rank<int_u8> accu(7);
fill(accu);
mln_assertion(accu.to_result() == 5u);
}
{
- accu::rank<bool> accu_bool(1, 5);
+ accu::rank<bool> accu_bool(1);
accu_bool.take(true);
accu_bool.take(true);
accu_bool.take(true);
diff --git a/milena/tests/morpho/Makefile.am b/milena/tests/morpho/Makefile.am
index 734aef5..fd5cc00 100644
--- a/milena/tests/morpho/Makefile.am
+++ b/milena/tests/morpho/Makefile.am
@@ -33,6 +33,7 @@ check_PROGRAMS = \
opening_area \
opening_height \
opening_volume \
+ rank_filter \
skeleton_constrained \
thinning
@@ -70,6 +71,8 @@ complex_image_wst_SOURCES = complex_image_wst.cc
meyer_wst_SOURCES = meyer_wst.cc
+rank_filter_SOURCES = rank_filter.cc
+
skeleton_constrained_SOURCES = skeleton_constrained.cc
combined_SOURCES = combined.cc
diff --git a/milena/tests/morpho/rank_filter.cc b/milena/tests/morpho/rank_filter.cc
index 597dccd..9550876 100644
--- a/milena/tests/morpho/rank_filter.cc
+++ b/milena/tests/morpho/rank_filter.cc
@@ -25,16 +25,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/morpho/rank_filter.cc
- *
- * \brief Test on mln::morpho::rank_filter.
- */
+/// \file tests/morpho/rank_filter.cc
+///
+/// Test on mln::morpho::rank_filter.
#include <mln/core/image/image2d.hh>
#include <mln/win/rectangle2d.hh>
-#include <mln/win/octagon2d.hh>
-#include <mln/win/diag2d.hh>
-#include <mln/win/backdiag2d.hh>
#include <mln/core/alias/window2d.hh>
#include <mln/io/pgm/load.hh>
@@ -52,9 +48,6 @@
#include <mln/pw/cst.hh>
#include <mln/fun/ops.hh>
-#include <mln/convert/to_p_array.hh>
-#include <mln/convert/to_window.hh>
-
#include "tests/data.hh"
@@ -70,23 +63,23 @@ int main()
io::pgm::load(lena, MLN_IMG_DIR "/small.pgm");
{
- win::octagon2d oct(31);
image2d<int_u8> out;
out = morpho::rank_filter(lena, rec, 0);
image2d<int_u8> ref(lena.domain());
ref = morpho::erosion(lena, rec);
+
mln_assertion(ref == out);
}
{
- win::octagon2d oct(31);
image2d<int_u8> out;
- out = morpho::rank_filter(lena, rec, 21 * 21 - 1);
+ out = morpho::rank_filter(lena, rec, 21 * 21);
image2d<int_u8> ref(lena.domain());
ref = morpho::dilation(lena, rec);
+
mln_assertion(ref == out);
}
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Start /filtering to n components/ procedure.
* jardonnet/n_cmpt/Makefile (all,debug): New.
* jardonnet/n_cmpt: New.
* jardonnet/n_cmpt/n_cmpt.cc: New. Lauch procedure.
* jardonnet/n_cmpt/check: New.
* jardonnet/n_cmpt/check/tiny.pgm: New test image.
* jardonnet/n_cmpt/check/mg_ima.pgm: New test image.
* jardonnet/n_cmpt/n_cmpt.hh: Modified version of algebraic unionfind.
* jardonnet/igr/check/check: New check script.
igr/Makefile | 24 ++++---
igr/check/check | 10 +++
n_cmpt/Makefile | 5 +
n_cmpt/n_cmpt.cc | 43 +++++++++++++
n_cmpt/n_cmpt.hh | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 247 insertions(+), 9 deletions(-)
Index: jardonnet/n_cmpt/n_cmpt.cc
--- jardonnet/n_cmpt/n_cmpt.cc (revision 0)
+++ jardonnet/n_cmpt/n_cmpt.cc (revision 0)
@@ -0,0 +1,43 @@
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/accu/volume.hh>
+
+#include "n_cmpt.hh"
+
+using namespace mln;
+using namespace mln::value;
+
+bool usage(int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ std::cout << argv[0] << " ima.pgm lambda" << std::endl;
+ return false;
+ }
+ return true;
+}
+
+int main(int argc, char ** argv)
+{
+ if (not usage(argc,argv))
+ return 1;
+
+ image2d<int_u8> ima;
+ io::pgm::load(ima, argv[1]);
+
+ int lambda = atoi(argv[2]);
+
+ image2d<int_u8> out(ima.domain());
+
+ n_cmpt::algebraic_union_find(ima, c4(), lambda, out);
+
+ io::pgm::save(out, "out.pgm");
+}
+
Index: jardonnet/n_cmpt/Makefile
--- jardonnet/n_cmpt/Makefile (revision 0)
+++ jardonnet/n_cmpt/Makefile (revision 0)
@@ -0,0 +1,5 @@
+n_cmpt: n_cmpt.hh n_cmpt.cc
+ g++ -I../../.. n_cmpt.cc -DNDEBUG -O1 -o n_cmpt
+
+debug: n_cmpt.hh n_cmpt.cc
+ g++ -I../../.. n_cmpt.cc -g -g3 -DNDEBUG -O1 -o n_cmpt
Index: jardonnet/n_cmpt/check/tiny.pgm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: jardonnet/n_cmpt/check/tiny.pgm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: jardonnet/n_cmpt/check/mg_ima.pgm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: jardonnet/n_cmpt/check/mg_ima.pgm
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Index: jardonnet/n_cmpt/n_cmpt.hh
--- jardonnet/n_cmpt/n_cmpt.hh (revision 0)
+++ jardonnet/n_cmpt/n_cmpt.hh (revision 0)
@@ -0,0 +1,174 @@
+// 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__N_CMPT_HH
+# define MLN__N_CMPT_HH
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/level/fill.hh>
+# include <mln/util/pix.hh>
+# include <mln/level/sort_psites.hh>
+
+namespace mln
+{
+
+ namespace n_cmpt
+ {
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I>
+ inline
+ mln_psite(I)
+ find_root(I& parent,
+ const mln_psite(I)& x)
+ {
+ if (parent(x) == x)
+ return x;
+ else
+ return parent(x) = find_root(parent, parent(x));
+ }
+
+ template <typename I, typename N, typename O>
+ void
+ algebraic_union_find(const Image<I>& input_,
+ const Neighborhood<N>& nbh_,
+ unsigned limit,
+ Image<O>& output_)
+ {
+ trace::entering("canvas::morpho::algebraic_union_find");
+
+ std::cout << "limit = " << limit << std::endl;
+
+
+ const I& input = exact(input_);
+ const N& nbh = exact(nbh_);
+ O& output = exact(output_);
+
+ mln_precondition(output.domain() == input.domain());
+
+ // Local type.
+ typedef mln_psite(I) P;
+
+ typedef accu::volume<I> A;
+ typedef mln_psite(I) P;
+ typedef p_array<P> S;
+
+ const S s(level::sort_psites_increasing(input));
+
+ // Auxiliary data.
+ mln_ch_value(O, bool) deja_vu;
+ mln_ch_value(O, P) parent;
+
+ int n_cmpt = input.domain().nsites();
+ int lambda = 10;
+ std::cout << "trying lambda = 10" << std::endl;
+
+ // init
+ {
+ initialize(deja_vu, input);
+ initialize(parent, input);
+ }
+
+ // first pass
+ {
+
+ do {
+ mln_ch_value(O, A) data;
+ initialize(data, input);
+
+ mln::level::fill(deja_vu, false);
+
+ {
+ mln_fwd_piter(S) p(s);
+ for_all(p)
+ parent(p) = p;
+ }
+
+ mln_fwd_piter(S) p(s); // s required.
+ mln_niter(N) n(nbh, p);
+ for_all(p)
+ {
+ // Make set.
+ {
+ data(p).take_as_init(make::pix(input, p)); // FIXME: algebraic so p!
+ }
+
+ for_all(n)
+ if (input.domain().has(n) && deja_vu(n))
+ {
+ //do_union(n, p);
+ P r = find_root(parent, n);
+ if (r != p)
+ {
+ if (input(r) == input(p) || (data(p).to_result() < lambda))
+ // Either a flat zone or the component of r is still growing.
+ {
+ data(p).take(data(r));
+ parent(r) = p;
+ if(--n_cmpt <= limit)
+ {
+ std::cout << "limit reached at " << n_cmpt << std::endl;
+ goto step2;
+ }
+ }
+ else
+ data(p).set_value(lambda);
+ }
+ }
+ deja_vu(p) = true;
+ }
+ n_cmpt = input.domain().nsites();
+ lambda *= 1.1;
+ std::cout << "trying lambda = " << lambda << std::endl;
+ }while (1);
+ }
+
+ step2:
+ // second pass
+ {
+ mln_bkd_piter(S) p(s);
+ for_all(p)
+ if (parent(p) == p) // p is root.
+ output(p) = input(p);
+ else
+ output(p) = output(parent(p));
+ }
+
+ trace::exiting("canvas::morpho::algebraic_union_find");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::n_cmpt
+
+} // end of namespace mln
+
+#endif /* MLN__N_CMPT_HH */
+
Index: jardonnet/igr/Makefile
--- jardonnet/igr/Makefile (revision 2941)
+++ jardonnet/igr/Makefile (working copy)
@@ -2,18 +2,20 @@
## Author: ugo.jardonnet(a)lrde.epita.fr
## Version: $Id: Makefile,v 0.0 2008/11/19 11:40:34 jardonnet Exp $
-## Keywords:
-## X-URL:
+## Keywords: IGR OLENA LRDE RECONSTRUCTION
+
+
+CXXC?=g++
+LFLAGS=-I../../abraham/ -I../../../
+CFLAGS=-W -Wall -Wextra -O1 -DNDEBUG
PROJ=igr-reco
SRC=src/igr.cc
BIN=igr
-LFLAGS=-I../../abraham/ -I../../../
-CFLAGS=-W -Wall -Wextra -O1 -DNDEBUG
FILES=src configure check README
$(BIN): Makefile
- g++ $(CFLAGS) $(LFLAGS) $(SRC) -o $(BIN)
+ $(CXXC) $(CFLAGS) $(LFLAGS) $(SRC) -o $(BIN)
check:
cd check && ./check
@@ -23,7 +25,7 @@
rm -f .deps .depsr
rm -f *.ppm
-dist: clean todo AUTHORS svn_check
+dist: clean AUTHORS TODO svn_check
rm -rf $(PROJ)
mkdir $(PROJ)
cp -r Makefile AUTHORS TODO $(FILES) $(PROJ)
@@ -34,21 +36,25 @@
rm -rf $(PROJ)
chmod 644 $(PROJ).tar.bz2
+AUTHORS:
+ echo $(USER) > AUTHORS
+
svn_check:
@svn st | grep \? ; [ $$? = "1" ] \
|| (echo "----------------------------------------------"\
&& echo "SOME FILES ARE MISSING FROM THE SVN REPOSITORY"\
&& echo "----------------------------------------------");
-todo:
- grep "FIXME" -r . --exclude="Makefile" > TODO
+TODO:
+ grep "FIXME" -r . --exclude="Makefile" --exclude-dir=".svn" \
+ --exclude="TODO" > TODO
.deps:
g++ $(LFLAGS) -MM $(SRC) > $@
@sed -ir s/igr.cc// .deps
@sed -ir s/igr.o/igr/ .deps
-.PHONY: doc check .deps
+.PHONY: doc check .deps AUTHORS TODO
include .deps
Index: jardonnet/igr/check/check
--- jardonnet/igr/check/check (revision 0)
+++ jardonnet/igr/check/check (revision 0)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+
+for i in `seq 10000 1000 50000`
+do
+ ../igr ./tiny.ppm $i
+ mv out.ppm out/$i.ppm
+done
+
+rm g_ima.ppm mg_ima.ppm o_ima.ppm
\ No newline at end of file
Property changes on: jardonnet/igr/check/check
___________________________________________________________________
Name: svn:executable
+ *
1
0
21 Nov '08
* doc/doc.mk: add new path variables.
* doc/tutorial/figures/ima2d-rot-1.ppm
* doc/tutorial/figures/ima2d-rot-2.ppm
* doc/tutorial/outputs/borderthickness.txt
* doc/tutorial/outputs/dpoint-1.txt
* doc/tutorial/outputs/graph-data-full.txt
* doc/tutorial/outputs/ima-has.txt
* doc/tutorial/outputs/ima-size.txt
* doc/tutorial/outputs/ima2d-1.txt
* doc/tutorial/outputs/ima2d-decl-2-blobs-full.txt
* doc/tutorial/outputs/ima2d-rot.txt
* doc/tutorial/outputs/labeling-compute-full.txt
* doc/tutorial/outputs/logical-not.txt
* doc/tutorial/outputs/paste-call-1.txt
* doc/tutorial/outputs/point-1.txt: reference files.
* doc/tutorial/samples/Makefile.am: diff the generated files to their
reference.
---
milena/ChangeLog | 24 ++++++++
milena/doc/doc.mk | 10 +++-
milena/doc/tutorial/figures/ima2d-rot-1.ppm | Bin 0 -> 235320 bytes
milena/doc/tutorial/figures/ima2d-rot-2.ppm | Bin 0 -> 235320 bytes
milena/doc/tutorial/outputs/borderthickness.txt | 16 ++++++
milena/doc/tutorial/outputs/dpoint-1.txt | 1 +
milena/doc/tutorial/outputs/graph-data-full.txt | 5 ++
milena/doc/tutorial/outputs/ima-has.txt | 7 +++
milena/doc/tutorial/outputs/ima-size.txt | 1 +
milena/doc/tutorial/outputs/ima2d-1.txt | 2 +
.../tutorial/outputs/ima2d-decl-2-blobs-full.txt | 7 +++
.../doc/tutorial/outputs/labeling-compute-full.txt | 3 +
milena/doc/tutorial/outputs/logical-not.txt | 18 ++++++
milena/doc/tutorial/outputs/paste-call-1.txt | 4 ++
milena/doc/tutorial/outputs/point-1.txt | 2 +
milena/doc/tutorial/samples/Makefile.am | 58 +++++++++++++++++---
16 files changed, 147 insertions(+), 11 deletions(-)
create mode 100644 milena/doc/tutorial/figures/ima2d-rot-1.ppm
create mode 100644 milena/doc/tutorial/figures/ima2d-rot-2.ppm
create mode 100644 milena/doc/tutorial/outputs/borderthickness.txt
create mode 100644 milena/doc/tutorial/outputs/dpoint-1.txt
create mode 100644 milena/doc/tutorial/outputs/graph-data-full.txt
create mode 100644 milena/doc/tutorial/outputs/ima-has.txt
create mode 100644 milena/doc/tutorial/outputs/ima-size.txt
create mode 100644 milena/doc/tutorial/outputs/ima2d-1.txt
create mode 100644 milena/doc/tutorial/outputs/ima2d-decl-2-blobs-full.txt
create mode 100644 milena/doc/tutorial/outputs/ima2d-rot.txt
create mode 100644 milena/doc/tutorial/outputs/labeling-compute-full.txt
create mode 100644 milena/doc/tutorial/outputs/logical-not.txt
create mode 100644 milena/doc/tutorial/outputs/paste-call-1.txt
create mode 100644 milena/doc/tutorial/outputs/point-1.txt
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7669b73..2170ada 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,27 @@
+2008-11-21 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add reference files for example outputs used in the tutorial.
+
+ * doc/doc.mk: add new path variables.
+
+ * doc/tutorial/figures/ima2d-rot-1.ppm
+ * doc/tutorial/figures/ima2d-rot-2.ppm
+ * doc/tutorial/outputs/borderthickness.txt
+ * doc/tutorial/outputs/dpoint-1.txt
+ * doc/tutorial/outputs/graph-data-full.txt
+ * doc/tutorial/outputs/ima-has.txt
+ * doc/tutorial/outputs/ima-size.txt
+ * doc/tutorial/outputs/ima2d-1.txt
+ * doc/tutorial/outputs/ima2d-decl-2-blobs-full.txt
+ * doc/tutorial/outputs/ima2d-rot.txt
+ * doc/tutorial/outputs/labeling-compute-full.txt
+ * doc/tutorial/outputs/logical-not.txt
+ * doc/tutorial/outputs/paste-call-1.txt
+ * doc/tutorial/outputs/point-1.txt: reference files.
+
+ * doc/tutorial/samples/Makefile.am: diff the generated files to their
+ reference.
+
2008-11-21 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add some reference code in morpho tree.
diff --git a/milena/doc/doc.mk b/milena/doc/doc.mk
index d911d86..3311139 100644
--- a/milena/doc/doc.mk
+++ b/milena/doc/doc.mk
@@ -2,6 +2,12 @@
include $(top_srcdir)/milena/tests/tests.mk
-OUTPUTS_DIR = $(top_builddir)/milena/doc/tutorial/outputs
-FIGURES_DIR = $(top_builddir)/milena/doc/tutorial/figures
+TUTORIAL_SRCDIR = $(top_srcdir)/milena/doc/tutorial
+OUTPUTS_SRCDIR = $(TUTORIAL_SRCDIR)/outputs
+FIGURES_SRCDIR = $(TUTORIAL_SRCDIR)/figures
+
+TUTORIAL_BUILDDIR = $(top_builddir)/milena/doc/tutorial
+OUTPUTS_BUILDDIR = $(TUTORIAL_BUILDDIR)/outputs
+FIGURES_BUILDDIR = $(TUTORIAL_BUILDDIR)/figures
+
diff --git a/milena/doc/tutorial/figures/ima2d-rot-1.ppm b/milena/doc/tutorial/figures/ima2d-rot-1.ppm
new file mode 100644
index 0000000000000000000000000000000000000000..512ff99db8f5f207b30561a082499c471cd8116d
GIT binary patch
literal 235320
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
X5FkK+009C72oNAZfB*pk|3lzEi5B~u
literal 0
HcmV?d00001
diff --git a/milena/doc/tutorial/figures/ima2d-rot-2.ppm b/milena/doc/tutorial/figures/ima2d-rot-2.ppm
new file mode 100644
index 0000000000000000000000000000000000000000..c46713d24fdf6898ab821f6945fcab91780063de
GIT binary patch
literal 235320
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
b0SG_<0uX=z1Rwwb2tWV=5P$##91!>)W)sP>
literal 0
HcmV?d00001
diff --git a/milena/doc/tutorial/outputs/borderthickness.txt b/milena/doc/tutorial/outputs/borderthickness.txt
new file mode 100644
index 0000000..94f4df7
--- /dev/null
+++ b/milena/doc/tutorial/outputs/borderthickness.txt
@@ -0,0 +1,16 @@
+- - - - - - - - -
+- - - - - - - - -
+- - - - - - - - -
+- - - - | | - - -
+- - - | - - - - -
+- - - | | - - - -
+- - - - - - - - -
+- - - - - - - - -
+- - - - - - - - -
+
+===========
+
+- | |
+| - -
+| | -
+
diff --git a/milena/doc/tutorial/outputs/dpoint-1.txt b/milena/doc/tutorial/outputs/dpoint-1.txt
new file mode 100644
index 0000000..8982f0f
--- /dev/null
+++ b/milena/doc/tutorial/outputs/dpoint-1.txt
@@ -0,0 +1 @@
+(0, 1)
diff --git a/milena/doc/tutorial/outputs/graph-data-full.txt b/milena/doc/tutorial/outputs/graph-data-full.txt
new file mode 100644
index 0000000..6bfffae
--- /dev/null
+++ b/milena/doc/tutorial/outputs/graph-data-full.txt
@@ -0,0 +1,5 @@
+graph_vertices_ima((0, 0)) = 10
+graph_vertices_ima((2, 2)) = 11
+graph_vertices_ima((0, 4)) = 12
+graph_vertices_ima((4, 3)) = 13
+graph_vertices_ima((4, 4)) = 14
diff --git a/milena/doc/tutorial/outputs/ima-has.txt b/milena/doc/tutorial/outputs/ima-has.txt
new file mode 100644
index 0000000..598cd04
--- /dev/null
+++ b/milena/doc/tutorial/outputs/ima-has.txt
@@ -0,0 +1,7 @@
+ima1.has(0, 0) : 1
+ima1.has(-3, 0) : 1
+ima1.has(2, 5) : 1
+=========
+ima2.has(0, 0) : 1
+ima2.has(-3, 0) : 0
+ima2.has(2, 5) : 0
diff --git a/milena/doc/tutorial/outputs/ima-size.txt b/milena/doc/tutorial/outputs/ima-size.txt
new file mode 100644
index 0000000..333c6f9
--- /dev/null
+++ b/milena/doc/tutorial/outputs/ima-size.txt
@@ -0,0 +1 @@
+nrows = 11 - ncols = 13
diff --git a/milena/doc/tutorial/outputs/ima2d-1.txt b/milena/doc/tutorial/outputs/ima2d-1.txt
new file mode 100644
index 0000000..2a65d2f
--- /dev/null
+++ b/milena/doc/tutorial/outputs/ima2d-1.txt
@@ -0,0 +1,2 @@
+b = [(-2, -3)..(3, 5)]
+domain = [(-2, -3)..(3, 5)]
diff --git a/milena/doc/tutorial/outputs/ima2d-decl-2-blobs-full.txt b/milena/doc/tutorial/outputs/ima2d-decl-2-blobs-full.txt
new file mode 100644
index 0000000..b48c715
--- /dev/null
+++ b/milena/doc/tutorial/outputs/ima2d-decl-2-blobs-full.txt
@@ -0,0 +1,7 @@
+0 1 1 0 0
+0 1 1 0 0
+0 0 0 0 0
+2 2 0 3 0
+2 0 3 3 3
+2 0 0 0 0
+
diff --git a/milena/doc/tutorial/outputs/ima2d-rot.txt b/milena/doc/tutorial/outputs/ima2d-rot.txt
new file mode 100644
index 0000000..e69de29
diff --git a/milena/doc/tutorial/outputs/labeling-compute-full.txt b/milena/doc/tutorial/outputs/labeling-compute-full.txt
new file mode 100644
index 0000000..174807d
--- /dev/null
+++ b/milena/doc/tutorial/outputs/labeling-compute-full.txt
@@ -0,0 +1,3 @@
+[(0, 1)..(1, 2)]
+[(3, 0)..(5, 1)]
+[(3, 2)..(4, 4)]
diff --git a/milena/doc/tutorial/outputs/logical-not.txt b/milena/doc/tutorial/outputs/logical-not.txt
new file mode 100644
index 0000000..42391a7
--- /dev/null
+++ b/milena/doc/tutorial/outputs/logical-not.txt
@@ -0,0 +1,18 @@
+ima:
+| -
+- |
+
+----
+ima_neg:
+- |
+| -
+
+ima:
+| -
+- |
+
+----
+not_inplace(ima)
+- |
+| -
+
diff --git a/milena/doc/tutorial/outputs/paste-call-1.txt b/milena/doc/tutorial/outputs/paste-call-1.txt
new file mode 100644
index 0000000..a09b521
--- /dev/null
+++ b/milena/doc/tutorial/outputs/paste-call-1.txt
@@ -0,0 +1,4 @@
+b b b b
+b b b b
+b b b b
+
diff --git a/milena/doc/tutorial/outputs/point-1.txt b/milena/doc/tutorial/outputs/point-1.txt
new file mode 100644
index 0000000..39f77d0
--- /dev/null
+++ b/milena/doc/tutorial/outputs/point-1.txt
@@ -0,0 +1,2 @@
+has(p1)? false
+has(p2)? true
diff --git a/milena/doc/tutorial/samples/Makefile.am b/milena/doc/tutorial/samples/Makefile.am
index dcbf13c..43a5877 100644
--- a/milena/doc/tutorial/samples/Makefile.am
+++ b/milena/doc/tutorial/samples/Makefile.am
@@ -5,6 +5,7 @@ include $(top_srcdir)/milena/doc/doc.mk
bin_PROGRAMS = \
borderthickness \
dpoint-1 \
+ graph-data-full \
ima-has \
ima-size \
ima2d-1 \
@@ -17,6 +18,7 @@ bin_PROGRAMS = \
borderthickness_SOURCES = borderthickness.cc
dpoint_1_SOURCES = dpoint-1.cc
+graph_data_full_SOURCES = graph-data-full.cc
ima_has_SOURCES = ima-has.cc
ima_size_SOURCES = ima-size.cc
ima2d_1_SOURCES = ima2d-1.cc
@@ -27,15 +29,53 @@ logical_not_SOURCES = logical-not.cc
paste_call_1_SOURCES = paste-call-1.cc
point_1_SOURCES = point-1.cc
-all:
- mkdir -p $(OUTPUTS_DIR)
- mkdir -p $(FIGURES_DIR)
- @failcom='exit 1'; \
- list='$(bin_PROGRAMS)'; for bin in $$list; do \
- echo "Running $$bin"; \
- ./$$bin > $(OUTPUTS_DIR)/$$bin.txt || eval $$failcom; \
- done;
+all: clean-png-figures
+ mkdir -p $(OUTPUTS_BUILDDIR)
+ mkdir -p $(FIGURES_BUILDDIR)
+ @failcom='exit 1'; \
+ list='$(bin_PROGRAMS)'; for bin in $$list; do \
+ echo "Running $$bin"; \
+ ./$$bin > $(OUTPUTS_BUILDDIR)/$$bin.txt || eval $$failcom; \
+ done; \
+ has_txt_diff=""; \
+ txtlist="$(OUTPUTS_BUILDDIR)/*"; for txt in $$txtlist; do \
+ echo "Diff `basename $$txt`"; \
+ diff $$txt $(OUTPUTS_SRCDIR)/`basename $$txt` >/dev/null 2>&1 \
+ || has_txt_diff+=" `basename $$txt`"; \
+ done; \
+ has_fig_diff=""; \
+ figlist="$(FIGURES_BUILDDIR)/*"; for fig in $$figlist; do \
+ echo "Diff `basename $$fig`"; \
+ diff $$fig $(FIGURES_SRCDIR)/`basename $$fig` >/dev/null 2>&1 \
+ || has_fig_diff=" `basename $$fig`"; \
+ done; \
+ (test -z "$$has_txt_diff" && test -z "$$has_fig_diff") \
+ || (echo "--------"; \
+ echo "ERROR: please check if the tutorial needs an update.";\
+ echo " The following files differ from their \
+reference or their reference file does not exist:"; \
+ echo "--------"; \
+ echo "* Outputs:"; \
+ echo ""; \
+ echo "$$has_txt_diff"; \
+ echo ""; \
+ echo "--------"; \
+ echo "* Figures:"; \
+ echo ""; \
+ echo "$$has_fig_diff"; \
+ echo ""; \
+ echo "--------"; \
+ echo "* Please update the reference files located in:"; \
+ echo ""; \
+ echo " $(OUTPUTS_SRCDIR)"; \
+ echo " $(FIGURES_SRCDIR)"; \
+ echo ""; \
+ eval $$failcom);
+
clean-local:
- rm -Rf $(OUTPUTS_DIR) $(FIGURES_DIR)
+ rm -Rf $(OUTPUTS_BUILDDIR) $(FIGURES_BUILDDIR)
+## Clean up converted images. (*.p*m -> *.png)
+clean-png-figures:
+ rm -f $(FIGURES_BUILDDIR)/*.png
--
1.5.6.5
1
0
* bootstrap: Add missings functions.
---
ChangeLog | 6 ++++++
bootstrap | 28 +++++++++++++++++++++++++---
milena/ChangeLog | 2 +-
3 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e385329..dc72c90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-11-20 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Fix bootstrap.
+
+ * bootstrap: Add missings functions.
+
+2008-11-20 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Generate unit test files on bootstrap.
* bootstrap: generate unit test files.
diff --git a/bootstrap b/bootstrap
index 75befde..575c158 100755
--- a/bootstrap
+++ b/bootstrap
@@ -7,6 +7,11 @@ fatal ()
exit 1
}
+stderr ()
+{
+ echo >&2 "$0: $@"
+}
+
awk_strverscmp='
# Use only awk features that work with 7th edition Unix awk (1978).
# My, what an old awk you have, Mr. Solaris!
@@ -87,6 +92,23 @@ require ()
esac
}
+# run DIRECTORY COMMAND-LINE
+# --------------------------
+# "set -e" doesn't work for subshells!
+run ()
+{
+ (
+ stderr "$@"
+ cd "$1"
+ shift
+ if ! "$@"; then
+ fatal "unexpected failure: $@"
+ exit 1
+ fi
+ )
+}
+
+
# Failures do matter.
set -e
@@ -94,11 +116,11 @@ set -e
require autoconf 2.59
require automake 1.9.4
+# Generate unit test files.
+run milena/tests/unit_test ./build_unit_test.sh
+
# Tell what's going on.
set -x
-# Generate unit test files.
-run milena/tests/unit_tests build_unit_test.sh
-
# Install the GNU Build System.
autoreconf -f -v -i
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 2c59824..7669b73 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -23,7 +23,7 @@
* tests/morpho/Makefile.am: Update.
* mln/canvas/morpho/all.hh: Upgrade doc style.
-2008-11-20 Guillaume Lazzara <z(a)lrde.epita.fr>
+2008-11-21 Guillaume Lazzara <z(a)lrde.epita.fr>
Add new from_to overloads.
--
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>
Add some reference code in morpho tree.
* mln/morpho/tree/compute_parent.hh: Add doc.
* mln/morpho/tree/max.hh: New.
* mln/morpho/tree/all.hh: New.
* mln/morpho/tree/utils.hh: New.
* mln/morpho/all.hh: Update.
* tests/morpho/tree/max.cc: New.
* tests/morpho/tree/Makefile.am: Update.
mln/morpho/all.hh | 12 ++-
mln/morpho/tree/all.hh | 55 ++++++++++++++
mln/morpho/tree/compute_parent.hh | 18 ++++
mln/morpho/tree/max.hh | 91 ++++++++++++++++++++++++
mln/morpho/tree/utils.hh | 141 ++++++++++++++++++++++++++++++++++++++
tests/morpho/tree/Makefile.am | 5 -
tests/morpho/tree/max.cc | 73 +++++++++++++++++++
7 files changed, 386 insertions(+), 9 deletions(-)
Index: tests/morpho/tree/Makefile.am
--- tests/morpho/tree/Makefile.am (revision 2938)
+++ tests/morpho/tree/Makefile.am (working copy)
@@ -3,9 +3,10 @@
include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
- compute_tree
-
+ compute_tree \
+ max
compute_tree_SOURCES = compute_tree_.cc
+max_SOURCES = max_.cc
TESTS = $(check_PROGRAMS)
Index: tests/morpho/tree/max.cc
--- tests/morpho/tree/max.cc (revision 0)
+++ tests/morpho/tree/max.cc (revision 0)
@@ -0,0 +1,73 @@
+// 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/morpho/tree/max.cc
+///
+/// Tests on mln::morpho::tree::max.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/pw/image.hh>
+
+#include <mln/debug/println.hh>
+#include <mln/debug/iota.hh>
+#include <mln/morpho/elementary/dilation.hh>
+
+#include <mln/morpho/tree/utils.hh>
+#include <mln/morpho/tree/max.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<unsigned> ima(3, 3);
+ debug::iota(ima);
+
+ ima = morpho::elementary::dilation(ima, c8());
+ debug::println(ima);
+
+ image2d<point2d> par = morpho::tree::max(ima, c4());
+ debug::println(par);
+
+
+// using morpho::tree::is_root;
+// using morpho::tree::is_a_node;
+
+// mln_piter_(box2d) p(ima.domain());
+// for_all(p)
+// if (is_root(par, p, ima))
+// std::cout << "R ";
+// else if (is_a_node(par, p, ima))
+// std::cout << "n ";
+// else
+// std::cout << ". ";
+// std::cout << std::endl;
+
+ p_array<point2d> s = level::sort_psites_increasing(ima);
+ std::cout << morpho::tree::nodes(par, ima, s) << std::endl;
+}
Index: mln/morpho/tree/compute_parent.hh
--- mln/morpho/tree/compute_parent.hh (revision 2938)
+++ mln/morpho/tree/compute_parent.hh (working copy)
@@ -49,9 +49,21 @@
namespace tree
{
- // Remember:
- // p is root iff parent(p) == p
- // p is node iff either p is root or f(parent(p)) != f(p)
+ /// Compute a tree with a parent relationship between sites.
+ ///
+ /// Warning: \p s translates the ordering related to the
+ /// "natural" childhood relationship. The parenthood is thus
+ /// inverted w.r.t. to \p s.
+ ///
+ /// It is very convenient since all processing upon the parent
+ /// tree are performed following \p s (in the default "forward"
+ /// way).
+ ///
+ /// FIXME: Put it more clearly...
+ ///
+ /// The parent result image verifies: \n
+ /// - p is root iff parent(p) == p \n
+ /// - p is a node iff either p is root or f(parent(p)) != f(p).
template <typename I, typename N, typename S>
mln_ch_value(I, mln_psite(I))
Index: mln/morpho/tree/max.hh
--- mln/morpho/tree/max.hh (revision 0)
+++ mln/morpho/tree/max.hh (revision 0)
@@ -0,0 +1,91 @@
+// 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_MORPHO_TREE_MAX_HH
+# define MLN_MORPHO_TREE_MAX_HH
+
+/// \file mln/morpho/tree/max.hh
+///
+/// Compute a canonized (parenthood) max-tree from an image.
+
+# include <mln/morpho/tree/compute_parent.hh>
+# include <mln/level/sort_psites.hh>
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ namespace tree
+ {
+
+ // Remember:
+ // p is root iff parent(p) == p
+ // p is node iff either p is root or f(parent(p)) != f(p)
+
+ template <typename I, typename N>
+ mln_ch_value(I, mln_psite(I))
+ max(const Image<I>& f, const Neighborhood<N>& nbh);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename N>
+ inline
+ mln_ch_value(I, mln_psite(I))
+ max(const Image<I>& f_, const Neighborhood<N>& nbh_)
+ {
+ trace::entering("morpho::tree::max");
+
+ const I& f = exact(f_);
+ const N& nbh = exact(nbh_);
+
+ mln_precondition(f.has_data());
+ // mln_precondition(nbh.is_valid());
+
+ // For the max-tree, childhood maps "increasing level":
+ p_array<mln_psite(I)> s = level::sort_psites_increasing(f);
+ mln_ch_value(I, mln_psite(I)) output = compute_parent(f, nbh, s);
+
+ trace::exiting("morpho::tree::max");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::morpho::tree
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MORPHO_TREE_MAX_HH
Index: mln/morpho/tree/all.hh
--- mln/morpho/tree/all.hh (revision 0)
+++ mln/morpho/tree/all.hh (revision 0)
@@ -0,0 +1,55 @@
+// 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_MORPHO_TREE_ALL_HH
+# define MLN_MORPHO_TREE_ALL_HH
+
+/// \file mln/morpho/tree/all.hh
+///
+/// File that includes all morphological tree-related routines.
+
+
+namespace mln
+{
+ namespace morpho
+ {
+
+ /// Namespace of morphological tree-related routines.
+ namespace tree
+ {}
+
+ }
+}
+
+
+# include <mln/morpho/tree/compute_parent.hh>
+# include <mln/morpho/tree/max.hh>
+# include <mln/morpho/tree/utils.hh>
+
+
+
+#endif // ! MLN_MORPHO_TREE_ALL_HH
Index: mln/morpho/tree/utils.hh
--- mln/morpho/tree/utils.hh (revision 0)
+++ mln/morpho/tree/utils.hh (revision 0)
@@ -0,0 +1,141 @@
+// 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_MORPHO_TREE_UTILS_HH
+# define MLN_MORPHO_TREE_UTILS_HH
+
+/// \file mln/morpho/tree/utils.hh
+///
+/// Utilities.
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/site_set/p_array.hh>
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ namespace tree
+ {
+
+ template <typename T, typename I>
+ bool
+ is_root(const Image<T>& parent, const mln_psite(T)& p,
+ const Image<I>& f);
+
+
+ template <typename T, typename I>
+ bool
+ is_a_node(const Image<T>& parent, const mln_psite(T)& p,
+ const Image<I>& f);
+
+
+
+ template <typename T, typename I, typename S>
+ p_array<mln_psite(T)>
+ nodes(const Image<T>& parent, const Image<I>& f, const Site_Set<S>& s);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename T, typename I>
+ inline
+ bool
+ is_root(const Image<T>& parent_, const mln_psite(T)& p,
+ const Image<I>& f_)
+ {
+ mlc_equal(mln_value(T), mln_psite(T))::check();
+
+ const T& parent = exact(parent_);
+ const I& f = exact(f_);
+
+ mln_precondition(parent.has_data());
+ mln_precondition(f.has_data());
+ mln_precondition(parent.domain() == f.domain());
+
+ return parent(p) == p;
+ }
+
+
+ template <typename T, typename I>
+ inline
+ bool
+ is_a_node(const Image<T>& parent_, const mln_psite(T)& p,
+ const Image<I>& f_)
+ {
+ mlc_equal(mln_value(T), mln_psite(T))::check();
+
+ const T& parent = exact(parent_);
+ const I& f = exact(f_);
+
+ mln_precondition(parent.has_data());
+ mln_precondition(f.has_data());
+ mln_precondition(parent.domain() == f.domain());
+
+ return parent(p) == p || f(parent(p)) != f(p);
+ }
+
+
+ template <typename T, typename I, typename S>
+ inline
+ p_array<mln_psite(T)>
+ nodes(const Image<T>& parent_, const Image<I>& f_, const Site_Set<S>& s_)
+ {
+ mlc_equal(mln_value(T), mln_psite(T))::check();
+
+ const T& parent = exact(parent_);
+ const I& f = exact(f_);
+ const S& s = exact(s_);
+
+ mln_precondition(parent.has_data());
+ mln_precondition(f.has_data());
+ mln_precondition(f.domain() == parent.domain());
+ mln_precondition(s == f.domain());
+
+ p_array<mln_psite(T)> arr;
+ mln_bkd_piter(S) p(exact(s));
+ for_all(p)
+ if (is_a_node(parent, p, f))
+ arr.insert(p);
+
+ return arr;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::morpho::tree
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MORPHO_TREE_MAX_HH
Index: mln/morpho/all.hh
--- mln/morpho/all.hh (revision 2938)
+++ mln/morpho/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,10 +29,9 @@
#ifndef MLN_MORPHO_ALL_HH
# define MLN_MORPHO_ALL_HH
-/*! \file mln/morpho/all.hh
- *
- * \brief File that includes all morpho-related routines.
- */
+/// \file mln/morpho/all.hh
+///
+/// File that includes all morpho-related routines.
namespace mln
@@ -82,7 +82,11 @@
# include <mln/morpho/thinning.hh>
# include <mln/morpho/top_hat.hh>
+
+// Sub-directories.
+
# include <mln/morpho/elementary/all.hh>
+# include <mln/morpho/tree/all.hh>
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add a morpho tree computation.
* mln/morpho/tree: New directory.
* mln/morpho/tree/compute_parent.hh: New; revamp of...
* sandbox/geraud/max_tree_nnodes.cc: ...this file.
* tests/morpho/tree: New directory.
* tests/morpho/tree/compute_parent.cc:
* tests/morpho/tree/Makefile.am: New.
* tests/morpho/Makefile.am: Update.
* mln/canvas/morpho/all.hh: Upgrade doc style.
mln/canvas/morpho/all.hh | 16 +-
mln/morpho/tree/compute_parent.hh | 273 +++++++++++++++++++++++-------------
tests/morpho/Makefile.am | 4
tests/morpho/tree/Makefile.am | 11 +
tests/morpho/tree/compute_parent.cc | 80 ++++++++++
5 files changed, 284 insertions(+), 100 deletions(-)
Index: tests/morpho/tree/compute_parent.cc
--- tests/morpho/tree/compute_parent.cc (revision 0)
+++ tests/morpho/tree/compute_parent.cc (revision 0)
@@ -0,0 +1,80 @@
+// 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/morpho/tree/compute_parent.cc
+///
+/// Tests on mln::morpho::tree::compute_parent.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+
+#include <mln/debug/println.hh>
+#include <mln/debug/iota.hh>
+
+#include <mln/core/var.hh>
+#include <mln/core/image/image_if.hh>
+#include <mln/pw/value.hh>
+
+#include <mln/morpho/tree/compute_parent.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ bool vals[] = { 1, 1, 1,
+ 0, 1, 0,
+ 0, 0, 1 };
+ image2d<bool> ima = make::image2d(vals);
+ mln_VAR(sub, ima | pw::value(ima));
+ debug::println(sub);
+
+ mln_VAR(par, morpho::tree::compute_parent(sub, c4(), sub.domain()));
+ debug::println(par);
+ }
+
+/*
+ {
+ image2d<unsigned> ima(3, 3);
+ debug::iota(ima);
+ debug::println(ima);
+
+ debug::println( morpho::tree::compute_parent(ima, c4(), ima.domain()) );
+ }
+
+
+ {
+ image2d<unsigned> ima(3, 3);
+ level::fill(ima, 0);
+ debug::println(ima);
+
+ debug::println( morpho::tree::compute_parent(ima, c4(), ima.domain()) );
+ }
+*/
+
+}
Index: tests/morpho/tree/Makefile.am
--- tests/morpho/tree/Makefile.am (revision 0)
+++ tests/morpho/tree/Makefile.am (revision 0)
@@ -0,0 +1,11 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ compute_tree
+
+
+compute_tree_SOURCES = compute_tree_.cc
+
+TESTS = $(check_PROGRAMS)
Index: tests/morpho/Makefile.am
--- tests/morpho/Makefile.am (revision 2937)
+++ tests/morpho/Makefile.am (working copy)
@@ -2,7 +2,9 @@
include $(top_srcdir)/milena/tests/tests.mk
-SUBDIRS = elementary
+SUBDIRS = \
+ elementary \
+ tree
check_PROGRAMS = \
artificial_line_graph_image_wst \
Index: mln/morpho/tree/compute_parent.hh
--- mln/morpho/tree/compute_parent.hh (revision 0)
+++ mln/morpho/tree/compute_parent.hh (working copy)
@@ -1,151 +1,240 @@
+// 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_MORPHO_TREE_COMPUTE_PARENT_HH
+# define MLN_MORPHO_TREE_COMPUTE_PARENT_HH
+
+/// \file mln/morpho/tree/compute_parent.hh
+///
+/// Compute a canonized tree from an image.
+///
+/// \todo Specialize for low quant (and try fastest).
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
# include <mln/level/fill.hh>
-# include <mln/util/pix.hh>
-# include <mln/morpho/includes.hh>
-# include <mln/level/sort_psites.hh>
-
-# include <mln/core/image/image2d.hh>
-# include <mln/core/alias/neighb2d.hh>
-# include <mln/value/int_u8.hh>
-# include <mln/io/pgm/load.hh>
namespace mln
{
- template <typename I, typename N>
- struct max_tree_
+ namespace morpho
{
- typedef mln_site(I) point;
- typedef p_array<point> S;
- // in:
- const I& f;
- const N& nbh;
+ namespace tree
+ {
- // aux:
- S s;
- mln_ch_value(I, bool) deja_vu;
- mln_ch_value(I, point) parent;
- mln_ch_value(I, point) zpar;
+ // Remember:
+ // p is root iff parent(p) == p
+ // p is node iff either p is root or f(parent(p)) != f(p)
+
+ template <typename I, typename N, typename S>
+ mln_ch_value(I, mln_psite(I))
+ compute_parent(const Image<I>& f, const Neighborhood<N>& nbh,
+ const Site_Set<S>& s);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // Tests.
+
+
+ namespace internal
+ {
- max_tree_(const I& f, const N& nbh)
- : f(f),
- nbh(nbh)
+ template <typename I, typename N, typename S>
+ void
+ compute_parent_tests(const Image<I>& f_,
+ const Neighborhood<N>& nbh_,
+ const Site_Set<S>& s_)
{
- run();
+ const I& f = exact(f_);
+ const N& nbh = exact(nbh_);
+ const S& s = exact(s_);
+
+ mln_precondition(f.has_data());
+ // mln_precondition(nbh.is_valid());
+ mln_precondition(s == f.domain());
+
+ (void) f;
+ (void) nbh;
+ (void) s;
}
- void run()
+
+ } // end of namespace mln::morpho::tree::internal
+
+
+
+ // Implementations.
+
+
+ namespace impl
+ {
+
+ namespace generic
{
- // init
+
+ // Z-Find-Root.
+
+ template <typename T>
+ inline
+ mln_psite(T) zfind_root(T& zpar, const mln_psite(T)& x)
{
+ mlc_equal(mln_value(T), mln_psite(T))::check();
+ if (zpar(x) == x)
+ return x;
+ else
+ return zpar(x) = zfind_root(zpar, zpar(x));
+ }
+
+ // Compute-Parent.
+
+ template <typename I, typename N, typename S>
+ inline
+ mln_ch_value(I, mln_psite(I))
+ compute_parent(const Image<I>& f_,
+ const Neighborhood<N>& nbh_,
+ const Site_Set<S>& s_)
+ {
+ trace::entering("morpho::tree::impl::generic::compute_parent");
+
+ typedef mln_psite(I) P;
+
+ const I& f = exact(f_);
+ const N& nbh = exact(nbh_);
+ const S& s = exact(s_);
+
+ // Tests.
+ internal::compute_parent_tests(f, nbh, s);
+
+ // Auxiliary data.
+ mln_ch_value(I, bool) deja_vu;
+ mln_ch_value(I, P) parent;
+ mln_ch_value(I, P) zpar;
+
initialize(deja_vu, f);
- mln::level::fill(deja_vu, false);
initialize(parent, f);
initialize(zpar, f);
- s = level::sort_psites_decreasing(f);
- }
- // first pass
- {
- mln_fwd_piter(S) p(s);
+ // Initialization.
+ level::fill(deja_vu, false);
+
+ // Body.
+ mln_bkd_piter(S) p(s);
mln_niter(N) n(nbh, p);
for_all(p)
{
- make_set(p);
+ // Make-Set.
+ parent(p) = p;
+ zpar(p) = p;
+
for_all(n)
- if (f.has(n) && deja_vu(n))
- do_union(n, p);
- deja_vu(p) = true;
+ if (f.domain().has(n) && deja_vu(n))
+ {
+ // Do-Union.
+ P r = zfind_root(zpar, n);
+ if (r != p)
+ {
+ parent(r) = p;
+ zpar(r) = p;
}
}
+ deja_vu(p) = true;
+ }
- // second pass: canonization
+ // Canonization.
{
- mln_bkd_piter(S) p(s);
+ mln_fwd_piter(S) p(s);
for_all(p)
{
- point q = parent(p);
+ P q = parent(p);
if (f(parent(q)) == f(q))
parent(p) = parent(q);
}
}
- } // end of run()
-
- void make_set(const point& p)
- {
- parent(p) = p;
- zpar(p) = p;
+ trace::exiting("morpho::tree::impl::generic::compute_parent");
+ return parent;
}
- bool is_root(const point& p) const
- {
- return parent(p) == p;
- }
+ } // end of namespace mln::morpho::tree::impl::generic
+
+ } // end of namespace mln::morpho::tree::impl
- bool is_node(const point& p) const
- {
- return is_root(p) || f(parent(p)) != f(p);
- }
- point find_root(const point& x)
- {
- if (zpar(x) == x)
- return x;
- else
- return zpar(x) = find_root(zpar(x));
- }
- void do_union(const point& n, const point& p)
+ // Dispatch.
+
+ namespace internal
{
- point r = find_root(n);
- if (r != p)
+
+ template <typename I, typename N, typename S>
+ inline
+ mln_ch_value(I, mln_psite(I))
+ compute_parent_dispatch(const Image<I>& f,
+ const Neighborhood<N>& nbh,
+ const Site_Set<S>& s)
{
- parent(r) = p;
- zpar(r) = p;
+ return impl::generic::compute_parent(f, nbh, s);
}
- }
-
- };
+ } // end of namespace mln::morpho::tree::internal
+ // Facade.
- template <typename I, typename N>
- unsigned max_tree(const I& f, const N& nbh)
+ template <typename I, typename N, typename S>
+ inline
+ mln_ch_value(I, mln_psite(I))
+ compute_parent(const Image<I>& f, const Neighborhood<N>& nbh,
+ const Site_Set<S>& s)
{
- max_tree_<I,N> run(f, nbh);
+ trace::entering("morpho::tree::compute_parent");
- mln_piter(I) p(f.domain());
- unsigned nnodes = 0;
- for_all(p)
- if (run.is_node(p))
- ++nnodes;
- return nnodes;
- }
+ internal::compute_parent_tests(f, nbh, s);
+
+ mln_ch_value(I, mln_psite(I)) output;
+ output = internal::compute_parent_dispatch(f, nbh, s);
-} // end of mln
+ trace::exiting("morpho::tree::compute_parent");
+ return output;
+ }
+# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace mln::morpho::tree
-int main(int argc, char* argv[])
-{
- if (argc != 2)
- {
- std::cerr << "usage: " << argv[0] << " filename" << std::endl;
- return 1;
- }
+ } // end of namespace mln::morpho
- using namespace mln;
- using value::int_u8;
+} // end of namespace mln
- image2d<int_u8> f;
- io::pgm::load(f, argv[1]);
- std::cout << "n nodes = " << mln::max_tree(f, c8()) << std::endl;
-}
+#endif // ! MLN_MORPHO_TREE_COMPUTE_PARENT_HH
Index: mln/canvas/morpho/all.hh
--- mln/canvas/morpho/all.hh (revision 2937)
+++ mln/canvas/morpho/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,23 +29,24 @@
#ifndef MLN_CANVAS_MORPHO_ALL_HH
# define MLN_CANVAS_MORPHO_ALL_HH
-/*! \file mln/canvas/morpho/all.hh
- *
- * \brief File that includes morphological canvas-related routines.
- */
+/// \file mln/canvas/morpho/all.hh
+///
+/// File that includes morphological canvas-related routines.
namespace mln
{
-
namespace canvas
{
+
/// Namespace of morphological canvas.
namespace morpho {}
- }
}
+}
+
# include <mln/canvas/morpho/algebraic_union_find.hh>
+
#endif // ! MLN_CANVAS_MORPHO_ALL_HH
1
0
21 Nov '08
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Move tree computation out from sandbox to mln morpho tree.
* geraud/max_tree_nnodes.cc: Move out.
max_tree_nnodes.cc | 151 -----------------------------------------------------
1 file changed, 151 deletions(-)
Index: geraud/max_tree_nnodes.cc
--- geraud/max_tree_nnodes.cc (revision 2936)
+++ geraud/max_tree_nnodes.cc (working copy)
@@ -1,151 +0,0 @@
-
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/neighborhood.hh>
-# include <mln/level/fill.hh>
-# include <mln/util/pix.hh>
-# include <mln/morpho/includes.hh>
-# include <mln/level/sort_psites.hh>
-
-# include <mln/core/image/image2d.hh>
-# include <mln/core/alias/neighb2d.hh>
-# include <mln/value/int_u8.hh>
-# include <mln/io/pgm/load.hh>
-
-
-
-namespace mln
-{
-
- template <typename I, typename N>
- struct max_tree_
- {
- typedef mln_site(I) point;
- typedef p_array<point> S;
-
- // in:
- const I& f;
- const N& nbh;
-
- // aux:
- S s;
- mln_ch_value(I, bool) deja_vu;
- mln_ch_value(I, point) parent;
- mln_ch_value(I, point) zpar;
-
- max_tree_(const I& f, const N& nbh)
- : f(f),
- nbh(nbh)
- {
- run();
- }
-
- void run()
- {
- // init
- {
- initialize(deja_vu, f);
- mln::level::fill(deja_vu, false);
- initialize(parent, f);
- initialize(zpar, f);
- s = level::sort_psites_decreasing(f);
- }
-
- // first pass
- {
- mln_fwd_piter(S) p(s);
- mln_niter(N) n(nbh, p);
- for_all(p)
- {
- make_set(p);
- for_all(n)
- if (f.has(n) && deja_vu(n))
- do_union(n, p);
- deja_vu(p) = true;
- }
- }
-
- // second pass: canonization
- {
- mln_bkd_piter(S) p(s);
- for_all(p)
- {
- point q = parent(p);
- if (f(parent(q)) == f(q))
- parent(p) = parent(q);
- }
- }
-
- } // end of run()
-
- void make_set(const point& p)
- {
- parent(p) = p;
- zpar(p) = p;
- }
-
- bool is_root(const point& p) const
- {
- return parent(p) == p;
- }
-
- bool is_node(const point& p) const
- {
- return is_root(p) || f(parent(p)) != f(p);
- }
-
- point find_root(const point& x)
- {
- if (zpar(x) == x)
- return x;
- else
- return zpar(x) = find_root(zpar(x));
- }
-
- void do_union(const point& n, const point& p)
- {
- point r = find_root(n);
- if (r != p)
- {
- parent(r) = p;
- zpar(r) = p;
- }
- }
-
- };
-
-
-
-
- template <typename I, typename N>
- unsigned max_tree(const I& f, const N& nbh)
- {
- max_tree_<I,N> run(f, nbh);
-
- mln_piter(I) p(f.domain());
- unsigned nnodes = 0;
- for_all(p)
- if (run.is_node(p))
- ++nnodes;
- return nnodes;
- }
-
-} // end of mln
-
-
-
-int main(int argc, char* argv[])
-{
- if (argc != 2)
- {
- std::cerr << "usage: " << argv[0] << " filename" << std::endl;
- return 1;
- }
-
- using namespace mln;
- using value::int_u8;
-
- image2d<int_u8> f;
- io::pgm::load(f, argv[1]);
-
- std::cout << "n nodes = " << mln::max_tree(f, c8()) << std::endl;
-}
1
0
* mln/convert/from_to.hxx: add new definitions.
* mln/core/concept/accumulator.hh: add default from_to.
* mln/labeling/compute.hh: use from_to.
* mln/util/array.hh: add from_to(array<T1>, array<T2>).
---
milena/ChangeLog | 12 ++++
milena/mln/convert/from_to.hxx | 12 ++++
milena/mln/core/concept/accumulator.hh | 58 +++++++++++++----
milena/mln/labeling/compute.hh | 113 +++++++++++++++-----------------
milena/mln/util/array.hh | 51 ++++++++++++++-
5 files changed, 171 insertions(+), 75 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7c72bd2..7831512 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,17 @@
2008-11-20 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add new from_to overloads.
+
+ * mln/convert/from_to.hxx: add new definitions.
+
+ * mln/core/concept/accumulator.hh: add default from_to.
+
+ * mln/labeling/compute.hh: use from_to.
+
+ * mln/util/array.hh: add from_to(array<T1>, array<T2>).
+
+2008-11-20 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Cleanup various files.
* doc/examples/mk_graph.cc: use int_u16 instead of int_u8.
diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx
index 1876401..9dbd0c8 100644
--- a/milena/mln/convert/from_to.hxx
+++ b/milena/mln/convert/from_to.hxx
@@ -45,6 +45,7 @@ namespace mln
// Forward declarations.
+ template <typename E> struct Accumulator;
template <typename E> struct Gdpoint;
template <typename E> struct Gpoint;
template <typename E> struct Image;
@@ -230,6 +231,17 @@ namespace mln
void
from_to(const std::vector<T>& from, fun::i2v::array<T>& to);
+ // util::array<T1> -> util::array<T2>
+ template <typename T1, typename T2>
+ void
+ from_to(const util::array<T1>& from, util::array<T2>& to);
+
+
+ // Accumulator<A> -> mln_result(A)
+ template <typename A>
+ void
+ from_to(const Accumulator<A>& from, mln_result(A)& to);
+
} // end of namespace mln::convert
} // end of namespace mln
diff --git a/milena/mln/core/concept/accumulator.hh b/milena/mln/core/concept/accumulator.hh
index a4f4c74..5fcbf29 100644
--- a/milena/mln/core/concept/accumulator.hh
+++ b/milena/mln/core/concept/accumulator.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
@@ -28,10 +29,9 @@
#ifndef MLN_CORE_CONCEPT_ACCUMULATOR_HH
# define MLN_CORE_CONCEPT_ACCUMULATOR_HH
-/*! \file mln/core/concept/accumulator.hh
- *
- * \brief Definition of the concept of mln::Accumulator.
- */
+/// \file mln/core/concept/accumulator.hh
+///
+/// Definition of the concept of mln::Accumulator.
# include <mln/core/concept/proxy.hh>
# include <mln/metal/fix_return.hh>
@@ -41,9 +41,20 @@
namespace mln
{
- // Fwd decl.
+ // Forward declaration.
template <typename E> struct Accumulator;
+
+ namespace convert
+ {
+
+ template <typename A>
+ void
+ from_to(const Accumulator<A>& from, mln_result(A)& to);
+
+ } // end of namespace mln::convert
+
+
// Accumulator category flag type.
template <>
struct Accumulator<void>
@@ -53,13 +64,13 @@ namespace mln
- /*! \brief Base class for implementation of accumulators.
- *
- * The parameter \a E is the exact type.
- *
- * \see mln::doc::Accumulator for a complete documentation of this
- * class contents.
- */
+ /// \brief Base class for implementation of accumulators.
+ ///
+ /// The parameter \a E is the exact type.
+ ///
+ /// \see mln::doc::Accumulator for a complete documentation of this
+ /// class contents.
+ ///
template <typename E>
struct Accumulator : public Proxy<E>
{
@@ -91,6 +102,29 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
+
+ // convert::from_to
+
+ namespace convert
+ {
+
+ template <typename A>
+ void
+ from_to(const Accumulator<A>& from_, mln_result(A)& to)
+ {
+ const A& from = exact(from_);
+ if (from.is_valid())
+ to = from.to_result();
+ else
+ to = mln_result(A)();
+ }
+
+ } // end of namespace mln::convert
+
+
+
+ // Accumulator<E>
+
template <typename E>
inline
Accumulator<E>::Accumulator()
diff --git a/milena/mln/labeling/compute.hh b/milena/mln/labeling/compute.hh
index 1206c3d..6233979 100644
--- a/milena/mln/labeling/compute.hh
+++ b/milena/mln/labeling/compute.hh
@@ -37,6 +37,7 @@
# include <mln/core/concept/accumulator.hh>
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/util/array.hh>
+# include <mln/convert/to.hh>
namespace mln
@@ -55,12 +56,12 @@ namespace mln
/// \return A mln::p_array of accumulator result. One result per component in
/// \p label.
///
- template <typename A, typename I, typename J>
+ template <typename A, typename I, typename L>
util::array<mln_result(A)>
compute(const Accumulator<A>& a,
const Image<I>& input,
- const Image<J>& label,
- const mln_value(J)& nlabels);
+ const Image<L>& label,
+ const mln_value(L)& nlabels);
/// Compute an accumulator onto the pixel values of the image \p input.
/// for each component of the image \p label.
@@ -72,12 +73,12 @@ namespace mln
/// \return A mln::p_array of accumulator result. One result per component in
/// \p label.
///
- template <typename A, typename I, typename J>
+ template <typename A, typename I, typename L>
util::array<mln_accu_with(A, mln_value(I))::result>
compute(const Meta_Accumulator<A>& a,
const Image<I>& input,
- const Image<J>& label,
- const mln_value(J)& nlabels);
+ const Image<L>& label,
+ const mln_value(L)& nlabels);
/// Compute an accumulator onto the pixel sites of each component domain of
/// \p label.
@@ -88,11 +89,11 @@ namespace mln
/// \return A mln::p_array of accumulator result. One result per component in
/// \p label.
///
- template <typename A, typename J>
+ template <typename A, typename L>
util::array<mln_result(A)>
compute(const Accumulator<A>& a,
- const Image<J>& label,
- const mln_value(J)& nlabels);
+ const Image<L>& label,
+ const mln_value(L)& nlabels);
/// Compute an accumulator onto the pixel sites of each component domain of
/// \p label.
@@ -103,11 +104,11 @@ namespace mln
/// \return A mln::p_array of accumulator result. One result per component in
/// \p label.
///
- template <typename A, typename J>
- util::array<mln_accu_with(A, mln_psite(J))::result>
+ template <typename A, typename L>
+ util::array<mln_accu_with(A, mln_psite(L))::result>
compute(const Meta_Accumulator<A>& a,
- const Image<J>& label,
- const mln_value(J)& nlabels);
+ const Image<L>& label,
+ const mln_value(L)& nlabels);
@@ -116,12 +117,12 @@ namespace mln
namespace internal
{
- template <typename A, typename J>
+ template <typename A, typename L>
inline
void
compute_tests(const Accumulator<A>& a,
- const Image<J>& label,
- const mln_value(J)& nlabels)
+ const Image<L>& label,
+ const mln_value(L)& nlabels)
{
mln_precondition(exact(label).has_data());
(void) a;
@@ -130,13 +131,13 @@ namespace mln
}
- template <typename A, typename I, typename J>
+ template <typename A, typename I, typename L>
inline
void
compute_tests(const Accumulator<A>& a,
const Image<I>& input,
- const Image<J>& label,
- const mln_value(J)& nlabels)
+ const Image<L>& label,
+ const mln_value(L)& nlabels)
{
mln_precondition(exact(input).has_data());
mln_precondition(exact(label).has_data());
@@ -157,49 +158,44 @@ namespace mln
namespace generic
{
- template <typename A, typename J>
+ template <typename A, typename L>
inline
util::array<mln_result(A)>
compute(const Accumulator<A>& a_,
- const Image<J>& label_,
- const mln_value(J)& nlabels)
+ const Image<L>& label_,
+ const mln_value(L)& nlabels)
{
trace::entering("labeling::impl::generic::compute");
internal::compute_tests(a_, label_, nlabels);
const A& a = exact(a_);
- const J& label = exact(label_);
+ const L& label = exact(label_);
util::array<A> accus(nlabels + 1, a);
- mln_piter(J) p(label.domain());
+ mln_piter(L) p(label.domain());
for_all(p)
accus[label(p)].take(p);
- util::array<mln_result(A)> arr(nlabels + 1);
- for (unsigned i = 0; i < accus.nelements(); ++i)
- if (accus[i].is_valid())
- arr[i] = accus[i];
-
trace::exiting("labeling::impl::generic::compute");
- return arr;
+ return convert::to< util::array<mln_result(A)> >(accus);
}
- template <typename A, typename I, typename J>
+ template <typename A, typename I, typename L>
inline
util::array<mln_result(A)>
compute(const Accumulator<A>& a_,
const Image<I>& input_,
- const Image<J>& label_,
- const mln_value(J)& nlabels)
+ const Image<L>& label_,
+ const mln_value(L)& nlabels)
{
trace::entering("labeling::impl::generic::compute");
internal::compute_tests(a_, input_, label_, nlabels);
const A& a = exact(a_);
const I& input = exact(input_);
- const J& label = exact(label_);
+ const L& label = exact(label_);
util::array<A> accus (nlabels + 1, a);
@@ -207,13 +203,8 @@ namespace mln
for_all(p)
accus[label(p)].take(input(p));
- util::array<mln_result(A)> res(nlabels + 1);
- for (unsigned i = 0; i < accus.nelements(); ++i)
- if (accus[i].is_valid())
- res[i] = accus[i];
-
trace::exiting("labeling::impl::generic::compute");
- return res;
+ return convert::to< util::array<mln_result(A)> >(accus);
}
} // end of namespace mln::labeling::impl::internal
@@ -225,24 +216,24 @@ namespace mln
namespace internal
{
- template <typename A, typename J>
+ template <typename A, typename L>
inline
util::array<mln_result(A)>
compute_dispatch(const Accumulator<A>& a,
- const Image<J>& label,
- const mln_value(J)& nlabels)
+ const Image<L>& label,
+ const mln_value(L)& nlabels)
{
return impl::generic::compute(a, label, nlabels);
}
- template <typename A, typename I, typename J>
+ template <typename A, typename I, typename L>
inline
util::array<mln_result(A)>
compute_dispatch(const Accumulator<A>& a,
const Image<I>& input,
- const Image<J>& label,
- const mln_value(J)& nlabels)
+ const Image<L>& label,
+ const mln_value(L)& nlabels)
{
return impl::generic::compute(a, input, label, nlabels);
}
@@ -253,13 +244,13 @@ namespace mln
/// Facades.
- template <typename A, typename I, typename J>
+ template <typename A, typename I, typename L>
inline
util::array<mln_result(A)>
compute(const Accumulator<A>& a,
const Image<I>& input,
- const Image<J>& label,
- const mln_value(J)& nlabels)
+ const Image<L>& label,
+ const mln_value(L)& nlabels)
{
trace::entering("labeling::compute");
@@ -272,13 +263,13 @@ namespace mln
return res;
}
- template <typename A, typename I, typename J>
+ template <typename A, typename I, typename L>
inline
util::array<mln_accu_with(A, mln_value(I))::result>
compute(const Meta_Accumulator<A>& a,
const Image<I>& input,
- const Image<J>& label,
- const mln_value(J)& nlabels)
+ const Image<L>& label,
+ const mln_value(L)& nlabels)
{
typedef mln_accu_with(A, mln_value(I)) A_;
A_ a_ = accu::unmeta(exact(a), mln_value(I)());
@@ -287,12 +278,12 @@ namespace mln
}
- template <typename A, typename J>
+ template <typename A, typename L>
inline
util::array<mln_result(A)>
compute(const Accumulator<A>& a,
- const Image<J>& label,
- const mln_value(J)& nlabels)
+ const Image<L>& label,
+ const mln_value(L)& nlabels)
{
trace::entering("labeling::compute");
@@ -306,15 +297,15 @@ namespace mln
}
- template <typename A, typename J>
+ template <typename A, typename L>
inline
- util::array<mln_accu_with(A, mln_psite(J))::result>
+ util::array<mln_accu_with(A, mln_psite(L))::result>
compute(const Meta_Accumulator<A>& a,
- const Image<J>& label,
- const mln_value(J)& nlabels)
+ const Image<L>& label,
+ const mln_value(L)& nlabels)
{
- typedef mln_accu_with(A, mln_psite(J)) A_;
- A_ a_ = accu::unmeta(exact(a), mln_psite(J)());
+ typedef mln_accu_with(A, mln_psite(L)) A_;
+ A_ a_ = accu::unmeta(exact(a), mln_psite(L)());
return internal::compute_dispatch(a_, label, nlabels);
}
diff --git a/milena/mln/util/array.hh b/milena/mln/util/array.hh
index 9658919..b5e2534 100644
--- a/milena/mln/util/array.hh
+++ b/milena/mln/util/array.hh
@@ -49,6 +49,28 @@ namespace mln
namespace util
{
+ /// Forward declaration.
+ template <typename T>
+ class array;
+
+ } // end of namespace mln::util
+
+
+
+ namespace convert
+ {
+
+ template <typename T1, typename T2>
+ void
+ from_to(const util::array<T1>& from, util::array<T2>& to);
+
+ } // end of namespace mln::convert
+
+
+
+ namespace util
+ {
+
// Forward declarations.
template <typename T> class array_fwd_iter;
template <typename T> class array_bkd_iter;
@@ -239,10 +261,33 @@ namespace mln
const array<T>* a_;
};
+ } // end of namespace mln::util
+
# ifndef MLN_INCLUDE_ONLY
+
+ // convert::from_to
+
+ namespace convert
+ {
+
+ template <typename T1, typename T2>
+ void
+ from_to(const util::array<T1>& from, util::array<T2>& to)
+ {
+ to.resize(from.nelements());
+ for (unsigned i = 0; i < from.nelements(); ++i)
+ from_to(from[i], to[i]);
+ }
+
+ } // end of namespace mln::convert
+
+
+ namespace util
+ {
+
// util::array<T>
@@ -576,11 +621,13 @@ namespace mln
return ostr;
}
+ } // end of namespace mln::util
+
+
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::util
-} // end of namespace mln
+} // end of namespace mln
#endif // ! MLN_UTIL_ARRAY_HH
--
1.5.6.5
1
0
* doc/examples/mk_graph.cc: use int_u16 instead of int_u8.
* mln/debug/colorize.hh,
* mln/debug/draw_graph.hh,
* mln/level/compute.hh,
* mln/literal/zero.hh,
* mln/value/concept/symbolic.hh,
* mln/value/int_u.hh,
* mln/value/internal/value_like.hh: Cleanup comments.
* tests/core/image/graph_image.cc: Fix includes.
---
milena/ChangeLog | 17 +++++++++++++++
milena/doc/examples/mk_graph.cc | 12 +++++-----
milena/mln/debug/colorize.hh | 20 +++++++++--------
milena/mln/debug/draw_graph.hh | 7 ++---
milena/mln/level/compute.hh | 24 ++++++++++----------
milena/mln/literal/zero.hh | 14 ++++++------
milena/mln/value/concept/symbolic.hh | 12 +++++-----
milena/mln/value/int_u.hh | 35 +++++++++++++++----------------
milena/mln/value/internal/value_like.hh | 34 +++++++++++++----------------
milena/tests/core/image/graph_image.cc | 2 +-
10 files changed, 95 insertions(+), 82 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 3dfa998..7c72bd2 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,22 @@
2008-11-20 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Cleanup various files.
+
+ * doc/examples/mk_graph.cc: use int_u16 instead of int_u8.
+
+ * mln/debug/colorize.hh,
+ * mln/debug/draw_graph.hh,
+ * mln/level/compute.hh,
+ * mln/literal/zero.hh,
+ * mln/value/concept/symbolic.hh,
+ * mln/value/int_u.hh,
+ * mln/value/internal/value_like.hh: Cleanup comments.
+
+ * tests/core/image/graph_image.cc: Fix includes.
+
+
+2008-11-20 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Update unit tests.
* tests/unit_test/Makefile.am: update list of tests.
diff --git a/milena/doc/examples/mk_graph.cc b/milena/doc/examples/mk_graph.cc
index 18b7a86..eff6433 100644
--- a/milena/doc/examples/mk_graph.cc
+++ b/milena/doc/examples/mk_graph.cc
@@ -47,7 +47,7 @@
int main(int argc, char *argv[])
{
using namespace mln;
- using value::int_u8;
+ using value::int_u16;
if (argc < 2)
{
@@ -59,13 +59,13 @@ int main(int argc, char *argv[])
logical::not_inplace(ima);
// Create a label image and compute the influence zones.
- int_u8 nlabels;
- image2d<int_u8> lbl = labeling::blobs(ima, c8(), nlabels);
+ int_u16 nlabels;
+ image2d<int_u16> lbl = labeling::blobs(ima, c8(), nlabels);
io::ppm::save(debug::colorize< image2d<value::rgb8> >(lbl, nlabels),
"1_blobs.ppm");
- image2d<int_u8> iz = transform::influence_zone_geodesic(lbl,
- c8(),
- lbl.ncols());
+ image2d<int_u16> iz = transform::influence_zone_geodesic(lbl,
+ c8(),
+ lbl.ncols());
io::ppm::save(debug::colorize< image2d<value::rgb8> >(iz, nlabels),
"2_influence_zone_geodesic.ppm");
diff --git a/milena/mln/debug/colorize.hh b/milena/mln/debug/colorize.hh
index c997921..f764278 100644
--- a/milena/mln/debug/colorize.hh
+++ b/milena/mln/debug/colorize.hh
@@ -1,4 +1,5 @@
// 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,10 +29,9 @@
#ifndef MLN_DEBUG_COLORIZE_HH
# define MLN_DEBUG_COLORIZE_HH
-/*! \file mln/debug/colorize.hh
- *
- * \brief Fill an image with successive values.
- */
+/// \file mln/debug/colorize.hh
+///
+/// Fill an image with successive values.
# include <mln/core/concept/image.hh>
# include <mln/fun/i2v/array.hh>
@@ -64,8 +64,8 @@ namespace mln
* \param[in] labeled_image A labeled image (\sa labeling::blobs).
* \param[in] nlabels Number of labels.
*/
- template <typename I, typename J>
- mln_concrete(I) colorize(const Image<J>& labeled_image, mln_value(J) nlabels);
+ template <typename I, typename L>
+ mln_concrete(I) colorize(const Image<L>& labeled_image, mln_value(L) nlabels);
# ifndef MLN_INCLUDE_ONLY
@@ -93,10 +93,10 @@ namespace mln
}
- template <typename I, typename J>
+ template <typename I, typename L>
inline
mln_concrete(I)
- colorize(const Image<J>& input, mln_value(J) nlabels)
+ colorize(const Image<L>& input, mln_value(L) nlabels)
{
trace::entering("debug::colorize");
mln_precondition(exact(input).has_data());
@@ -109,8 +109,10 @@ namespace mln
unsigned i = f.size() + diff_size;
// We want to treat comp 0 differently since it is the background.
if (i == 0)
+ {
i = 1;
- f(0) = literal::black;
+ f(0) = literal::black;
+ }
for (; i < f.size(); ++i)
f(i) = internal::random_color();
}
diff --git a/milena/mln/debug/draw_graph.hh b/milena/mln/debug/draw_graph.hh
index 159b974..a891534 100644
--- a/milena/mln/debug/draw_graph.hh
+++ b/milena/mln/debug/draw_graph.hh
@@ -29,16 +29,15 @@
#ifndef MLN_DEBUG_DRAW_GRAPH_HH
# define MLN_DEBUG_DRAW_GRAPH_HH
-/// \file mln/debug/graph.hh
+/// \file mln/debug/draw_graph.hh
///
/// \brief Draw an (classical) image from a mln::graph_image.
///
/// \todo write a version for graph images.
-# include <mln/pw/image.hh>
-# include <mln/level/fill.hh>
-# include <mln/draw/line.hh>
# include <mln/core/site_set/p_vertices.hh>
+# include <mln/draw/line.hh>
+# include <mln/level/fill.hh>
namespace mln
{
diff --git a/milena/mln/level/compute.hh b/milena/mln/level/compute.hh
index 776ee66..888120f 100644
--- a/milena/mln/level/compute.hh
+++ b/milena/mln/level/compute.hh
@@ -45,24 +45,24 @@ namespace mln
{
/// Compute an accumulator onto the pixel values of the image \p input.
- /*!
- * \param[in] a An accumulator.
- * \param[in] input The input image.
- * \return The accumulator result.
- *
- * It fully relies on level::update.
- */
+ ///
+ /// \param[in] a An accumulator.
+ /// \param[in] input The input image.
+ /// \return The accumulator result.
+ ///
+ /// It fully relies on level::update.
+ ///
template <typename A, typename I>
mln_result(A)
compute(const Accumulator<A>& a, const Image<I>& input);
/// Compute an accumulator onto the pixel values of the image \p input.
- /*!
- * \param[in] a A meta-accumulator.
- * \param[in] input The input image.
- * \return The accumulator result.
- */
+ ///
+ /// \param[in] a A meta-accumulator.
+ /// \param[in] input The input image.
+ /// \return The accumulator result.
+ ///
template <typename A, typename I>
mln_accu_with(A, mln_value(I))::result
compute(const Meta_Accumulator<A>& a, const Image<I>& input);
diff --git a/milena/mln/literal/zero.hh b/milena/mln/literal/zero.hh
index 8762ec1..b6b4e48 100644
--- a/milena/mln/literal/zero.hh
+++ b/milena/mln/literal/zero.hh
@@ -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,12 +29,11 @@
#ifndef MLN_LITERAL_ZERO_HH
# define MLN_LITERAL_ZERO_HH
-/*! \file mln/literal/zero.hh
- *
- * \brief Definition of the literal of mln::zero.
- *
- * \todo Macro-ification of similar code (when no trivial conversion ops are involved).
- */
+/// \file mln/literal/zero.hh
+///
+/// Definition of the literal of mln::zero.
+///
+/// \todo Macro-ification of similar code (when no trivial conversion ops are involved).
# include <mln/core/concept/literal.hh>
# include <mln/metal/converts_to.hh>
diff --git a/milena/mln/value/concept/symbolic.hh b/milena/mln/value/concept/symbolic.hh
index ad171d9..b4d0d98 100644
--- a/milena/mln/value/concept/symbolic.hh
+++ b/milena/mln/value/concept/symbolic.hh
@@ -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_VALUE_CONCEPT_SYMBOLIC_HH
# define MLN_VALUE_CONCEPT_SYMBOLIC_HH
-/*! \file mln/value/concept/symbolic.hh
- *
- * \brief Define a generic class for symbolic values.
- */
+/// \file mln/value/concept/symbolic.hh
+///
+/// Define a generic class for symbolic values.
# include <mln/core/concept/value.hh>
@@ -39,7 +39,7 @@
namespace mln
{
- // Fwd decl.
+ // Forward declaration.
namespace value { template <typename E> struct Symbolic; }
diff --git a/milena/mln/value/int_u.hh b/milena/mln/value/int_u.hh
index 10d6526..e5589fe 100644
--- a/milena/mln/value/int_u.hh
+++ b/milena/mln/value/int_u.hh
@@ -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_VALUE_INT_U_HH
# define MLN_VALUE_INT_U_HH
-/*! \file mln/value/int_u.hh
- *
- * \brief Define a generic class for unsigned integers.
- */
+/// \file mln/value/int_u.hh
+///
+/// Define a generic class for unsigned integers.
# include <mln/trait/all.hh> // FIXME!
@@ -51,13 +51,13 @@ namespace mln
namespace value
{
- // Fwd decls.
+ // Forward declaration.
template <unsigned n> struct int_u;
}
namespace literal
{
- // Fwd decls.
+ // Forward declarations.
struct zero_t;
struct one_t;
}
@@ -104,10 +104,9 @@ namespace mln
namespace value
{
- /*! \brief Unsigned integer value class.
- *
- * The parameter is \c n the number of encoding bits.
- */
+ /// Unsigned integer value class.
+ ///
+ /// The parameter is \c n the number of encoding bits.
template <unsigned n>
struct int_u
:
@@ -154,13 +153,13 @@ namespace mln
- /*! \brief Print an unsigned integer \p i into the output stream \p ostr.
- *
- * \param[in,out] ostr An output stream.
- * \param[in] i An unsigned integer.
- *
- * \return The modified output stream \p ostr.
- */
+ /// \brief Print an unsigned integer \p i into the output stream \p ostr.
+ ///
+ /// \param[in,out] ostr An output stream.
+ /// \param[in] i An unsigned integer.
+ ///
+ /// \return The modified output stream \p ostr.
+ ///
template <unsigned n>
std::ostream& operator<<(std::ostream& ostr, const int_u<n>& i);
diff --git a/milena/mln/value/internal/value_like.hh b/milena/mln/value/internal/value_like.hh
index 7a52e80..6159ee5 100644
--- a/milena/mln/value/internal/value_like.hh
+++ b/milena/mln/value/internal/value_like.hh
@@ -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,12 +29,9 @@
#ifndef MLN_VALUE_INTERNAL_VALUE_LIKE_HH
# define MLN_VALUE_INTERNAL_VALUE_LIKE_HH
-/*! \file mln/value/internal/value_like.hh
- *
- * \brief Factor code for value classes defined over another type.
- *
- *
- */
+/// \file mln/value/internal/value_like.hh
+///
+/// Factor code for value classes defined over another type.
# include <mln/core/concept/value.hh>
# include <mln/core/internal/force_exact.hh>
@@ -48,10 +46,10 @@ namespace mln
namespace internal
{
- /*! Base class for value classes defined over another
- * type. Parameters are \c V the equivalent value type and
- * \c E the exact value type.
- */
+ /// Base class for value classes defined over another
+ /// type. Parameters are \c V the equivalent value type and
+ /// \c E the exact value type.
+ ///
template < typename V, // Equivalent.
typename C, // Encoding.
typename N, // Interoperation.
@@ -85,18 +83,16 @@ namespace mln
};
- /*! General definition of the "equal to" operator between
- * value-like types.
- *
- */
+ /// General definition of the "equal to" operator between
+ /// value-like types.
+ ///
template <typename V, typename C, typename N, typename E>
bool operator==(const value_like_<V,C,N,E>& lhs, const value_like_<V,C,N,E>& rhs);
- /*! General definition of the "less than" operator
- * between value-like types.
- *
- */
+ /// General definition of the "less than" operator
+ /// between value-like types.
+ ///
template <typename V, typename C, typename N, typename E>
bool operator<(const value_like_<V,C,N,E>& lhs, const value_like_<V,C,N,E>& rhs);
diff --git a/milena/tests/core/image/graph_image.cc b/milena/tests/core/image/graph_image.cc
index 9fc556c..3614807 100644
--- a/milena/tests/core/image/graph_image.cc
+++ b/milena/tests/core/image/graph_image.cc
@@ -49,7 +49,7 @@
#include <mln/util/graph.hh>
-#include <mln/debug/graph.hh>
+#include <mln/debug/draw_graph.hh>
#include <mln/debug/println.hh>
#include <mln/core/concept/function.hh>
--
1.5.6.5
1
0
* bootstrap: generate unit test files.
---
ChangeLog | 6 ++++++
bootstrap | 3 +++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cc742bc..e385329 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-20 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Generate unit test files on bootstrap.
+
+ * bootstrap: generate unit test files.
+
2008-11-18 Roland Levillain <roland(a)lrde.epita.fr>
* configure.ac: Configure milena/mesh/Makefile.
diff --git a/bootstrap b/bootstrap
index c729754..75befde 100755
--- a/bootstrap
+++ b/bootstrap
@@ -97,5 +97,8 @@ require automake 1.9.4
# Tell what's going on.
set -x
+# Generate unit test files.
+run milena/tests/unit_tests build_unit_test.sh
+
# Install the GNU Build System.
autoreconf -f -v -i
--
1.5.6.5
1
0