Commit 1c596f64 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Use sites instead of pixels in canvas::labeling::blobs functors.

	* mln/canvas/labeling/blobs.hh,
	* mln/labeling/blobs.hh: Update members prototypes.

	* mln/labeling/blobs_and_compute.hh: Do not construct on-the-fly
	pixels anymore.
parent 70ca8455
2010-06-03 Guillaume Lazzara <z@lrde.epita.fr>
Use sites instead of pixels in canvas::labeling::blobs functors.
* mln/canvas/labeling/blobs.hh,
* mln/labeling/blobs.hh: Update members prototypes.
* mln/labeling/blobs_and_compute.hh: Do not construct on-the-fly
pixels anymore.
2010-05-25 Guillaume Lazzara <z@lrde.epita.fr>
 
Small fixes.
// 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.
//
......@@ -87,8 +88,10 @@ namespace mln
template <typename I, typename N, typename L, typename F>
mln_ch_value(I, L)
blobs(const I& input, const N& nbh, L& nlabels, F& functor)
blobs(const Image<I>& input_, const N& nbh, L& nlabels, F& functor)
{
const I& input = exact(input_);
typedef mln_psite(I) P;
P cur;
......@@ -125,7 +128,8 @@ for this label type: nlabels > max(label_type).");
mln_invariant(qu.is_empty());
qu.push(p);
output(p) = nlabels;
functor.process_p(util::pix<out_t>(output, p)); // <-- functor.process_p()
functor.process_p(p); // <-- functor.process_p()
// output(p) == nlabels
do
{
cur = qu.front();
......@@ -136,21 +140,24 @@ for this label type: nlabels > max(label_type).");
mln_invariant(! qu.compute_has(n));
qu.push(n);
output(n) = nlabels;
functor.process_n(util::pix<out_t>(output, n)); // <-- functor.process_n()
functor.process_n(n); // <-- functor.process_n()
// output(n) == nlabels
}
}
while (! qu.is_empty());
}
functor.finalize(); // <-- functor.finalize()
return output;
}
} // end of namespace mln::labeling::impl::generic
} // end of namespace mln::labeling::impl
} // end of namespace mln::canvas::labeling::impl
// Facade.
......
......@@ -83,9 +83,9 @@ namespace mln
void new_label(const mln_value(L)&) {}
void process_p(const util::pix<L>&) {}
void process_p(const mln_site(L)&) {}
void process_n(const util::pix<L>&) {}
void process_n(const mln_site(L)&) {}
void finalize() {}
};
......
......@@ -83,28 +83,33 @@ namespace mln
{
}
inline
void init()
{
accus_.reserve(static_cast<unsigned>(nlabels_));
accus_.reserve(1000);
accus_.append(A());
}
inline
void new_label(const mln_value(L)& l)
{
current_lbl_ = l;
accus_.append(A());
}
void process_p(const util::pix<L>& pix)
inline
void process_p(const mln_site(L)& p)
{
process__(accu_argument(), pix);
process__(accu_argument(), p);
}
void process_n(const util::pix<L>& pix)
inline
void process_n(const mln_site(L)& n)
{
process__(accu_argument(), pix);
process__(accu_argument(), n);
}
inline
void finalize()
{
convert::from_to(accus_, result_);
......@@ -112,19 +117,23 @@ namespace mln
private:
void process__(const mln_psite(L)&, const util::pix<L>& pix)
inline
void process__(const mln_psite(L)&, const mln_site(L)& p)
{
accus_[current_lbl_].take(pix.p());
accus_[current_lbl_].take(p);
}
void process__(const mln_value(L)&, const util::pix<L>& pix)
inline
void process__(const mln_value(L)&, const mln_site(L)&)
{
accus_[current_lbl_].take(pix.v());
accus_[current_lbl_].take(current_lbl_);
}
void process__(const util::pix<L>&, const util::pix<L>& pix)
template <typename V>
inline
void process__(const V&, const mln_site(L)&)
{
accus_[current_lbl_].take(pix);
mlc_abort(V)::check();
}
public:
......
Supports Markdown
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