---
ChangeLog | 10 ++++++++++
milena/mln/labeling/compute.hh | 36 ++++++++++++++----------------------
milena/sandbox/scribo/demat.hh | 7 +++----
milena/tests/labeling/compute.cc | 5 +++--
4 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d1e291a..e8de481 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Update the prototype of labeling::compute().
+ * milena/mln/labeling/compute.hh: change the return type to an
+ util::array.
+
+ * milena/sandbox/scribo/demat.hh,
+ * milena/tests/labeling/compute.cc: update according the new
+ prototype.
+
+2008-15-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Remove the useless '_' postfix in all the accumulators.
* milena/doc/examples/tuto_bis.cc,
* milena/doc/tutorial/examples/accu.cc,
diff --git a/milena/mln/labeling/compute.hh b/milena/mln/labeling/compute.hh
index e68ac30..cea30b1 100644
--- a/milena/mln/labeling/compute.hh
+++ b/milena/mln/labeling/compute.hh
@@ -57,7 +57,7 @@ namespace mln
* It fully relies on labeling::update.
*/
template <typename A, typename I, typename J>
- p_array<mlc_unqualif(mln_result(A))>
+ util::array<mln_result(A)>
compute(const Accumulator<A>& a,
const Image<I>& input,
const Image<J>& label, mln_value(J) nlabels);
@@ -75,7 +75,7 @@ namespace mln
* It fully relies on labeling::update.
*/
template <typename A, typename I, typename J>
- p_array<mlc_unqualif(mln_accu_with(A, mln_value(I))::result)>
+ util::array<mln_accu_with(A, mln_value(I))::result>
compute(const Meta_Accumulator<A>& a,
const Image<I>& input,
const Image<J>& label, mln_value(J) nlabels);
@@ -92,7 +92,7 @@ namespace mln
* It fully relies on labeling::update.
*/
template <typename A, typename J>
- p_array<mlc_unqualif(mln_result(A))>
+ util::array<mln_result(A)>
compute(const Accumulator<A>& a,
const Image<J>& label, mln_value(J) nlabels);
@@ -108,7 +108,7 @@ namespace mln
* It fully relies on labeling::update.
*/
template <typename A, typename J>
- p_array<mlc_unqualif(mln_accu_with(A, mln_psite(J))::result)>
+ util::array<mln_accu_with(A, mln_psite(J))::result>
compute(const Meta_Accumulator<A>& a,
const Image<J>& label, mln_value(J) nlabels);
@@ -121,7 +121,7 @@ namespace mln
template <typename A, typename I, typename J>
inline
- p_array<mlc_unqualif(mln_result(A))>
+ util::array<mln_result(A)>
compute(const Accumulator<A>&,
const Image<I>& input_,
const Image<J>& label_, mln_value(J) nlabels)
@@ -132,19 +132,15 @@ namespace mln
const J& label = exact(label_);
util::array<A> accus;
- for (mln_value(J) i = 0; i < nlabels; ++i)
+ for (mln_value(J) i = 0; i <= nlabels; ++i)
accus.append(A());
mln_piter(I) p(input.domain());
mln_value(J) l;
for_all(p)
- {
- l = label(p) - 1;
- if (l >= 0)
- accus[l].take(input(p));
- }
+ accus[label(p)].take(input(p));
- p_array<mln_result(A)> results;
+ util::array<mln_result(A)> results;
for (unsigned i = 0; i < accus.nelements(); ++i)
results.append(accus[i]);
@@ -154,7 +150,7 @@ namespace mln
template <typename A, typename I, typename J>
inline
- p_array<mlc_unqualif(mln_accu_with(A, mln_value(I))::result)>
+ util::array<mln_accu_with(A, mln_value(I))::result>
compute(const Meta_Accumulator<A>&,
const Image<I>& input,
const Image<J>& label, mln_value(J) nlabels)
@@ -166,7 +162,7 @@ namespace mln
template <typename A, typename J>
inline
- p_array<mlc_unqualif(mln_result(A))>
+ util::array<mln_result(A)>
compute(const Accumulator<A>& a,
const Image<J>& label_, mln_value(J) nlabels)
{
@@ -175,19 +171,15 @@ namespace mln
const J& label = exact(label_);
util::array<A> accus;
- for (mln_value(J) i = 0; i < nlabels; ++i)
+ for (mln_value(J) i = 0; i <= nlabels; ++i)
accus.append(exact(a));
mln_piter(J) p(label.domain());
mln_value(J) l;
for_all(p)
- {
- l = label(p) - 1;
- if (l >= 0)
- accus[l].take(p);
- }
+ accus[label(p)].take(p);
- p_array<mlc_unqualif(mln_result(A))> results;
+ util::array<mln_result(A)> results;
for (unsigned i = 0; i < accus.nelements(); ++i)
results.append(accus[i]);
@@ -198,7 +190,7 @@ namespace mln
template <typename A, typename J>
inline
- p_array<mlc_unqualif(mln_accu_with(A, mln_psite(J))::result)>
+ util::array<mln_accu_with(A, mln_psite(J))::result>
compute(const Meta_Accumulator<A>&,
const Image<J>& label, mln_value(J) nlabels)
{
diff --git a/milena/sandbox/scribo/demat.hh b/milena/sandbox/scribo/demat.hh
index bba9105..7a35ee9 100644
--- a/milena/sandbox/scribo/demat.hh
+++ b/milena/sandbox/scribo/demat.hh
@@ -73,17 +73,16 @@ namespace scribo
typedef image2d<int_u8> I;
typedef mln_accu_with_(accu::meta::bbox, mln_psite_(I)) A;
- typedef p_array<mlc_unqualif_(A::result)> boxes_t;
+ typedef util::array<A::result> boxes_t;
int_u8 nlabels;
I lbl = labeling::blobs(filter, c4(), nlabels);
boxes_t boxes = labeling::compute(accu::meta::bbox(), lbl, nlabels);
- mln_piter_(boxes_t) p(boxes);
- for_all(p)
+ for (unsigned i = 1; i <= nlabels; ++i)
level::paste(pw::cst(false)
- | p.to_site().to_larger(bbox_larger),
+ | boxes[i].to_larger(bbox_larger),
ima);
}
diff --git a/milena/tests/labeling/compute.cc b/milena/tests/labeling/compute.cc
index e333ab9..070dc6c 100644
--- a/milena/tests/labeling/compute.cc
+++ b/milena/tests/labeling/compute.cc
@@ -37,6 +37,7 @@
#include <mln/accu/count.hh>
#include <mln/accu/sum.hh>
#include <mln/value/int_u8.hh>
+#include <mln/util/array.hh>
int main()
{
@@ -55,7 +56,7 @@ int main()
int_u8 nlabels = 3;
accu::sum<int_u8> sum;
- p_array<float> sums = labeling::compute(sum, ima, ima, nlabels);
+ util::array<float> sums = labeling::compute(sum, ima, ima, nlabels);
mln_assertion(sums[0] == 0);
mln_assertion(sums[1] == 4);
mln_assertion(sums[2] == 8);
@@ -68,7 +69,7 @@ int main()
mln_assertion(sums[3] == 12);
accu::count<mln_site_(image2d<int_u8>)> count;
- p_array<unsigned int> counts = labeling::compute(count, ima, nlabels);
+ util::array<unsigned int> counts = labeling::compute(count, ima, nlabels);
mln_assertion(counts[0] == 18);
mln_assertion(counts[1] == 4);
mln_assertion(counts[2] == 4);
--
1.5.6.5