Commit e102484e authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Make use of value::next in Milena.

	* mln/accu/label_used.hh,
	* mln/core/internal/labeled_image_base.hh,
	* mln/labeling/colorize.hh,
	* mln/labeling/compute.hh,
	* mln/labeling/superpose.hh,
	* mln/make/relabelfun.hh,
	* mln/set/compute_with_weights.hh: Make use of value::next.
parent 9c95965d
2010-10-21 Guillaume Lazzara <z@lrde.epita.fr>
Make use of value::next in Milena.
* mln/accu/label_used.hh,
* mln/core/internal/labeled_image_base.hh,
* mln/labeling/colorize.hh,
* mln/labeling/compute.hh,
* mln/labeling/superpose.hh,
* mln/make/relabelfun.hh,
* mln/set/compute_with_weights.hh: Make use of value::next.
2010-10-21 Guillaume Lazzara <z@lrde.epita.fr>
 
Add value::next routine.
......@@ -34,6 +34,7 @@
# include <mln/accu/internal/base.hh>
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/math/max.hh>
# include <mln/value/next.hh>
# include <mln/fun/i2v/array.hh>
......@@ -117,7 +118,7 @@ namespace mln
label_used<L>::take(const argument& l)
{
if (label_used_.size() <= l)
label_used_.resize(unsigned(l) + 1, false);
label_used_.resize(value::next(l), false);
label_used_(l) = true;
}
......
// 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.
//
......@@ -40,6 +41,7 @@
# include <mln/labeling/relabel.hh>
# include <mln/util/array.hh>
# include <mln/value/next.hh>
# include <mln/pw/cst.hh>
# include <mln/pw/value.hh>
......@@ -279,7 +281,7 @@ namespace mln
labeled_image_base<I,E>::update_data(const fun::i2v::array<mln_value(I)>& relabel_fun)
{
util::array<accu::shape::bbox<mln_psite(I)> >
new_bboxes(static_cast<unsigned>(this->data_->nlabels_) + 1);
new_bboxes(mln::value::next(this->data_->nlabels_));
exact(this)->init_update_data_();
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -40,6 +40,7 @@
# include <mln/accu/stat/max.hh>
# include <mln/util/array.hh>
# include <mln/util/set.hh>
# include <mln/value/next.hh>
namespace mln
......@@ -192,7 +193,7 @@ namespace mln
// mlc_is_a(mln_value(L), mln::value::Symbolic)::check();
(void) value;
unsigned label_count = static_cast<unsigned>(nlabels) + 1;
unsigned label_count = value::next(nlabels);
static fun::i2v::array<V> f(0);
int diff_size = f.size() - label_count;
if (diff_size < 0)
......
......@@ -51,6 +51,7 @@
# include <mln/util/array.hh>
# include <mln/convert/from_to.hh>
# include <mln/geom/ncols.hh>
# include <mln/value/next.hh>
namespace mln
......@@ -210,7 +211,7 @@ namespace mln
const A& a = exact(a_);
const L& label = exact(label_);
util::array<A> accus(static_cast<unsigned>(nlabels) + 1, a);
util::array<A> accus(value::next(nlabels), a);
mln_piter(L) p(label.domain());
for_all(p)
......@@ -244,12 +245,12 @@ namespace mln
trace::entering("labeling::impl::generic::compute");
internal::compute_tests(A(), label_, nlabels);
if (static_cast<unsigned>(nlabels) + 1 != accus.size())
if (value::next(nlabels) != accus.size())
{
accus.resize(0); // Make sure all the accumulators are
// re-initialized when resizing on next
// line.
accus.resize(static_cast<unsigned>(nlabels) + 1);
accus.resize(value::next(nlabels));
}
const L& label = exact(label_);
......@@ -291,7 +292,7 @@ namespace mln
const I& input = exact(input_);
const L& label = exact(label_);
util::array<A> accus(static_cast<unsigned>(nlabels) + 1, a);
util::array<A> accus(value::next(nlabels), a);
mln_piter(I) p(input.domain());
for_all(p)
......@@ -330,12 +331,12 @@ namespace mln
const L& label = exact(label_);
(void) nlabels;
if (static_cast<unsigned>(nlabels) + 1 != accus.size())
if (value::next(nlabels) != accus.size())
{
accus.resize(0); // Make sure all the accumulators are
// re-initialized when resizing on next
// line.
accus.resize(static_cast<unsigned>(nlabels) + 1);
accus.resize(value::next(nlabels));
}
mln_piter(I) p(input.domain());
......@@ -383,7 +384,7 @@ namespace mln
// FIXME: check image properties + add doc.
util::array<A> accus(static_cast<unsigned>(nlabels) + 1, a);
util::array<A> accus(value::next(nlabels), a);
unsigned ncols = geom::ncols(label);
......@@ -438,12 +439,12 @@ namespace mln
const L& label = exact(label_);
(void) nlabels;
if (static_cast<unsigned>(nlabels) + 1 != accus.size())
if (value::next(nlabels) != accus.size())
{
accus.resize(0); // Make sure all the accumulators are
// re-initialized when resizing on next
// line.
accus.resize(static_cast<unsigned>(nlabels) + 1);
accus.resize(value::next(nlabels));
}
unsigned ncols = geom::ncols(label);
......@@ -742,7 +743,7 @@ namespace mln
typedef util::array<mln_result(A)> R;
R res = internal::compute_dispatch(accus, label, nlabels);
mln_postcondition(res.nelements() == static_cast<unsigned>(nlabels) + 1);
mln_postcondition(res.nelements() == value::next(nlabels));
trace::exiting("labeling::compute");
return res;
......@@ -764,7 +765,7 @@ namespace mln
typedef util::array<mln_result(A)> R;
R res = internal::compute_dispatch(a, label, nlabels);
mln_postcondition(res.nelements() == static_cast<unsigned>(nlabels) + 1);
mln_postcondition(res.nelements() == value::next(nlabels));
trace::exiting("labeling::compute");
return res;
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -39,8 +39,6 @@
# include <mln/data/transform.hh>
# include <mln/data/transform_inplace.hh>
# include <mln/value/label.hh>
namespace mln
......
// 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.
//
......@@ -37,6 +38,9 @@
# include <mln/data/paste.hh>
# include <mln/pw/all.hh>
# include <mln/value/next.hh>
# include <mln/value/equiv.hh>
namespace mln
{
......@@ -94,18 +98,18 @@ namespace mln
mln_concrete(I) output = duplicate(lhs);
util::array<mln_value(J)>
rebase_lbl(static_cast<unsigned>(rhs_nlabels) + 1);
rebase_lbl(value::next(rhs_nlabels));
rebase_lbl(0) = 0;
for (unsigned i = 1; i <= rhs_nlabels; ++i)
rebase_lbl(i) = i + static_cast<unsigned>(lhs_nlabels);
rebase_lbl(i) = i + value::equiv(lhs_nlabels);
data::paste(labeling::relabel(rhs, rhs_nlabels, rebase_lbl)
| (pw::value(rhs) != pw::cst(literal::zero)),
output);
new_nlabels = static_cast<unsigned>(lhs_nlabels)
+ static_cast<unsigned>(rhs_nlabels) + 1;
new_nlabels = value::equiv(lhs_nlabels)
+ value::equiv(rhs_nlabels) + 1;
trace::exiting("mln::labeling::superpose");
return output;
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -32,7 +33,7 @@
# include <mln/core/concept/function.hh>
# include <mln/fun/i2v/array.hh>
# include <mln/value/label.hh>
# include <mln/value/next.hh>
namespace mln
{
......@@ -87,7 +88,7 @@ namespace mln
const F& fv2b = exact(fv2b_);
unsigned nlabels_i = static_cast<unsigned>(nlabels) + 1;
unsigned nlabels_i = value::next(nlabels);
V tmp_nlabels = literal::zero;
fun::i2v::array<V> fi2v(nlabels_i, literal::zero);
for (V i = 1; i < nlabels_i; ++i)
......@@ -110,7 +111,7 @@ namespace mln
const F& fv2v = exact(fv2v_);
unsigned nlabels_i = static_cast<unsigned>(nlabels) + 1;
unsigned nlabels_i = value::next(nlabels);
util::array<V> new_labels(nlabels_i, mln_max(V));
new_labels(0) = literal::zero;
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -37,6 +38,7 @@
# include <mln/core/concept/site_set.hh>
# include <mln/util/array.hh>
# include <mln/convert/from_to.hh>
# include <mln/value/next.hh>
namespace mln
......@@ -187,7 +189,7 @@ namespace mln
internal::compute_with_weights_tests(a, w, label);
util::array<A> accus(static_cast<unsigned>(nlabels) + 1, a);
util::array<A> accus(value::next(nlabels), a);
mln_piter(I) p(w.domain());
for_all(p)
......
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