https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Use unmeta and handle accu object when needed.
* mln/level/compute.hh,
* mln/accu/compute.hh,
* mln/morpho/elementary/like_ero_fun.hh,
* mln/labeling/compute.hh: Use unmeta.
* mln/accu/transform_directional.hh,
* mln/accu/transform_diagonal.hh,
* mln/accu/transform_snake.hh: Handle the accu object.
(FIXME): Remove.
* mln/accu/transform_stop.hh: Layout.
accu/compute.hh | 7 +++---
accu/transform_diagonal.hh | 44 +++++++++++++++-----------------------
accu/transform_directional.hh | 20 ++++++++---------
accu/transform_snake.hh | 26 ++++++++++++----------
labeling/compute.hh | 16 ++++++++-----
level/compute.hh | 8 ++++--
morpho/elementary/like_ero_fun.hh | 12 +++++-----
7 files changed, 67 insertions(+), 66 deletions(-)
Index: mln/level/compute.hh
--- mln/level/compute.hh (revision 2885)
+++ mln/level/compute.hh (working copy)
@@ -94,10 +94,12 @@
template <typename A, typename I>
inline
mln_accu_with(A, mln_value(I))::result
- compute(const Meta_Accumulator<A>&, const Image<I>& input)
+ compute(const Meta_Accumulator<A>& a, const Image<I>& input)
{
- mln_accu_with(A, mln_value(I)) accu;
- return level::compute(accu, input); // Call the previous version.
+ typedef mln_accu_with(A, mln_value(I)) A_;
+ A_ a_ = accu::unmeta(exact(a), mln_value(I)());
+
+ return level::compute(a_, input); // Call the previous version.
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/accu/transform_directional.hh
--- mln/accu/transform_directional.hh (revision 2885)
+++ mln/accu/transform_directional.hh (working copy)
@@ -58,14 +58,14 @@
template <typename A, typename I, typename W>
mln_ch_value(I, mln_result(A))
- transform_directional(const Accumulator<A>&,
+ transform_directional(const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win,
unsigned dir);
template <typename A, typename I, typename W>
mln_ch_value(I, mln_accu_with(A, mln_value(I))::result)
- transform_directional(const Meta_Accumulator<A>&,
+ transform_directional(const Meta_Accumulator<A>& a,
const Image<I>& input, const Window<W>& win,
unsigned dir);
@@ -135,10 +135,10 @@
q_l,
q_r;
- directional_functor(const I& input, const W& win, int dir)
+ directional_functor(const I& input, const W& win, const A& a, int dir)
: input(input),
win(win),
- accu(),
+ accu(a),
dir(dir),
win_left(win::shift(win, -dp_directional<dpsite>(dir)) - win),
win_right(win - win::shift(win, -dp_directional<dpsite>(dir))),
@@ -202,10 +202,10 @@
mln_qixter(const I, window2d) q_l, q_r;
- directional_fastest_functor(const I& input, const W& win, unsigned dir)
+ directional_fastest_functor(const I& input, const W& win, const A& a,
unsigned dir)
: input(input),
win(win),
- accu(),
+ accu(a),
dir(dir),
win_left(win::shift(win, -dp_directional<dpsite>(dir)) - win),
win_right(win - win::shift(win, -dp_directional<dpsite>(dir))),
@@ -254,12 +254,12 @@
inline
mln_ch_value(I, mln_result(A))
transform_directional_dispatch(trait::image::speed::any,
- const Accumulator<A>& /* FIXME a */,
+ const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win,
unsigned dir)
{
typedef directional_functor<I, W, A> F;
- F f(exact(input), exact(win), dir); // FIXME: Pass a to f.
+ F f(exact(input), exact(win), exact(a), dir);
canvas::browsing::directional(f);
return f.output;
}
@@ -268,12 +268,12 @@
inline
mln_ch_value(I, mln_result(A))
transform_directional_dispatch(trait::image::speed::fastest,
- const Accumulator<A>& /* FIXME a*/,
+ const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win,
unsigned dir)
{
typedef directional_fastest_functor<I, W, A> F;
- F f(exact(input), exact(win), dir); // FIXME: Pass a to f.
+ F f(exact(input), exact(win), exact(a), dir);
canvas::browsing::directional(f);
return f.output;
}
Index: mln/accu/transform_diagonal.hh
--- mln/accu/transform_diagonal.hh (revision 2885)
+++ mln/accu/transform_diagonal.hh (working copy)
@@ -62,13 +62,13 @@
template <typename A, typename I, typename W>
mln_ch_value(I, mln_result(A))
- transform_diagonal(const Accumulator<A>&,
+ transform_diagonal(const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win);
template <typename A, typename I, typename W>
mln_ch_value(I, mln_accu_with(A, mln_value(I))::result)
- transform_diagonal(const Meta_Accumulator<A>&,
+ transform_diagonal(const Meta_Accumulator<A>& a,
const Image<I>& input, const Window<W>& win);
@@ -114,17 +114,15 @@
mln_psite(I) p;
enum { dim = I::site::dim };
- unsigned dir;
window2d win_left, win_right;
mln_qiter(window2d) q_l, q_r;
- diagonal_functor(const I& input, const W& win)
+ diagonal_functor(const I& input, const W& win, const A& a)
: input(input),
win(win),
- accu(),
- dir(dir),
+ accu(a),
win_left(win::shift(win, dpsite(1, -1)) - win),
win_right(win - win::shift(win, dpsite(1, -1))),
q_l(win_left, p),
@@ -178,17 +176,15 @@
mln_psite(I) p;
enum { dim = I::site::dim };
- unsigned dir;
window2d win_left, win_right;
mln_qiter(window2d) q_l, q_r;
- backdiagonal_functor(const I& input, const W& win)
+ backdiagonal_functor(const I& input, const W& win, const A& a)
: input(input),
win(win),
- accu(),
- dir(dir),
+ accu(a),
win_left(win::shift(win, dpsite(-1, -1)) - win),
win_right(win - win::shift(win, dpsite(-1, -1))),
q_l(win_left, p),
@@ -245,17 +241,15 @@
mln_psite(I) p;
enum { dim = I::site::dim };
- unsigned dir;
window2d win_left, win_right;
mln_qixter(const I, window2d) q_l, q_r;
- diagonal_fastest_functor(const I& input, const W& win)
+ diagonal_fastest_functor(const I& input, const W& win, const A& a)
: input(input),
win(win),
- accu(),
- dir(dir),
+ accu(a),
win_left(win::shift(win, dpsite(1, -1)) - win),
win_right(win - win::shift(win, dpsite(1, -1))),
q_l(input, win_left, p),
@@ -308,17 +302,15 @@
mln_psite(I) p;
enum { dim = I::site::dim };
- unsigned dir;
window2d win_left, win_right;
mln_qixter(const I, window2d) q_l, q_r;
- backdiagonal_fastest_functor(const I& input, const W& win)
+ backdiagonal_fastest_functor(const I& input, const W& win, const A& a)
: input(input),
win(win),
- accu(),
- dir(dir),
+ accu(a),
win_left(win::shift(win, dpsite(-1, -1)) - win),
win_right(win - win::shift(win, dpsite(-1, -1))),
q_l(input, win_left, p),
@@ -366,11 +358,11 @@
inline
mln_ch_value(I, mln_result(A))
transform_diagonal_dispatch(trait::image::speed::any,
- const Accumulator<A>& /* FIXME a */,
+ const Accumulator<A>& a,
const Image<I>& input, const win::diag2d& win)
{
typedef diagonal_functor<I, win::diag2d, A> F;
- F f(exact(input), win); // FIXME: Pass a to f.
+ F f(exact(input), win, exact(a));
canvas::browsing::diagonal2d(f);
return f.output;
}
@@ -379,11 +371,11 @@
inline
mln_ch_value(I, mln_result(A))
transform_diagonal_dispatch(trait::image::speed::any,
- const Accumulator<A>& /* FIXME a */,
+ const Accumulator<A>& a,
const Image<I>& input, const win::backdiag2d& win)
{
typedef backdiagonal_functor<I, win::backdiag2d, A> F;
- F f(exact(input), win); // FIXME: Pass a to f.
+ F f(exact(input), win, exact(a));
canvas::browsing::backdiagonal2d(f);
return f.output;
}
@@ -392,11 +384,11 @@
inline
mln_ch_value(I, mln_result(A))
transform_diagonal_dispatch(trait::image::speed::fastest,
- const Accumulator<A>& /* FIXME a*/,
+ const Accumulator<A>& a,
const Image<I>& input, const win::diag2d& win)
{
typedef diagonal_fastest_functor<I, win::diag2d, A> F;
- F f(exact(input), win); // FIXME: Pass a to f.
+ F f(exact(input), win, exact(a));
canvas::browsing::diagonal2d(f);
return f.output;
}
@@ -405,11 +397,11 @@
inline
mln_ch_value(I, mln_result(A))
transform_diagonal_dispatch(trait::image::speed::fastest,
- const Accumulator<A>& /* FIXME a*/,
+ const Accumulator<A>& a,
const Image<I>& input, const win::backdiag2d& win)
{
typedef backdiagonal_fastest_functor<I, win::backdiag2d, A> F;
- F f(exact(input), win); // FIXME: Pass a to f.
+ F f(exact(input), win, exact(a));
canvas::browsing::backdiagonal2d(f);
return f.output;
}
Index: mln/accu/transform_stop.hh
Index: mln/accu/transform_snake.hh
--- mln/accu/transform_snake.hh (revision 2885)
+++ mln/accu/transform_snake.hh (working copy)
@@ -60,12 +60,12 @@
template <typename A, typename I, typename W>
mln_ch_value(I, mln_result(A))
- transform_snake(const Accumulator<A>&, const Image<I>& input,
const Window<W>& win);
+ transform_snake(const Accumulator<A>& a, const Image<I>& input,
const Window<W>& win);
template <typename A, typename I, typename W>
mln_ch_value(I, mln_accu_with(A, mln_value(I))::result)
- transform_snake(const Meta_Accumulator<A>&, const Image<I>&
input, const Window<W>& win);
+ transform_snake(const Meta_Accumulator<A>& a, const Image<I>&
input, const Window<W>& win);
@@ -101,9 +101,10 @@
const I& input;
const W& win;
- mln_ch_value(I, mln_result(A)) output;
A accu;
+ mln_ch_value(I, mln_result(A)) output;
+
mln_psite(I) p;
window2d
@@ -129,10 +130,10 @@
std::vector<move_fun> moves;
std::vector<dpsite> dps;
- transform_snake_functor(const Image<I>& input, const Window<W>&
win)
+ transform_snake_functor(const Image<I>& input, const Window<W>& win,
const Accumulator<A>& a)
: input(exact(input)),
win(exact(win)),
- accu(),
+ accu(exact(a)),
win_left_fwd(win::shift(win, mln::left) - win),
win_right_fwd(win - win::shift(win, mln::left)),
@@ -253,9 +254,10 @@
const I& input;
const W& win;
- mln_ch_value(I, mln_result(A)) output;
A accu;
+ mln_ch_value(I, mln_result(A)) output;
+
mln_psite(I) p;
window2d
@@ -282,10 +284,10 @@
std::vector<move_fun> moves;
std::vector<dpsite> dps;
- transform_snake_fastest_functor(const I& input, const W& win)
+ transform_snake_fastest_functor(const I& input, const W& win, const A& a)
: input(input),
win(win),
- accu(),
+ accu(a),
win_left_fwd(win::shift(win, mln::left) - win),
win_right_fwd(win - win::shift(win, mln::left)),
@@ -394,11 +396,11 @@
inline
mln_ch_value(I, mln_result(A))
transform_snake_dispatch(trait::image::speed::any,
- const Accumulator<A>& /* FIXME a */,
+ const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win)
{
typedef transform_snake_functor<I, W, A> F;
- F f(exact(input), exact(win)); // FIXME: Pass a to f.
+ F f(exact(input), exact(win), exact(a));
canvas::browsing::snake_generic(f);
return f.output;
}
@@ -407,11 +409,11 @@
inline
mln_ch_value(I, mln_result(A))
transform_snake_dispatch(trait::image::speed::fastest,
- const Accumulator<A>& /* FIXME a*/,
+ const Accumulator<A>& a,
const Image<I>& input, const Window<W>& win)
{
typedef transform_snake_fastest_functor<I, W, A> F;
- F f(exact(input), exact(win)); // FIXME: Pass a to f.
+ F f(exact(input), exact(win), exact(a));
canvas::browsing::snake_generic(f);
return f.output;
}
Index: mln/accu/compute.hh
--- mln/accu/compute.hh (revision 2885)
+++ mln/accu/compute.hh (working copy)
@@ -142,15 +142,16 @@
template <typename A, typename I>
inline
mln_accu_with(A, util::pix<I>)::result
- compute(const Meta_Accumulator<A>&, const Image<I>& input)
+ compute(const Meta_Accumulator<A>& a, const Image<I>& input)
{
trace::entering("accu::compute");
mln_precondition(exact(input).has_data());
typedef mln_accu_with(A, util::pix<I>) A_;
- A_ a;
- mln_result(A_) output = internal::compute_dispatch(a, input);
+ A_ a_ = accu::unmeta(exact(a), util::pix<I>());
+
+ mln_result(A_) output = internal::compute_dispatch(a_, input);
trace::exiting("accu::compute");
return output;
Index: mln/morpho/elementary/like_ero_fun.hh
--- mln/morpho/elementary/like_ero_fun.hh (revision 2885)
+++ mln/morpho/elementary/like_ero_fun.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,7 +48,7 @@
template <typename A, typename F,
typename I, typename N>
mln_concrete(I)
- like_ero_fun(const Meta_Accumulator<A>&, const F& f,
+ like_ero_fun(const Meta_Accumulator<A>& a, const F& f,
const Image<I>& input, const Neighborhood<N>& nbh);
@@ -79,7 +79,7 @@
template <typename A, typename F,
typename I, typename N>
mln_concrete(I)
- like_ero_fun(const Meta_Accumulator<A>&, const F& f,
+ like_ero_fun(const Meta_Accumulator<A>& a_, const F& f,
const Image<I>& input_, const Neighborhood<N>& nbh_)
{
trace::entering("morpho::elementary::impl::generic::like_ero_fun");
@@ -87,7 +87,7 @@
const I& input = exact(input_);
const N& nbh = exact(nbh_);
- mln_accu_with(A, mln_value(I)) a;
+ mln_accu_with(A, mln_value(I)) a = accu::unmeta(exact(a_), mln_value(I)());
extension::adjust_fill(input, nbh, a);
mln_concrete(I) output;
@@ -113,7 +113,7 @@
template <typename A, typename F,
typename I, typename N>
mln_concrete(I)
- like_ero_fun_fastest(const Meta_Accumulator<A>&, const F& f,
+ like_ero_fun_fastest(const Meta_Accumulator<A>& a_, const F& f,
const Image<I>& input_, const Neighborhood<N>& nbh_)
{
trace::entering("morpho::elementary::impl::like_ero_fun_fastest");
@@ -121,7 +121,7 @@
const I& input = exact(input_);
const N& nbh = exact(nbh_);
- mln_accu_with(A, mln_value(I)) a;
+ mln_accu_with(A, mln_value(I)) a = accu::unmeta(exact(a_), mln_value(I)());
extension::adjust_fill(input, nbh, a);
mln_concrete(I) output;
Index: mln/labeling/compute.hh
--- mln/labeling/compute.hh (revision 2885)
+++ mln/labeling/compute.hh (working copy)
@@ -150,12 +150,14 @@
template <typename A, typename I, typename J>
inline
util::array<mln_accu_with(A, mln_value(I))::result>
- compute(const Meta_Accumulator<A>&,
+ compute(const Meta_Accumulator<A>& a,
const Image<I>& input,
const Image<J>& label, mln_value(J) nlabels)
{
- mln_accu_with(A, mln_value(I)) accu;
- return compute(accu, input, label, nlabels);
+ typedef mln_accu_with(A, mln_value(I)) A_;
+ A_ a_ = accu::unmeta(exact(a), mln_value(I)());
+
+ return compute(a_, input, label, nlabels);
}
@@ -190,11 +192,13 @@
template <typename A, typename J>
inline
util::array<mln_accu_with(A, mln_psite(J))::result>
- compute(const Meta_Accumulator<A>&,
+ compute(const Meta_Accumulator<A>& a,
const Image<J>& label, mln_value(J) nlabels)
{
- mln_accu_with(A, mln_psite(J)) accu;
- return compute(accu, label, nlabels);
+ typedef mln_accu_with(A, mln_psite(J)) A_;
+ A_ a_ = accu::unmeta(exact(a), mln_psite(J)());
+
+ return compute(a_, label, nlabels);
}