URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-31 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add functon which display a binary image from a FLLT branch.
* mln/util/tree_to_image.hh:
(display_branch(const Image<J>& ima_, node<I>* node)) :
Take a node and compute its binary image from set_p of FLLT
and display this image.
---
tree_to_image.hh | 40 +++++++++++++++++++++++++++++++++-------
1 file changed, 33 insertions(+), 7 deletions(-)
Index: trunk/milena/mln/util/tree_to_image.hh
===================================================================
--- trunk/milena/mln/util/tree_to_image.hh (revision 1418)
+++ trunk/milena/mln/util/tree_to_image.hh (revision 1419)
@@ -47,23 +47,19 @@
template <typename T, typename I>
void
- tree_to_image_rec(node<T>* node, Image<I>& output_);
-
- template <typename T, typename I>
- void
tree_to_image (tree<T>& tree, Image<I>& output_);
template <typename P, typename J>
void
display_set(const Image<J>& ima_, set_p<P>& s);
- template <typename T, typename J>
+ template <typename I, typename J>
void
- display_tree_rec(const Image<J>& ima_, node<T>* node, int level);
+ display_tree(const Image<J>& ima_, tree<I>& tree);
template <typename I, typename J>
void
- display_tree(const Image<J>& ima_, tree<I>& tree);
+ display_branch(const Image<J>& ima_, node<I>* node);
# ifndef MLN_INCLUDE_ONLY
@@ -142,6 +138,36 @@
display_tree_rec(ima, tree.root(), level);
}
+ template <typename T, typename J, typename K>
+ void
+ display_branch_rec(const Image<J>& ima_, node<T>* node,
Image<K>& output_)
+ {
+ K& output = exact(output_);
+ const J& ima = exact(ima_);
+
+ mln_piter(set_p<point2d>) p(node->elt().points);
+ for_all (p)
+ output(p) = true;
+ typename mln::util::node<T>::children_t::iterator it =
node->children().begin();
+ for (;
+ it != node->children().end(); ++it)
+ display_branch_rec(ima, (*it), output);
+ }
+
+ template <typename I, typename J>
+ void
+ display_branch(const Image<J>& ima_, node<I>* node)
+ {
+ const J& ima = exact(ima_);
+ image2d<bool> output (ima.domain ());
+
+ level::fill(output, false);
+ mln_assertion(node);
+ display_branch_rec(ima, node, output);
+ debug::println(output);
+ }
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::util