https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Add stuff for report.
* jardonnet/n_cmpt/tikz.hh: New. Generate tikz and various images.
* jardonnet/n_cmpt/tikz.cc: New.
tikz.cc | 63 +++++++++++++++
tikz.hh | 254 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 317 insertions(+)
Index: jardonnet/n_cmpt/tikz.hh
--- jardonnet/n_cmpt/tikz.hh (revision 0)
+++ jardonnet/n_cmpt/tikz.hh (revision 0)
@@ -0,0 +1,254 @@
+// 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_CMPT3_HH
+# define MLN_N_CMPT3_HH
+
+# include <mln/labeling/regional_minima.hh>
+# include <mln/core/alias/neighb2d.hh>
+# include <mln/util/set.hh>
+
+# include <mln/debug/println.hh>
+# include <mln/debug/iota.hh>
+
+# include <mln/accu/volume.hh>
+# include <mln/morpho/tree/data.hh>
+# include <mln/morpho/tree/compute_attribute_image.hh>
+
+# include <mln/level/paste.hh>
+
+namespace mln
+{
+
+ namespace n_cmpt
+ {
+
+ template < typename I >
+ void n_cmpt5(const I& (((((((ima))))))));
+
+# 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>
+ I
+ n_cmpt3(const I& ima, const N& nbh,
+ unsigned lambda)
+ {
+ std::cout << "/ima/" << std::endl;
+ debug::println(ima);
+ io::tikz::save(ima, "ima.tex");
+
+ // compute volume image
+ //---------------------
+
+ typedef p_array<mln_psite(I)> S;
+ typedef mln_ch_value(I, value::int_u<16>) V;
+ typedef accu::volume<I> A;
+
+ S sp = level::sort_psites_decreasing(ima);
+ morpho::tree::data<I,S> t(ima, sp, nbh);
+
+ V volume(ima.domain());
+ level::paste(morpho::tree::compute_attribute_image(A(), t),
+ volume);
+
+ sp = level::sort_psites_increasing(volume);
+ std::cout << "/volume/" << std::endl;
+ debug::println(volume);
+ io::tikz::save(volume, "volume.tex");
+ io::pgm::save(volume, "volume.pgm");
+
+
+ // get /volume/ regional minima
+ //-----------------------------
+
+ unsigned label;
+ mln_ch_value(I, unsigned) min_v = labeling::regional_minima(volume, nbh, label);
+ std::cout << "/volume/ regional minima" << std::endl;
+ debug::println(min_v);
+
+ // number of minima
+ unsigned cmpts = label;
+ if (lambda > cmpts)
+ std::cout << "warning : lambda value is to hight." << std::endl;
+
+ std::cout << cmpts << std::endl;
+
+
+ // two pass algo
+ //--------------
+
+ // init fused image
+ mln_ch_value(I, bool) fused;
+ initialize(fused, volume);
+ mln::level::fill(fused, false);
+
+ // prepare union find
+ typedef mln_psite(V) P;
+
+ //data
+ mln_ch_value(V, accu::volume<V>) data(volume.domain());
+
+ //deja_vu
+ mln_ch_value(V, bool) deja_vu(volume.domain());
+ mln::level::fill(deja_vu, false);
+
+ //parent
+ mln_ch_value(V, P) parent(volume.domain());
+ {
+ mln_fwd_piter(S) p(sp);
+ for_all(p)
+ {
+ parent(p) = p;
+
+ // Mandatory since we propagate fused
+ if (min_v(p) != 0) // p in a reg min of the attribute image
+ fused(p) = true; // ok
+ }
+ }
+
+ // UNION FIND ON VOLUME
+ mln_fwd_piter(S) p(sp);
+ mln_niter(N) n(nbh, p);
+ for_all(p)
+ {
+ std::cout << p << std::endl;
+ //if (volume(p) > lambda)
+ // goto step2;
+ for_all(n)
+ {
+ if (volume.domain().has(n) && deja_vu(n))
+ {
+ //do_union(n, p);
+ P r = find_root(parent, n);
+ if (r != p)
+ {
+ std::cout << "neighb: " << n << std::endl;
+ std::cout << "v(r): " << volume(r) << " v(p): " << volume(p) << " f(p): " << fused(p) << std::endl;
+
+ //if (volume(r) != volume(p)) // r and p have different volumes
+ // This check was wrong.
+ // you just fused with a minima.
+ // then you fuse with a neighbor already fused that has the same volume as you
+ // a) 1 50 1
+ // 2 2 2
+ // we don't have ( volume(r) == volume(p) ) => not fused(r)
+ // even if r and p are not minima
+
+ // problem :
+ // - when fusing minima : same level, both fused. NOT DEC
+ // - when fusing cmpts (a) : same level, both fused. DEC
+
+ // One cmpt less if
+ if (fused(r) && min_v(p) == 0) // p is not a minima
+ if (fused(p)) // p already belong to a cmpt (fused for an another n)
+ if (cmpts >= lambda) // union is still allowed
+ {
+ cmpts--;
+ std::cout << "dec" << std::endl;
+ }
+
+ mln_invariant(fused(r) || volume(r) == volume(p));
+
+ // Union made if
+ if (cmpts >= lambda || // union is still allowed or
+ not fused(r) || // r not fused or
+ not fused(p) || // p not fused or
+ min_v(p) != 0) // p is a minima
+ {
+ std::cout << "fuse" << p << n << std::endl;
+ parent(r) = p;
+
+ // This test is mandatory. Sometimes (--_) points are fused
+ // tought none of these points belongs to a component (attached
+ // to a local minima). In this case fused(p) must not be true
+ // since it can be fused again without removing a component.
+ // looking if r is fused should be enought.
+ // This test force minima to be initialized fused.
+ if (fused(r))
+ fused(p) = true;
+
+
+ // If I try to fuse with something never fused I am on a plateau.
+ // not fused(r) => ( volume(r) == volume(p) )
+ mln_invariant(fused(r) || volume(r) == volume(p));
+ // fused(r) and ( volume(r) == volume(p) ) happen on minima plateau.
+
+ // fused(n) = true; // useless ? probably yes because when we
+ // want to know that we really fuse component, we look at
+ // fused(r) not n.
+ // fused(n) is not an invariant: --_. And it is ok (I think).
+ // We don't have to retro-propagate fused.
+
+ std::cerr << "volume " << volume(p) << " - " << cmpts << std::endl;
+ //debug::println(fused);
+ }
+ }
+ }
+ }
+ deja_vu(p) = true;
+ }
+
+ mln_ch_value(I,value::int_u<16>) iota(ima.domain());
+ debug::iota(iota);
+
+ std::cout << std::endl;
+ std::cout << "cmpts : " << cmpts << std::endl;
+
+ // second pass
+ I output(ima.domain());
+ {
+ mln_bkd_piter(S) p(sp);
+ for_all(p)
+ if (parent(p) == p) // p is root.
+ output(p) = iota(p);
+ else
+ output(p) = output(parent(p));
+ }
+
+ return output;
+ }
+
+ } // end of namespace n_cmpt
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+#endif /* MLN_N_CMPT3_HH */
+
Index: jardonnet/n_cmpt/tikz.cc
--- jardonnet/n_cmpt/tikz.cc (revision 0)
+++ jardonnet/n_cmpt/tikz.cc (revision 0)
@@ -0,0 +1,63 @@
+
+#include <iostream>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/value/int_u8.hh>
+
+#include <mln/make/image.hh>
+#include <mln/core/alias/neighb1d.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+#include <mln/io/tikz/save.hh>
+
+#include <cmath>
+
+#include "tickz.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]);
+ unsigned lambda = atoi(argv[2]);
+
+ image2d<int_u8> cos_(6,6);
+ for (int i = 0; i <= 6; i++)
+ for (int j = 0; j <= 6; j++)
+ cos_(point2d(i,j)) = (sin(i) * cos(j) + 1)/2*255;
+ io::pgm::save(cos_, "cos.pgm");
+
+ int_u8 tree[5][5] =
+ {
+ {100, 160, 160, 100, 100},
+ {160, 220, 220, 100, 100},
+ {160, 160, 220, 100, 100},
+ {220, 160, 100, 100, 100},
+ {100, 160, 100, 160, 160},
+ };
+
+ io::tikz::save(make::image(tree), "tree.tex");
+
+ int_u8 tab[] = {2,3,1,0,2,3,4,5,1,1,0,5,6,8,7,1,1,2,3,4};
+ image1d<int_u8> ima1= make::image(tab);
+
+ n_cmpt::n_cmpt3(ima, c4(), lambda);
+}
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Comment. Fix wrong fusing condition, dec condition.
* jardonnet/n_cmpt/n_cmpt5.cc: Comment. Change fusing/dec conditions.
* jardonnet/n_cmpt/n_cmpt5.hh: Remove old hack.
n_cmpt5.cc | 2 --
n_cmpt5.hh | 43 ++++++++++++++++++++++++++++++++++---------
2 files changed, 34 insertions(+), 11 deletions(-)
Index: jardonnet/n_cmpt/n_cmpt5.cc
--- jardonnet/n_cmpt/n_cmpt5.cc (revision 3039)
+++ jardonnet/n_cmpt/n_cmpt5.cc (working copy)
@@ -35,8 +35,6 @@
io::pgm::load(ima, argv[1]);
unsigned lambda = atoi(argv[2]);
- ima(point2d(0,3)) = 106;
-
int_u8 tab[] = {2,3,1,0,2,3,4,5,1,1,0,5,6,8,7,1,1,2,3,4};
image1d<int_u8> ima1= make::image(tab);
Index: jardonnet/n_cmpt/n_cmpt5.hh
--- jardonnet/n_cmpt/n_cmpt5.hh (revision 3039)
+++ jardonnet/n_cmpt/n_cmpt5.hh (working copy)
@@ -149,16 +149,40 @@
P r = find_root(parent, n);
if (r != p)
{
+ std::cout << "neighb: " << n << std::endl;
+ std::cout << "v(r): " << volume(r) << " v(p): " << volume(p) << " f(p): " << fused(p) << std::endl;
+
+ //if (volume(r) != volume(p)) // r and p have different volumes
+ // This check was wrong.
+ // you just fused with a minima.
+ // then you fuse with a neighbor already fused that has the same volume as you
+ // a) 1 50 1
+ // 2 2 2
+ // we don't have ( volume(r) == volume(p) ) => not fused(r)
+ // even if r and p are not minima
+
+ // problem :
+ // - when fusing minima : same level, both fused. NOT DEC
+ // - when fusing cmpts (a) : same level, both fused. DEC
+
// One cmpt less if
- if (volume(r) != volume(p)) // r and p have differerent volumes
+ if (fused(r) && min_v(p) == 0) // p is not a minima
if (fused(p)) // p already belong to a cmpt (fused for an another n)
- if (cmpts >= lambda) // union is still alowed
+ if (cmpts >= lambda) // union is still allowed
+ {
cmpts--;
+ std::cout << "dec" << std::endl;
+ }
- if (cmpts >= lambda ||
- volume(r) == volume(p) ||
- not fused(p))
+ mln_invariant(fused(r) || volume(r) == volume(p));
+
+ // Union made if
+ if (cmpts >= lambda || // union is still allowed or
+ not fused(r) || // r not fused or
+ not fused(p) || // p not fused or
+ min_v(p) != 0) // p is a minima
{
+ std::cout << "fuse" << p << n << std::endl;
parent(r) = p;
// This test is mandatory. Sometimes (--_) points are fused
@@ -170,6 +194,7 @@
if (fused(r))
fused(p) = true;
+
// If I try to fuse with something never fused I am on a plateau.
// not fused(r) => ( volume(r) == volume(p) )
mln_invariant(fused(r) || volume(r) == volume(p));
@@ -181,8 +206,8 @@
// fused(n) is not an invariant: --_. And it is ok (I think).
// We don't have to retro-propagate fused.
- //std::cout << "volume " << volume(p) << " - " << cmpts << std::endl;
- debug::println(fused);
+ std::cerr << "volume " << volume(p) << " - " << cmpts << std::endl;
+ //debug::println(fused);
}
}
}
@@ -190,7 +215,7 @@
deja_vu(p) = true;
}
- I iota(ima.domain());
+ mln_ch_value(I,value::int_u<16>) iota(ima.domain());
debug::iota(iota);
std::cout << std::endl;
@@ -202,7 +227,7 @@
mln_bkd_piter(S) p(sp);
for_all(p)
if (parent(p) == p) // p is root.
- output(p) = iota(p) * 10;
+ output(p) = iota(p);
else
output(p) = output(parent(p));
}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2008-12-12 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Make level::compare use test::predicate.
* mln/level/compare.hh: .
* mln/test/predicate.hh: Add a version which works on two images.
Add the concept of vv2b function.
* mln/fun/vv2b: New.
* mln/core/concept/function.hh: .
Add some vv2b functions.
* mln/fun/vv2b/eq.hh: New.
* mln/fun/vv2b/ge.hh: New.
* mln/fun/vv2b/gt.hh: New.
* mln/fun/vv2b/implies.hh: New.
* mln/fun/vv2b/le.hh: New.
* mln/fun/vv2b/lt.hh: New.
---
core/concept/function.hh | 36 ++++++++++++++++++++++
fun/vv2b/eq.hh | 75 +++++++++++++++++++++++++++++++++++++++++++++++
fun/vv2b/ge.hh | 75 +++++++++++++++++++++++++++++++++++++++++++++++
fun/vv2b/gt.hh | 75 +++++++++++++++++++++++++++++++++++++++++++++++
fun/vv2b/implies.hh | 75 +++++++++++++++++++++++++++++++++++++++++++++++
fun/vv2b/le.hh | 75 +++++++++++++++++++++++++++++++++++++++++++++++
fun/vv2b/lt.hh | 75 +++++++++++++++++++++++++++++++++++++++++++++++
level/compare.hh | 31 ++++++++++---------
test/predicate.hh | 62 ++++++++++++++++++++++++++++++++++++--
9 files changed, 560 insertions(+), 19 deletions(-)
Index: trunk/milena/mln/core/concept/function.hh
===================================================================
--- trunk/milena/mln/core/concept/function.hh (revision 3038)
+++ trunk/milena/mln/core/concept/function.hh (revision 3039)
@@ -52,6 +52,7 @@
template <typename E> struct Function_l2l;
template <typename E> struct Function_vv2v;
+ template <typename E> struct Function_vv2b;
/// Function category flag type.
template <>
@@ -324,6 +325,28 @@
Function_vv2v(const Function_vv2v&);
};
+ /*------------------------.
+ | Value, Value -> Boolean.|
+ `------------------------*/
+
+ template <>
+ struct Function_vv2b<void> { typedef Function<void> super; };
+
+ /// Base class for implementation of function-objects from
+ /// a couple of values to a boolean.
+ ///
+ /// The parameter \a E is the exact type.
+ ///
+ template <typename E>
+ struct Function_vv2b : public Function<E>
+ {
+ typedef bool result;
+ typedef Function_vv2b<void> category;
+ protected:
+ Function_vv2b();
+ Function_vv2b(const Function_vv2b&);
+ };
+
# ifndef MLN_INCLUDE_ONLY
@@ -483,6 +506,19 @@
{
}
+ template <typename E>
+ inline
+ Function_vv2b<E>::Function_vv2b()
+ {
+ }
+
+ template <typename E>
+ inline
+ Function_vv2b<E>::Function_vv2b(const Function_vv2b<E>& rhs)
+ : Function<E>(rhs)
+ {
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: trunk/milena/mln/level/compare.hh
===================================================================
--- trunk/milena/mln/level/compare.hh (revision 3038)
+++ trunk/milena/mln/level/compare.hh (revision 3039)
@@ -34,6 +34,10 @@
*/
# include <mln/core/concept/image.hh>
+# include <mln/fun/vv2b/eq.hh>
+# include <mln/fun/vv2b/le.hh>
+# include <mln/fun/vv2b/lt.hh>
+# include <mln/test/predicate.hh>
namespace mln
@@ -82,42 +86,39 @@
inline
bool operator == (const Image<L>& lhs_, const Image<R>& rhs_)
{
+ typedef fun::vv2b::eq<mln_value(L), mln_value(R)> F;
+
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
mln_precondition(lhs.domain() == rhs.domain());
- mln_piter(L) p(lhs.domain());
- for_all(p)
- if (! (lhs(p) == rhs(p)))
- return false;
- return true;
+
+ return test::predicate(lhs_, rhs_, F());
}
template <typename L, typename R>
inline
bool operator < (const Image<L>& lhs_, const Image<R>& rhs_)
{
+ typedef fun::vv2b::lt<mln_value(L), mln_value(R)> F;
+
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
mln_precondition(lhs.domain() == rhs.domain());
- mln_piter(L) p(lhs.domain());
- for_all(p)
- if (! (lhs(p) < rhs(p)))
- return false;
- return true;
+
+ return test::predicate(lhs_, rhs_, F());
}
template <typename L, typename R> // required!
inline
bool operator <= (const Image<L>& lhs_, const Image<R>& rhs_)
{
+ typedef fun::vv2b::le<mln_value(L), mln_value(R)> F;
+
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
mln_precondition(lhs.domain() == rhs.domain());
- mln_piter(L) p(lhs.domain());
- for_all(p)
- if (! (lhs(p) <= rhs(p)))
- return false;
- return true;
+
+ return test::predicate(lhs_, rhs_, F());
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/test/predicate.hh
===================================================================
--- trunk/milena/mln/test/predicate.hh (revision 3038)
+++ trunk/milena/mln/test/predicate.hh (revision 3039)
@@ -54,6 +54,17 @@
bool predicate(const Image<I>& ima, const Function_v2b<F>& f);
+ /*! Test if all pixel values of \p lhs and \p rhs verify the
+ * predicate \p f.
+ *
+ * \param[in] lhs The image.
+ * \param[in] rhs The image.
+ * \param[in] f The predicate.
+ */
+ template <typename I, typename J, typename F>
+ bool predicate(const Image<I>& lhs, const Image<J>& rhs, const Function_v2b<F>& f);
+
+
/*! Test if all points of \p pset verify the predicate \p f.
*
* \param[in] pset The point set.
@@ -70,9 +81,8 @@
template <typename I, typename F>
inline
- bool predicate_(trait::image::speed::any, const I& ima_, const F& f)
+ bool predicate_(trait::image::speed::any, const I& ima, const F& f)
{
- const I& ima = exact(ima_);
mln_piter(I) p(ima.domain());
for_all(p)
if (! f(ima(p)))
@@ -82,9 +92,8 @@
template <typename I, typename F>
inline
- bool predicate_(trait::image::speed::fastest, const I& ima_, const F& f)
+ bool predicate_(trait::image::speed::fastest, const I& ima, const F& f)
{
- const I& ima = exact(ima_);
mln_pixter(const I) pxl(ima);
for_all(pxl)
if (! f(pxl.val()))
@@ -92,6 +101,33 @@
return true;
}
+ template <typename I, typename J, typename F>
+ inline
+ bool predicate_(trait::image::speed::any,
+ trait::image::speed::any,
+ const I& lhs, const J& rhs, const F& f)
+ {
+ mln_piter(I) p(lhs.domain());
+ for_all(p)
+ if (! f(lhs(p), rhs(p)))
+ return false;
+ return true;
+ }
+
+ template <typename I, typename J, typename F>
+ inline
+ bool predicate_(trait::image::speed::fastest,
+ trait::image::speed::fastest,
+ const I& lhs, const J& rhs, const F& f)
+ {
+ mln_pixter(const I) pxl1(lhs);
+ mln_pixter(const I) pxl2(rhs);
+ for_all_2(pxl1, pxl2)
+ if (! f(pxl1.val(), pxl2.val()))
+ return false;
+ return true;
+ }
+
template <typename S, typename F>
inline
bool predicate_(const Site_Set<S>& pset, const F& f)
@@ -117,6 +153,24 @@
exact(f));
}
+
+ template <typename I, typename J, typename F>
+ inline
+ bool predicate(const Image<I>& lhs_, const Image<J>& rhs_, const Function_vv2b<F>& f)
+ {
+ const I& lhs = exact(lhs_);
+ const J& rhs = exact(rhs_);
+
+ mln_precondition(lhs.has_data());
+ mln_precondition(rhs.has_data());
+ mln_precondition(lhs.domain() == rhs.domain());
+
+ return impl::predicate_(mln_trait_image_speed(I)(),
+ mln_trait_image_speed(J)(),
+ lhs, rhs,
+ exact(f));
+ }
+
template <typename S, typename F>
inline
bool predicate(const Site_Set<S>& pset, const Function_p2b<F>& f)
Index: trunk/milena/mln/fun/vv2b/implies.hh
===================================================================
--- trunk/milena/mln/fun/vv2b/implies.hh (revision 0)
+++ trunk/milena/mln/fun/vv2b/implies.hh (revision 3039)
@@ -0,0 +1,75 @@
+// 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_FUN_VV2B_IMPLIES_HH
+# define MLN_FUN_VV2B_IMPLIES_HH
+
+/// \file mln/fun/vv2b/implies.hh
+///
+/// Functor that computes "logical implies" between two values.
+
+# include <mln/core/concept/function.hh>
+# include <mln/trait/op/and.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace vv2b
+ {
+
+ /// Functor computing logical-implies between two values.
+ template <typename L, typename R = L>
+ struct implies : public Function_vv2b< implies<L,R> >
+ {
+ bool operator()(const L& v1, const R& v2) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L, typename R>
+ inline
+ bool
+ implies<L,R>::operator()(const L& v1, const R& v2) const
+ {
+ return (! v1) || v2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::vv2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_VV2B_IMPLIES_HH
Index: trunk/milena/mln/fun/vv2b/eq.hh
===================================================================
--- trunk/milena/mln/fun/vv2b/eq.hh (revision 0)
+++ trunk/milena/mln/fun/vv2b/eq.hh (revision 3039)
@@ -0,0 +1,75 @@
+// 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_FUN_VV2B_EQ_HH
+# define MLN_FUN_VV2B_EQ_HH
+
+/// \file mln/fun/vv2b/eq.hh
+///
+/// Functor that computes equal between two values.
+
+# include <mln/core/concept/function.hh>
+# include <mln/trait/op/and.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace vv2b
+ {
+
+ /// Functor computing equal between two values.
+ template <typename L, typename R = L>
+ struct eq : public Function_vv2b< eq<L,R> >
+ {
+ bool operator()(const L& v1, const R& v2) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L, typename R>
+ inline
+ bool
+ eq<L,R>::operator()(const L& v1, const R& v2) const
+ {
+ return v1 == v2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::vv2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_VV2B_EQ_HH
Index: trunk/milena/mln/fun/vv2b/gt.hh
===================================================================
--- trunk/milena/mln/fun/vv2b/gt.hh (revision 0)
+++ trunk/milena/mln/fun/vv2b/gt.hh (revision 3039)
@@ -0,0 +1,75 @@
+// 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_FUN_VV2B_GT_HH
+# define MLN_FUN_VV2B_GT_HH
+
+/// \file mln/fun/vv2b/gt.hh
+///
+/// Functor that computes "greater than" between two values.
+
+# include <mln/core/concept/function.hh>
+# include <mln/trait/op/and.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace vv2b
+ {
+
+ /// Functor computing "greater than" between two values.
+ template <typename L, typename R = L>
+ struct gt : public Function_vv2b< gt<L,R> >
+ {
+ bool operator()(const L& v1, const R& v2) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L, typename R>
+ inline
+ bool
+ gt<L,R>::operator()(const L& v1, const R& v2) const
+ {
+ return v1 > v2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::vv2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_VV2B_GT_HH
Index: trunk/milena/mln/fun/vv2b/ge.hh
===================================================================
--- trunk/milena/mln/fun/vv2b/ge.hh (revision 0)
+++ trunk/milena/mln/fun/vv2b/ge.hh (revision 3039)
@@ -0,0 +1,75 @@
+// 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_FUN_VV2B_GE_HH
+# define MLN_FUN_VV2B_GE_HH
+
+/// \file mln/fun/vv2b/ge.hh
+///
+/// Functor that computes "greater or equal than" between two values.
+
+# include <mln/core/concept/function.hh>
+# include <mln/trait/op/and.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace vv2b
+ {
+
+ /// Functor computing "greater or equal than" between two values.
+ template <typename L, typename R = L>
+ struct ge : public Function_vv2b< ge<L,R> >
+ {
+ bool operator()(const L& v1, const R& v2) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L, typename R>
+ inline
+ bool
+ ge<L,R>::operator()(const L& v1, const R& v2) const
+ {
+ return v1 >= v2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::vv2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_VV2B_GE_HH
Index: trunk/milena/mln/fun/vv2b/lt.hh
===================================================================
--- trunk/milena/mln/fun/vv2b/lt.hh (revision 0)
+++ trunk/milena/mln/fun/vv2b/lt.hh (revision 3039)
@@ -0,0 +1,75 @@
+// 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_FUN_VV2B_LT_HH
+# define MLN_FUN_VV2B_LT_HH
+
+/// \file mln/fun/vv2b/lt.hh
+///
+/// Functor that computes "lower than" between two values.
+
+# include <mln/core/concept/function.hh>
+# include <mln/trait/op/and.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace vv2b
+ {
+
+ /// Functor computing "lower than" between two values.
+ template <typename L, typename R = L>
+ struct lt : public Function_vv2b< lt<L,R> >
+ {
+ bool operator()(const L& v1, const R& v2) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L, typename R>
+ inline
+ bool
+ lt<L,R>::operator()(const L& v1, const R& v2) const
+ {
+ return v1 < v2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::vv2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_VV2B_LT_HH
Index: trunk/milena/mln/fun/vv2b/le.hh
===================================================================
--- trunk/milena/mln/fun/vv2b/le.hh (revision 0)
+++ trunk/milena/mln/fun/vv2b/le.hh (revision 3039)
@@ -0,0 +1,75 @@
+// 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_FUN_VV2B_LE_HH
+# define MLN_FUN_VV2B_LE_HH
+
+/// \file mln/fun/vv2b/le.hh
+///
+/// Functor that computes "lower or equal than" between two values.
+
+# include <mln/core/concept/function.hh>
+# include <mln/trait/op/and.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace vv2b
+ {
+
+ /// Functor computing "lower or equal than" between two values.
+ template <typename L, typename R = L>
+ struct le : public Function_vv2b< le<L,R> >
+ {
+ bool operator()(const L& v1, const R& v2) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L, typename R>
+ inline
+ bool
+ le<L,R>::operator()(const L& v1, const R& v2) const
+ {
+ return v1 <= v2;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::vv2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_VV2B_LE_HH
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2008-12-12 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add a pseudo report of a discution with theo on my seminar.
* garrigues/union_find/reunion_avec_theo: New.
---
reunion_avec_theo | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
Index: trunk/milena/sandbox/garrigues/union_find/reunion_avec_theo
===================================================================
--- trunk/milena/sandbox/garrigues/union_find/reunion_avec_theo (revision 0)
+++ trunk/milena/sandbox/garrigues/union_find/reunion_avec_theo (revision 3035)
@@ -0,0 +1,24 @@
+Verifier les resultats bizarres.
+
+1/ Ajouter le test d'inclusion pour les reconstruction_on_set
+ -> regarder si level compare utilise test/predicate
+ -> sinon le faire, et fastestiser test/predicate
+ -> level compare specialisation pour les boolean? test d'implication??
+
+Comment Specialiser les canvas pour les images fastest?
+Rendre le canvas indépedant de la gestion du bord.
+Faire passer les initialisation du bord au canvas
+
+Attention! les initialisation des images doivent savoir
+si on est fast ou pas.
+
+
+
+* Pour les opérateur auto duaux
+
+Coder la reconstruction auto duale (Rapide).
+
+Un peu plus chaud: les deux autres opérateur du papier (some levelings et
+inf-semilatice approach).
+Difficultée: comment coder le canvas sachant qu'on doit pouvoir paser un op
+(et son dual aussi car l'algo a besoin des deux).