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
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
New ESIEE stuff.
* theo/esiee/slides_2009_may: New.
* theo/esiee/slides_2009_may/dilation.hh: New.
* theo/esiee/slides_2009_may/main.cc: New.
* theo/esiee/laurent/ismm09/extinct_attributes.hh: New.
* theo/esiee/laurent/ismm09/main.ext.cc: New.
laurent/ismm09/extinct_attributes.hh | 136 +++++++++++++++++++++++++++++++++++
laurent/ismm09/main.ext.cc | 76 +++++++++++++++++++
slides_2009_may/dilation.hh | 70 ++++++++++++++++++
slides_2009_may/main.cc | 31 +++++++
4 files changed, 313 insertions(+)
Index: theo/esiee/slides_2009_may/dilation.hh
--- theo/esiee/slides_2009_may/dilation.hh (revision 0)
+++ theo/esiee/slides_2009_may/dilation.hh (revision 0)
@@ -0,0 +1,70 @@
+
+#include <mln/pw/image.hh>
+#include <mln/convert/to_fun.hh>
+#include <mln/accu/max.hh>
+
+
+namespace mln
+{
+
+ // To be added in mln/pw/image.hh
+
+ template <typename V, typename P, typename S>
+ pw::image< fun::C<V(*)(P)>, S >
+ operator | (V (*f)(P), const S& s)
+ {
+ return convert::to_fun(f) | s;
+ }
+
+
+// namespace accu
+// {
+// template <typename T> struct sup : max<T> {};
+// }
+
+
+ namespace accu
+ {
+ template <typename T>
+ struct sup : public accu::internal::base< T, sup<T> >
+ {
+ typedef T argument;
+ T t_;
+
+ void init() { t_ = mln_min(T); }
+ void take(const T& t) { if (t > t_) t_ = t; }
+ void take(const sup& o) { if (o.t_ > t_) t_ = o.t_; }
+ T to_result() const { return t_; }
+ bool is_valid() const { return true; }
+ };
+
+ } // mln::accu
+
+
+ namespace morpho
+ {
+
+ template <typename I, typename W>
+ mln_concrete(I) dilation(const I& ima, const W& win)
+ {
+ mln_concrete(I) out;
+ initialize(out, ima);
+
+ mln_piter(I) p(ima.domain());
+ mln_qiter(W) q(win, p);
+ accu::sup<mln_value(I)> sup;
+
+ for_all(p)
+ {
+ sup.init();
+ for_all(q) if (ima.has(q))
+ sup.take(ima(q));
+ out(p) = sup;
+ }
+
+ return out;
+ }
+
+ } // mln::morpho
+
+} // mln
Index: theo/esiee/slides_2009_may/main.cc
--- theo/esiee/slides_2009_may/main.cc (revision 0)
+++ theo/esiee/slides_2009_may/main.cc (revision 0)
@@ -0,0 +1,31 @@
+#include <mln/core/var.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+
+#include "dilation.hh"
+
+
+
+int slope(mln::point2d p)
+{
+ return p.row() + p.col();
+}
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(2,2);
+ debug::iota(ima);
+ debug::println(ima);
+
+ debug::println(morpho::dilation(ima,
+ win_c4p()) );
+
+ mln_VAR(ima2, slope | box2d(3,3));
+ debug::println(ima2);
+ debug::println(morpho::dilation(ima2, c4().win()) );
+}
Index: theo/esiee/laurent/ismm09/extinct_attributes.hh
--- theo/esiee/laurent/ismm09/extinct_attributes.hh (revision 0)
+++ theo/esiee/laurent/ismm09/extinct_attributes.hh (revision 0)
@@ -0,0 +1,136 @@
+
+namespace mln
+{
+
+ // Display.
+ // --------
+
+
+ template <typename T, typename I>
+ void display_tree_attributes(const T& t, // Tree.
+ const I& a) // Attribute image.
+ {
+ typedef mln_site(I) P;
+
+ mln_ch_value(I, bool) deja_vu;
+ initialize(deja_vu, a);
+ data::fill(deja_vu, false);
+
+ mln_up_node_piter(T) p(t);
+ for_all(p)
+ {
+ if (deja_vu(p))
+ continue;
+
+ P e = p;
+ do
+ {
+ std::cout << a(e) << ':' << e << " -> ";
+ deja_vu(e) = true;
+ e = t.parent(e);
+ }
+ while (! deja_vu(e));
+ std::cout << a(e) << ':' << e << std::endl;
+ }
+ std::cout << std::endl;
+ }
+
+
+ // Attribute Extinction.
+ // ---------------------
+
+ namespace internal
+ {
+
+ template <typename T>
+ struct node_pred : Function_p2b< node_pred<T> >
+ {
+ typedef bool result;
+
+ template <typename P>
+ bool operator()(const P& p) const
+ {
+ return t->is_a_node(p);
+ }
+
+ const T* t;
+ };
+
+
+ // Vachier's version.
+
+ template <typename T, typename I, typename M>
+ inline
+ mln_value(I)
+ extinct_rec(const T& t, // tree
+ I& a, // attribute image
+ M& mark,
+ const mln_psite(I)& p)
+ {
+ mln_invariant(mark(p) == false);
+ mark(p) = true;
+ if (t.parent(p) == p || mark(t.parent(p)) == true) // Stop.
+ return a(p);
+ return a(p) = extinct_rec(t, a, mark, t.parent(p));
+ }
+
+
+ } // end of internal
+
+
+ // Vachier's version.
+
+ template <typename T, typename I>
+ void
+ extinct_attributes(const T& t, // Tree.
+ I& a, // Attribute image.
+ bool echo = false)
+ {
+ if (echo)
+ {
+ std::cout << "before:" << std::endl;
+ display_tree_attributes(t, a);
+ }
+
+ typedef mln_site(I) P;
+ typedef mln_value(I) A; // Type of attributes.
+
+ mln_ch_value(I, bool) mark;
+ initialize(mark, a);
+ data::fill(mark, false);
+
+ internal::node_pred<T> node_only;
+ node_only.t = &t;
+
+ typedef p_array<P> S;
+ S s = level::sort_psites_increasing(a | node_only);
+
+// {
+// mln_fwd_piter(S) p(s);
+// for_all(p)
+// std::cout << p << ' ' << a(p) << " - ";
+// std::cout << std::endl
+// << std::endl;
+// }
+
+ mln_invariant(geom::nsites(a | t.nodes()) == s.nsites());
+
+ mln_fwd_piter(S) p(s);
+ for_all(p)
+ {
+ if (mark(p) == true)
+ continue;
+ internal::extinct_rec(t, a, mark, p);
+ }
+
+ // debug::println(mark | t.nodes());
+
+ if (echo)
+ {
+ std::cout << "after:" << std::endl;
+ display_tree_attributes(t, a);
+ }
+ }
+
+
+} // mln
Index: theo/esiee/laurent/ismm09/main.ext.cc
--- theo/esiee/laurent/ismm09/main.ext.cc (revision 0)
+++ theo/esiee/laurent/ismm09/main.ext.cc (revision 0)
@@ -0,0 +1,76 @@
+
+#include <mln/core/var.hh>
+
+#include <mln/value/label_16.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/debug/println.hh>
+
+#include <mln/morpho/tree/data.hh>
+#include <mln/morpho/tree/compute_attribute_image.hh>
+#include <mln/morpho/attribute/height.hh>
+#include <mln/labeling/regional_minima.hh>
+
+#include "cplx2d.hh"
+#include "extinct_attributes.hh"
+
+
+
+
+void usage(char* argv[])
+{
+ std::cerr << "usage: " << argv[0] << " input.pgm" << std::endl;
+ std::cerr << "Laurent ISMM 2009 scheme." << std::endl;
+ abort();
+}
+
+
+
+
+int main(int argc, char* argv[])
+{
+ using namespace mln;
+ using value::int_u8;
+ using value::label_16;
+
+ if (argc != 2)
+ usage(argv);
+
+ // f: regular image.
+
+ image2d<int_u8> f;
+ io::pgm::load(f, argv[1]);
+
+
+ // g: weights on edges.
+
+ mln_VAR(g, cplx2d::f_to_g(f) );
+ debug::println("g:", g);
+
+
+ // a: array "label -> attribute".
+
+ typedef unsigned A; // <--- Type of attributes.
+
+ {
+ typedef p_array<point2d> s_t;
+ s_t s = level::sort_psites_decreasing(g); // min-tree
+
+ typedef morpho::tree::data<g_t,s_t> tree_t;
+ tree_t t(g, s, cplx2d::e2e());
+
+ morpho::attribute::height<g_t> a;
+ mln_VAR(h, morpho::tree::compute_attribute_image(a, t));
+ debug::println("h:", h);
+
+ unsigned l_max;
+
+ mln_VAR(h_r, labeling::regional_minima(h, cplx2d::e2e(), l_max));
+ debug::println("h_r:", h_r);
+
+ extinct_attributes(t, h, /* echo = */ true);
+ debug::println("he | nodes:", h | t.nodes());
+ }
+
+}
1
0
* theo/esiee/slides_2009_may: New.
* theo/esiee/slides_2009_may/dilation.hh: New.
* theo/esiee/slides_2009_may/main.cc: New.
* theo/esiee/laurent/ismm09/extinct_attributes.hh: New.
* theo/esiee/laurent/ismm09/main.ext.cc: New.
---
milena/sandbox/ChangeLog | 10 ++
.../esiee/laurent/ismm09/extinct_attributes.hh | 136 ++++++++++++++++++++
.../sandbox/theo/esiee/laurent/ismm09/main.ext.cc | 76 +++++++++++
.../sandbox/theo/esiee/slides_2009_may/dilation.hh | 70 ++++++++++
milena/sandbox/theo/esiee/slides_2009_may/main.cc | 31 +++++
5 files changed, 323 insertions(+), 0 deletions(-)
create mode 100644 milena/sandbox/theo/esiee/laurent/ismm09/extinct_attributes.hh
create mode 100644 milena/sandbox/theo/esiee/laurent/ismm09/main.ext.cc
create mode 100644 milena/sandbox/theo/esiee/slides_2009_may/dilation.hh
create mode 100644 milena/sandbox/theo/esiee/slides_2009_may/main.cc
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 123d1e0..0e9423a 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,13 @@
+2009-05-06 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
+
+ New ESIEE stuff.
+
+ * theo/esiee/slides_2009_may: New.
+ * theo/esiee/slides_2009_may/dilation.hh: New.
+ * theo/esiee/slides_2009_may/main.cc: New.
+ * theo/esiee/laurent/ismm09/extinct_attributes.hh: New.
+ * theo/esiee/laurent/ismm09/main.ext.cc: New.
+
2009-05-05 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add a file to test exprs like ''pw::value(ima) < 3''.
diff --git a/milena/sandbox/theo/esiee/laurent/ismm09/extinct_attributes.hh b/milena/sandbox/theo/esiee/laurent/ismm09/extinct_attributes.hh
new file mode 100644
index 0000000..2190ec2
--- /dev/null
+++ b/milena/sandbox/theo/esiee/laurent/ismm09/extinct_attributes.hh
@@ -0,0 +1,136 @@
+
+namespace mln
+{
+
+ // Display.
+ // --------
+
+
+ template <typename T, typename I>
+ void display_tree_attributes(const T& t, // Tree.
+ const I& a) // Attribute image.
+ {
+ typedef mln_site(I) P;
+
+ mln_ch_value(I, bool) deja_vu;
+ initialize(deja_vu, a);
+ data::fill(deja_vu, false);
+
+ mln_up_node_piter(T) p(t);
+ for_all(p)
+ {
+ if (deja_vu(p))
+ continue;
+
+ P e = p;
+ do
+ {
+ std::cout << a(e) << ':' << e << " -> ";
+ deja_vu(e) = true;
+ e = t.parent(e);
+ }
+ while (! deja_vu(e));
+ std::cout << a(e) << ':' << e << std::endl;
+ }
+ std::cout << std::endl;
+ }
+
+
+ // Attribute Extinction.
+ // ---------------------
+
+ namespace internal
+ {
+
+ template <typename T>
+ struct node_pred : Function_p2b< node_pred<T> >
+ {
+ typedef bool result;
+
+ template <typename P>
+ bool operator()(const P& p) const
+ {
+ return t->is_a_node(p);
+ }
+
+ const T* t;
+ };
+
+
+ // Vachier's version.
+
+ template <typename T, typename I, typename M>
+ inline
+ mln_value(I)
+ extinct_rec(const T& t, // tree
+ I& a, // attribute image
+ M& mark,
+ const mln_psite(I)& p)
+ {
+ mln_invariant(mark(p) == false);
+ mark(p) = true;
+ if (t.parent(p) == p || mark(t.parent(p)) == true) // Stop.
+ return a(p);
+ return a(p) = extinct_rec(t, a, mark, t.parent(p));
+ }
+
+
+ } // end of internal
+
+
+ // Vachier's version.
+
+ template <typename T, typename I>
+ void
+ extinct_attributes(const T& t, // Tree.
+ I& a, // Attribute image.
+ bool echo = false)
+ {
+ if (echo)
+ {
+ std::cout << "before:" << std::endl;
+ display_tree_attributes(t, a);
+ }
+
+ typedef mln_site(I) P;
+ typedef mln_value(I) A; // Type of attributes.
+
+ mln_ch_value(I, bool) mark;
+ initialize(mark, a);
+ data::fill(mark, false);
+
+ internal::node_pred<T> node_only;
+ node_only.t = &t;
+
+ typedef p_array<P> S;
+ S s = level::sort_psites_increasing(a | node_only);
+
+// {
+// mln_fwd_piter(S) p(s);
+// for_all(p)
+// std::cout << p << ' ' << a(p) << " - ";
+// std::cout << std::endl
+// << std::endl;
+// }
+
+ mln_invariant(geom::nsites(a | t.nodes()) == s.nsites());
+
+ mln_fwd_piter(S) p(s);
+ for_all(p)
+ {
+ if (mark(p) == true)
+ continue;
+ internal::extinct_rec(t, a, mark, p);
+ }
+
+ // debug::println(mark | t.nodes());
+
+ if (echo)
+ {
+ std::cout << "after:" << std::endl;
+ display_tree_attributes(t, a);
+ }
+ }
+
+
+} // mln
diff --git a/milena/sandbox/theo/esiee/laurent/ismm09/main.ext.cc b/milena/sandbox/theo/esiee/laurent/ismm09/main.ext.cc
new file mode 100644
index 0000000..3f223d8
--- /dev/null
+++ b/milena/sandbox/theo/esiee/laurent/ismm09/main.ext.cc
@@ -0,0 +1,76 @@
+
+#include <mln/core/var.hh>
+
+#include <mln/value/label_16.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/debug/println.hh>
+
+#include <mln/morpho/tree/data.hh>
+#include <mln/morpho/tree/compute_attribute_image.hh>
+#include <mln/morpho/attribute/height.hh>
+#include <mln/labeling/regional_minima.hh>
+
+#include "cplx2d.hh"
+#include "extinct_attributes.hh"
+
+
+
+
+void usage(char* argv[])
+{
+ std::cerr << "usage: " << argv[0] << " input.pgm" << std::endl;
+ std::cerr << "Laurent ISMM 2009 scheme." << std::endl;
+ abort();
+}
+
+
+
+
+int main(int argc, char* argv[])
+{
+ using namespace mln;
+ using value::int_u8;
+ using value::label_16;
+
+ if (argc != 2)
+ usage(argv);
+
+ // f: regular image.
+
+ image2d<int_u8> f;
+ io::pgm::load(f, argv[1]);
+
+
+ // g: weights on edges.
+
+ mln_VAR(g, cplx2d::f_to_g(f) );
+ debug::println("g:", g);
+
+
+ // a: array "label -> attribute".
+
+ typedef unsigned A; // <--- Type of attributes.
+
+ {
+ typedef p_array<point2d> s_t;
+ s_t s = level::sort_psites_decreasing(g); // min-tree
+
+ typedef morpho::tree::data<g_t,s_t> tree_t;
+ tree_t t(g, s, cplx2d::e2e());
+
+ morpho::attribute::height<g_t> a;
+ mln_VAR(h, morpho::tree::compute_attribute_image(a, t));
+ debug::println("h:", h);
+
+ unsigned l_max;
+
+ mln_VAR(h_r, labeling::regional_minima(h, cplx2d::e2e(), l_max));
+ debug::println("h_r:", h_r);
+
+ extinct_attributes(t, h, /* echo = */ true);
+ debug::println("he | nodes:", h | t.nodes());
+ }
+
+}
diff --git a/milena/sandbox/theo/esiee/slides_2009_may/dilation.hh b/milena/sandbox/theo/esiee/slides_2009_may/dilation.hh
new file mode 100644
index 0000000..2d0be82
--- /dev/null
+++ b/milena/sandbox/theo/esiee/slides_2009_may/dilation.hh
@@ -0,0 +1,70 @@
+
+#include <mln/pw/image.hh>
+#include <mln/convert/to_fun.hh>
+#include <mln/accu/max.hh>
+
+
+namespace mln
+{
+
+ // To be added in mln/pw/image.hh
+
+ template <typename V, typename P, typename S>
+ pw::image< fun::C<V(*)(P)>, S >
+ operator | (V (*f)(P), const S& s)
+ {
+ return convert::to_fun(f) | s;
+ }
+
+
+// namespace accu
+// {
+// template <typename T> struct sup : max<T> {};
+// }
+
+
+ namespace accu
+ {
+ template <typename T>
+ struct sup : public accu::internal::base< T, sup<T> >
+ {
+ typedef T argument;
+ T t_;
+
+ void init() { t_ = mln_min(T); }
+ void take(const T& t) { if (t > t_) t_ = t; }
+ void take(const sup& o) { if (o.t_ > t_) t_ = o.t_; }
+ T to_result() const { return t_; }
+ bool is_valid() const { return true; }
+ };
+
+ } // mln::accu
+
+
+ namespace morpho
+ {
+
+ template <typename I, typename W>
+ mln_concrete(I) dilation(const I& ima, const W& win)
+ {
+ mln_concrete(I) out;
+ initialize(out, ima);
+
+ mln_piter(I) p(ima.domain());
+ mln_qiter(W) q(win, p);
+ accu::sup<mln_value(I)> sup;
+
+ for_all(p)
+ {
+ sup.init();
+ for_all(q) if (ima.has(q))
+ sup.take(ima(q));
+ out(p) = sup;
+ }
+
+ return out;
+ }
+
+ } // mln::morpho
+
+} // mln
diff --git a/milena/sandbox/theo/esiee/slides_2009_may/main.cc b/milena/sandbox/theo/esiee/slides_2009_may/main.cc
new file mode 100644
index 0000000..ebb9074
--- /dev/null
+++ b/milena/sandbox/theo/esiee/slides_2009_may/main.cc
@@ -0,0 +1,31 @@
+#include <mln/core/var.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+
+#include "dilation.hh"
+
+
+
+int slope(mln::point2d p)
+{
+ return p.row() + p.col();
+}
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(2,2);
+ debug::iota(ima);
+ debug::println(ima);
+
+ debug::println(morpho::dilation(ima,
+ win_c4p()) );
+
+ mln_VAR(ima2, slope | box2d(3,3));
+ debug::println(ima2);
+ debug::println(morpho::dilation(ima2, c4().win()) );
+}
--
1.6.1.2
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-05-06 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add I/O tests.
* tests/io/Makefile.am: Update for dicom and IM.
* tests/io/dicom/Makefile.am: New Makefile for dicom.
* tests/io/dicom/dicom.cc: New test.
* tests/io/magick/Makefile.am: New Makefile for IM.
* tests/io/magick/magick.cc: New test.
---
Makefile.am | 2 +
dicom/Makefile.am | 10 ++++++++
dicom/dicom.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++
magick/Makefile.am | 10 ++++++++
magick/magick.cc | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 132 insertions(+)
Index: trunk/milena/tests/io/Makefile.am
===================================================================
--- trunk/milena/tests/io/Makefile.am (revision 3764)
+++ trunk/milena/tests/io/Makefile.am (revision 3765)
@@ -3,8 +3,10 @@
include $(top_srcdir)/milena/tests/tests.mk
SUBDIRS = \
+ dicom \
dump \
fits \
+ magick \
off \
pbm \
pfm \
Index: trunk/milena/tests/io/dicom/dicom.cc
===================================================================
--- trunk/milena/tests/io/dicom/dicom.cc (revision 0)
+++ trunk/milena/tests/io/dicom/dicom.cc (revision 3765)
@@ -0,0 +1,50 @@
+// Copyright (C) 2009 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/io/dicom/dicom.cc
+///
+/// Test on mln::io::dicom::*.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/dicom/load.hh>
+#include <mln/io/dump/save.hh>
+
+#include <mln/level/compare.hh>
+
+#include <mln/value/int_u12.hh>
+
+#include "tests/data.hh"
+
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ return 0;
+}
+
Index: trunk/milena/tests/io/dicom/Makefile.am
===================================================================
--- trunk/milena/tests/io/dicom/Makefile.am (revision 0)
+++ trunk/milena/tests/io/dicom/Makefile.am (revision 3765)
@@ -0,0 +1,10 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ dicom
+
+dicom_SOURCES = dicom.cc
+
+TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/io/magick/magick.cc
===================================================================
--- trunk/milena/tests/io/magick/magick.cc (revision 0)
+++ trunk/milena/tests/io/magick/magick.cc (revision 3765)
@@ -0,0 +1,60 @@
+// Copyright (C) 2009 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/io/magick/magick.cc
+///
+/// Test on mln::io::magick::*.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/magick/load.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/level/compare.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/rgb8.hh>
+
+#include "tests/data.hh"
+
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ {
+ image2d<value::rgb8> lena_im;
+ io::magick::load(lena_im, "lena.png");
+
+ image2d<value::rgb8> lena_mln;
+ io::ppm::load(lena_mln, "lena.ppm");
+
+ mln_assertion(lena_im.domain() == lena_mln.domain());
+ mln_assertion(lena_im == lena_mln);
+ }
+}
+
Index: trunk/milena/tests/io/magick/Makefile.am
===================================================================
--- trunk/milena/tests/io/magick/Makefile.am (revision 0)
+++ trunk/milena/tests/io/magick/Makefile.am (revision 3765)
@@ -0,0 +1,10 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ magick
+
+magick_SOURCES = magick.cc
+
+TESTS = $(check_PROGRAMS)
1
0
* tests/io/Makefile.am: Update for dicom and IM.
* tests/io/dicom/Makefile.am: New Makefile for dicom.
* tests/io/dicom/dicom.cc: New test.
* tests/io/magick/Makefile.am: New Makefile for IM.
* tests/io/magick/magick.cc: New test.
---
milena/ChangeLog | 9 +++++
milena/tests/io/Makefile.am | 2 +
milena/tests/io/dicom/Makefile.am | 10 ++++++
milena/tests/io/dicom/dicom.cc | 50 ++++++++++++++++++++++++++++++
milena/tests/io/magick/Makefile.am | 10 ++++++
milena/tests/io/magick/magick.cc | 60 ++++++++++++++++++++++++++++++++++++
6 files changed, 141 insertions(+), 0 deletions(-)
create mode 100644 milena/tests/io/dicom/Makefile.am
create mode 100644 milena/tests/io/dicom/dicom.cc
create mode 100644 milena/tests/io/magick/Makefile.am
create mode 100644 milena/tests/io/magick/magick.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index ff6c707..a8a37ed 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,12 @@
+2009-05-06 Fabien Freling <fabien.freling(a)lrde.epita.fr>
+
+ Add I/O tests.
+ * tests/io/Makefile.am: Update for dicom and IM.
+ * tests/io/dicom/Makefile.am: New Makefile for dicom.
+ * tests/io/dicom/dicom.cc: New test.
+ * tests/io/magick/Makefile.am: New Makefile for IM.
+ * tests/io/magick/magick.cc: New test.
+
2009-05-06 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
Add adjacency matrix.
diff --git a/milena/tests/io/Makefile.am b/milena/tests/io/Makefile.am
index cc4a0f8..760d591 100644
--- a/milena/tests/io/Makefile.am
+++ b/milena/tests/io/Makefile.am
@@ -3,8 +3,10 @@
include $(top_srcdir)/milena/tests/tests.mk
SUBDIRS = \
+ dicom \
dump \
fits \
+ magick \
off \
pbm \
pfm \
diff --git a/milena/tests/io/dicom/Makefile.am b/milena/tests/io/dicom/Makefile.am
new file mode 100644
index 0000000..07646c8
--- /dev/null
+++ b/milena/tests/io/dicom/Makefile.am
@@ -0,0 +1,10 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ dicom
+
+dicom_SOURCES = dicom.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/io/dicom/dicom.cc b/milena/tests/io/dicom/dicom.cc
new file mode 100644
index 0000000..ada15f8
--- /dev/null
+++ b/milena/tests/io/dicom/dicom.cc
@@ -0,0 +1,50 @@
+// Copyright (C) 2009 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/io/dicom/dicom.cc
+///
+/// Test on mln::io::dicom::*.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/dicom/load.hh>
+#include <mln/io/dump/save.hh>
+
+#include <mln/level/compare.hh>
+
+#include <mln/value/int_u12.hh>
+
+#include "tests/data.hh"
+
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ return 0;
+}
+
diff --git a/milena/tests/io/magick/Makefile.am b/milena/tests/io/magick/Makefile.am
new file mode 100644
index 0000000..1c7308d
--- /dev/null
+++ b/milena/tests/io/magick/Makefile.am
@@ -0,0 +1,10 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ magick
+
+magick_SOURCES = magick.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/io/magick/magick.cc b/milena/tests/io/magick/magick.cc
new file mode 100644
index 0000000..d6145fc
--- /dev/null
+++ b/milena/tests/io/magick/magick.cc
@@ -0,0 +1,60 @@
+// Copyright (C) 2009 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/io/magick/magick.cc
+///
+/// Test on mln::io::magick::*.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/magick/load.hh>
+#include <mln/io/ppm/save.hh>
+
+#include <mln/level/compare.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/rgb8.hh>
+
+#include "tests/data.hh"
+
+#include <mln/debug/println.hh>
+
+int main()
+{
+ using namespace mln;
+
+ {
+ image2d<value::rgb8> lena_im;
+ io::magick::load(lena_im, "lena.png");
+
+ image2d<value::rgb8> lena_mln;
+ io::ppm::load(lena_mln, "lena.ppm");
+
+ mln_assertion(lena_im.domain() == lena_mln.domain());
+ mln_assertion(lena_im == lena_mln);
+ }
+}
+
--
1.6.1.2
1
0
---
AUTHORS | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ChangeLog | 4 +
2 files changed, 245 insertions(+), 0 deletions(-)
create mode 100644 AUTHORS
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..c165b77
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,241 @@
+The Olena Group consists of
+
+===============
+Permanent staff
+===============
+
+* Thierry Geraud thierry.geraud(a)lrde.epita.fr
+ - Management of the project in the first place
+ - Type system
+ - Revamp of Metalic (Olena 1.0)
+ - SCOOP, SCOOP 2, Static (Olena proto-1.0, Olena 1.0)
+ - Extended (Olena 1.0)
+ - Numerous hours spent thinking about Olena
+
+* Roland Levillain roland.levillain(a)lrde.epita.fr
+ - Project manager,
+ - Theoritical mentor
+ - Renovation of Swilena (Olena 0.10a),
+ - G++ 4.0 and 4.1 compatibility (Olena 0.10a),
+ - Integration of GNU Libtool (Olena 0.10a),
+ - SCOOP 2 and Static (Olena 1.0).
+
+
+
+===============
+Temporary staff
+===============
+
+* Yann Régis-Gianas
+ - type system.
+
+* Yoann Fabre
+ - type system.
+
+* Vincent Berruchon
+
+* Simon Odou
+ - contributions to document the code,
+ - deconvolution,
+ - generic morphers,
+ - SCOOP 2 (Olena proto-1.0).
+
+* Sylvain Berlemont
+ - combinatorial maps,
+ - cleanup the sources.
+
+* Alexandre Duret-Lutz
+ - maintenance of the source tree for several years,
+ - type system,
+ - test system,
+ - first documentation system,
+ - numerous hours spent on Olena to make it better.
+
+* Réda Dehak
+ - management of the project,
+ - color conversions,
+ - cleanup the sources.
+
+* Akim Demaille
+ - configuration system.
+ - maintenance of code's clearness.
+
+* Anthony Pinagot
+ - Olena I/O,
+ - statistical operators,
+ - FFT algorithm.
+
+* Astrid Wang
+ - new documentation system,
+ - static arrays implementation.
+
+* David Lesage
+ - type system,
+ - new paradigm,
+ - cleanup the sources.
+
+* Dimitri Papadopoulos-Orfanos
+ - type system
+
+* Emmanuel Turquin
+ - implementation of transforms,
+ - integre.
+
+* Giovanni Palma
+ - color conversion,
+ - attribute opening and closing algorithms,
+ - new documentation system,
+ - document the code,
+ - cleanup the sources.
+
+* Heru Xue
+ - color system.
+
+* Ignacy Gawedzki
+ - color system.
+
+* Jean Chalard
+ - colors,
+ - vectors and matrices implementation,
+ - Olena iterators implementation,
+ - wavelets.
+
+* Jean-Sébastien Mouret
+ - image I/O,
+ - source tree and configuration system,
+ - fast morphological operators.
+
+* Jérôme Darbon
+ - image morphology and Olena morpho.
+
+* Ludovic Perrine
+ - fuzzy types.
+
+* Michaël Strauss
+ - image morphology,
+ - watershed algorithms,
+ - Olena I/O.
+
+* Niels Van Vliet
+ - color conversion,
+ - attribute opening and closing algorithms,
+ - contributions to document the code,
+ - histograms.
+
+* Pierre-Yves Strub
+ - Olena morpho,
+ - source tree and configuration system,
+ - type system.
+
+* Quôc Peyrot
+ - watershed algorithm.
+
+* Rémi Coupet
+ - Olena morpho,
+ - data types (pre-0.6),
+ - Olena core,
+ - bibliographical research.
+
+* Renaud François
+ - bibliographical research.
+
+* Fabien Freling fabien.freling(a)lrde.epita.fr
+ - Work on Melimage with IGR.
+ - Library improvements.
+
+* Guillaume Lazzara
+ - Work on Scribo
+ - Library improvements.
+
+
+==================
+Year 2003 students
+==================
+
+* Raphaël Poss
+ - source tree and configuration system,
+ - documentation.
+
+
+==================
+Year 2004 students
+==================
+
+* Nicolas Burrus
+ - integre,
+ - Olena I/O,
+ - source tree.
+
+
+==================
+Year 2006 students
+==================
+
+* Nicolas Pouillard
+ - Dynamic? (Dyn) (Olena proto-1.0).
+
+* Damien Thivolle
+ - contributions to document the code,
+ - generic morphers,
+ - configuration system,
+ - shapelets transform,
+ - G++ 4.0 compatibility (Olena 0.10a),
+ - canvas for algorithms (Olena proto-1.0),
+ - SCOOP 2 (Olena proto-1.0),
+ - Dynamic? (Dyn) (Olena proto-1.0).
+
+
+==================
+Year 2007 students
+==================
+
+* Christophe Berger
+ - connected filters (Olena proto-1.0, Olena 1.0),
+ - SCOOP 2 (Olena proto-1.0).
+
+* Nicolas Widynski
+ - connected filters (Olena proto-1.0),
+ - inpainting (Olena proto-1.0),
+ - segmentation (watershed transform, watersnake, snakes) (Olena proto-1.0)
+
+
+==================
+Year 2008 students
+==================
+
+* Tristan Croiset
+ - Dynamic (Dyn) (Olena proto-1.0)
+
+* Quentin Hocquet
+ - SCOOL? (Olena 1.0).
+
+* Thomas Moulard
+ - Scool (Olena 1.0)
+
+==================
+Year 2009 students
+==================
+
+* Alexandre Abraham alexandre.abraham(a)lrde.epita.fr
+
+* Nicolas Ballas nicolas.ballas(a)lrde.epita.fr
+
+* Matthieu Garrigues matthieu.garrigues(a)lrde.epita.fr
+
+* Ugo Jardonnet ugo.jardonnet(a)lrde.epita.fr
+
+
+==================
+Year 2010 students
+==================
+
+* Etienne Folio etienne.folio(a)lrde.epita.fr
+
+
+==================
+Year 2011 students
+==================
+
+* Frederic Bour frederic.bour(a)lrde.epita.fr
+* Edwin Carlinet edwin.carlinet(a)lrde.epita.fr
+
diff --git a/ChangeLog b/ChangeLog
index d32d1c1..faa0325 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-06 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ * AUTHORS: First draft.
+
2009-05-05 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
* configure.ac: Configure tests/world/*
--
1.5.6.5
1
0
---
AUTHORS | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ChangeLog | 4 +
2 files changed, 245 insertions(+), 0 deletions(-)
create mode 100644 AUTHORS
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..c165b77
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,241 @@
+The Olena Group consists of
+
+===============
+Permanent staff
+===============
+
+* Thierry Geraud thierry.geraud(a)lrde.epita.fr
+ - Management of the project in the first place
+ - Type system
+ - Revamp of Metalic (Olena 1.0)
+ - SCOOP, SCOOP 2, Static (Olena proto-1.0, Olena 1.0)
+ - Extended (Olena 1.0)
+ - Numerous hours spent thinking about Olena
+
+* Roland Levillain roland.levillain(a)lrde.epita.fr
+ - Project manager,
+ - Theoritical mentor
+ - Renovation of Swilena (Olena 0.10a),
+ - G++ 4.0 and 4.1 compatibility (Olena 0.10a),
+ - Integration of GNU Libtool (Olena 0.10a),
+ - SCOOP 2 and Static (Olena 1.0).
+
+
+
+===============
+Temporary staff
+===============
+
+* Yann Régis-Gianas
+ - type system.
+
+* Yoann Fabre
+ - type system.
+
+* Vincent Berruchon
+
+* Simon Odou
+ - contributions to document the code,
+ - deconvolution,
+ - generic morphers,
+ - SCOOP 2 (Olena proto-1.0).
+
+* Sylvain Berlemont
+ - combinatorial maps,
+ - cleanup the sources.
+
+* Alexandre Duret-Lutz
+ - maintenance of the source tree for several years,
+ - type system,
+ - test system,
+ - first documentation system,
+ - numerous hours spent on Olena to make it better.
+
+* Réda Dehak
+ - management of the project,
+ - color conversions,
+ - cleanup the sources.
+
+* Akim Demaille
+ - configuration system.
+ - maintenance of code's clearness.
+
+* Anthony Pinagot
+ - Olena I/O,
+ - statistical operators,
+ - FFT algorithm.
+
+* Astrid Wang
+ - new documentation system,
+ - static arrays implementation.
+
+* David Lesage
+ - type system,
+ - new paradigm,
+ - cleanup the sources.
+
+* Dimitri Papadopoulos-Orfanos
+ - type system
+
+* Emmanuel Turquin
+ - implementation of transforms,
+ - integre.
+
+* Giovanni Palma
+ - color conversion,
+ - attribute opening and closing algorithms,
+ - new documentation system,
+ - document the code,
+ - cleanup the sources.
+
+* Heru Xue
+ - color system.
+
+* Ignacy Gawedzki
+ - color system.
+
+* Jean Chalard
+ - colors,
+ - vectors and matrices implementation,
+ - Olena iterators implementation,
+ - wavelets.
+
+* Jean-Sébastien Mouret
+ - image I/O,
+ - source tree and configuration system,
+ - fast morphological operators.
+
+* Jérôme Darbon
+ - image morphology and Olena morpho.
+
+* Ludovic Perrine
+ - fuzzy types.
+
+* Michaël Strauss
+ - image morphology,
+ - watershed algorithms,
+ - Olena I/O.
+
+* Niels Van Vliet
+ - color conversion,
+ - attribute opening and closing algorithms,
+ - contributions to document the code,
+ - histograms.
+
+* Pierre-Yves Strub
+ - Olena morpho,
+ - source tree and configuration system,
+ - type system.
+
+* Quôc Peyrot
+ - watershed algorithm.
+
+* Rémi Coupet
+ - Olena morpho,
+ - data types (pre-0.6),
+ - Olena core,
+ - bibliographical research.
+
+* Renaud François
+ - bibliographical research.
+
+* Fabien Freling fabien.freling(a)lrde.epita.fr
+ - Work on Melimage with IGR.
+ - Library improvements.
+
+* Guillaume Lazzara
+ - Work on Scribo
+ - Library improvements.
+
+
+==================
+Year 2003 students
+==================
+
+* Raphaël Poss
+ - source tree and configuration system,
+ - documentation.
+
+
+==================
+Year 2004 students
+==================
+
+* Nicolas Burrus
+ - integre,
+ - Olena I/O,
+ - source tree.
+
+
+==================
+Year 2006 students
+==================
+
+* Nicolas Pouillard
+ - Dynamic? (Dyn) (Olena proto-1.0).
+
+* Damien Thivolle
+ - contributions to document the code,
+ - generic morphers,
+ - configuration system,
+ - shapelets transform,
+ - G++ 4.0 compatibility (Olena 0.10a),
+ - canvas for algorithms (Olena proto-1.0),
+ - SCOOP 2 (Olena proto-1.0),
+ - Dynamic? (Dyn) (Olena proto-1.0).
+
+
+==================
+Year 2007 students
+==================
+
+* Christophe Berger
+ - connected filters (Olena proto-1.0, Olena 1.0),
+ - SCOOP 2 (Olena proto-1.0).
+
+* Nicolas Widynski
+ - connected filters (Olena proto-1.0),
+ - inpainting (Olena proto-1.0),
+ - segmentation (watershed transform, watersnake, snakes) (Olena proto-1.0)
+
+
+==================
+Year 2008 students
+==================
+
+* Tristan Croiset
+ - Dynamic (Dyn) (Olena proto-1.0)
+
+* Quentin Hocquet
+ - SCOOL? (Olena 1.0).
+
+* Thomas Moulard
+ - Scool (Olena 1.0)
+
+==================
+Year 2009 students
+==================
+
+* Alexandre Abraham alexandre.abraham(a)lrde.epita.fr
+
+* Nicolas Ballas nicolas.ballas(a)lrde.epita.fr
+
+* Matthieu Garrigues matthieu.garrigues(a)lrde.epita.fr
+
+* Ugo Jardonnet ugo.jardonnet(a)lrde.epita.fr
+
+
+==================
+Year 2010 students
+==================
+
+* Etienne Folio etienne.folio(a)lrde.epita.fr
+
+
+==================
+Year 2011 students
+==================
+
+* Frederic Bour frederic.bour(a)lrde.epita.fr
+* Edwin Carlinet edwin.carlinet(a)lrde.epita.fr
+
diff --git a/ChangeLog b/ChangeLog
index d32d1c1..faa0325 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-06 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ * AUTHORS: First draft.
+
2009-05-05 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
* configure.ac: Configure tests/world/*
--
1.6.1.2
1
0
* mln/make/influence_zone_adjacency_graph.hh,
* mln/make/region_adjacency_graph.hh: make use of this new structure.
* mln/util/adjacency_matrix.hh: new structure.
* tests/util/Makefile.am,
* tests/util/adjacency_matrix.cc: associated test.
---
milena/ChangeLog | 12 +
milena/mln/make/influence_zone_adjacency_graph.hh | 17 +-
milena/mln/make/region_adjacency_graph.hh | 15 +-
milena/mln/util/adjacency_matrix.hh | 335 +++++++++++++++++++++
milena/tests/util/Makefile.am | 3 +
milena/tests/util/adjacency_matrix.cc | 76 +++++
6 files changed, 440 insertions(+), 18 deletions(-)
create mode 100644 milena/mln/util/adjacency_matrix.hh
create mode 100644 milena/tests/util/adjacency_matrix.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d68a7e9..ff6c707 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,17 @@
2009-05-06 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Add adjacency matrix.
+
+ * mln/make/influence_zone_adjacency_graph.hh,
+ * mln/make/region_adjacency_graph.hh: make use of this new structure.
+
+ * mln/util/adjacency_matrix.hh: new structure.
+
+ * tests/util/Makefile.am,
+ * tests/util/adjacency_matrix.cc: associated test.
+
+2009-05-06 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Small fixes.
* doc/tutorial/tutorial.tex: fix compilation.
diff --git a/milena/mln/make/influence_zone_adjacency_graph.hh b/milena/mln/make/influence_zone_adjacency_graph.hh
index 7113962..6cbaa4c 100644
--- a/milena/mln/make/influence_zone_adjacency_graph.hh
+++ b/milena/mln/make/influence_zone_adjacency_graph.hh
@@ -44,6 +44,8 @@
# include <mln/core/alias/box2d.hh>
# include <mln/extension/adjust_fill.hh>
# include <mln/util/graph.hh>
+# include <mln/util/adjacency_matrix.hh>
+
namespace mln
{
@@ -104,8 +106,7 @@ namespace mln
const I& iz = exact(iz_);
const N& nbh = exact(nbh_);
- mln::image2d<bool> adj(mln::box2d(nlabels.next(), nlabels.next()));
- data::fill(adj, false);
+ util::adjacency_matrix<> adj(nlabels.next());
extension::adjust_fill(iz, nbh, 0u);
typedef mln_value(I) L;
@@ -120,13 +121,7 @@ namespace mln
{
L l2 = iz(n);
if (iz(n) != iz((p)))
- {
- // l2 is adjacent to l1
- if (l2 < l1)
- adj(point2d(l1,l2)) = true;
- else
- adj(point2d(l2,l1)) = true;
- }
+ adj.add(l1, l2);
}
}
}
@@ -134,9 +129,9 @@ namespace mln
// Construct graph.
util::graph g;
g.add_vertices(nlabels.next());
- for (unsigned i = 0; i < geom::nrows(adj); ++i)
+ for (unsigned i = 0; i < nlabels.next(); ++i)
for (unsigned j = 0; j < i; ++j)
- if (adj(point2d(i,j)))
+ if (adj.are_adjacent(i, j))
g.add_edge(i, j);
trace::exiting("make::impl::generic::influence_zone_adjacency_graph");
diff --git a/milena/mln/make/region_adjacency_graph.hh b/milena/mln/make/region_adjacency_graph.hh
index 695174d..b930367 100644
--- a/milena/mln/make/region_adjacency_graph.hh
+++ b/milena/mln/make/region_adjacency_graph.hh
@@ -33,6 +33,8 @@
/// Create a region_adjacency_graph from a watershed image.
///
/// \sa morpho::meyer_wst.
+///
+/// \todo add dispatch.
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
@@ -40,6 +42,8 @@
# include <mln/core/alias/box2d.hh>
# include <mln/extension/adjust_fill.hh>
# include <mln/util/graph.hh>
+# include <mln/util/adjacency_matrix.hh>
+
namespace mln
{
@@ -100,8 +104,7 @@ namespace mln
const I& wshd = exact(wshd_);
const N& nbh = exact(nbh_);
- mln::image2d<bool> adj(mln::box2d(nbasins.next(), nbasins.next()));
- data::fill(adj, false);
+ util::adjacency_matrix<> adj(nbasins.next());
extension::adjust_fill(wshd, nbh, 0u);
typedef mln_value(I) L;
@@ -129,19 +132,17 @@ namespace mln
}
if (l2 == 0u || l1 == 0u)
continue;
- if (l2 < l1)
- std::swap(l1, l2);
// adjacency l1 l2
- adj(point2d(l2,l1)) = true;
+ adj.add(l2, l1);
}
// Construct graph.
util::graph g;
g.add_vertices(nbasins.next());
- for (unsigned i = 1; i < geom::nrows(adj); ++i)
+ for (unsigned i = 1; i < nbasins.next(); ++i)
for (unsigned j = 1; j < i; ++j)
- if (adj(point2d(i,j)))
+ if (adj.are_adjacent(i, j))
g.add_edge(i, j);
diff --git a/milena/mln/util/adjacency_matrix.hh b/milena/mln/util/adjacency_matrix.hh
new file mode 100644
index 0000000..dfda26f
--- /dev/null
+++ b/milena/mln/util/adjacency_matrix.hh
@@ -0,0 +1,335 @@
+// Copyright (C) 2009 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_UTIL_ADJACENCY_MATRIX_HH
+# define MLN_UTIL_ADJACENCY_MATRIX_HH
+
+/// \file mln/util/adjacency_matrix.hh
+///
+/// A class of adjacency matrix.
+///
+/// FIXME: the underlying data structure is chosen according
+/// to the value type quantification however we may like to make it
+/// depend on the number of elements.
+
+# include <mln/core/image/image2d.hh>
+# include <mln/util/set.hh>
+# include <mln/util/ord_pair.hh>
+# include <mln/trait/value_.hh>
+# include <mln/metal/converts_to.hh>
+# include <mln/debug/println.hh>
+
+namespace mln
+{
+
+ namespace util
+ {
+
+ namespace internal
+ {
+
+ // Implementation for low quantification.
+
+ template <typename V, typename Q>
+ struct adjacency_matrix_impl_selector
+ {
+ /// Data structure used to store adjacency information.
+ typedef image2d<bool> adj_t;
+
+ /// Constructor.
+ adjacency_matrix_impl_selector(const V& nelements);
+
+ /// Make \p e1 and \p e2 adjacent.
+ void add(const V& e1, const V& e2);
+
+ /// Remove adjacency between \p e1 and \p e2.
+ void remove(const V& e1, const V& e2);
+
+ /// Clear all adjacencies.
+ void clear();
+
+ /// Check whether \p e1 and \p e2 are adjacent.
+ bool are_adjacent(const V& e1, const V& e2) const;
+
+ /// Print data to std::out.
+ std::ostream& print_data_(std::ostream& ostr) const;
+
+ protected:
+ adj_t adj_;
+ };
+
+
+ // Implementation for high quantification.
+
+ template <typename V>
+ struct adjacency_matrix_impl_selector<V, metal::bool_<false> >
+ {
+ /// Data structure used to store adjacency information.
+ typedef util::set< util::ord_pair<V> > adj_t;
+
+ /// Constructor.
+ adjacency_matrix_impl_selector(const V& nelements);
+
+ /// Make \p e1 and \p e2 adjacent.
+ void add(const V& e1, const V& e2);
+
+ /// Remove adjacency between \p e1 and \p e2.
+ void remove(const V& e1, const V& e2);
+
+ /// Clear all adjacencies.
+ void clear();
+
+ /// Check whether \p e1 and \p e2 are adjacent.
+ bool are_adjacent(const V& e1, const V& e2) const;
+
+ /// Print data to std::out.
+ std::ostream& print_data_(std::ostream& ostr) const;
+
+ protected:
+ adj_t adj_;
+
+# ifndef NDEBUG
+ unsigned nelements_;
+# endif // ! NDEBUG
+ };
+
+
+ } // end of namespace mln::util::internal
+
+
+ /// A class of adjacency matrix.
+ ///
+ /// Support low and high quantification value types.
+ /// In case of low quantification value type, it uses
+ /// an image2d to store adjacency information.
+ /// In case of high quantification value type, it uses
+ /// a util::set to store the adjacency information.
+ ///
+ /// \ingroup modutil
+ //
+ template <typename V = def::coord>
+ class adjacency_matrix
+ : private mlc_converts_to(V,unsigned)::check_t,
+ public internal::adjacency_matrix_impl_selector<V, typename mlc_equal(mln_trait_value_quant(V),trait::value::quant::low)::eval>
+ {
+ typedef internal::adjacency_matrix_impl_selector<V, typename mlc_equal(mln_trait_value_quant(V),trait::value::quant::low)::eval>
+ impl_t;
+
+ typedef typename impl_t::adj_t adj_t;
+
+ public:
+ /// Constructors.
+ /// \@{
+ ///
+ /// Default
+ adjacency_matrix();
+ /// Construct an adjacency matrix with \p nelements elements
+ /// maximum.
+ adjacency_matrix(const V& nelements);
+ ///
+ /// \@}
+
+ /// Hook member used to retrieve the underlying data structure.
+ const adj_t& hook_data_() const;
+ };
+
+
+ // <<
+
+ template <typename V>
+ std::ostream&
+ operator<<(std::ostream& ostr, const adjacency_matrix<V>& adj);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ namespace internal
+ {
+
+ // Low quantification.
+
+ template <typename V, typename Q>
+ adjacency_matrix_impl_selector<V, Q>::adjacency_matrix_impl_selector(const V& nelements)
+ : adj_(nelements, nelements)
+ {
+ clear();
+ }
+
+ template <typename V, typename Q>
+ void
+ adjacency_matrix_impl_selector<V, Q>::add(const V& e1, const V& e2)
+ {
+ mln_precondition(adj_.is_valid());
+ mln_precondition(e1 < adj_.nrows());
+ mln_precondition(e2 < adj_.nrows());
+
+ if (e1 > e2)
+ opt::at(adj_, e2, e1) = true;
+ else
+ opt::at(adj_, e1, e2) = true;
+ }
+
+ template <typename V, typename Q>
+ void
+ adjacency_matrix_impl_selector<V, Q>::remove(const V& e1, const V& e2)
+ {
+ mln_precondition(adj_.is_valid());
+ mln_precondition(e1 < adj_.nrows());
+ mln_precondition(e2 < adj_.nrows());
+
+ if (e1 > e2)
+ opt::at(adj_, e2, e1) = false;
+ else
+ opt::at(adj_, e1, e2) = false;
+ }
+
+ template <typename V, typename Q>
+ void
+ adjacency_matrix_impl_selector<V, Q>::clear()
+ {
+ mln_precondition(adj_.is_valid());
+ data::fill(adj_, false);
+ }
+
+ template <typename V, typename Q>
+ bool
+ adjacency_matrix_impl_selector<V, Q>::are_adjacent(const V& e1,
+ const V& e2) const
+ {
+ mln_precondition(adj_.is_valid());
+ mln_precondition(e1 < adj_.nrows());
+ mln_precondition(e2 < adj_.nrows());
+
+ if (e1 > e2)
+ return opt::at(adj_, e2, e1);
+ return opt::at(adj_, e1, e2);
+ }
+
+ template <typename V, typename Q>
+ std::ostream&
+ adjacency_matrix_impl_selector<V, Q>::print_data_(std::ostream& ostr) const
+ {
+ mln_precondition(adj_.is_valid());
+ debug::println(adj_);
+ return ostr;
+ }
+
+
+
+
+ // High quantification.
+
+ template <typename V>
+ adjacency_matrix_impl_selector<V, metal::bool_<false> >
+ ::adjacency_matrix_impl_selector(const V& nelements)
+ {
+ (void) nelements;
+# ifndef DNDEBUG
+ nelements_ = nelements;
+# endif // ! DNDEBUG
+ }
+
+ template <typename V>
+ void
+ adjacency_matrix_impl_selector<V, metal::bool_<false> >
+ ::add(const V& e1, const V& e2)
+ {
+ mln_precondition(e1 < nelements_);
+ mln_precondition(e2 < nelements_);
+ adj_.insert(make::ord_pair(e1, e2));
+ }
+
+ template <typename V>
+ void
+ adjacency_matrix_impl_selector<V, metal::bool_<false> >
+ ::remove(const V& e1, const V& e2)
+ {
+ mln_precondition(e1 < nelements_);
+ mln_precondition(e2 < nelements_);
+ mln_precondition(adj_.has(make::ord_pair(e1, e2)));
+ adj_.remove(make::ord_pair(e1, e2));
+ }
+
+ template <typename V>
+ void
+ adjacency_matrix_impl_selector<V, metal::bool_<false> >::clear()
+ {
+ adj_.clear();
+ }
+
+ template <typename V>
+ bool
+ adjacency_matrix_impl_selector<V, metal::bool_<false> >
+ ::are_adjacent(const V& e1, const V& e2) const
+ {
+ mln_precondition(e1 < nelements_);
+ mln_precondition(e2 < nelements_);
+ return adj_.has(make::ord_pair(e1, e2));
+ }
+
+ template <typename V>
+ std::ostream&
+ adjacency_matrix_impl_selector<V, metal::bool_<false> >::print_data_(std::ostream& ostr) const
+ {
+ return ostr << adj_;
+ }
+
+ } // end of namespace mln::internal
+
+
+ template <typename V>
+ adjacency_matrix<V>::adjacency_matrix()
+ : impl_t()
+ {
+ }
+
+
+ template <typename V>
+ adjacency_matrix<V>::adjacency_matrix(const V& nelements)
+ : impl_t(nelements)
+ {
+ }
+
+
+ template <typename V>
+ std::ostream&
+ operator<<(std::ostream& ostr, const adjacency_matrix<V>& adj)
+ {
+ return adj.print_data_(ostr);
+ }
+
+
+# endif // ! MLN_UTIL_ADJACENCY_MATRIX_HH
+
+ } // end of namespace mln::util
+
+} // end of namespace mln
+
+
+#endif // ! MLN_UTIL_ADJACENCY_MATRIX_HH
diff --git a/milena/tests/util/Makefile.am b/milena/tests/util/Makefile.am
index c1d6c4d..07b6018 100644
--- a/milena/tests/util/Makefile.am
+++ b/milena/tests/util/Makefile.am
@@ -4,6 +4,7 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
+ adjacency_matrix \
branch_iter \
branch_iter_ind \
eat \
@@ -21,6 +22,8 @@ check_PROGRAMS = \
tree_to_fast \
tree_to_image
+
+adjacency_matrix_SOURCES = adjacency_matrix.cc
branch_iter_SOURCES = branch_iter.cc
branch_iter_ind_SOURCES = branch_iter_ind.cc
eat_SOURCES = eat.cc
diff --git a/milena/tests/util/adjacency_matrix.cc b/milena/tests/util/adjacency_matrix.cc
new file mode 100644
index 0000000..e67f659
--- /dev/null
+++ b/milena/tests/util/adjacency_matrix.cc
@@ -0,0 +1,76 @@
+// Copyright (C) 2009 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/util/adjacency_matrix.cc
+///
+/// test of mln::util::adjacency_matrix
+
+#include <mln/util/adjacency_matrix.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u16.hh>
+
+int main()
+{
+ using namespace mln;
+
+ // The underlying data structure is a image2d.
+ {
+ util::adjacency_matrix<value::int_u8> adj(5);
+ adj.add(3, 4);
+ adj.add(2, 3);
+ adj.add(1, 2);
+
+ mln_assertion(adj.are_adjacent(2,3));
+ mln_assertion(adj.are_adjacent(4,3));
+ mln_assertion(adj.are_adjacent(2,1));
+ mln_assertion(adj.are_adjacent(1,2));
+ mln_assertion(!adj.are_adjacent(1,4));
+
+ adj.remove(2,3);
+ mln_assertion(!adj.are_adjacent(2,3));
+ mln_assertion(!adj.are_adjacent(2,2));
+ }
+
+ // The underlying data structure is a util::set
+ {
+ util::adjacency_matrix<value::int_u16> adj(5);
+ adj.add(3, 4);
+ adj.add(2, 3);
+ adj.add(1, 2);
+
+ mln_assertion(adj.are_adjacent(2,3));
+ mln_assertion(adj.are_adjacent(4,3));
+ mln_assertion(adj.are_adjacent(2,1));
+ mln_assertion(adj.are_adjacent(1,2));
+ mln_assertion(!adj.are_adjacent(1,4));
+
+ adj.remove(2,3);
+ mln_assertion(!adj.are_adjacent(2,3));
+ mln_assertion(!adj.are_adjacent(2,2));
+ }
+
+}
--
1.5.6.5
1
0
* doc/tutorial/tutorial.tex: fix compilation.
* mln/core/internal/neighb_niter_impl.hh: fix ambiguities and add more
doc.
* mln/fun/v2v/rgb_to_hsl.hh: remove duplicate declarations.
* mln/literal/one.hh,
* mln/literal/zero.hh: add 'const' qualification to conversion
operator.
* mln/make/edge_image.hh: update prototype.
* mln/make/rag_and_labeled_wsl.hh: remove useless local variable.
* mln/pw/internal/image_base.hh: add missing include.
* mln/util/vertex.hh: add missing include and forward declaration.
* tests/util/set.cc: update header.
---
milena/ChangeLog | 25 +++++++++++
milena/doc/tutorial/tutorial.tex | 25 +++++++----
milena/mln/core/internal/neighb_niter_impl.hh | 56 ++++++++++++++++++++++---
milena/mln/fun/v2v/rgb_to_hsl.hh | 56 -------------------------
milena/mln/literal/one.hh | 14 +++---
milena/mln/literal/zero.hh | 6 +-
milena/mln/make/edge_image.hh | 9 ++--
milena/mln/make/rag_and_labeled_wsl.hh | 2 -
milena/mln/pw/internal/image_base.hh | 1 +
milena/mln/util/vertex.hh | 2 +
milena/tests/util/set.cc | 1 +
11 files changed, 108 insertions(+), 89 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index a5e7011..d68a7e9 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,28 @@
+2009-05-06 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Small fixes.
+
+ * doc/tutorial/tutorial.tex: fix compilation.
+
+ * mln/core/internal/neighb_niter_impl.hh: fix ambiguities and add more
+ doc.
+
+ * mln/fun/v2v/rgb_to_hsl.hh: remove duplicate declarations.
+
+ * mln/literal/one.hh,
+ * mln/literal/zero.hh: add 'const' qualification to conversion
+ operator.
+
+ * mln/make/edge_image.hh: update prototype.
+
+ * mln/make/rag_and_labeled_wsl.hh: remove useless local variable.
+
+ * mln/pw/internal/image_base.hh: add missing include.
+
+ * mln/util/vertex.hh: add missing include and forward declaration.
+
+ * tests/util/set.cc: update header.
+
2009-05-06 Frederic Bour <bour(a)lrde.epita.fr>
Correct typo errors, rename storage_ to state, update thrubin morpher.
diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex
index b07b170..509a002 100644
--- a/milena/doc/tutorial/tutorial.tex
+++ b/milena/doc/tutorial/tutorial.tex
@@ -1118,7 +1118,7 @@ A list of available site sets is available in section \ref{siteset}.
%--------------------------
-\doxysubsection{Creating a site set}
+\doxysubsection{tuto4createsiteset}{Creating a site set}
In this section, we will detail how to create common site sets.
@@ -1126,7 +1126,7 @@ This is actually simple.
%--------------------------
-\doxysubsection{Getting access to sites}
+\doxysubsection{tuto4accesstosites}{Getting access to sites}
@@ -1137,15 +1137,15 @@ In milena, an image is seen as a composition of both a site set and a function
mapping a site to a value.
%--------------------------
-\doxysubsection{Creating an image}
+\doxysubsection{tuto4createimate}{Creating an image}
In this section, we will detail how to create common images.
%--------------------------
-\doxysubsection{Reading an image from a file}
+\doxysubsection{tuto4readimage}{Reading an image from a file}
%--------------------------
-\doxysubsection{Accessing data}
+\doxysubsection{tuto4accessdata}{Accessing data}
@@ -1224,7 +1224,8 @@ Finally, you may want to save the image. Since we use bool as image value, the
PBM format is the best choice. Therefore, we use io::pbm::save.
\doxycode[4]{tuto2_first_image}
-The output image looks like the following:
+The output image looks like the following: \\
+
\doxyfigure{tuto2_first_image}{3cm}
In this first step we used a boolean image. Many other value types are available
@@ -1262,25 +1263,29 @@ Updating a site value is also possible using \code{operator()} or the
\doxycode[3]{tuto3_rw_image}
\doxycode[4]{tuto3_rw_image}
-The corresponding image:
+The corresponding image: \\
+
\doxyfigure[1]{tuto3_rw_image}{3cm}
An image can also be initialized/modified thanks to another image.
Let's load a new image.
\doxycode[5]{tuto3_rw_image}
-\var{lena} looks like:
+\var{lena} looks like: \\
+
\doxyimg{small-enlarged}{3cm}
If we want to initialize \var{ima} with \var{lena}, we can use \code{data::fill}:
\doxycode[6]{tuto3_rw_image}
-Output:
+Output: \\
+
\doxyfigure[2]{tuto3_rw_image}{3cm}
Note that to fill an image with some data, the image domain \must be smaller
or equal to the data.
Likewise, it is possible to paste data from an image to another:
\doxycode[7]{tuto3_rw_image}
-Output:
+Output: \\
+
\doxyfigure[3]{tuto3_rw_image}{3cm}
More details can be found in sections \doxyref{imaaccessmodval}, \doxyref{fillop} and \doxyref{pasteop} in
diff --git a/milena/mln/core/internal/neighb_niter_impl.hh b/milena/mln/core/internal/neighb_niter_impl.hh
index a21f690..060f574 100644
--- a/milena/mln/core/internal/neighb_niter_impl.hh
+++ b/milena/mln/core/internal/neighb_niter_impl.hh
@@ -44,6 +44,11 @@ namespace mln
template <typename G, typename F> class graph_elt_window;
template <typename G, typename F, typename I> class graph_elt_window_if;
template <typename G, typename F> class line_graph_elt_window;
+ namespace util
+ {
+ template <typename G> class vertex;
+ template <typename G> class edge;
+ }
namespace internal
@@ -56,11 +61,54 @@ namespace mln
};
+ /// Add more implementation for neighborhoods made from
+ /// graph_window_base windows.
+ ///
+ /// FIXME: we need to redeclare the graph element interface.
+ /// Here, a neighb niter iterator encapsulates a window qiter iterator.
+ /// A window qiter iterator is a Proxy on a site P and can convert towards
+ /// a graph element through its member element().
+ ///
+ /// The window qiter iterator cannot have an automatic conversion towards
+ /// a graph element since there would be an ambiguity between this
+ /// conversion and the conversion to a psite P, if P is also a graph
+ /// element.
+ template <typename P, typename E>
+ struct neighb_niter_impl_graph_window
+ {
+ unsigned id() const
+ {
+ return internal::force_exact<E>(*this).compute_p_().id();
+ }
+
+ };
+
+ /// In this case, The site P is a util::vertex which means this iterator
+ /// can automatically converts towards this type.
+ /// There would be an ambiguity between util::vertex members and the one
+ /// declared in neighb_niter_impl_graph_window<P,E> if this
+ /// specialization did not exist.
+ template <typename G, typename E>
+ struct neighb_niter_impl_graph_window< util::vertex<G>, E >
+ {
+ };
+
+ /// In this case, The site P is a util::vertex which means this iterator
+ /// can automatically converts towards this type.
+ /// There would be an ambiguity between util::edge members and the one
+ /// declared in neighb_niter_impl_graph_window<P,E> if this
+ /// specialization did not exist.
+ template <typename G, typename E>
+ struct neighb_niter_impl_graph_window< util::edge<G>, E >
+ {
+ };
+
/// Add more implementation for neighborhoods made from
/// graph_window_base windows.
template <typename P, typename T, typename E>
- struct neighb_niter_impl<graph_window_base<P,T>, E>
+ struct neighb_niter_impl< graph_window_base<P, T>, E >
+ : neighb_niter_impl_graph_window<P,E>
{
typedef typename T::target S;
@@ -69,14 +117,10 @@ namespace mln
return internal::force_exact<E>(*this).compute_p_().element();
}
- unsigned id() const
- {
- return internal::force_exact<E>(*this).compute_p_().id();
- }
-
};
+
/// Add more implementation for neighborhoods made from a
/// graph_window_piter.
template <typename G, typename S, typename E>
diff --git a/milena/mln/fun/v2v/rgb_to_hsl.hh b/milena/mln/fun/v2v/rgb_to_hsl.hh
index a27e80c..7645750 100644
--- a/milena/mln/fun/v2v/rgb_to_hsl.hh
+++ b/milena/mln/fun/v2v/rgb_to_hsl.hh
@@ -69,31 +69,11 @@ namespace mln
extern f_rgb_to_hsl_f_t f_rgb_to_hsl_f;
- template <typename T_rgb>
- struct f_hsl_to_rgb_ : public Function_v2v< f_hsl_to_rgb_<T_rgb> >
- {
- typedef T_rgb result;
-
- template <typename T_hsl>
- T_rgb operator()(const T_hsl& hsl) const;
-
- };
-
- typedef f_hsl_to_rgb_< value::rgb<8> > f_hsl_to_rgb_3x8_t;
- typedef f_hsl_to_rgb_< value::rgb<16> > f_hsl_to_rgb_3x16_t;
-
- extern f_hsl_to_rgb_3x8_t f_hsl_to_rgb_3x8;
- extern f_hsl_to_rgb_3x16_t f_hsl_to_rgb_3x16;
-
-
# ifndef MLN_INCLUDE_ONLY
/// Global variables.
/// \{
f_rgb_to_hsl_f_t f_rgb_to_hsl_f;
-
- f_hsl_to_rgb_3x8_t f_hsl_to_rgb_3x8;
- f_hsl_to_rgb_3x16_t f_hsl_to_rgb_3x16;
/// \}
@@ -144,42 +124,6 @@ namespace mln
}
- template <typename T_rgb>
- template <typename T_hsl>
- inline
- T_rgb
- f_hsl_to_rgb_<T_rgb>::operator()(const T_hsl& hsl) const
- {
- typedef typename T_rgb::red_t red_t;
- typedef typename T_rgb::green_t green_t;
- typedef typename T_rgb::blue_t blue_t;
-
- static math::round<red_t> to_r;
- static math::round<green_t> to_g;
- static math::round<blue_t> to_b;
-
- static const float
- sqrt3_3 = std::sqrt(3) / 3,
- inv_sqrt6 = 1 / std::sqrt(6),
- inv_sqrt2 = 1 / std::sqrt(2);
-
- float
- h = hsl.hue() / 180.0 * 3.1415,
- alpha = hsl.sat() * std::cos(h),
- beta = hsl.sat() * std::sin(h);
-
-
- red_t r = to_r(sqrt3_3 * hsl.lum() + 2 * inv_sqrt6 * beta);
- green_t g =
- to_g(sqrt3_3 * hsl.lum() + inv_sqrt2 * alpha - inv_sqrt6 * beta);
- blue_t b =
- to_b(sqrt3_3 * hsl.lum() - inv_sqrt2 * alpha - inv_sqrt6 * beta);
-
- T_rgb rgb(r, g, b);
-
- return rgb;
- }
-
# endif // !MLN_INCLUDE_ONLY
} // end of namespace fun::v2v
diff --git a/milena/mln/literal/one.hh b/milena/mln/literal/one.hh
index 8176ce2..68fde6d 100644
--- a/milena/mln/literal/one.hh
+++ b/milena/mln/literal/one.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2009 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_LITERAL_ONE_HH
# define MLN_LITERAL_ONE_HH
-/*! \file mln/literal/one.hh
- *
- * \brief Definition of the literal of mln::one.
- */
+/// \file mln/literal/one.hh
+///
+/// Definition of the literal of mln::one.
# include <mln/core/concept/literal.hh>
# include <mln/metal/converts_to.hh>
@@ -49,7 +49,7 @@ namespace mln
// FIXME: Cf. comments in literal/zero.hh.
template <typename T>
- operator T () const;
+ operator const T () const;
};
@@ -61,7 +61,7 @@ namespace mln
template <typename T>
inline
- one_t::operator T () const
+ one_t::operator const T () const
{
mlc_converts_to(int, T)::check();
return 1;
diff --git a/milena/mln/literal/zero.hh b/milena/mln/literal/zero.hh
index b6b4e48..62acfbf 100644
--- a/milena/mln/literal/zero.hh
+++ b/milena/mln/literal/zero.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of the Olena Library. This library is free
@@ -51,7 +51,7 @@ namespace mln
// FIXME: (for the record) Add "friend class Literal<zero_t>;" and a protected ctor.
template <typename T>
- operator T () const;
+ operator const T () const;
};
/// Literal zero.
@@ -61,7 +61,7 @@ namespace mln
template <typename T>
inline
- zero_t::operator T () const
+ zero_t::operator const T () const
{
mlc_converts_to(int, T)::check();
return 0;
diff --git a/milena/mln/make/edge_image.hh b/milena/mln/make/edge_image.hh
index d4510c1..bd03162 100644
--- a/milena/mln/make/edge_image.hh
+++ b/milena/mln/make/edge_image.hh
@@ -94,16 +94,15 @@ namespace mln
/// Construct an edge image.
///
/// \param[in] v_ima_ A vertex image.
- /// \param[in] pe A p_edges mapping graph element to themselves.
/// \param[in] fv A function mapping two vertex ids to a value.
/// The result is associated to the corresponding edge.
///
- /// \return an edge image.
+ /// \return an edge image without localization information mapped to
+ /// graph elements.
//
template <typename P, typename V, typename G, typename FV>
mln::edge_image<void,mln_result(FV),G>
edge_image(const vertex_image<P,V,G>& v_ima_,
- const p_edges<G,util::internal::id2element<G,util::edge<G> > > pe,
const Function_vv2v<FV>& fv_);
@@ -174,7 +173,6 @@ namespace mln
template <typename P, typename V, typename G, typename FV>
mln::edge_image<void,mln_result(FV),G>
edge_image(const vertex_image<P,V,G>& v_ima_,
- const p_edges<G,util::internal::id2element<G,util::edge<G> > > pe,
const Function_vv2v<FV>& fv_)
{
trace::entering("make::edge_image");
@@ -183,12 +181,13 @@ namespace mln
const vertex_image<P,V,G>& v_ima = exact(v_ima_);
mln_precondition(v_ima.is_valid());
+ p_edges<G> pe(v_ima.graph());
typedef mln::edge_image<void,mln_result(FV),G> edge_ima_t;
edge_ima_t ima_e(pe);
mln_piter(edge_ima_t) e(ima_e.domain());
for_all(e)
- ima_e(e) = fv(e.element().v1(), e.element().v2());
+ ima_e(e) = fv(v_ima(e.element().v1()), v_ima(e.element().v2()));
trace::exiting("make::edge_image");
return ima_e;
diff --git a/milena/mln/make/rag_and_labeled_wsl.hh b/milena/mln/make/rag_and_labeled_wsl.hh
index 774c78a..60f2824 100644
--- a/milena/mln/make/rag_and_labeled_wsl.hh
+++ b/milena/mln/make/rag_and_labeled_wsl.hh
@@ -140,8 +140,6 @@ namespace mln
const N& nbh = exact(nbh_);
typedef mln_value(I) L;
- mln::image2d<bool> adj(mln::box2d(nbasins.next(), nbasins.next()));
- data::fill(adj, false);
extension::adjust_fill(wshd, nbh, 0u);
mln_concrete(I) output(wshd.domain());
diff --git a/milena/mln/pw/internal/image_base.hh b/milena/mln/pw/internal/image_base.hh
index b6571b9..d1dd608 100644
--- a/milena/mln/pw/internal/image_base.hh
+++ b/milena/mln/pw/internal/image_base.hh
@@ -33,6 +33,7 @@
/// Definition of the common base class for all point-wise images.
# include <mln/core/internal/image_primary.hh>
+# include <mln/core/routine/init.hh>
# include <mln/metal/unqualif.hh>
# include <mln/metal/not_equal.hh>
# include <mln/value/set.hh>
diff --git a/milena/mln/util/vertex.hh b/milena/mln/util/vertex.hh
index 0cde7a1..4f0c5ad 100644
--- a/milena/mln/util/vertex.hh
+++ b/milena/mln/util/vertex.hh
@@ -35,6 +35,7 @@
# include <mln/core/concept/proxy.hh>
# include <mln/core/concept/site.hh>
# include <mln/util/graph_ids.hh>
+# include <mln/util/edge.hh>
/// \file mln/util/vertex.hh
///
@@ -47,6 +48,7 @@ namespace mln
// Forward declaration.
namespace util { template<typename G> class vertex; }
+ namespace util { template<typename G> class edge; }
/// Vertex category flag type.
template <typename E>
diff --git a/milena/tests/util/set.cc b/milena/tests/util/set.cc
index f97449f..988a397 100644
--- a/milena/tests/util/set.cc
+++ b/milena/tests/util/set.cc
@@ -1,4 +1,5 @@
// Copyright (C) 2008, 2009 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
--
1.5.6.5
1
0
milena r3761: Correct typo errors, rename storage_ to state, update thrubin morpher
by Frederic Bour 06 May '09
by Frederic Bour 06 May '09
06 May '09
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-05-06 Frederic Bour <bour(a)lrde.epita.fr>
Correct typo errors, rename storage_ to state, update thrubin morpher.
* mln/core/concept/meta_function.hh: Add mln_fun_withbin for binary
metafunction.
* mln/core/image/thrubin_morpher.hh: Correct implementation of
thrubin_morpher.hh.
* mln/core/image/thru_morpher.hh: Typos correction.
* mln/fun/binary.hh,
* mln/fun/binary_param.hh: Renamed storage_get to state.
* mln/fun/math/inf.hh,
* mln/fun/math/sup.hh: Correct bug when working on two different
types.
* mln/fun/spe/binary.hh,
* mln/fun/spe/unary.hh,
* mln/fun/unary.hh,
* mln/fun/unary_param.hh: Renamed storage_get to state.
* mln/trait/next/solve_proxy.hh: Added one inclusion to prevent
errors.
* sandbox/fred/tests/thru.cc: Added test for thrubin.
---
mln/core/concept/meta_function.hh | 9 -
mln/core/image/thru_morpher.hh | 21 ++-
mln/core/image/thrubin_morpher.hh | 206 ++++++++++++++++----------------------
mln/fun/binary.hh | 14 +-
mln/fun/binary_param.hh | 2
mln/fun/math/inf.hh | 10 -
mln/fun/math/sup.hh | 8 -
mln/fun/spe/binary.hh | 16 ++
mln/fun/spe/unary.hh | 18 ++-
mln/fun/unary.hh | 18 +--
mln/fun/unary_param.hh | 4
mln/trait/next/solve_proxy.hh | 2
sandbox/fred/tests/thru.cc | 12 +-
13 files changed, 178 insertions(+), 162 deletions(-)
Index: trunk/milena/mln/trait/next/solve_proxy.hh
===================================================================
--- trunk/milena/mln/trait/next/solve_proxy.hh (revision 3760)
+++ trunk/milena/mln/trait/next/solve_proxy.hh (revision 3761)
@@ -37,6 +37,8 @@
# include <mln/core/concept/proxy.hh>
# include <mln/core/concept/proxy.hxx>
+# include <mln/trait/next/solve.hh>
+
namespace mln
{
Index: trunk/milena/mln/core/image/thru_morpher.hh
===================================================================
--- trunk/milena/mln/core/image/thru_morpher.hh (revision 3760)
+++ trunk/milena/mln/core/image/thru_morpher.hh (revision 3761)
@@ -123,12 +123,14 @@
typedef mln_psite(I) psite;
/// Value associated type.
- typedef typename F::result value;
+ typedef mln_result(F) value;
/// Return type of read-only access.
- typedef typename F::result rvalue;
+ typedef value rvalue;
+ typedef value lvalue; // Workaround for write operator()
rvalue operator()(const mln_psite(I)& p) const;
+ rvalue operator()(const mln_psite(I)& p);
};
@@ -221,7 +223,7 @@
thru_image<I, F>::thru_image(I& ima)
{
mln_precondition(ima.is_valid());
- init_(ima, mln_value(I)());
+ init_(ima, F());
}
template <typename I, typename F>
@@ -256,6 +258,15 @@
template <typename I, typename F>
inline
+ typename thru_image_read<I, F>::rvalue
+ thru_image_read<I, F>::operator()(const mln_psite(I)& p)
+ {
+ mln_precondition(this->is_valid());
+ return this->data_->f_(this->data_->ima_(p));
+ }
+
+ template <typename I, typename F>
+ inline
typename thru_image_write<I, F>::lvalue
thru_image_write<I, F>::operator()(const mln_psite(I)& p)
{
@@ -287,7 +298,7 @@
thru(const mln::Meta_Function<M>& f, Image<I>& ima)
{
typedef mln_fun_with(M, mln_value(I)) F;
- thru_image<I, F> tmp(exact(ima), F());
+ thru_image<I, F> tmp(exact(ima), F(exact(f).state()));
return tmp;
}
@@ -297,7 +308,7 @@
thru(const mln::Meta_Function<M>& f, const Image<I>& ima)
{
typedef mln_fun_with(M, mln_value(I)) F;
- thru_image<const I, F> tmp(exact(ima), F());
+ thru_image<const I, F> tmp(exact(ima), F(exact(f).state()));
return tmp;
}
Index: trunk/milena/mln/core/image/thrubin_morpher.hh
===================================================================
--- trunk/milena/mln/core/image/thrubin_morpher.hh (revision 3760)
+++ trunk/milena/mln/core/image/thrubin_morpher.hh (revision 3761)
@@ -43,7 +43,7 @@
{
// Forward declaration.
- template <typename I, typename F> struct thrubin_image;
+ template <typename I1, typename I2, typename F> struct thrubin_image;
namespace internal
{
@@ -53,7 +53,7 @@
{
data(I1& ima1, I2& ima2, const F& f);
- I1 ima1_;
+ I1 ima_;
I2 ima2_;
F f_;
};
@@ -65,94 +65,68 @@
{
template <typename I1, typename I2, typename F>
- struct image_< thrubin_image<I1, I2, F> > : image_< typename mln::internal::thrubin_find_impl<I1, , F>::ret > // Same as I except...
+ struct image_< thrubin_image<I1, I2, F> > : image_< I1 > // Same as I except...
{
// ...these changes.
typedef trait::image::category::value_morpher category;
- typedef mln_internal_trait_image_speed_from(I) speed; // Un-fastest.
+ typedef mln_internal_trait_image_speed_from(I1) speed; // Un-fastest.
typedef trait::image::value_access::computed value_access;
typedef trait::image::vw_io::read vw_io;
};
} // end of namespace mln::trait
-
-
- // FIXME: Doc!
-
- namespace internal
- {
-
- template <typename I, typename F>
- class thrubin_image_read : public internal::image_value_morpher< I, typename F::result, thrubin_image<I,F> >
+ /// \brief Morphes values from two images through a binary function.
+ ///
+ /// \ingroup modimagevaluemorpher
+ template <typename I1, typename I2, typename F>
+ class thrubin_image : public internal::image_value_morpher< I1, typename F::result, thrubin_image<I1,I2,F> >
{
public:
+ thrubin_image();
+ thrubin_image(I1& ima1, I2& ima2);
+ thrubin_image(I1& ima1, I2& ima2, const F& f);
+
/// Skeleton.
- typedef thrubin_image<tag::image_<I>, F> skeleton;
+ typedef thrubin_image<tag::image_<I1>, tag::image_<I2>, F> skeleton;
/// Point_Site associated type.
- typedef mln_psite(I) psite;
+ typedef mln_psite(I1) psite;
/// Value associated type.
- typedef typename F::result value;
+ typedef mln_result(F) value;
/// Return type of read-only access.
- typedef typename F::result rvalue;
-
- rvalue operator()(const mln_psite(I)& p) const;
-
- };
-
- // Inheritance from read ?!
- template <typename I, typename F>
- class thrubin_image_write : public thrubin_image_read<I,F>
- {
- public:
-
- /// Type returned by the read-write pixel value operator.
-// typedef typename F::template lresult<typename F::argument>::ret lvalue;
- typedef typename F::lresult lvalue;
-
- using thrubin_image_read<I,F>::operator();
- lvalue operator()(const mln_psite(I)& p);
-
- };
- }
-
- /// \brief Morphes values from two images through a binary function.
- ///
- /// \ingroup modimagevaluemorpher
- template <typename I, typename F>
- class thrubin_image : public internal::thrubin_find_impl<I, F>::ret
- {
- public:
+ typedef value rvalue;
+ typedef value lvalue; // Workaround for write operator()
- thrubin_image();
- thrubin_image(I& ima);
- thrubin_image(I& ima, const F& f);
+ rvalue operator()(const mln_psite(I1)& p) const;
+ rvalue operator()(const mln_psite(I1)& p);
- void init_(I& ima, const F& f);
+ void init_(I1& ima1, I2& ima2, const F& f);
/// Const promotion via conversion.
- operator thrubin_image<const I, F>() const;
+ operator thrubin_image<const I1, const I2, F>() const;
};
- template <typename I, typename F>
- thrubin_image<I, F> thrubin(const mln::Function<F>& f,
- Image<I>& ima);
-
- template <typename I, typename F>
- const thrubin_image<const I, F> thrubin(const mln::Function<F>& f,
- const Image<I>& ima);
-
- template <typename I, typename M>
- thrubin_image<I, mln_fun_with(M, mln_value(I))>
- thrubin(const mln::Meta_Function<M>& f, Image<I>& ima);
-
- template <typename I, typename M>
- const thrubin_image<const I, mln_fun_with(M, mln_value(I))>
- thrubin(const mln::Meta_Function<M>& f, const Image<I>& ima);
+ template <typename I1, typename I2, typename F>
+ thrubin_image<I1, I2, F>
+ thru(const mln::Function<F>& f,
+ Image<I1>& ima1, Image<I2>& ima2);
+
+ template <typename I1, typename I2, typename F>
+ const thrubin_image<const I1, const I2, F>
+ thru(const mln::Function<F>& f,
+ const Image<I1>& ima1, const Image<I2>& ima2);
+
+ template <typename I1, typename I2, typename M>
+ thrubin_image<I1, I2, mln_fun_withbin(M, mln_value(I1), mln_value(I2))>
+ thru(const mln::Meta_Function<M>& f, Image<I1>& ima1, Image<I1>& ima2);
+
+ template <typename I1, typename I2, typename M>
+ const thrubin_image<const I1, const I2, mln_fun_withbin(M, mln_value(I1), mln_value(I2))>
+ thru(const mln::Meta_Function<M>& f, const Image<I1>& ima1, const Image<I2>& ima2);
# ifndef MLN_INCLUDE_ONLY
@@ -161,10 +135,10 @@
namespace internal
{
- template <typename I, typename F>
+ template <typename I1, typename I2, typename F>
inline
- data< thrubin_image<I, F> >::data(I& ima, const F& f)
- : ima_(ima),
+ data< thrubin_image<I1, I2, F> >::data(I1& ima1, I2& ima2, const F& f)
+ : ima_(ima1), ima2_(ima2),
f_(f)
{
}
@@ -173,102 +147,102 @@
// thrubin_image<I>
- template <typename I, typename F>
+ template <typename I1, typename I2, typename F>
inline
- thrubin_image<I, F>::thrubin_image()
+ thrubin_image<I1, I2, F>::thrubin_image()
{
}
- template <typename I, typename F>
+ template <typename I1, typename I2, typename F>
inline
- thrubin_image<I, F>::thrubin_image(I& ima, const F& f)
+ thrubin_image<I1, I2, F>::thrubin_image(I1& ima1, I2& ima2, const F& f)
{
- mln_precondition(ima.is_valid());
- init_(ima, f);
+ mln_precondition(ima1.is_valid());
+ mln_precondition(ima2.is_valid());
+ init_(ima1, ima2, f);
}
- template <typename I, typename F>
+ template <typename I1, typename I2, typename F>
inline
- thrubin_image<I, F>::thrubin_image(I& ima)
+ thrubin_image<I1, I2, F>::thrubin_image(I1& ima1, I2& ima2)
{
- mln_precondition(ima.is_valid());
- init_(ima, mln_value(I)());
+ mln_precondition(ima1.is_valid());
+ mln_precondition(ima2.is_valid());
+ init_(ima1, ima2, F());
}
- template <typename I, typename F>
+ template <typename I1, typename I2, typename F>
inline
void
- thrubin_image<I, F>::init_(I& ima, const F& f)
+ thrubin_image<I1, I2, F>::init_(I1& ima1, I2& ima2, const F& f)
{
mln_precondition(! this->is_valid());
- mln_precondition(ima.is_valid());
- this->data_ = new internal::data< thrubin_image<I, F> >(ima, f);
+ mln_precondition(ima1.is_valid());
+ mln_precondition(ima2.is_valid());
+ this->data_ = new internal::data< thrubin_image<I1, I2, F> >(ima1, ima2, f);
}
- template <typename I, typename F>
+ template <typename I1, typename I2, typename F>
inline
- thrubin_image<I, F>::operator thrubin_image<const I, F>() const
+ thrubin_image<I1, I2, F>::operator thrubin_image<const I1, const I2, F>() const
{
- thrubin_image<const I, F> tmp(this->data_->ima_, this->data_->f_);
+ thrubin_image<const I1, const I2, F> tmp(this->data_->ima_, this->data_->ima2_, this->data_->f_);
return tmp;
}
- namespace internal
- {
-
- template <typename I, typename F>
+ template <typename I1, typename I2, typename F>
inline
- typename thrubin_image_read<I, F>::rvalue
- thrubin_image_read<I, F>::operator()(const mln_psite(I)& p) const
+ typename thrubin_image<I1, I2, F>::rvalue
+ thrubin_image<I1, I2, F>::operator()(const mln_psite(I1)& p) const
{
mln_precondition(this->is_valid());
- return this->data_->f_(this->data_->ima_(p));
+ return this->data_->f_(this->data_->ima_(p), this->data_->ima2_(p));
}
- template <typename I, typename F>
+ template <typename I1, typename I2, typename F>
inline
- typename thrubin_image_write<I, F>::lvalue
- thrubin_image_write<I, F>::operator()(const mln_psite(I)& p)
+ typename thrubin_image<I1, I2, F>::rvalue
+ thrubin_image<I1, I2, F>::operator()(const mln_psite(I1)& p)
{
mln_precondition(this->is_valid());
- return this->data_->f_(this->data_->ima_(p));
- }
-
+ return this->data_->f_(this->data_->ima_(p), this->data_->ima2_(p));
}
// thrubin
- template <typename I, typename F>
- thrubin_image<I, F> thrubin(const mln::Function<F>& f,
- Image<I>& ima)
+ template <typename I1, typename I2, typename F>
+ thrubin_image<I1, I2, F>
+ thru(const mln::Function<F>& f,
+ Image<I1>& ima1, Image<I2>& ima2)
{
- thrubin_image<I, F> tmp(exact(ima), exact(f));
+ thrubin_image<I1, I2, F> tmp(exact(ima1), exact(ima2), exact(f).state());
return tmp;
}
- template <typename I, typename F>
- thrubin_image<const I, F> thrubin(const mln::Function<F>& f,
- const Image<I>& ima)
+ template <typename I1, typename I2, typename F>
+ const thrubin_image<const I1, const I2, F>
+ thru(const mln::Function<F>& f,
+ const Image<I1>& ima1, const Image<I2>& ima2)
{
- thrubin_image<const I, F> tmp(exact(ima), exact(f));
+ thrubin_image<const I1, const I2, F> tmp(exact(ima1), exact(ima2), exact(f).state());
return tmp;
}
- template <typename I, typename M>
- thrubin_image<I, mln_fun_with(M, mln_value(I))>
- thrubin(const mln::Meta_Function<M>& f, Image<I>& ima)
+ template <typename I1, typename I2, typename M>
+ thrubin_image<I1, I2, mln_fun_withbin(M, mln_value(I1), mln_value(I2))>
+ thru(const mln::Meta_Function<M>& f, Image<I1>& ima1, Image<I2>& ima2)
{
- typedef mln_fun_with(M, mln_value(I)) F;
- thrubin_image<I, F> tmp(exact(ima), F());
+ typedef mln_fun_withbin(M, mln_value(I1), mln_value(I2)) F;
+ thrubin_image<I1, I2, F> tmp(exact(ima1), exact(ima2), F(exact(f).state()));
return tmp;
}
- template <typename I, typename M>
- thrubin_image<const I, mln_fun_with(M, mln_value(I))>
- thrubin(const mln::Meta_Function<M>& f, const Image<I>& ima)
+ template <typename I1, typename I2, typename M>
+ const thrubin_image<const I1, const I2, mln_fun_withbin(M, mln_value(I1), mln_value(I2))>
+ thru(const mln::Meta_Function<M>& f, const Image<I1>& ima1, const Image<I2>& ima2)
{
- typedef mln_fun_with(M, mln_value(I)) F;
- thrubin_image<const I, F> tmp(exact(ima), F());
+ typedef mln_fun_withbin(M, mln_value(I1), mln_value(I2)) F;
+ thrubin_image<const I1, const I2, F> tmp(exact(ima1), exact(ima2), F(exact(f).state()));
return tmp;
}
Index: trunk/milena/mln/core/concept/meta_function.hh
===================================================================
--- trunk/milena/mln/core/concept/meta_function.hh (revision 3760)
+++ trunk/milena/mln/core/concept/meta_function.hh (revision 3761)
@@ -35,23 +35,24 @@
# include <mln/core/concept/object.hh>
# include <mln/core/concept/function.hh>
-
# define mln_fun_with(F, T) \
typename F::template with< T >::ret
# define mln_fun_with_(F, T) \
F::with< T >::ret
+# define mln_fun_withbin(F, T1, T2) \
+typename F::template with< T1, T2 >::ret
+
+# define mln_fun_withbin_(F, T1, T2) \
+F::with< T1, T2 >::ret
# define mln_fun_result(F, T) \
typename F::template with< T >::ret::result
-
# define mln_fun_result_(F, T) \
F::with< T >::ret::result
-
-
namespace mln
{
Index: trunk/milena/mln/fun/spe/binary.hh
===================================================================
--- trunk/milena/mln/fun/spe/binary.hh (revision 3760)
+++ trunk/milena/mln/fun/spe/binary.hh (revision 3761)
@@ -93,17 +93,27 @@
result operator () (const argument1& a, const argument2& b) const
{
- return def::read(storage_, a, b);
+ return def::read(state_, a, b);
}
template <typename U>
void init(const U& value)
{
- storage_ = mln::trait::function::internal::introspect::has_storage_t<def, void>::compute(value);
+ state_ = mln::trait::function::internal::introspect::has_storage_t<def, void>::compute(value);
+ }
+
+ stored<storage>& state()
+ {
+ return state_;
+ }
+
+ const stored<storage>& state() const
+ {
+ return state_;
}
protected:
- mln::fun::stored<storage> storage_;
+ mln::fun::stored<storage> state_;
};
} // end of namespace mln::fun::spe::impl
Index: trunk/milena/mln/fun/spe/unary.hh
===================================================================
--- trunk/milena/mln/fun/spe/unary.hh (revision 3760)
+++ trunk/milena/mln/fun/spe/unary.hh (revision 3761)
@@ -233,17 +233,27 @@
result operator () (const argument& value) const
{
- return def::read(this->storage_, value);
+ return def::read(this->state_, value);
}
template <typename U>
void init(const U& value)
{
- storage_ = mln::trait::function::internal::introspect::has_storage_t<def, void>::compute(value);
+ state_ = mln::trait::function::internal::introspect::has_storage_t<def, void>::compute(value);
};
+ stored<storage>& state()
+ {
+ return state_;
+ }
+
+ const stored<storage>& state() const
+ {
+ return state_;
+ }
+
protected:
- storage storage_;
+ stored<storage> state_;
};
template <typename Fun, typename T>
@@ -262,7 +272,7 @@
void set(lvalue l, const typename super::result& r) const
{
- super::def::write(this->storage_, l, r);
+ super::def::write(this->state(), l, r);
}
using super::operator ();
Index: trunk/milena/mln/fun/math/sup.hh
===================================================================
--- trunk/milena/mln/fun/math/sup.hh (revision 3760)
+++ trunk/milena/mln/fun/math/sup.hh (revision 3761)
@@ -47,12 +47,12 @@
{
template <typename T>
- struct set_binary_<mln::fun::sup, mln::Object, T, mln::Object, T>
+ struct set_binary_<mln::fun::sup, mln::Object, T1, mln::Object, T2>
{
typedef set_binary_ ret;
- typedef T result;
- typedef T argument1;
- typedef T argument2;
+ typedef mln_trait_promote(T1, T2) result;
+ typedef T1 argument1;
+ typedef T2 argument2;
static result read(const argument1& a, const argument1& b)
{
Index: trunk/milena/mln/fun/math/inf.hh
===================================================================
--- trunk/milena/mln/fun/math/inf.hh (revision 3760)
+++ trunk/milena/mln/fun/math/inf.hh (revision 3761)
@@ -46,13 +46,13 @@
namespace next
{
- template <typename T>
- struct set_binary_<mln::fun::inf, mln::Object, T, mln::Object, T>
+ template <typename T1, typename T2>
+ struct set_binary_<mln::fun::inf, mln::Object, T1, mln::Object, T2>
{
typedef set_binary_ ret;
- typedef T result;
- typedef T argument1;
- typedef T argument2;
+ typedef mln_trait_promote(T1, T2) result;
+ typedef T1 argument1;
+ typedef T2 argument2;
static result read(const argument1& a, const argument1& b)
{
Index: trunk/milena/mln/fun/unary.hh
===================================================================
--- trunk/milena/mln/fun/unary.hh (revision 3760)
+++ trunk/milena/mln/fun/unary.hh (revision 3761)
@@ -71,19 +71,19 @@
template <typename T>
typename with<T>::ret::template lresult_with<T>::ret operator()(T& v) const
{
- return typename with<T>::ret(storage_get()).apply_rw(v);
+ return typename with<T>::ret(state()).apply_rw(v);
}
template <typename T, typename R>
void set(T& v, const R& r) const
{
- typename with<T>::ret(storage_).set(v, r);
+ typename with<T>::ret(state()).set(v, r);
}
template <typename U>
void init(const U& value)
{
- storage_ = mln::trait::function::internal::introspect::has_storage_t<flag, void>::compute(value);
+ state_ = mln::trait::function::internal::introspect::has_storage_t<flag, void>::compute(value);
};
unary()
@@ -96,18 +96,18 @@
this->init(param);
}
- stored<storage>& storage_get()
+ stored<storage>& state()
{
- return storage_;
+ return state_;
}
- const stored<storage>& storage_get() const
+ const stored<storage>& state() const
{
- return storage_;
+ return state_;
}
protected:
- stored<storage> storage_;
+ stored<storage> state_;
};
} // end of namespace mln::fun
@@ -128,7 +128,7 @@
static typename ret::result call(const F& f, const T& v)
{
- return ret(f.storage_get())(v);
+ return ret(f.state())(v);
}
};
Index: trunk/milena/mln/fun/unary_param.hh
===================================================================
--- trunk/milena/mln/fun/unary_param.hh (revision 3760)
+++ trunk/milena/mln/fun/unary_param.hh (revision 3761)
@@ -41,6 +41,10 @@
template <typename F, typename Param, typename Storage = void, typename E = F>
struct unary_param: unary< unary_param<F,Param,Storage,E>, E>
{
+ typedef F flag;
+ typedef Param param;
+ typedef Storage storage;
+
unary_param()
{
}
Index: trunk/milena/mln/fun/binary.hh
===================================================================
--- trunk/milena/mln/fun/binary.hh (revision 3760)
+++ trunk/milena/mln/fun/binary.hh (revision 3761)
@@ -54,13 +54,13 @@
template <typename T1, typename T2>
typename with<T1, T2>::ret::result operator()(const T1& a, const T2& b) const
{
- return typename with<T1, T2>::ret(storage_)(a, b);
+ return typename with<T1, T2>::ret(state())(a, b);
}
template <typename U>
void init(const U& value)
{
- storage_ = mln::trait::function::internal::introspect::has_storage_t<flag, void>::compute(value);
+ state_ = mln::trait::function::internal::introspect::has_storage_t<flag, void>::compute(value);
};
binary()
@@ -73,18 +73,18 @@
this->init(param);
}
- stored<storage>& storage_get()
+ stored<storage>& state()
{
- return storage_;
+ return state_;
}
- const stored<storage>& storage_get() const
+ const stored<storage>& state() const
{
- return storage_;
+ return state_;
}
protected:
- stored<storage> storage_;
+ stored<storage> state_;
};
} // end of namespace mln::fun
Index: trunk/milena/mln/fun/binary_param.hh
===================================================================
--- trunk/milena/mln/fun/binary_param.hh (revision 3760)
+++ trunk/milena/mln/fun/binary_param.hh (revision 3761)
@@ -42,6 +42,8 @@
struct binary_param: binary<binary_param<F,Param,Storage>, E>
{
typedef F flag;
+ typedef Param param;
+ typedef Storage storage;
binary_param()
{
Index: trunk/milena/sandbox/fred/tests/thru.cc
===================================================================
--- trunk/milena/sandbox/fred/tests/thru.cc (revision 3760)
+++ trunk/milena/sandbox/fred/tests/thru.cc (revision 3761)
@@ -2,12 +2,14 @@
#include <mln/fun/v2v/convert.hh>
#include <mln/fun/math/cos.hh>
#include <mln/core/image/thru_morpher.hh>
+#include <mln/core/image/thrubin_morpher.hh>
#include <mln/fun/compose.hh>
#include <mln/core/var.hh>
#include <mln/core/image/image2d.hh>
#include <mln/fun/point/row.hh>
+#include <mln/fun/math/inf.hh>
#include <mln/value/int_u8.hh>
#include <mln/debug/all.hh>
@@ -23,24 +25,24 @@
using namespace mln;
fun::cos cos;
+ fun::inf inf;
+
typedef image2d<float> I;
I ima(5, 5);
-
image2d<value::int_u8> tmp(5, 5);
+
+
debug::iota(tmp);
data::fill_with_image(ima, tmp);
debug::println(ima);
debug::println(thru(cos, ima));
+ debug::println(thru(inf, ima, tmp));
mln_VAR(ima2, thru(cos(cos), ima));
- data::fill_with_image(ima2, tmp);
-
mln::fun::row row;
-
mln_piter_(I) p(ima.domain());
-
for_all(p)
std::cout << row(p);
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add a file to test exprs like ''pw::value(ima) < 3''.
* theo/experimental/op_pw_value_pw_cst.cc: New.
op_pw_value_pw_cst.cc | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 91 insertions(+)
Index: theo/experimental/op_pw_value_pw_cst.cc
--- theo/experimental/op_pw_value_pw_cst.cc (revision 0)
+++ theo/experimental/op_pw_value_pw_cst.cc (revision 0)
@@ -0,0 +1,91 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/pw/value.hh>
+#include <mln/pw/cst.hh>
+#include <mln/fun/ops.hh>
+#include <mln/value/scalar.hh>
+
+
+namespace mln
+{
+
+
+ namespace trait
+ {
+
+// template <typename L, typename R>
+// struct set_binary_< op::less,
+// mln::Function_p2v, L,
+// mln::value::Scalar, R >
+// {
+// typedef fun::less_p2b_expr_< L, pw::cst_<mln_result(L)> > ret;
+// };
+
+
+ template <typename L, typename R>
+ struct set_binary_< op::less,
+ mln::Function_p2v, L,
+ mln::Object, R >
+ {
+ typedef fun::less_p2b_expr_< L, pw::cst_<mln_result(L)> > ret;
+ };
+
+ }
+
+
+// template <typename L, typename R>
+// fun::less_p2b_expr_< L, pw::cst_<mln_result(L)> >
+// operator < (const Function_p2v<L>& lhs, const value::Scalar<R>& rhs)
+// {
+// mlc_converts_to(mln_equiv(R), mln_result(L))::check();
+// mln_equiv(R) rhs_ = exact(rhs).to_equiv();
+// typedef pw::cst_<mln_result(L)> C;
+// fun::less_p2b_expr_<L, C> tmp(exact(lhs), C(rhs_));
+// return tmp;
+// }
+
+
+ template <typename L, typename R>
+ fun::less_p2b_expr_< L, pw::cst_<mln_result(L)> >
+ operator < (const Function_p2v<L>& lhs, const Object<R>& rhs)
+ {
+ // mln_trait_op_less(L, mln_result(L)) b = lhs;
+
+ typedef pw::cst_<mln_result(L)> C;
+ fun::less_p2b_expr_<L, C> tmp(exact(lhs), C(exact(rhs)));
+ return tmp;
+ }
+
+
+// template <typename L>
+// fun::less_p2b_expr_< L, pw::cst_<mln_result(L)> >
+// operator < (const Function_p2v<L>& lhs, const mln_result(L)& rhs)
+// {
+// mln_trait_op_less(L, mln_result(L)) b = lhs;
+
+// typedef pw::cst_<mln_result(L)> C;
+// fun::less_p2b_expr_<L, C> tmp(exact(lhs), C(rhs));
+// return tmp;
+// }
+
+
+}
+
+
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<value::int_u8> ima(1,1);
+ point2d p(0,0);
+ ima(p) = 2;
+
+// void* v =
+ (pw::value(ima) < 3);
+
+// std::cout << (pw::value(ima) < 3u)(p) << std::endl;
+
+ // pw::value(ima) < 3;
+}
1
0