Commit 4ebb5d64 authored by Roland Levillain's avatar Roland Levillain
Browse files

Improve topo::skeleton::breadth_first_thinning.

	* mln/topo/skeleton/breadth_first_thinning.hh
	(mln::topo::skeleton::breadth_first_thinning):
	Fix a bias in the algorithm due to a buggy predicate.
	Introduce a temporary psite to help the compiler.
	Fix the type of `output'.
parent 7e43020f
2010-05-04 Roland Levillain <roland@lrde.epita.fr>
Improve topo::skeleton::breadth_first_thinning.
* mln/topo/skeleton/breadth_first_thinning.hh
(mln::topo::skeleton::breadth_first_thinning):
Fix a bias in the algorithm due to a buggy predicate.
Introduce a temporary psite to help the compiler.
Fix the type of `output'.
2013-08-29 Roland Levillain <roland@lrde.epita.fr>
 
Catch up with the new interface of the topological watershed.
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -90,7 +90,7 @@ namespace mln
F& is_simple = exact(is_simple_);
const H& constraint = exact(constraint_);
I output = duplicate(input);
mln_concrete(I) output = duplicate(input);
// Attach the work image to IS_SIMPLE.
is_simple.set_image(output);
......@@ -133,15 +133,23 @@ namespace mln
/* FIXME: We compute the cell and attachment of P twice:
during the call to is_simple() and within detach().
How could we reuse this elegantly, without breaking
the genericity of the skeleton algorithm? */
the genericity of the skeleton algorithm?
Also, keep in mind that functors can maintain an
internal state and make side effects, meaning that
e.g. constraint(p) might not be constant for a
given p during the thinning. */
if (constraint(p) && is_simple(p))
{
detach(p, output);
mln_niter(N) n(nbh, p);
for_all(n)
mln_niter(N) n_(nbh, p);
for_all(n_)
{
// Same remark as above regarding P and P_.
psite n = n_;
if (output.domain().has(n)
&& output(n) && constraint(p) && is_simple(n))
&& output(n) && constraint(n) && is_simple(n))
next_set.insert(n);
}
}
}
set.clear();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment