https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Move some meta-acc into meta:: and revamp level take'n compute.
* mln/level/take.spe.hh,
* mln/level/take.hh: Merge both files into as...
* mln/level/update.hh: ...this single new one.
Update.
* tests/level/take.cc: Rename as...
* tests/level/update.cc: ...this.
* tests/level/Makefile.am: Update.
* mln/level/compute.hh: Change sig.
* mln/accu/min.hh,
* mln/accu/max.hh,
* mln/accu/min_max.hh,
* mln/accu/pair.hh,
* mln/accu/sum.hh,
* mln/accu/mean.hh: Move meta-accumulator into the meta::
namespace.
* mln/estim/sum.hh,
* mln/estim/min_max.hh,
* mln/estim/mean.hh,
* tests/level/compute_full.cc,
* tests/level/compute.cc: Update.
* tests/estim/min_max.cc: New.
* tests/estim/Makefile.am: Update.
mln/accu/max.hh | 11 +--
mln/accu/mean.hh | 11 +--
mln/accu/min.hh | 14 ++-
mln/accu/min_max.hh | 5 +
mln/accu/pair.hh | 10 +-
mln/accu/sum.hh | 9 +-
mln/estim/mean.hh | 8 +-
mln/estim/min_max.hh | 8 +-
mln/estim/sum.hh | 6 -
mln/level/compute.hh | 158 ++++++++++++++++++++++++++++++++++++--------
mln/level/update.hh | 141 +++++++++++++++++++++++++++++++--------
tests/estim/Makefile.am | 4 -
tests/estim/min_max.cc | 52 ++++++++++++++
tests/level/Makefile.am | 6 -
tests/level/compute.cc | 12 +--
tests/level/compute_full.cc | 22 +++---
tests/level/update.cc | 21 ++---
17 files changed, 379 insertions(+), 119 deletions(-)
Index: tests/level/compute_full.cc
--- tests/level/compute_full.cc (revision 2546)
+++ tests/level/compute_full.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -116,8 +116,8 @@
accu::min_<I> acu_min;
accu::max_<I> acu_max;
- I min = level::compute(ima, acu_min);
- I max = level::compute(ima, acu_max);
+ I min = level::compute(acu_min, ima);
+ I max = level::compute(acu_max, ima);
mln_assertion(min == real_min);
mln_assertion(max == real_max);
}
@@ -128,8 +128,8 @@
accu::min_<I> acu_min;
accu::max_<I> acu_max;
- I min = level::compute(sub_ima, acu_min);
- I max = level::compute(sub_ima, acu_max);
+ I min = level::compute(acu_min, sub_ima);
+ I max = level::compute(acu_max, sub_ima);
mln_assertion(min == real_min2);
mln_assertion(max == real_max2);
}
@@ -141,8 +141,8 @@
accu::min_<I> acu_min;
accu::max_<I> acu_max;
- I min = level::compute(if_ima, acu_min);
- I max = level::compute(if_ima, acu_max);
+ I min = level::compute(acu_min, if_ima);
+ I max = level::compute(acu_max, if_ima);
mln_assertion(min == real_min2);
mln_assertion(max == real_max2);
}
@@ -176,8 +176,8 @@
accu::min_<I> acu_min;
accu::max_<I> acu_max;
- I min = level::compute(ima, acu_min);
- I max = level::compute(ima, acu_max);
+ I min = level::compute(acu_min, ima);
+ I max = level::compute(acu_max, ima);
mln_assertion(min == real_min);
mln_assertion(max == real_max);
@@ -207,8 +207,8 @@
accu::min_<I> acu_min;
accu::max_<I> acu_max;
- I min = level::compute(ima, acu_min);
- I max = level::compute(ima, acu_max);
+ I min = level::compute(acu_min, ima);
+ I max = level::compute(acu_max, ima);
mln_assertion(min == real_min);
mln_assertion(max == real_max);
Index: tests/level/compute.cc
--- tests/level/compute.cc (revision 2546)
+++ tests/level/compute.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -43,11 +43,13 @@
const unsigned size = 200;
image2d<int> ima(size, size);
- accu::min_<int> acu_min;
- accu::max_<int> acu_max;
debug::iota(ima);
- int min = level::compute(ima, acu_min);
- int max = level::compute(ima, acu_max);
+
+ accu::min_<int> m;
+ int min = level::compute(m, ima);
mln_assertion(min == 1);
+
+ accu::max_<int> M;
+ int max = level::compute(M, ima);
mln_assertion(max == 40000);
}
Index: tests/level/update.cc
--- tests/level/update.cc (revision 2546)
+++ tests/level/update.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,13 +25,13 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/level/take.cc
+/*! \file tests/level/update.cc
*
- * \brief Tests on mln::level::take.
+ * \brief Tests on mln::level::update.
*/
#include <mln/core/image/image2d.hh>
-#include <mln/level/take.hh>
+#include <mln/level/update.hh>
#include <mln/level/compare.hh>
#include <mln/debug/iota.hh>
#include <mln/accu/min.hh>
@@ -44,14 +44,13 @@
const unsigned size = 200;
image2d<int> ima(size, size);
- accu::min_<int> acu_min;
- accu::max_<int> acu_max;
+ accu::min_<int> m;
+ accu::max_<int> M;
debug::iota(ima);
- level::take(ima, acu_min);
- level::take(ima, acu_max);
-
- mln_assertion(acu_min.to_result() == 1);
- mln_assertion(acu_max.to_result() == 40000);
+ level::update(m, ima);
+ level::update(M, ima);
+ mln_assertion(m == 1);
+ mln_assertion(M == 40000);
}
Index: tests/level/Makefile.am
--- tests/level/Makefile.am (revision 2546)
+++ tests/level/Makefile.am (working copy)
@@ -25,8 +25,8 @@
sort_psites \
sort_psites_full \
stretch \
- take \
- transform
+ transform \
+ update
abs_SOURCES = abs.cc
all_headers_SOURCES = all_headers.cc
@@ -47,8 +47,8 @@
saturate_SOURCES = saturate.cc
sort_psites_SOURCES = sort_psites.cc
stretch_SOURCES = stretch.cc
-take_SOURCES = take.cc
transform_SOURCES = transform.cc
+update_SOURCES = update.cc
# Lengthy tests.
sort_psites_full_SOURCES = sort_psites_full.cc
Index: tests/estim/Makefile.am
--- tests/estim/Makefile.am (revision 2546)
+++ tests/estim/Makefile.am (working copy)
@@ -3,8 +3,10 @@
include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
- mean
+ mean \
+ min_max
mean_SOURCES = mean.cc
+min_max_SOURCES = min_max.cc
TESTS = $(check_PROGRAMS)
Index: tests/estim/min_max.cc
--- tests/estim/min_max.cc (revision 0)
+++ tests/estim/min_max.cc (revision 0)
@@ -0,0 +1,52 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/estim/min_max.cc
+ *
+ * \brief Tests on mln::estim::min_max.
+ */
+
+#include <mln/core/image/image2d.hh>
+#include <mln/estim/min_max.hh>
+#include <mln/debug/iota.hh>
+#include <mln/accu/min.hh>
+#include <mln/accu/max.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 200;
+ image2d<int> ima(size, size);
+ debug::iota(ima);
+
+ int m, M;
+ estim::min_max(ima, m, M);
+ mln_assertion(m == 1);
+ mln_assertion(M == 40000);
+}
Index: mln/level/update.hh
--- mln/level/update.hh (revision 2546)
+++ mln/level/update.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,19 +25,19 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LEVEL_TAKE_HH
-# define MLN_LEVEL_TAKE_HH
+#ifndef MLN_LEVEL_UPDATE_HH
+# define MLN_LEVEL_UPDATE_HH
-/*! \file mln/level/take.hh
+/*! \file mln/level/update.hh
*
- * \brief Make an accumulator take image pixel values.
+ * \brief Update an accumulator with image pixel values.
*/
# include <mln/core/concept/accumulator.hh>
# include <mln/core/concept/image.hh>
+# include <mln/core/concept/meta_accumulator.hh>
+
-// Specializations are in:
-# include <mln/level/take.spe.hh>
namespace mln
{
@@ -45,60 +45,143 @@
namespace level
{
- /*! Make an accumulator take the values of the image \p input.
+ /*! Update an accumulator with the pixel values of the image \p input.
*
+ * \param[in] a The accumulator.
* \param[in] input The input image.
- * \param[in,out] a The accumulator.
- *
- * This routine runs: \n
- * for all p of \p input, \p a.take( \p input(p) ) \n
- *
- * \pre \p input has to be initialized.
- *
- * \warning This routine does not perform a.init().
+ * \return The accumulator result.
*/
template <typename A, typename I>
- void take(const Image<I>& input, Accumulator<A>& a);
+ mln_result(A)
+ update(Accumulator<A>& a, const Image<I>& input);
+
# ifndef MLN_INCLUDE_ONLY
+
+ // Tests.
+
+ namespace internal
+ {
+
+ template <typename A, typename I>
+ inline
+ void
+ update_tests(Accumulator<A>& a_, const Image<I>& input_)
+ {
+ A& a = exact(a_);
+ const I& input = exact(input_);
+ mln_precondition(input.has_data());
+ // sizeof(a.take(mln_value(I)()));
+
+ (void) a;
+ (void) input;
+ }
+
+ } // end of namespace internal
+
+
+
+ // Implementations.
+
namespace impl
{
namespace generic
{
+
template <typename A, typename I>
- inline
- void take_(const I& input, A& a)
+ mln_result(A)
+ update(Accumulator<A>& a_, const Image<I>& input_)
{
- trace::entering("level::impl::generic::take");
+ trace::entering("level::impl::generic::update");
+
+ A& a = exact(a_);
+ const I& input = exact(input_);
+ internal::update_tests(a, input);
mln_piter(I) p(input.domain());
for_all(p)
a.take(input(p));
- trace::exiting("level::impl::generic::take");
+ trace::exiting("level::impl::generic::update");
+ return a.to_result();
}
} // end of namespace mln::level::impl::generic
+
+ template <typename A, typename I>
+ mln_result(A)
+ update_fastest(Accumulator<A>& a_, const Image<I>& input_)
+ {
+ trace::entering("level::impl::update_fastest");
+
+ A& a = exact(a_);
+ const I& input = exact(input_);
+ internal::update_tests(a, input);
+
+ mln_pixter(const I) pxl(input);
+ for_all(pxl)
+ a.take(pxl.val());
+
+ trace::exiting("level::impl::update_fastest");
+ return a.to_result();
+ }
+
+
} // end of namespace mln::level::impl
- // Facade.
+
+ // Dispatch.
+
+ namespace internal
+ {
+
+ template <typename A, typename I>
+ mln_result(A)
+ update_dispatch(trait::image::speed::any,
+ Accumulator<A>& a, const Image<I>& input)
+ {
+ return impl::generic::update(a, input);
+ }
+
+ template <typename A, typename I>
+ mln_result(A)
+ update_dispatch(trait::image::speed::fastest,
+ Accumulator<A>& a, const Image<I>& input)
+ {
+ return impl::update_fastest(a, input);
+ }
+
+ template <typename A, typename I>
+ mln_result(A)
+ update_dispatch(Accumulator<A>& a, const Image<I>& input)
+ {
+ return update_dispatch(mln_trait_image_speed(I)(),
+ a, input);
+ }
+
+ } // end of namespace internal
+
+
+
+ // Facades.
template <typename A, typename I>
inline
- void take(const Image<I>& input, Accumulator<A>& a)
+ mln_result(A)
+ update(Accumulator<A>& a, const Image<I>& input)
{
- trace::entering("level::take");
+ trace::entering("level::update");
- mln_precondition(exact(input).has_data());
- impl::take_(mln_trait_image_speed(I)(), exact(input),
- exact(a));
+ internal::update_tests(a, input);
+ mln_result(A) r = internal::update_dispatch(a, input);
- trace::exiting("level::take");
+ trace::exiting("level::update");
+ return r;
}
# endif // ! MLN_INCLUDE_ONLY
@@ -108,4 +191,4 @@
} // end of namespace mln
-#endif // ! MLN_LEVEL_TAKE_HH
+#endif // ! MLN_LEVEL_UPDATE_HH
Index: mln/level/compute.hh
--- mln/level/compute.hh (revision 2546)
+++ mln/level/compute.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -33,9 +33,9 @@
* \brief Compute an accumulator onto image pixel values.
*/
+# include <mln/core/concept/accumulator.hh>
+# include <mln/core/concept/image.hh>
# include <mln/core/concept/meta_accumulator.hh>
-# include <mln/level/take.hh>
-# include <mln/metal/is_a.hh>
@@ -47,60 +47,162 @@
/*! Compute an accumulator onto the pixel values of the image \p input.
*
+ * \param[in] a An accumulator.
* \param[in] input The input image.
- * \param[in] a The accumulator.
* \return The accumulator result.
- *
- * This routine runs: \n
- * tmp = \p a \n
- * tmp.init() \n
- * level::take(\p input, tmp) \n
- * return tmp.to_result() \n
*/
- template <typename I, typename A>
+ template <typename A, typename I>
mln_result(A)
- compute(const Image<I>& input, const Accumulator<A>& a);
+ compute(const Accumulator<A>& a, const Image<I>& input);
+
+ /*! Compute an accumulator onto the pixel values of the image \p input.
+ *
+ * \param[in] a A meta-accumulator.
+ * \param[in] input The input image.
+ * \return The accumulator result.
+ */
template <typename A, typename I>
mln_accu_with(A, mln_value(I))::result
- compute(const Image<I>& input);
+ compute(const Meta_Accumulator<A>& a, const Image<I>& input);
+
# ifndef MLN_INCLUDE_ONLY
- template <typename I, typename A>
+
+ // Tests.
+
+ namespace internal
+ {
+
+ template <typename A, typename I>
inline
+ void
+ compute_tests(const Accumulator<A>& a_, const Image<I>&
input_)
+ {
+ const A& a = exact(a_);
+ const I& input = exact(input_);
+ mln_precondition(input.has_data());
+ // sizeof(a.take(mln_value(I)()));
+
+ (void) a;
+ (void) input;
+ }
+
+ } // end of namespace internal
+
+
+
+ // Implementations.
+
+ namespace impl
+ {
+
+ namespace generic
+ {
+
+ template <typename A, typename I>
mln_result(A)
- compute(const Image<I>& input, const Accumulator<A>& a_)
+ compute(const Accumulator<A>& a_, const Image<I>& input_)
{
- trace::entering("level::compute");
+ trace::entering("level::impl::generic::compute");
+
+ A a = exact(a_);
+ const I& input = exact(input_);
+ internal::compute_tests(a, input);
- mln_precondition(exact(input).has_data());
- A a = exact(a_); // Cpy.
a.init();
- level::take(input, a);
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ a.take(input(p));
- trace::exiting("level::compute");
+ trace::exiting("level::impl::generic::compute");
return a.to_result();
}
+ } // end of namespace mln::level::impl::generic
+
+
template <typename A, typename I>
- inline
mln_result(A)
- compute(const Image<I>& input)
+ compute_fastest(const Accumulator<A>& a_, const Image<I>&
input_)
{
- mln_precondition(exact(input).has_data());
- return level::compute(input, A());
+ trace::entering("level::impl::compute_fastest");
+
+ A a = exact(a_);
+ const I& input = exact(input_);
+ internal::compute_tests(a, input);
+
+ a.init();
+ mln_pixter(const I) pxl(input);
+ for_all(pxl)
+ a.take(pxl.val());
+
+ trace::exiting("level::impl::compute_fastest");
+ return a.to_result();
+ }
+
+
+ } // end of namespace mln::level::impl
+
+
+
+ // Dispatch.
+
+ namespace internal
+ {
+
+ template <typename A, typename I>
+ mln_result(A)
+ compute_dispatch(trait::image::speed::any,
+ const Accumulator<A>& a, const Image<I>& input)
+ {
+ return impl::generic::compute(a, input);
+ }
+
+ template <typename A, typename I>
+ mln_result(A)
+ compute_dispatch(trait::image::speed::fastest,
+ const Accumulator<A>& a, const Image<I>& input)
+ {
+ return impl::compute_fastest(a, input);
}
template <typename A, typename I>
+ mln_result(A)
+ compute_dispatch(const Accumulator<A>& a, const Image<I>&
input)
+ {
+ return compute_dispatch(mln_trait_image_speed(I)(),
+ a, input);
+ }
+
+ } // end of namespace internal
+
+
+
+ // Facades.
+
+ template <typename A, typename I>
inline
+ mln_result(A)
+ compute(const Accumulator<A>& a, const Image<I>& input)
+ {
+ trace::entering("level::compute");
+
+ internal::compute_tests(a, input);
+ mln_result(A) r = internal::compute_dispatch(a, input);
+
+ trace::exiting("level::compute");
+ return r;
+ }
+
+ template <typename A, typename I>
mln_accu_with(A, mln_value(I))::result
- compute(const Image<I>& input)
+ compute(const Meta_Accumulator<A>&, const Image<I>& input)
{
- mlc_is_a(A, Meta_Accumulator)::check();
- return compute(input,
- mln_accu_with(A, mln_value(I))());
+ mln_accu_with(A, mln_value(I)) accu;
+ return compute(accu, input); // Call the previous version.
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/accu/min.hh
--- mln/accu/min.hh (revision 2546)
+++ mln/accu/min.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -74,9 +74,12 @@
template <typename I> struct min_< util::pix<I> >;
- /*!
- * \brief Meta accumulator for min.
- */
+
+ namespace meta
+ {
+
+ /// Meta accumulator for min.
+
struct min : public Meta_Accumulator< min >
{
template <typename T>
@@ -86,8 +89,7 @@
};
};
-
-
+ } // end of namespace mln::accu::meta
Index: mln/accu/max.hh
--- mln/accu/max.hh (revision 2546)
+++ mln/accu/max.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -74,9 +74,11 @@
template <typename I> struct max_< util::pix<I> >;
- /*!
- * \brief Meta accumulator for max.
- */
+ namespace meta
+ {
+
+ /// Meta accumulator for max.
+
struct max : public Meta_Accumulator< max >
{
template <typename T>
@@ -86,6 +88,7 @@
};
};
+ } // end of namespace mln::accu::meta
# ifndef MLN_INCLUDE_ONLY
Index: mln/accu/min_max.hh
--- mln/accu/min_max.hh (revision 2546)
+++ mln/accu/min_max.hh (working copy)
@@ -63,9 +63,14 @@
template <typename I> struct min_max_< util::pix<I> >;
+ namespace meta
+ {
+
// FIXME: Doc!
typedef pair<min,max> min_max;
+ } // end of namespace mln::accu::meta
+
} // end of namespace mln::accu
Index: mln/accu/pair.hh
--- mln/accu/pair.hh (revision 2546)
+++ mln/accu/pair.hh (working copy)
@@ -84,9 +84,11 @@
A2 a2_;
};
- /*!
- * \brief Meta accumulator for pair.
- */
+
+ namespace meta
+ {
+
+ /// Meta accumulator for pair.
template <typename A1, typename A2>
struct pair : public Meta_Accumulator< pair<A1,A2> >
{
@@ -99,6 +101,8 @@
};
};
+ } // end of namespace mln::accu::meta
+
# ifndef MLN_INCLUDE_ONLY
Index: mln/accu/sum.hh
--- mln/accu/sum.hh (revision 2546)
+++ mln/accu/sum.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -79,10 +79,10 @@
template <typename I, typename S>
struct sum_< util::pix<I>, S >;
+ namespace meta
+ {
- /*!
- * \brief Meta accumulator for sum.
- */
+ /// Meta accumulator for sum.
struct sum : public Meta_Accumulator< sum >
{
template <typename T, typename S = mln_sum(T)>
@@ -92,6 +92,7 @@
};
};
+ } // end of namespace mln::accu::meta
# ifndef MLN_INCLUDE_ONLY
Index: mln/accu/mean.hh
--- mln/accu/mean.hh (revision 2546)
+++ mln/accu/mean.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -83,9 +83,10 @@
struct mean_< util::pix<I>, S,M >;
- /*!
- * \brief Meta accumulator for mean.
- */
+ namespace meta
+ {
+
+ /// Meta accumulator for mean.
struct mean : public Meta_Accumulator< mean >
{
template < typename T,
@@ -97,6 +98,8 @@
};
};
+ } // end of namespace mln::accu::meta
+
# ifndef MLN_INCLUDE_ONLY
Index: mln/estim/sum.hh
--- mln/estim/sum.hh (revision 2546)
+++ mln/estim/sum.hh (working copy)
@@ -70,7 +70,7 @@
mln_sum(mln_value(I)) sum(const Image<I>& input)
{
mln_precondition(exact(input).has_data());
- return level::compute<accu::sum, I>(input);
+ return level::compute(accu::meta::sum(), input);
}
template <typename I, typename S>
@@ -78,8 +78,8 @@
void sum(const Image<I>& input, S& result)
{
mln_precondition(exact(input).has_data());
- typedef accu::sum_<mln_value(I), S> A;
- result = level::compute(input, A());
+ accu::sum_<mln_value(I), S> a;
+ result = level::compute(a, input);
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/estim/min_max.hh
--- mln/estim/min_max.hh (revision 2546)
+++ mln/estim/min_max.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -31,6 +31,8 @@
/*! \file mln/estim/min_max.hh
*
* \brief Compute the min and max pixel values of an image.
+ *
+ * \todo Overload while returning an std::pair.
*/
# include <mln/accu/min_max.hh>
@@ -62,8 +64,8 @@
mln_value(I)& min, mln_value(I)& max)
{
mln_precondition(exact(input).has_data());
- typedef accu::min_max_<mln_value(I)> A;
- mln_result(A) mm = level::compute<A>(input);
+ typedef mln_value(I) V;
+ std::pair<V, V> mm = level::compute(accu::meta::min_max(), input);
min = mm.first;
max = mm.second;
}
Index: mln/estim/mean.hh
--- mln/estim/mean.hh (revision 2546)
+++ mln/estim/mean.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -71,7 +71,7 @@
mln_sum(mln_value(I)) mean(const Image<I>& input)
{
mln_precondition(exact(input).has_data());
- return level::compute<accu::mean>(input);
+ return level::compute(accu::meta::mean(), input);
}
template <typename S, typename I, typename M>
@@ -79,8 +79,8 @@
void mean(const Image<I>& input, M& result)
{
mln_precondition(exact(input).has_data());
- typedef accu::mean_<mln_value(I), S, M> A;
- result = level::compute(input, A());
+ accu::mean_<mln_value(I), S, M> a;
+ result = level::compute(a, input);
}
# endif // ! MLN_INCLUDE_ONLY