https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena/sandbox
Index: ChangeLog
from Alexandre Abraham <abraham(a)lrde.epita.fr>
Make topological watershed work.
* abraham/tests/core/image/thru_v2w2v.cc:
make::image2d -> make::image.
* abraham/mln/morpho/topo_wst.hh:
fix reversion of tree .
* abraham/mln/value/shell.hh:
add traits.
mln/morpho/topo_wst.hh | 13 +++++++++----
mln/value/shell.hh | 13 ++++++++++++-
tests/core/image/thru_v2w2v.cc | 2 +-
3 files changed, 22 insertions(+), 6 deletions(-)
Index: abraham/tests/core/image/thru_v2w2v.cc
--- abraham/tests/core/image/thru_v2w2v.cc (revision 2842)
+++ abraham/tests/core/image/thru_v2w2v.cc (working copy)
@@ -47,7 +47,7 @@
};
- image2d<double> ima(make::image2d(vs));
+ image2d<double> ima(make::image(vs));
thru<mln::fun::v2w2v::cos<double>, image2d<double> > out(ima);
double i = 0;
Index: abraham/mln/morpho/topo_wst.hh
--- abraham/mln/morpho/topo_wst.hh (revision 2842)
+++ abraham/mln/morpho/topo_wst.hh (working copy)
@@ -91,6 +91,7 @@
mln_value(I) min() { return mln_min(mln_value(I)); }
mln_value(I) max() { return mln_max(mln_value(I)); }
+ void revert () { level = max() - level + min(); }
}; // struct node
@@ -171,15 +172,15 @@
template <class I, class N>
topo_wst<I, N>::topo_wst(const Image<I>& i,
const Neighborhood<N>& n)
- : pima(exact(i)),
- nbh(exact(n)),
+ : nbh(exact(n)),
Par_node(exact(i).domain(), exact(i).border()),
Par_tree(exact(i).domain(), exact(i).border()),
Rnk_tree(exact(i).domain(), exact(i).border()),
Rnk_node(exact(i).domain(), exact(i).border()),
subtreeRoot(exact(i).domain(), exact(i).border()),
nodes(exact(i).domain(), exact(i).border()),
- isproc(exact(i).domain(), exact(i).border())
+ isproc(exact(i).domain(), exact(i).border()),
+ pima(exact(i))
{
}
@@ -227,7 +228,11 @@
BuildComponentTree();
compressTree();
arith::revert_inplace(pima);
- arith::revert_inplace(nodes);
+ // arith::revert_inplace(nodes);
+ mln_piter(image2d<node>) p (nodes.domain());
+ for_all(p)
+ nodes(p).revert();
+
build_euler_tour();
build_minim();
topo_watershed();
Index: abraham/mln/value/shell.hh
--- abraham/mln/value/shell.hh (revision 2842)
+++ abraham/mln/value/shell.hh (working copy)
@@ -41,9 +41,20 @@
struct shell;
}
- // FIXME : traits
+ namespace trait
+ {
+
+ template <typename F, typename I>
+ struct value_< mln::value::shell<F, I> >
+ :
+ value_< mln_result(F) >
+ {
+ };
+
+ } // end of namespace trait
+
namespace value
{
namespace impl