URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-06-08 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Move mean, median_h accus to stat.
* mln/accu/all.hh,
* mln/accu/essential.hh,
* mln/accu/stat/all.hh,
* mln/accu/stat/essential.hh:
Move median_h, and mean inclusions.
* mln/accu/mean.hh,
* mln/accu/median_h.hh: Move to...
* mln/accu/stat/mean.hh
* mln/accu/stat/median_h.hh: New.
Move median_h, and mean accus to stat directory.
* tests/accu/mean.cc
* tests/accu/median_h.cc: Move to...
* tests/accu/stat/mean.cc,
* tests/accu/stat/median_h.cc: New.
Move median_h, and mean tests to stat directory.
* tests/accu/Makefile.am,
* tests/accu/stat/Makefile.am:
Update makefiles.
* doc/examples/trash/accu.cc,
* doc/examples/trash/tuto_bis.cc,
* mln/data/fast_median.hh,
* mln/data/median.hh,
* mln/data/naive/median.hh,
* mln/data/was.median.hh,
* mln/estim/mean.hh,
* mln/geom/seeds2tiling.hh,
* mln/geom/seeds2tiling_roundness.hh,
* mln/labeling/mean_values.hh,
* mln/make/voronoi.hh,
* sandbox/beguin/irm.cc,
* sandbox/beguin/irm_g.cc,
* sandbox/duhamel/labeling_algo.hh,
* sandbox/duhamel/slow_seed2tiling.cc,
* sandbox/edwin/exec/color_labeling_mean.hh,
* sandbox/fabien/binarization/test.cc,
* sandbox/fabien/igr/filter.cc,
* sandbox/fabien/igr/fixed_seg/main.cc,
* sandbox/fabien/igr/fun_labels.cc,
* sandbox/fabien/igr/graph.cc,
* sandbox/fabien/igr/label2gif.cc,
* sandbox/fabien/igr/matlab.cc,
* sandbox/fabien/igr/mean_median_label.cc,
* sandbox/fabien/igr/mean_slices.cc,
* sandbox/fabien/igr/med.cc,
* sandbox/fabien/igr/norm.cc,
* sandbox/fabien/igr/plot_label.hh,
* sandbox/fabien/igr/point_filtering/main.cc,
* sandbox/fabien/igr/seg_vol_irm.hh,
* sandbox/fabien/igr/smooth_fixed_seg/main.cc,
* sandbox/fabien/igr/space_smooth/linear.cc,
* sandbox/fabien/igr/space_smooth/median.cc,
* sandbox/fabien/igr/space_smooth/morpho.cc,
* sandbox/fabien/igr/time_max.cc,
* sandbox/fabien/igr/time_max_norm.cc,
* sandbox/fabien/igr/time_smooth/linear.cc,
* sandbox/fabien/igr/time_smooth/median.cc,
* sandbox/fabien/igr/time_smooth/morpho.cc,
* sandbox/fabien/igr/watershed.hh,
* sandbox/fabien/igr/watershed2d.cc,
* sandbox/fabien/igr/watershed3d.cc,
* sandbox/fabien/igr/wst_edges.cc,
* sandbox/folio/test/histo/project_histo_add.cc,
* sandbox/folio/test/histo/project_screen.cc,
* sandbox/folio/test/histo/projected3d.cc,
* sandbox/fred/old/accuprops.cc,
* sandbox/fred/old/accuprops2.cc,
* sandbox/fred/old/mean.hh,
* sandbox/icdar/2009/dibco/binarization.cc,
* sandbox/icdar/2009/dibco/svg.1.binarization.cc,
* sandbox/icdar/2009/dibco/svg.2.binarization.cc,
* sandbox/icdar/2009/dibco/svg.3.binarization.cc,
* sandbox/inim/2009/classif/src/proj.hh,
* sandbox/inim/2009/color/reference.cc,
* sandbox/inim/2009/color/reference2.cc,
* sandbox/inim/2009/nature/proj.hh,
* sandbox/lazzara/igr/irm/wst_rag.cc,
* sandbox/lazzara/igr/irm/wst_rag_hsl.cc,
* sandbox/lazzara/igr/irm_seg_with_mm_and_rag.mine.cc,
* sandbox/nivault/extract_character.cc,
* sandbox/nivault/extract_score.cc,
* sandbox/theo/color/filter_blen_rgb_edges.cc,
* sandbox/theo/color/segment_rgb_edges.cc,
* sandbox/theo/cs2d/cs2d.cc,
* sandbox/theo/esiee/laurent/presentation/wst_edge.cc,
* sandbox/theo/exec/color_labeling_mean.cc,
* sandbox/theo/experimental/projected_histo.cc,
* sandbox/theo/igr/irm_anat_segm.cc,
* sandbox/theo/igr/irm_anat_segm__2D_ONLY.cc,
* sandbox/theo/igr/irm_seg_with_mm_and_rag.cc,
* sandbox/theo/igr/segment_2d_t.cc,
* tests/accu/all_accus.cc,
* tests/accu/pair.cc,
* tests/accu/tuple.cc,
* tests/estim/mean.cc:
Replace accu::accu_name by accu::stat::accu_name,
accu::meta::accu_name by accu::meta::stat::accu_name,
accu/accu_name.cc by accu/stat/accu_name.cc,
accu/accu_name.hh by accu/stat/accu_name.hh.
---
doc/examples/trash/accu.cc | 6
doc/examples/trash/tuto_bis.cc | 4
mln/accu/all.hh | 2
mln/accu/essential.hh | 2
mln/accu/stat/all.hh | 4
mln/accu/stat/essential.hh | 3
mln/accu/stat/mean.hh | 189 +++++++++++++
mln/accu/stat/median_h.hh | 288 ++++++++++++++++++++
mln/data/fast_median.hh | 4
mln/data/median.hh | 6
mln/data/naive/median.hh | 2
mln/data/was.median.hh | 4
mln/estim/mean.hh | 6
mln/geom/seeds2tiling.hh | 2
mln/geom/seeds2tiling_roundness.hh | 2
mln/labeling/mean_values.hh | 6
mln/make/voronoi.hh | 4
sandbox/beguin/irm.cc | 2
sandbox/beguin/irm_g.cc | 2
sandbox/duhamel/labeling_algo.hh | 2
sandbox/duhamel/slow_seed2tiling.cc | 2
sandbox/edwin/exec/color_labeling_mean.hh | 4
sandbox/fabien/binarization/test.cc | 4
sandbox/fabien/igr/filter.cc | 4
sandbox/fabien/igr/fixed_seg/main.cc | 8
sandbox/fabien/igr/fun_labels.cc | 10
sandbox/fabien/igr/graph.cc | 2
sandbox/fabien/igr/label2gif.cc | 4
sandbox/fabien/igr/matlab.cc | 6
sandbox/fabien/igr/mean_median_label.cc | 6
sandbox/fabien/igr/mean_slices.cc | 4
sandbox/fabien/igr/med.cc | 8
sandbox/fabien/igr/norm.cc | 4
sandbox/fabien/igr/plot_label.hh | 6
sandbox/fabien/igr/point_filtering/main.cc | 4
sandbox/fabien/igr/seg_vol_irm.hh | 4
sandbox/fabien/igr/smooth_fixed_seg/main.cc | 8
sandbox/fabien/igr/space_smooth/linear.cc | 2
sandbox/fabien/igr/space_smooth/median.cc | 6
sandbox/fabien/igr/space_smooth/morpho.cc | 2
sandbox/fabien/igr/time_max.cc | 4
sandbox/fabien/igr/time_max_norm.cc | 2
sandbox/fabien/igr/time_smooth/linear.cc | 2
sandbox/fabien/igr/time_smooth/median.cc | 4
sandbox/fabien/igr/time_smooth/morpho.cc | 4
sandbox/fabien/igr/watershed.hh | 2
sandbox/fabien/igr/watershed2d.cc | 2
sandbox/fabien/igr/watershed3d.cc | 2
sandbox/fabien/igr/wst_edges.cc | 2
sandbox/folio/test/histo/project_histo_add.cc | 4
sandbox/folio/test/histo/project_screen.cc | 4
sandbox/folio/test/histo/projected3d.cc | 4
sandbox/fred/old/accuprops.cc | 10
sandbox/fred/old/accuprops2.cc | 8
sandbox/fred/old/mean.hh | 2
sandbox/icdar/2009/dibco/binarization.cc | 6
sandbox/icdar/2009/dibco/svg.1.binarization.cc | 6
sandbox/icdar/2009/dibco/svg.2.binarization.cc | 6
sandbox/icdar/2009/dibco/svg.3.binarization.cc | 6
sandbox/inim/2009/classif/src/proj.hh | 4
sandbox/inim/2009/color/reference.cc | 2
sandbox/inim/2009/color/reference2.cc | 2
sandbox/inim/2009/nature/proj.hh | 2
sandbox/lazzara/igr/irm/wst_rag.cc | 2
sandbox/lazzara/igr/irm/wst_rag_hsl.cc | 2
sandbox/lazzara/igr/irm_seg_with_mm_and_rag.mine.cc | 4
sandbox/nivault/extract_character.cc | 2
sandbox/nivault/extract_score.cc | 2
sandbox/theo/color/filter_blen_rgb_edges.cc | 6
sandbox/theo/color/segment_rgb_edges.cc | 6
sandbox/theo/cs2d/cs2d.cc | 4
sandbox/theo/esiee/laurent/presentation/wst_edge.cc | 2
sandbox/theo/exec/color_labeling_mean.cc | 4
sandbox/theo/experimental/projected_histo.cc | 4
sandbox/theo/igr/irm_anat_segm.cc | 4
sandbox/theo/igr/irm_anat_segm__2D_ONLY.cc | 4
sandbox/theo/igr/irm_seg_with_mm_and_rag.cc | 2
sandbox/theo/igr/segment_2d_t.cc | 4
tests/accu/Makefile.am | 4
tests/accu/all_accus.cc | 25 -
tests/accu/pair.cc | 8
tests/accu/stat/Makefile.am | 6
tests/accu/stat/mean.cc | 69 ++++
tests/accu/stat/median_h.cc | 70 ++++
tests/accu/tuple.cc | 4
tests/estim/mean.cc | 2
86 files changed, 790 insertions(+), 178 deletions(-)
Index: trunk/milena/mln/data/was.median.hh
===================================================================
--- trunk/milena/mln/data/was.median.hh (revision 4030)
+++ trunk/milena/mln/data/was.median.hh (revision 4031)
@@ -87,7 +87,7 @@
q_bp(win_bkd_plus, p), q_bm(win_bkd_minus, p),
q_top(win_top, p), q_bot(win_bot, p);
- accu::median_h<mln_vset(I)> med(input.values());
+ accu::stat::median_h<mln_vset(I)> med(input.values());
// initialization
@@ -160,7 +160,7 @@
int& row = p.row();
int& col = p.col();
- accu::median_h<mln_vset(I)> med(input.values());
+ accu::stat::median_h<mln_vset(I)> med(input.values());
for (row = min_row; row <= max_row; ++row)
{
Index: trunk/milena/mln/data/median.hh
===================================================================
--- trunk/milena/mln/data/median.hh (revision 4030)
+++ trunk/milena/mln/data/median.hh (revision 4031)
@@ -44,7 +44,7 @@
# include <mln/win/line.hh>
# include <mln/canvas/browsing/snake_fwd.hh>
-# include <mln/accu/median_h.hh>
+# include <mln/accu/stat/median_h.hh>
# include <mln/accu/transform_line.hh>
@@ -106,7 +106,7 @@
// aux data
- accu::median_h<mln_value(I)> med;
+ accu::stat::median_h<mln_value(I)> med;
P p;
window<D> win_fp, win_fm, win_bp, win_bm, win_dp, win_dm;
mln_qiter(window<D>) q_fp, q_fm, q_bp, q_bm, q_dp, q_dm;
@@ -222,7 +222,7 @@
trait::image::quant::low)::check();
internal::median_tests(input, win);
- accu::median_h<mln_value(I)> a;
+ accu::stat::median_h<mln_value(I)> a;
mln_concrete(I) output = accu::transform_line(a, input, win.length(), i);
trace::exiting("data::impl::median_line");
Index: trunk/milena/mln/data/naive/median.hh
===================================================================
--- trunk/milena/mln/data/naive/median.hh (revision 4030)
+++ trunk/milena/mln/data/naive/median.hh (revision 4031)
@@ -79,7 +79,7 @@
{
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
- accu::median_h<mln_value(I)> med;
+ accu::stat::median_h<mln_value(I)> med;
for_all(p)
{
Index: trunk/milena/mln/data/fast_median.hh
===================================================================
--- trunk/milena/mln/data/fast_median.hh (revision 4030)
+++ trunk/milena/mln/data/fast_median.hh (revision 4031)
@@ -37,7 +37,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/alias/window2d.hh>
-# include <mln/accu/median_h.hh>
+# include <mln/accu/stat/median_h.hh>
# include <mln/win/shift.hh>
# include <mln/win/diff.hh>
@@ -95,7 +95,7 @@
win_bot = win - win::shift(win, up),
win_top = win::shift(win, up) - win;
- accu::median_h<mln_value(I)> med;
+ accu::stat::median_h<mln_value(I)> med;
// initialization
Index: trunk/milena/mln/accu/median_h.hh (deleted)
===================================================================
Index: trunk/milena/mln/accu/mean.hh (deleted)
===================================================================
Index: trunk/milena/mln/accu/all.hh
===================================================================
--- trunk/milena/mln/accu/all.hh (revision 4030)
+++ trunk/milena/mln/accu/all.hh (revision 4031)
@@ -69,8 +69,6 @@
# include <mln/accu/line.hh>
# include <mln/accu/lor.hh>
# include <mln/accu/lor_basic.hh>
-# include <mln/accu/mean.hh>
-# include <mln/accu/median_h.hh>
# include <mln/accu/nil.hh>
# include <mln/accu/pair.hh>
# include <mln/accu/rank.hh>
Index: trunk/milena/mln/accu/essential.hh
===================================================================
--- trunk/milena/mln/accu/essential.hh (revision 4030)
+++ trunk/milena/mln/accu/essential.hh (revision 4031)
@@ -36,8 +36,6 @@
# include <mln/accu/center.hh>
# include <mln/accu/count.hh>
# include <mln/accu/histo.hh>
-# include <mln/accu/mean.hh>
-# include <mln/accu/median_h.hh>
# include <mln/accu/rank.hh>
# include <mln/accu/sum.hh>
Index: trunk/milena/mln/accu/stat/median_h.hh
===================================================================
--- trunk/milena/mln/accu/stat/median_h.hh (revision 0)
+++ trunk/milena/mln/accu/stat/median_h.hh (revision 4031)
@@ -0,0 +1,288 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
+//
+// This file is part of the Milena 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.
+
+#ifndef MLN_ACCU_STAT_MEDIAN_H_HH
+# define MLN_ACCU_STAT_MEDIAN_H_HH
+
+/// \file mln/accu/stat/median_h.hh
+///
+/// Define a generic median accumulator class.
+
+# include <mln/accu/internal/base.hh>
+# include <mln/accu/histo.hh>
+# include <mln/value/set.hh>
+
+
+namespace mln
+{
+ namespace accu
+ {
+ namespace stat
+ {
+ // Forward declaration.
+ template <typename V>
+ struct median_h;
+ }
+
+ namespace meta
+ {
+ namespace stat
+ {
+ /// Meta accumulator for median_h.
+ struct median_h : public Meta_Accumulator< median_h >
+ {
+ template <typename V>
+ struct with
+ {
+ typedef accu::stat::median_h<V> ret;
+ };
+ };
+ } // end of namespace mln::accu::meta::stat
+ } // end of namespace mln::accu::meta
+
+ namespace stat
+ {
+
+ /// \brief Generic median function based on histogram over a value
+ /// set with type \c V.
+ ///
+ /// \ingroup modaccuvalues
+ template <typename V>
+ struct median_h : public mln::accu::internal::base< const V&,
median_h<V> >
+ {
+ typedef V argument;
+
+ median_h();
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take(const argument& t);
+ void take(const median_h<V>& other);
+ void untake(const argument& t);
+ /// \}
+
+ unsigned card() const { return h_.sum(); }
+
+ /// Get the value of the accumulator.
+ const argument& to_result() const;
+
+ const accu::histo<V>& histo() const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ protected:
+
+ mutable accu::histo<V> h_;
+ const value::set<V>& s_; // derived from h_
+
+ mutable unsigned sum_minus_, sum_plus_;
+
+ mutable bool valid_;
+ mutable unsigned i_; // the median_h index
+ mutable argument t_; // the median_h value
+
+ // Auxiliary methods
+ void update_() const;
+ void go_minus_() const;
+ void go_plus_() const;
+ };
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename V>
+ inline
+ median_h<V>::median_h()
+ : h_(),
+ s_(h_.vset())
+ {
+ init();
+ }
+
+ template <typename V>
+ inline
+ void
+ median_h<V>::take(const argument& t)
+ {
+ h_.take(t);
+
+ if (t < t_)
+ ++sum_minus_;
+ else if (t > t_)
+ ++sum_plus_;
+
+ if (valid_)
+ valid_ = false;
+ }
+
+ template <typename V>
+ inline
+ void
+ median_h<V>::take(const median_h<V>& other)
+ {
+ // h_
+ h_.take(other.h_);
+
+ // sum_minus_
+ for (unsigned i = 0; i < i_; ++i)
+ sum_minus_ += other.h_[i];
+
+ // sum_plus_
+ for (unsigned i = i_ + 1; i < h_.nvalues(); ++i)
+ sum_plus_ += other.h_[i];
+
+ if (valid_)
+ valid_ = false;
+ }
+
+ template <typename V>
+ inline
+ void
+ median_h<V>::untake(const argument& t)
+ {
+ mln_precondition(h_(t) != 0);
+ h_.untake(t);
+
+ if (t < t_)
+ --sum_minus_;
+ else if (t > t_)
+ --sum_plus_;
+
+ if (valid_)
+ valid_ = false;
+ }
+
+ template <typename V>
+ inline
+ void
+ median_h<V>::update_() const
+ {
+ valid_ = true;
+
+ if (h_.sum() == 0)
+ return;
+
+ if (2 * sum_minus_ > h_.sum())
+ go_minus_();
+ else
+ if (2 * sum_plus_ > h_.sum())
+ go_plus_();
+ else
+ if (h_[i_] == 0)
+ {
+ // go to the heaviest side
+ if (sum_plus_ > sum_minus_)
+ go_plus_();
+ else
+ go_minus_(); // default when both sides are balanced
+ }
+ }
+
+ template <typename V>
+ inline
+ void
+ median_h<V>::go_minus_() const
+ {
+ do
+ {
+ sum_plus_ += h_[i_];
+ do
+ --i_;
+ while (h_[i_] == 0);
+ sum_minus_ -= h_[i_];
+ }
+ while (2 * sum_minus_ > h_.sum());
+ t_ = s_[i_];
+ }
+
+ template <typename V>
+ inline
+ void
+ median_h<V>::go_plus_() const
+ {
+ do
+ {
+ sum_minus_ += h_[i_];
+ do
+ ++i_;
+ while (h_[i_] == 0);
+ sum_plus_ -= h_[i_];
+ }
+ while (2 * sum_plus_ > h_.sum());
+ t_ = s_[i_];
+ }
+
+ template <typename V>
+ inline
+ void
+ median_h<V>::init()
+ {
+ h_.init();
+ sum_minus_ = 0;
+ sum_plus_ = 0;
+ i_ = (s_.index_of(mln_max(argument))
+ - s_.index_of(mln_min(argument))) / 2;
+ t_ = s_[i_];
+ valid_ = true;
+ }
+
+ template <typename V>
+ inline
+ const typename median_h<V>::argument&
+ median_h<V>::to_result() const
+ {
+ if (! valid_)
+ update_();
+ return t_;
+ }
+
+ template <typename V>
+ inline
+ const accu::histo<V>&
+ median_h<V>::histo() const
+ {
+ return h_;
+ }
+
+ template <typename V>
+ inline
+ bool
+ median_h<V>::is_valid() const
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::stat
+ } // end of namespace mln::accu
+} // end of namespace mln
+
+#endif // ! MLN_ACCU_STAT_MEDIAN_H_HH
Property changes on: trunk/milena/mln/accu/stat/median_h.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/mln/accu/stat/essential.hh
===================================================================
--- trunk/milena/mln/accu/stat/essential.hh (revision 4030)
+++ trunk/milena/mln/accu/stat/essential.hh (revision 4031)
@@ -37,6 +37,7 @@
# include <mln/accu/stat/min.hh>
# include <mln/accu/stat/min_h.hh>
# include <mln/accu/stat/min_max.hh>
+# include <mln/accu/stat/mean.hh>
+# include <mln/accu/stat/median_h.hh>
#endif // !MLN_ACCU_STAT_ESSENTIAL_HH_
-
Index: trunk/milena/mln/accu/stat/all.hh
===================================================================
--- trunk/milena/mln/accu/stat/all.hh (revision 4030)
+++ trunk/milena/mln/accu/stat/all.hh (revision 4031)
@@ -58,7 +58,7 @@
# include <mln/accu/stat/max_h.hh>
# include <mln/accu/stat/min_h.hh>
# include <mln/accu/stat/min_max.hh>
-
-
+# include <mln/accu/stat/mean.hh>
+# include <mln/accu/stat/median_h.hh>
#endif // ! MLN_ACCU_STAT_ALL_HH
Index: trunk/milena/mln/accu/stat/mean.hh
===================================================================
--- trunk/milena/mln/accu/stat/mean.hh (revision 0)
+++ trunk/milena/mln/accu/stat/mean.hh (revision 4031)
@@ -0,0 +1,189 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
+//
+// This file is part of the Milena 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.
+
+#ifndef MLN_ACCU_STAT_MEAN_HH
+# define MLN_ACCU_STAT_MEAN_HH
+
+/// \file mln/accu/stat/mean.hh
+///
+/// Define an accumulator that computes a mean.
+///
+/// \todo Use accu::pair just like in accu::stat::min_max.
+
+# include <mln/accu/internal/base.hh>
+# include <mln/accu/count.hh>
+# include <mln/accu/sum.hh>
+
+
+namespace mln
+{
+ namespace accu
+ {
+ namespace stat
+ {
+ // Forward declaration.
+ template <typename T, typename S, typename M>
+ struct mean;
+ }
+
+ namespace meta
+ {
+ namespace stat
+ {
+ /// Meta accumulator for mean.
+ struct mean : public Meta_Accumulator< mean >
+ {
+ template < typename T,
+ typename S = mln_sum(T),
+ typename M = S >
+ struct with
+ {
+ typedef accu::stat::mean<T,S,M> ret;
+ };
+ };
+ } // end of namespace mln::accu::meta::stat
+ } // end of namespace mln::accu::meta
+
+ namespace stat
+ {
+
+ /// \brief Generic mean accumulator class.
+ /*!
+ * Parameter \c T is the type of values that we sum. Parameter \c
+ * S is the type to store the sum of values; the default type of
+ * \c S is the summation type (property) of \c T. Parameter \c M
+ * is the type of the mean value; the default type of \c M is \c
+ * S.
+ *
+ * \ingroup modaccuvalues
+ */
+ template <typename T,
+ typename S = mln_sum(T),
+ typename M = S>
+ struct mean : public mln::accu::internal::base< M , mean<T,S,M> >
+ {
+ typedef T argument;
+ typedef M result;
+
+ mean();
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take(const argument& t);
+ void take(const mean<T,S,M>& other);
+ /// \}
+
+ /// Get the value of the accumulator.
+ M to_result() const;
+ operator M () const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ protected:
+
+ accu::count<T> count_;
+ accu::sum<T,S> sum_;
+ };
+
+
+
+ template <typename I, typename S, typename M>
+ struct mean< util::pix<I>, S,M >;
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T, typename S, typename M>
+ inline
+ mean<T,S,M>::mean()
+ {
+ init();
+ }
+
+ template <typename T, typename S, typename M>
+ inline
+ void
+ mean<T,S,M>::init()
+ {
+ count_.init();
+ sum_.init();
+ }
+
+ template <typename T, typename S, typename M>
+ inline
+ void mean<T,S,M>::take(const argument& t)
+ {
+ count_.take(t);
+ sum_.take(t);
+ }
+
+ template <typename T, typename S, typename M>
+ inline
+ void
+ mean<T,S,M>::take(const mean<T,S,M>& other)
+ {
+ count_.take(other.count_);
+ sum_.take(other.sum_);
+ }
+
+ template <typename T, typename S, typename M>
+ inline
+ M
+ mean<T,S,M>::to_result() const
+ {
+ unsigned n = count_.to_result();
+ if (n == 0u)
+ return M(); // Safety.
+ return static_cast<M>(sum_.to_result() / n);
+ }
+
+ template <typename T, typename S, typename M>
+ inline
+ mean<T,S,M>::operator M() const
+ {
+ return to_result();
+ }
+
+ template <typename T, typename S, typename M>
+ inline
+ bool
+ mean<T,S,M>::is_valid() const
+ {
+ return count_.to_result() != 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::stat
+ } // end of namespace mln::accu
+} // end of namespace mln
+
+#endif // ! MLN_ACCU_STAT_MEAN_HH
Property changes on: trunk/milena/mln/accu/stat/mean.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/mln/make/voronoi.hh
===================================================================
--- trunk/milena/mln/make/voronoi.hh (revision 4030)
+++ trunk/milena/mln/make/voronoi.hh (revision 4031)
@@ -38,7 +38,7 @@
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/site_set/p_vertices.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/estim/min_max.hh>
# include <mln/util/graph.hh>
@@ -83,7 +83,7 @@
estim::min_max (ima, min, max);
unsigned nb = max - min + 1;
fun::i2v::array<P> v(nb);
- std::vector< accu::mean< X > > tab_mean (nb);
+ std::vector< accu::stat::mean< X > > tab_mean (nb);
std::map<std::pair<V, V>, bool> m;
/// Take original point.
Index: trunk/milena/mln/estim/mean.hh
===================================================================
--- trunk/milena/mln/estim/mean.hh (revision 4030)
+++ trunk/milena/mln/estim/mean.hh (revision 4031)
@@ -33,7 +33,7 @@
///
/// Compute the mean pixel value.
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/data/compute.hh>
@@ -71,7 +71,7 @@
mln_sum(mln_value(I)) mean(const Image<I>& input)
{
mln_precondition(exact(input).is_valid());
- return data::compute(accu::meta::mean(), input);
+ return data::compute(accu::meta::stat::mean(), input);
}
template <typename S, typename I, typename M>
@@ -79,7 +79,7 @@
void mean(const Image<I>& input, M& result)
{
mln_precondition(exact(input).is_valid());
- accu::mean<mln_value(I), S, M> a;
+ accu::stat::mean<mln_value(I), S, M> a;
result = data::compute(a, input);
}
Index: trunk/milena/mln/geom/seeds2tiling_roundness.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling_roundness.hh (revision 4030)
+++ trunk/milena/mln/geom/seeds2tiling_roundness.hh (revision 4031)
@@ -41,7 +41,7 @@
# include <mln/core/site_set/p_priority.hh>
# include <mln/core/site_set/p_queue_fast.hh>
# include <mln/core/routine/duplicate.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/estim/min_max.hh>
# include <mln/algebra/vec.hh>
# include <mln/geom/chamfer.hh>
Index: trunk/milena/mln/geom/seeds2tiling.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling.hh (revision 4030)
+++ trunk/milena/mln/geom/seeds2tiling.hh (revision 4031)
@@ -38,7 +38,7 @@
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/site_set/p_queue.hh>
# include <mln/core/routine/duplicate.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/estim/min_max.hh>
# include <mln/algebra/vec.hh>
Index: trunk/milena/mln/labeling/mean_values.hh
===================================================================
--- trunk/milena/mln/labeling/mean_values.hh (revision 4030)
+++ trunk/milena/mln/labeling/mean_values.hh (revision 4031)
@@ -40,7 +40,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/alias/vec3d.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/data/transform.hh>
@@ -109,7 +109,7 @@
typedef mln_value(I) IV;
util::array<float> m_3f
- = labeling::compute(accu::mean<IV>(),
+ = labeling::compute(accu::stat::mean<IV>(),
input, // input color image
lbl, // watershed labeling
nlabels);
@@ -139,7 +139,7 @@
const I& input = exact(input_);
const L& lbl = exact(lbl_);
- util::array<vec3d_f> m_3f = labeling::compute(accu::mean<mln_value(I)>(),
+ util::array<vec3d_f> m_3f =
labeling::compute(accu::stat::mean<mln_value(I)>(),
input, // input color image
lbl, // watershed labeling
nlabels);
Index: trunk/milena/sandbox/duhamel/slow_seed2tiling.cc
===================================================================
--- trunk/milena/sandbox/duhamel/slow_seed2tiling.cc (revision 4030)
+++ trunk/milena/sandbox/duhamel/slow_seed2tiling.cc (revision 4031)
@@ -58,7 +58,7 @@
# include <mln/core/queue_p.hh>
# include <mln/core/routine/duplicate.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/estim/min_max.hh>
# include <mln/algebra/vec.hh>
Index: trunk/milena/sandbox/duhamel/labeling_algo.hh
===================================================================
--- trunk/milena/sandbox/duhamel/labeling_algo.hh (revision 4030)
+++ trunk/milena/sandbox/duhamel/labeling_algo.hh (revision 4031)
@@ -12,7 +12,7 @@
#include <mln/debug/println.hh>
#include <mln/util/graph.hh>
#include <mln/core/mesh_p.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/estim/min_max.hh>
#include <algorithm>
#include <utility>
Index: trunk/milena/sandbox/fred/old/accuprops.cc
===================================================================
--- trunk/milena/sandbox/fred/old/accuprops.cc (revision 4030)
+++ trunk/milena/sandbox/fred/old/accuprops.cc (revision 4031)
@@ -216,10 +216,10 @@
template <typename T>
/// Morphological (i.e. for pixel and pixel values) accumulator calculating mean.
/// FIXME: is inclusion polyphormism really appliable ?
- struct mean : public mln::accu::mean<T, typename
internal::sum_handling_pixels<T>::ret>,
+ struct mean : public mln::accu::stat::mean<T, typename
internal::sum_handling_pixels<T>::ret>,
public Accumulator< mean<T> >
{
- typedef mln::accu::mean<T, typename
internal::sum_handling_pixels<T>::ret> super;
+ typedef mln::accu::stat::mean<T, typename
internal::sum_handling_pixels<T>::ret> super;
typedef typename super::result result;
using super::operator result;
@@ -275,8 +275,8 @@
namespace trait {
template <typename I>
- struct accu_< morpho::accu::mean< util::pix<I> > > :
- public undefined_accu_ < morpho::accu::mean< util::pix<I> > >
+ struct accu_< morpho::accu::stat::mean< util::pix<I> > > :
+ public undefined_accu_ < morpho::accu::stat::mean< util::pix<I> >
>
{
typedef accu::when_pix::use_v when_pix;
};
@@ -297,7 +297,7 @@
typedef mln::image2d<int> I;
I ima(1000, 1000);
- mln::morpho::accu::mean< mln::util::pix<I> > acc;
+ mln::morpho::accu::stat::mean< mln::util::pix<I> > acc;
float elapsed;
mln::util::timer chrono;
Index: trunk/milena/sandbox/fred/old/accuprops2.cc
===================================================================
--- trunk/milena/sandbox/fred/old/accuprops2.cc (revision 4030)
+++ trunk/milena/sandbox/fred/old/accuprops2.cc (revision 4031)
@@ -217,10 +217,10 @@
template <typename T>
/// Morphological (i.e. for pixel and pixel values) accumulator calculating mean.
/// FIXME: is inclusion polyphormism really appliable ?
- struct mean : public mln::accu::mean<T, typename
internal::sum_handling_pixels<T>::ret>,
+ struct mean : public mln::accu::stat::mean<T, typename
internal::sum_handling_pixels<T>::ret>,
public Accumulator< mean<T> >
{
- typedef mln::accu::mean<T, typename
internal::sum_handling_pixels<T>::ret> super;
+ typedef mln::accu::stat::mean<T, typename
internal::sum_handling_pixels<T>::ret> super;
using super::operator typename super::result;
using super::take;
@@ -318,8 +318,8 @@
namespace trait {
template <typename I>
- struct accu_< morpho::accu::mean< util::pix<I> > > :
- public undefined_accu_ < morpho::accu::mean< util::pix<I> > >
+ struct accu_< morpho::accu::stat::mean< util::pix<I> > > :
+ public undefined_accu_ < morpho::accu::stat::mean< util::pix<I> >
>
{
typedef accu::when_pix::use_v when_pix;
};
Index: trunk/milena/sandbox/fred/old/mean.hh
===================================================================
--- trunk/milena/sandbox/fred/old/mean.hh (revision 4030)
+++ trunk/milena/sandbox/fred/old/mean.hh (revision 4031)
@@ -36,7 +36,7 @@
///
# include <mln/accu/internal/base.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/util/pix.hh>
namespace mln {
Index: trunk/milena/sandbox/nivault/extract_score.cc
===================================================================
--- trunk/milena/sandbox/nivault/extract_score.cc (revision 4030)
+++ trunk/milena/sandbox/nivault/extract_score.cc (revision 4031)
@@ -52,7 +52,7 @@
# include <mln/labeling/blobs.hh>
# include <mln/core/alias/neighb2d.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/accu/bbox.hh>
# include <mln/accu/p.hh>
# include <mln/accu/count.hh>
Index: trunk/milena/sandbox/nivault/extract_character.cc
===================================================================
--- trunk/milena/sandbox/nivault/extract_character.cc (revision 4030)
+++ trunk/milena/sandbox/nivault/extract_character.cc (revision 4031)
@@ -50,7 +50,7 @@
# include <mln/labeling/blobs.hh>
# include <mln/core/alias/neighb2d.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/accu/bbox.hh>
# include <mln/accu/p.hh>
# include <mln/accu/count.hh>
Index: trunk/milena/sandbox/icdar/2009/dibco/svg.1.binarization.cc
===================================================================
--- trunk/milena/sandbox/icdar/2009/dibco/svg.1.binarization.cc (revision 4030)
+++ trunk/milena/sandbox/icdar/2009/dibco/svg.1.binarization.cc (revision 4031)
@@ -42,8 +42,8 @@
# include <mln/linear/gaussian_1d.hh>
#include <mln/accu/center.hh>
-#include <mln/accu/median_h.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/median_h.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/math/abs.hh>
#include <mln/literal/colors.hh>
@@ -348,7 +348,7 @@
contours(input, threshold);
- typedef accu::median_h<int_u8> A;
+ typedef accu::stat::median_h<int_u8> A;
typedef fun::i2v::array<point2d> F;
Index: trunk/milena/sandbox/icdar/2009/dibco/svg.2.binarization.cc
===================================================================
--- trunk/milena/sandbox/icdar/2009/dibco/svg.2.binarization.cc (revision 4030)
+++ trunk/milena/sandbox/icdar/2009/dibco/svg.2.binarization.cc (revision 4031)
@@ -52,8 +52,8 @@
#include <mln/linear/gaussian_1d.hh>
#include <mln/accu/center.hh>
-#include <mln/accu/median_h.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/median_h.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/math/abs.hh>
#include <mln/debug/draw_graph.hh>
@@ -597,7 +597,7 @@
contours(input, threshold);
- typedef accu::median_h<int_u8> A;
+ typedef accu::stat::median_h<int_u8> A;
typedef fun::i2v::array<point2d> F;
Index: trunk/milena/sandbox/icdar/2009/dibco/svg.3.binarization.cc
===================================================================
--- trunk/milena/sandbox/icdar/2009/dibco/svg.3.binarization.cc (revision 4030)
+++ trunk/milena/sandbox/icdar/2009/dibco/svg.3.binarization.cc (revision 4031)
@@ -54,8 +54,8 @@
#include <mln/linear/gaussian_1d.hh>
#include <mln/accu/center.hh>
-#include <mln/accu/median_h.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/median_h.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/math/abs.hh>
#include <mln/debug/draw_graph.hh>
@@ -700,7 +700,7 @@
contours(input, threshold);
- typedef accu::median_h<int_u8> A;
+ typedef accu::stat::median_h<int_u8> A;
typedef fun::i2v::array<point2d> F;
Index: trunk/milena/sandbox/icdar/2009/dibco/binarization.cc
===================================================================
--- trunk/milena/sandbox/icdar/2009/dibco/binarization.cc (revision 4030)
+++ trunk/milena/sandbox/icdar/2009/dibco/binarization.cc (revision 4031)
@@ -54,8 +54,8 @@
#include <mln/linear/gaussian_1d.hh>
#include <mln/accu/center.hh>
-#include <mln/accu/median_h.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/median_h.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/math/abs.hh>
#include <mln/debug/draw_graph.hh>
@@ -679,7 +679,7 @@
contours(input, threshold);
- typedef accu::median_h<int_u8> A;
+ typedef accu::stat::median_h<int_u8> A;
typedef fun::i2v::array<point2d> F;
Index: trunk/milena/sandbox/fabien/igr/mean_median_label.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/mean_median_label.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/mean_median_label.cc (revision 4031)
@@ -21,7 +21,7 @@
#include <mln/value/rgb8.hh>
#include <mln/accu/sum.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/image/all.hh>
#include <mln/accu/stat/deviation.hh>
#include <mln/arith/div.hh>
@@ -134,7 +134,7 @@
// Mean distance.
- accu::mean<input_type> accu_mean;
+ accu::stat::mean<input_type> accu_mean;
util::array<float> means = labeling::compute(accu_mean, dist, wst, nbasins);
// Display.
@@ -148,7 +148,7 @@
io_save_edges_float(ima_means, 0u, "means.pgm");
}
- typedef accu::mean<input_type> A;
+ typedef accu::stat::mean<input_type> A;
util::array<input_type> m = labeling::compute(A(), dist, wst, nbasins);
{
Index: trunk/milena/sandbox/fabien/igr/time_max_norm.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/time_max_norm.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/time_max_norm.cc (revision 4031)
@@ -14,7 +14,7 @@
#include <mln/io/pgm/save.hh>
#include <mln/accu/count.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/sum.hh>
#include <mln/accu/image/all.hh>
Index: trunk/milena/sandbox/fabien/igr/smooth_fixed_seg/main.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/smooth_fixed_seg/main.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/smooth_fixed_seg/main.cc (revision 4031)
@@ -20,7 +20,7 @@
#include <mln/value/label_16.hh>
#include <mln/accu/sum.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/image/all.hh>
#include <mln/data/fill.hh>
#include <mln/data/paste.hh>
@@ -81,7 +81,7 @@
image1d<V> closing_ima = morpho::closing::structural(input, win_1);
image1d<V> opening_ima = morpho::opening::structural(input, win_1);
- image1d<accu::mean<float> > result;
+ image1d<accu::stat::mean<float> > result;
initialize(result, input);
@@ -215,11 +215,11 @@
// Mean distance.
// Old code.
- //accu::mean<E_TYPE> accu_mean;
+ //accu::stat::mean<E_TYPE> accu_mean;
//util::array<float> means = labeling::compute(accu_mean, e, wst, nbasins);
// Theo version.
- typedef accu::mean<int_u12,float,int_u12> A;
+ typedef accu::stat::mean<int_u12,float,int_u12> A;
util::array<int_u12> means = labeling::compute(A(), e, wst, nbasins);
Index: trunk/milena/sandbox/fabien/igr/time_max.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/time_max.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/time_max.cc (revision 4031)
@@ -12,7 +12,7 @@
#include <mln/io/magick/save.hh>
#include <mln/accu/count.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/sum.hh>
#include <mln/accu/image/all.hh>
@@ -39,7 +39,7 @@
inline
image2d<float> mean_slices(util::array<image2d<float> >& arr_ima,
int first, int last)
{
- image2d<accu::mean<float> > result;
+ image2d<accu::stat::mean<float> > result;
mln_precondition(first >=0 && first < arr_ima.nelements());
mln_precondition(last >=0 && last < arr_ima.nelements());
Index: trunk/milena/sandbox/fabien/igr/fun_labels.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/fun_labels.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/fun_labels.cc (revision 4031)
@@ -25,8 +25,8 @@
#include <mln/value/int_u12.hh>
#include <mln/value/label_16.hh>
-#include <mln/accu/mean.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/mean.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/data/fill.hh>
#include <mln/data/compute.hh>
#include <mln/data/stretch.hh>
@@ -71,7 +71,7 @@
box3d slice = make::box3d(sli, min_row, min_col,
sli, max_row, max_col);
mln_VAR(slice_label, vol_label | slice);
- accu::mean<mln_value(I)> accu_mean;
+ accu::stat::mean<mln_value(I)> accu_mean;
float mean = data::compute(accu_mean, slice_label);
arr.append(mean);
}
@@ -95,7 +95,7 @@
void plot_all_labels(Image<I>& ima, Image<L>& ima_labels, unsigned
nlabels)
{
util::array<util::array<float> > arrays(nlabels);
- accu::mean<int_u12> accu_mean;
+ accu::stat::mean<int_u12> accu_mean;
label_16 l = 0;
int max_slice = ima.domain().pmax().sli();
@@ -167,7 +167,7 @@
start = sli + 1;
}
// Taking the median value of the region.
- accu::mean<mln_value(I)> accu_mean;
+ accu::stat::mean<mln_value(I)> accu_mean;
mln_value(I) mean = data::compute(accu_mean, ima_slice | pw::value(lbl_slice) ==
pw::cst(lbl_slice(point)));
arr.append(mean);
prev_lbl = lbl_slice(point);
Index: trunk/milena/sandbox/fabien/igr/norm.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/norm.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/norm.cc (revision 4031)
@@ -13,7 +13,7 @@
#include <mln/value/int_u12.hh>
#include <mln/accu/image/all.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/arith/all.hh>
#include <mln/data/paste.hh>
@@ -36,7 +36,7 @@
inline
image2d<float> mean_slices(Image<I>& ima, int first, int last)
{
- image2d<accu::mean<float> > result;
+ image2d<accu::stat::mean<float> > result;
initialize(result, slice(ima, first));
Index: trunk/milena/sandbox/fabien/igr/watershed2d.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/watershed2d.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/watershed2d.cc (revision 4031)
@@ -122,7 +122,7 @@
{
// Cf. sandbox/theo/color/segment_rgb_pixels.cc
- util::array<float> m_3f = labeling::compute(accu::mean<mln_value(I)>(),
+ util::array<float> m_3f =
labeling::compute(accu::stat::mean<mln_value(I)>(),
input, // input color image
w, // watershed labeling
nbasins);
Index: trunk/milena/sandbox/fabien/igr/watershed3d.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/watershed3d.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/watershed3d.cc (revision 4031)
@@ -126,7 +126,7 @@
{
// Cf. sandbox/theo/color/segment_rgb_pixels.cc
- util::array<float> m_3f = labeling::compute(accu::mean<mln_value(I)>(),
+ util::array<float> m_3f =
labeling::compute(accu::stat::mean<mln_value(I)>(),
input, // input color image
w, // watershed labeling
nbasins);
Index: trunk/milena/sandbox/fabien/igr/seg_vol_irm.hh
===================================================================
--- trunk/milena/sandbox/fabien/igr/seg_vol_irm.hh (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/seg_vol_irm.hh (revision 4031)
@@ -76,7 +76,7 @@
#include <mln/accu/center.hh>
#include <mln/accu/stat/max.hh>
#include <mln/accu/sum.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/stat/deviation.hh>
#include <mln/histo/compute.hh>
@@ -315,7 +315,7 @@
{
unsigned coef = 1;
- accu::mean<unsigned> mean_accu;
+ accu::stat::mean<unsigned> mean_accu;
unsigned mean = data::compute(mean_accu, (input | (pw::value(input) != 0)));
accu::stat::deviation<unsigned, unsigned, float> dev_accu(mean);
Index: trunk/milena/sandbox/fabien/igr/wst_edges.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/wst_edges.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/wst_edges.cc (revision 4031)
@@ -21,7 +21,7 @@
#include <mln/value/rgb8.hh>
#include <mln/accu/sum.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/image/all.hh>
#include <mln/accu/stat/deviation.hh>
#include <mln/arith/div.hh>
Index: trunk/milena/sandbox/fabien/igr/label2gif.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/label2gif.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/label2gif.cc (revision 4031)
@@ -24,8 +24,8 @@
#include <mln/value/label_16.hh>
#include <mln/value/label_32.hh>
-#include <mln/accu/mean.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/mean.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/data/fill.hh>
#include <mln/data/compute.hh>
#include <mln/data/stretch.hh>
Index: trunk/milena/sandbox/fabien/igr/plot_label.hh
===================================================================
--- trunk/milena/sandbox/fabien/igr/plot_label.hh (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/plot_label.hh (revision 4031)
@@ -13,8 +13,8 @@
#include <mln/io/plot/save.hh>
-#include <mln/accu/mean.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/mean.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/data/compute.hh>
#include <mln/pw/all.hh>
#include <mln/util/array.hh>
@@ -37,7 +37,7 @@
for (int sli = sli_min; sli <= sli_max; ++sli)
{
image2d<I> slice_ima = duplicate(slice(ima, sli));
- accu::mean<I> accu_mean;
+ accu::stat::mean<I> accu_mean;
float mean = data::compute(accu_mean, slice_ima | ima_label.domain());
arr.append(mean);
}
Index: trunk/milena/sandbox/fabien/igr/watershed.hh
===================================================================
--- trunk/milena/sandbox/fabien/igr/watershed.hh (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/watershed.hh (revision 4031)
@@ -122,7 +122,7 @@
{
// Cf. sandbox/theo/color/segment_rgb_pixels.cc
- util::array<float> m_3f = labeling::compute(accu::mean<mln_value(I)>(),
+ util::array<float> m_3f =
labeling::compute(accu::stat::mean<mln_value(I)>(),
input, // input color image
w, // watershed labeling
nbasins);
Index: trunk/milena/sandbox/fabien/igr/space_smooth/median.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/space_smooth/median.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/space_smooth/median.cc (revision 4031)
@@ -10,7 +10,7 @@
#include <mln/io/dicom/load.hh>
#include <mln/io/plot/save.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/core/alias/window2d.hh>
#include <mln/util/array.hh>
@@ -64,8 +64,8 @@
window2d win_c4 = win_c4p();
util::array<image2d<int_u12> > ima_median3;
util::array<image2d<int_u12> > ima_median5;
- accu::median_h<int_u12> accu_med3;
- accu::median_h<int_u12> accu_med5;
+ accu::stat::median_h<int_u12> accu_med3;
+ accu::stat::median_h<int_u12> accu_med5;
image2d<int_u12> tmp;
initialize(tmp, arr_ima[0]);
mln_piter_(image2d<int_u12>) p(arr_ima[0].domain());
Index: trunk/milena/sandbox/fabien/igr/space_smooth/morpho.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/space_smooth/morpho.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/space_smooth/morpho.cc (revision 4031)
@@ -12,7 +12,7 @@
#include <mln/io/dicom/load.hh>
#include <mln/io/plot/save.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/convert/from_to.hh>
#include <mln/morpho/closing/area.hh>
#include <mln/morpho/opening/area.hh>
Index: trunk/milena/sandbox/fabien/igr/space_smooth/linear.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/space_smooth/linear.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/space_smooth/linear.cc (revision 4031)
@@ -10,7 +10,7 @@
#include <mln/io/dump/load.hh>
#include <mln/io/plot/save.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/linear/convolve.hh>
#include <mln/make/w_window2d.hh>
#include <mln/util/array.hh>
Index: trunk/milena/sandbox/fabien/igr/matlab.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/matlab.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/matlab.cc (revision 4031)
@@ -10,7 +10,7 @@
#include <mln/io/dicom/load.hh>
#include <mln/accu/count.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/sum.hh>
#include <mln/accu/image/all.hh>
#include <mln/arith/minus.hh>
@@ -31,7 +31,7 @@
inline
image2d<float> mean_slices(util::array<image2d<float> >& arr_ima,
int first, int last)
{
- image2d<accu::mean<float> > result;
+ image2d<accu::stat::mean<float> > result;
mln_precondition(first >=0 && first < arr_ima.nelements());
mln_precondition(last >=0 && last < arr_ima.nelements());
@@ -93,7 +93,7 @@
// Moyenne //
// //
/////////////
- accu::mean<float> accu_mean;
+ accu::stat::mean<float> accu_mean;
float moysignal1 = data::compute(accu_mean, prodsignal1 | pw::value(roi_noise) ==
pw::cst(true));
////////////////
Index: trunk/milena/sandbox/fabien/igr/graph.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/graph.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/graph.cc (revision 4031)
@@ -120,7 +120,7 @@
{
// Cf. sandbox/theo/color/segment_rgb_pixels.cc
- util::array<float> m_3f = labeling::compute(accu::mean<mln_value(I)>(),
+ util::array<float> m_3f =
labeling::compute(accu::stat::mean<mln_value(I)>(),
input, // input color image
w, // watershed labeling
nbasins);
Index: trunk/milena/sandbox/fabien/igr/time_smooth/median.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/time_smooth/median.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/time_smooth/median.cc (revision 4031)
@@ -10,7 +10,7 @@
#include <mln/io/dicom/load.hh>
#include <mln/io/plot/save.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/util/array.hh>
@@ -54,7 +54,7 @@
initialize(ima_median3, ima_arr);
initialize(ima_median5, ima_arr);
mln_piter_(image2d<int_u12>) p(ima_median3.domain());
- accu::median_h<int_u12> accu_med;
+ accu::stat::median_h<int_u12> accu_med;
for_all(p)
{
// Median 3
Index: trunk/milena/sandbox/fabien/igr/time_smooth/morpho.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/time_smooth/morpho.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/time_smooth/morpho.cc (revision 4031)
@@ -12,7 +12,7 @@
#include <mln/io/dicom/load.hh>
#include <mln/io/plot/save.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/convert/from_to.hh>
#include <mln/morpho/closing/area.hh>
#include <mln/morpho/opening/area.hh>
@@ -67,7 +67,7 @@
image2d<image1d<int_u12> > ima_morpho;
initialize(ima_morpho, ima_arr);
mln_piter_(image2d<int_u12>) p(ima_morpho.domain());
- accu::median_h<int_u12> accu_med;
+ accu::stat::median_h<int_u12> accu_med;
for_all(p)
{
image1d<int_u12> tmp_ima;
Index: trunk/milena/sandbox/fabien/igr/time_smooth/linear.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/time_smooth/linear.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/time_smooth/linear.cc (revision 4031)
@@ -10,7 +10,7 @@
#include <mln/io/dump/all.hh>
#include <mln/io/plot/save.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/util/array.hh>
#include <mln/linear/convolve.hh>
#include <mln/make/w_window3d.hh>
Index: trunk/milena/sandbox/fabien/igr/med.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/med.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/med.cc (revision 4031)
@@ -17,8 +17,8 @@
#include <mln/core/var.hh>
#include <mln/core/routine/extend.hh>
-#include <mln/accu/mean.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/mean.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/histo/array.hh>
#include <mln/histo/compute.hh>
#include <mln/labeling/compute.hh>
@@ -86,7 +86,7 @@
}
image1d<unsigned> ima_histo;
convert::from_to(histogram, ima_histo);
- accu::median_h<int_u12> accu_med;
+ accu::stat::median_h<int_u12> accu_med;
median = data::compute(accu_med, ima_histo | pw::value(ima_histo) != pw::cst(0));
for (int i = 0; i < histogram.nvalues(); ++i)
@@ -122,7 +122,7 @@
}
image1d<unsigned> ima_histo;
convert::from_to(histogram, ima_histo);
- accu::median_h<int_u12> accu_med;
+ accu::stat::median_h<int_u12> accu_med;
median = data::compute(accu_med, ima_histo | pw::value(ima_histo) != pw::cst(0));
for (int i = 0; i < histogram.nvalues(); ++i)
Index: trunk/milena/sandbox/fabien/igr/point_filtering/main.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/point_filtering/main.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/point_filtering/main.cc (revision 4031)
@@ -3,7 +3,7 @@
#include <mln/io/plot/all.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/image/all.hh>
#include <mln/convert/from_to.hh>
#include <mln/morpho/closing/structural.hh>
@@ -44,7 +44,7 @@
image1d<float> opening_ima = morpho::opening::structural(ima, seg21);
image1d<float> closing_ima = morpho::closing::structural(ima, seg21);
- image1d<accu::mean<float> > result;
+ image1d<accu::stat::mean<float> > result;
initialize(result, ima);
Index: trunk/milena/sandbox/fabien/igr/fixed_seg/main.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/fixed_seg/main.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/fixed_seg/main.cc (revision 4031)
@@ -21,7 +21,7 @@
#include <mln/value/rgb8.hh>
#include <mln/accu/sum.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/image/all.hh>
#include <mln/accu/stat/deviation.hh>
#include <mln/arith/div.hh>
@@ -105,7 +105,7 @@
image1d<V> closing_ima = morpho::closing::structural(input, seg);
image1d<V> opening_ima = morpho::opening::structural(input, seg);
- image1d<accu::mean<float> > result;
+ image1d<accu::stat::mean<float> > result;
initialize(result, input);
@@ -280,7 +280,7 @@
// Mean distance.
- /*accu::mean<E_TYPE> accu_mean;
+ /*accu::stat::mean<E_TYPE> accu_mean;
util::array<float> means = labeling::compute(accu_mean, e, wst, nbasins);
// Display.
@@ -295,7 +295,7 @@
io::pgm::save(data::stretch(int_u8(), display_means), "04_means.pgm");
}*/
- /*typedef accu::mean<int_u12,float,int_u12> A;
+ /*typedef accu::stat::mean<int_u12,float,int_u12> A;
util::array<int_u12> m = labeling::compute(A(), d, wst, nbasins);
{
Index: trunk/milena/sandbox/fabien/igr/mean_slices.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/mean_slices.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/mean_slices.cc (revision 4031)
@@ -23,8 +23,8 @@
#include <mln/value/label_16.hh>
#include <mln/value/label_32.hh>
-#include <mln/accu/mean.hh>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/mean.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/labeling/relabel.hh>
#include <mln/labeling/mean_values.hh>
#include <mln/data/compute.hh>
Index: trunk/milena/sandbox/fabien/igr/filter.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/filter.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/igr/filter.cc (revision 4031)
@@ -21,7 +21,7 @@
#include <mln/value/rgb8.hh>
#include <mln/accu/sum.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/image/all.hh>
#include <mln/accu/stat/deviation.hh>
#include <mln/arith/div.hh>
@@ -81,7 +81,7 @@
image1d<V> closing_ima = morpho::closing::structural(input, seg);
image1d<V> opening_ima = morpho::opening::structural(input, seg);
- image1d<accu::mean<float> > result;
+ image1d<accu::stat::mean<float> > result;
initialize(result, input);
Index: trunk/milena/sandbox/fabien/binarization/test.cc
===================================================================
--- trunk/milena/sandbox/fabien/binarization/test.cc (revision 4030)
+++ trunk/milena/sandbox/fabien/binarization/test.cc (revision 4031)
@@ -1,7 +1,7 @@
#include <iostream>
#include <fstream>
-#include <mln/accu/median_h.hh>
+#include <mln/accu/stat/median_h.hh>
#include <mln/algebra/vec.hh>
@@ -87,7 +87,7 @@
image1d<int> ima_lines;
convert::from_to(inter_lines, ima_lines);
- accu::median_h<int_u12> accu_med;
+ accu::stat::median_h<int_u12> accu_med;
median = data::compute(accu_med, ima_lines);
// Gnuplot files creation
Index: trunk/milena/sandbox/inim/2009/classif/src/proj.hh
===================================================================
--- trunk/milena/sandbox/inim/2009/classif/src/proj.hh (revision 4030)
+++ trunk/milena/sandbox/inim/2009/classif/src/proj.hh (revision 4031)
@@ -31,7 +31,7 @@
#include <mln/io/ppm/save.hh>
#include <mln/io/pgm/save.hh>
#include <mln/data/paste.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/maj_h.hh>
#include <mln/literal/white.hh>
#include <mln/literal/colors.hh>
@@ -117,7 +117,7 @@
}
//FIXME: maj_h implies set is finite, mx set is ordered
- accu::mean<mln::algebra::vec<3u, float> > maj_2;
+ accu::stat::mean<mln::algebra::vec<3u, float> > maj_2;
image2d<mln::algebra::vec<3u, float> > mproj =
proj_vec(out3d, histo, maj_2);
Index: trunk/milena/sandbox/inim/2009/color/reference.cc
===================================================================
--- trunk/milena/sandbox/inim/2009/color/reference.cc (revision 4030)
+++ trunk/milena/sandbox/inim/2009/color/reference.cc (revision 4031)
@@ -23,7 +23,7 @@
# include <mln/io/ppm/save.hh>
# include <mln/accu/stat/min_max.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/fun/i2v/array.hh>
# include <mln/fun/p2v/iota.hh>
Index: trunk/milena/sandbox/inim/2009/color/reference2.cc
===================================================================
--- trunk/milena/sandbox/inim/2009/color/reference2.cc (revision 4030)
+++ trunk/milena/sandbox/inim/2009/color/reference2.cc (revision 4031)
@@ -23,7 +23,7 @@
# include <mln/io/ppm/save.hh>
# include <mln/accu/stat/min_max.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/fun/i2v/array.hh>
# include <mln/fun/p2v/iota.hh>
Index: trunk/milena/sandbox/inim/2009/nature/proj.hh
===================================================================
--- trunk/milena/sandbox/inim/2009/nature/proj.hh (revision 4030)
+++ trunk/milena/sandbox/inim/2009/nature/proj.hh (revision 4031)
@@ -30,7 +30,7 @@
#include <mln/io/pgm/save.hh>
#include <mln/data/paste.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/literal/white.hh>
#include <mln/core/image/image2d.hh>
#include <mln/core/image/image1d.hh>
Index: trunk/milena/sandbox/theo/igr/irm_seg_with_mm_and_rag.cc
===================================================================
--- trunk/milena/sandbox/theo/igr/irm_seg_with_mm_and_rag.cc (revision 4030)
+++ trunk/milena/sandbox/theo/igr/irm_seg_with_mm_and_rag.cc (revision 4031)
@@ -24,7 +24,7 @@
#include <mln/morpho/closing_area.hh>
#include <mln/morpho/meyer_wst.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/data/take.hh>
#include <mln/util/graph.hh>
Index: trunk/milena/sandbox/theo/igr/irm_anat_segm.cc
===================================================================
--- trunk/milena/sandbox/theo/igr/irm_anat_segm.cc (revision 4030)
+++ trunk/milena/sandbox/theo/igr/irm_anat_segm.cc (revision 4031)
@@ -10,7 +10,7 @@
#include <mln/morpho/closing_height.hh>
#include <mln/morpho/watershed/flooding.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/labeling/compute.hh>
#include <mln/fun/i2v/array.hh>
#include <mln/data/transform.hh>
@@ -52,7 +52,7 @@
std::cout << n_basins << std::endl;
- accu::mean<int_u8, float, int_u8> a_;
+ accu::stat::mean<int_u8, float, int_u8> a_;
util::array<int_u8> a = labeling::compute(a_, vol, wst, n_basins);
for (L l = 1; l <= n_basins; ++l)
if (a[l] == 0)
Index: trunk/milena/sandbox/theo/igr/irm_anat_segm__2D_ONLY.cc
===================================================================
--- trunk/milena/sandbox/theo/igr/irm_anat_segm__2D_ONLY.cc (revision 4030)
+++ trunk/milena/sandbox/theo/igr/irm_anat_segm__2D_ONLY.cc (revision 4031)
@@ -9,7 +9,7 @@
#include <mln/morpho/closing_volume.hh>
#include <mln/morpho/meyer_wst.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/labeling/compute.hh>
#include <mln/fun/i2v/array.hh>
#include <mln/data/transform.hh>
@@ -44,7 +44,7 @@
std::cout << n_basins << std::endl;
- accu::mean<int_u8, float, int_u8> a_;
+ accu::stat::mean<int_u8, float, int_u8> a_;
util::array<int_u8> a = labeling::compute(a_, vol, wst, n_basins);
std::cout << a << std::endl;
a[0] = 0;
Index: trunk/milena/sandbox/theo/igr/segment_2d_t.cc
===================================================================
--- trunk/milena/sandbox/theo/igr/segment_2d_t.cc (revision 4030)
+++ trunk/milena/sandbox/theo/igr/segment_2d_t.cc (revision 4031)
@@ -18,7 +18,7 @@
#include <mln/morpho/closing/height.hh>
#include <mln/morpho/watershed/flooding.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/labeling/compute.hh>
#include <mln/arith/div.hh>
@@ -107,7 +107,7 @@
// debug_println("w", w);
// io_save_edges_int_u12(w, 0, "w.pgm");
- typedef accu::mean<int_u12,float,int_u12> A;
+ typedef accu::stat::mean<int_u12,float,int_u12> A;
util::array<int_u12> m = labeling::compute(A(), d, w, n_basins);
{
Index: trunk/milena/sandbox/theo/exec/color_labeling_mean.cc
===================================================================
--- trunk/milena/sandbox/theo/exec/color_labeling_mean.cc (revision 4030)
+++ trunk/milena/sandbox/theo/exec/color_labeling_mean.cc (revision 4031)
@@ -2,7 +2,7 @@
#include <mln/estim/min_max.hh>
#include <mln/labeling/compute.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/data/transform.hh>
#include <mln/value/label_8.hh>
@@ -49,7 +49,7 @@
std::cout << "n labels = " << nlabels << std::endl;
- accu::mean<rgb8> m_;
+ accu::stat::mean<rgb8> m_;
typedef algebra::vec<3,float> V;
util::array<V> m = labeling::compute(m_, ima, lab_, nlabels);
Index: trunk/milena/sandbox/theo/esiee/laurent/presentation/wst_edge.cc
===================================================================
--- trunk/milena/sandbox/theo/esiee/laurent/presentation/wst_edge.cc (revision 4030)
+++ trunk/milena/sandbox/theo/esiee/laurent/presentation/wst_edge.cc (revision 4031)
@@ -22,7 +22,7 @@
# include <mln/io/ppm/save.hh>
# include <mln/accu/stat/min_max.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/fun/i2v/array.hh>
# include <mln/fun/p2v/iota.hh>
Index: trunk/milena/sandbox/theo/cs2d/cs2d.cc
===================================================================
--- trunk/milena/sandbox/theo/cs2d/cs2d.cc (revision 4030)
+++ trunk/milena/sandbox/theo/cs2d/cs2d.cc (revision 4031)
@@ -17,7 +17,7 @@
# include <mln/logical/not.hh>
# include <mln/labeling/blobs.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
@@ -101,7 +101,7 @@
mln_invariant(L == l);
std::vector<int_u8> v(l + 1);
- accu::compute<accu::mean>(cs_.cell, label, v);
+ accu::compute<accu::stat::mean>(cs_.cell, label, v);
data::fill(cs_.cell, data::transform(label, v));
io::pgm::save(cell_image(cs_), argv[3]);
Index: trunk/milena/sandbox/theo/experimental/projected_histo.cc
===================================================================
--- trunk/milena/sandbox/theo/experimental/projected_histo.cc (revision 4030)
+++ trunk/milena/sandbox/theo/experimental/projected_histo.cc (revision 4031)
@@ -9,7 +9,7 @@
#include <mln/pw/value.hh>
#include <mln/accu/count.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/image/init.hh>
#include <mln/accu/image/take.hh>
@@ -30,7 +30,7 @@
io::pgm::load(lena, "../../../img/fly.pgm");
debug::println(lena);
- typedef accu::mean<int_u8, unsigned, int_u8> A;
+ typedef accu::stat::mean<int_u8, unsigned, int_u8> A;
image1d<A> vmean(lena.ncols());
accu::image::init(vmean);
Index: trunk/milena/sandbox/theo/color/segment_rgb_edges.cc
===================================================================
--- trunk/milena/sandbox/theo/color/segment_rgb_edges.cc (revision 4030)
+++ trunk/milena/sandbox/theo/color/segment_rgb_edges.cc (revision 4031)
@@ -24,7 +24,7 @@
#include <mln/accu/count.hh>
#include <mln/accu/volume.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include "sum_pix.hh"
#include "segment.hh"
@@ -341,7 +341,7 @@
typedef algebra::vec<3,float> vec3f;
- util::array<vec3f> m_3f = labeling::compute(accu::mean<rgb8>(),
+ util::array<vec3f> m_3f = labeling::compute(accu::stat::mean<rgb8>(),
input,
full2image(w_all),
nbasins);
@@ -360,7 +360,7 @@
// FIXME: The code below does not work!
-// util::array<vec3f> m_3f = labeling::compute(accu::mean<rgb8>(),
+// util::array<vec3f> m_3f = labeling::compute(accu::stat::mean<rgb8>(),
// input_,
// w_squares,
// nbasins);
Index: trunk/milena/sandbox/theo/color/filter_blen_rgb_edges.cc
===================================================================
--- trunk/milena/sandbox/theo/color/filter_blen_rgb_edges.cc (revision 4030)
+++ trunk/milena/sandbox/theo/color/filter_blen_rgb_edges.cc (revision 4031)
@@ -27,7 +27,7 @@
#include <mln/accu/count.hh>
#include <mln/accu/volume.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include "sum_pix.hh"
#include "segment.hh"
@@ -352,7 +352,7 @@
typedef algebra::vec<3,float> vec3f;
- util::array<vec3f> m_3f = labeling::compute(accu::mean<rgb8>(),
+ util::array<vec3f> m_3f = labeling::compute(accu::stat::mean<rgb8>(),
input,
full2image(w_all),
nbasins);
@@ -379,7 +379,7 @@
// FIXME: The code below does not work!
-// util::array<vec3f> m_3f = labeling::compute(accu::mean<rgb8>(),
+// util::array<vec3f> m_3f = labeling::compute(accu::stat::mean<rgb8>(),
// input_,
// w_squares,
// nbasins);
Index: trunk/milena/sandbox/lazzara/igr/irm_seg_with_mm_and_rag.mine.cc
===================================================================
--- trunk/milena/sandbox/lazzara/igr/irm_seg_with_mm_and_rag.mine.cc (revision 4030)
+++ trunk/milena/sandbox/lazzara/igr/irm_seg_with_mm_and_rag.mine.cc (revision 4031)
@@ -41,7 +41,7 @@
#include <mln/morpho/closing_area.hh>
#include <mln/morpho/meyer_wst.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
//#include <mln/data/take.hh>
#include <mln/util/graph.hh>
@@ -265,7 +265,7 @@
io::pgm::save( data::transform(wshed, convert::to_fun(foo)),
"tmp_wshed.pgm" );
- mln_VAR(mean_values, labeling::compute(accu::meta::mean(), irm, wshed, nbasins));
+ mln_VAR(mean_values, labeling::compute(accu::meta::stat::mean(), irm, wshed,
nbasins));
fun::i2v::array<label_16> to_keep(nbasins.next(), 0);
threshold f;
for (label_16 i = 1; i < mean_values.nelements(); ++i)
Index: trunk/milena/sandbox/lazzara/igr/irm/wst_rag_hsl.cc
===================================================================
--- trunk/milena/sandbox/lazzara/igr/irm/wst_rag_hsl.cc (revision 4030)
+++ trunk/milena/sandbox/lazzara/igr/irm/wst_rag_hsl.cc (revision 4031)
@@ -105,7 +105,7 @@
{
// Cf. sandbox/theo/color/segment_rgb_pixels.cc
- util::array<vec3d_f> m_3f =
labeling::compute(accu::mean<mln_value(I)>(),
+ util::array<vec3d_f> m_3f =
labeling::compute(accu::stat::mean<mln_value(I)>(),
input, // input color image
w, // watershed labeling
nbasins);
Index: trunk/milena/sandbox/lazzara/igr/irm/wst_rag.cc
===================================================================
--- trunk/milena/sandbox/lazzara/igr/irm/wst_rag.cc (revision 4030)
+++ trunk/milena/sandbox/lazzara/igr/irm/wst_rag.cc (revision 4031)
@@ -82,7 +82,7 @@
{
// Cf. sandbox/theo/color/segment_rgb_pixels.cc
- util::array<vec3d_f> m_3f =
labeling::compute(accu::mean<mln_value(I)>(),
+ util::array<vec3d_f> m_3f =
labeling::compute(accu::stat::mean<mln_value(I)>(),
input, // input color image
w, // watershed labeling
nbasins);
Index: trunk/milena/sandbox/edwin/exec/color_labeling_mean.hh
===================================================================
--- trunk/milena/sandbox/edwin/exec/color_labeling_mean.hh (revision 4030)
+++ trunk/milena/sandbox/edwin/exec/color_labeling_mean.hh (revision 4031)
@@ -32,7 +32,7 @@
# include <mln/core/image/image2d.hh>
# include <mln/labeling/compute.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/level/transform.hh>
# include <mln/value/label_8.hh>
@@ -49,7 +49,7 @@
using value::rgb8;
typedef algebra::vec<3,float> V;
- accu::mean<value::rgb8> m_;
+ accu::stat::mean<value::rgb8> m_;
util::array<V> m = labeling::compute(m_, input, exact(label), nlabels);
util::array<rgb8> c(unsigned(nlabels) + 1);
Index: trunk/milena/sandbox/folio/test/histo/project_histo_add.cc
===================================================================
--- trunk/milena/sandbox/folio/test/histo/project_histo_add.cc (revision 4030)
+++ trunk/milena/sandbox/folio/test/histo/project_histo_add.cc (revision 4031)
@@ -22,7 +22,7 @@
#include "../../mln/histo/classify_with_histo_rgb.hh"
#include <mln/accu/count.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/sum.hh>
#include <mln/accu/image/init.hh>
#include <mln/accu/image/take.hh>
@@ -123,7 +123,7 @@
// std::cout << " => computing projection..." << std::endl;
-// typedef accu::mean<int_u8, unsigned, int_u8> A;
+// typedef accu::stat::mean<int_u8, unsigned, int_u8> A;
// image2d<A> vmean(lab.nrows(), lab.ncols());
// accu::image::init(vmean);
// {
Index: trunk/milena/sandbox/folio/test/histo/project_screen.cc
===================================================================
--- trunk/milena/sandbox/folio/test/histo/project_screen.cc (revision 4030)
+++ trunk/milena/sandbox/folio/test/histo/project_screen.cc (revision 4031)
@@ -22,7 +22,7 @@
#include "../../mln/histo/classify_with_histo_rgb.hh"
#include <mln/accu/count.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/sum.hh>
#include <mln/accu/image/init.hh>
#include <mln/accu/image/take.hh>
@@ -134,7 +134,7 @@
// std::cout << " => computing projection..." << std::endl;
-// typedef accu::mean<int_u8, unsigned, int_u8> A;
+// typedef accu::stat::mean<int_u8, unsigned, int_u8> A;
// image2d<A> vmean(lab.nrows(), lab.ncols());
// accu::image::init(vmean);
// {
Index: trunk/milena/sandbox/folio/test/histo/projected3d.cc
===================================================================
--- trunk/milena/sandbox/folio/test/histo/projected3d.cc (revision 4030)
+++ trunk/milena/sandbox/folio/test/histo/projected3d.cc (revision 4031)
@@ -22,7 +22,7 @@
#include "../../mln/histo/classify_with_histo_rgb.hh"
#include <mln/accu/count.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/accu/sum.hh>
#include <mln/accu/image/init.hh>
#include <mln/accu/image/take.hh>
@@ -123,7 +123,7 @@
std::cout << " => computing projection..." << std::endl;
- // typedef accu::mean<int_u8, unsigned, int_u8> A;
+ // typedef accu::stat::mean<int_u8, unsigned, int_u8> A;
// image2d<A> vmean(lab.nrows(), lab.ncols());
// accu::image::init(vmean);
// {
Index: trunk/milena/sandbox/beguin/irm_g.cc
===================================================================
--- trunk/milena/sandbox/beguin/irm_g.cc (revision 4030)
+++ trunk/milena/sandbox/beguin/irm_g.cc (revision 4031)
@@ -24,7 +24,7 @@
#include <mln/morpho/closing_area.hh>
#include <mln/morpho/meyer_wst.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/data/take.hh>
#include <mln/util/graph.hh>
Index: trunk/milena/sandbox/beguin/irm.cc
===================================================================
--- trunk/milena/sandbox/beguin/irm.cc (revision 4030)
+++ trunk/milena/sandbox/beguin/irm.cc (revision 4031)
@@ -33,7 +33,7 @@
#include <mln/morpho/closing_area.hh>
#include <mln/morpho/meyer_wst.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
#include <mln/data/take.hh>
#include <mln/util/graph.hh>
Index: trunk/milena/tests/accu/median_h.cc (deleted)
===================================================================
Index: trunk/milena/tests/accu/mean.cc (deleted)
===================================================================
Index: trunk/milena/tests/accu/pair.cc
===================================================================
--- trunk/milena/tests/accu/pair.cc (revision 4030)
+++ trunk/milena/tests/accu/pair.cc (revision 4031)
@@ -25,9 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/accu/mean.cc
+/*! \file tests/accu/stat/mean.cc
*
- * \brief Tests on mln::accu::mean.
+ * \brief Tests on mln::accu::stat::mean.
*/
#include <mln/core/image/image2d.hh>
@@ -35,14 +35,14 @@
#include <mln/accu/pair.hh>
#include <mln/accu/stat/max.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
int main()
{
using namespace mln;
{
- accu::pair<accu::mean<int>, accu::stat::max<int> > mean;
+ accu::pair<accu::stat::mean<int>, accu::stat::max<int> > mean;
mean.take(10);
mean.take(9);
Index: trunk/milena/tests/accu/Makefile.am
===================================================================
--- trunk/milena/tests/accu/Makefile.am (revision 4030)
+++ trunk/milena/tests/accu/Makefile.am (revision 4031)
@@ -15,8 +15,6 @@
histo \
line \
max_site \
- mean \
- median_h \
nil \
pair \
rank \
@@ -34,8 +32,6 @@
histo_SOURCES = histo.cc
line_SOURCES = line.cc
max_site_SOURCES = max_site.cc
-mean_SOURCES = mean.cc
-median_h_SOURCES = median_h.cc
nil_SOURCES = nil.cc
pair_SOURCES = pair.cc
rank_SOURCES = rank.cc
Index: trunk/milena/tests/accu/all_accus.cc
===================================================================
--- trunk/milena/tests/accu/all_accus.cc (revision 4030)
+++ trunk/milena/tests/accu/all_accus.cc (revision 4031)
@@ -38,19 +38,18 @@
int main()
{
using namespace mln;
- using namespace mln::accu;
- bbox<point2d> b;
- count<int> c;
- mln::accu::histo<bool> h;
- stat::max<int> ma;
- mean<int> me;
- // median< value::set<bool> > med; // FIXME: bool has no min so
workaround!
- stat::min<int> mi;
- // min_h< value::set<bool> > mh; // OK: do not work since bool has
+ accu::bbox<point2d> b;
+ accu::count<int> c;
+ accu::histo<bool> h;
+ accu::stat::max<int> ma;
+ accu::stat::mean<int> me;
+ // accu::median< value::set<bool> > med; // FIXME: bool has no min so
workaround!
+ accu::stat::min<int> mi;
+ // accu::stat::min_h< value::set<bool> > mh; // OK: do not work since
bool has
// no min/max :)
- stat::min_max<int> mm;
- nil<int> n;
- pair< stat::min<int>, stat::max<int> > p;
- sum<int> s;
+ accu::stat::min_max<int> mm;
+ accu::nil<int> n;
+ accu::pair< accu::stat::min<int>, accu::stat::max<int> > p;
+ accu::sum<int> s;
}
Index: trunk/milena/tests/accu/stat/mean.cc
===================================================================
--- trunk/milena/tests/accu/stat/mean.cc (revision 0)
+++ trunk/milena/tests/accu/stat/mean.cc (revision 4031)
@@ -0,0 +1,69 @@
+// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
+//
+// This file is part of the Milena 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/accu/stat/mean.cc
+ *
+ * \brief Tests on mln::accu::stat::mean.
+ */
+
+#include <mln/core/image/image2d.hh>
+#include <mln/value/int_u8.hh>
+
+#include <mln/accu/stat/mean.hh>
+
+int main()
+{
+ using namespace mln;
+
+ {
+ mln_accu_with_(accu::meta::stat::mean, int) mean;
+
+ mean.take(10);
+ mean.take(9);
+ mean.take(8);
+ mean.take(7);
+ mean.take(6);
+ mean.take(5);
+ mean.take(4);
+ mean.take(3);
+ mean.take(2);
+ mean.take(1);
+ mean.take(0);
+
+ mln_assertion(mean.to_result() == 5);
+ }
+
+ {
+ mln_accu_with_(accu::meta::stat::mean, int) mean;
+
+ mean.take(10);
+ mean.take(8);
+ mean.take(0);
+
+ mln_assertion(mean.to_result() == 6);
+ }
+}
Property changes on: trunk/milena/tests/accu/stat/mean.cc
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/tests/accu/stat/median_h.cc
===================================================================
--- trunk/milena/tests/accu/stat/median_h.cc (revision 0)
+++ trunk/milena/tests/accu/stat/median_h.cc (revision 4031)
@@ -0,0 +1,70 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
+//
+// This file is part of the Milena 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/accu/stat/median_h.cc
+///
+/// Tests on mln::accu::stat::median_h.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/value/int_u8.hh>
+
+#include <mln/accu/stat/median_h.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ accu::stat::median_h<value::int_u8> med;
+
+ med.take(10);
+ med.take(9);
+ med.take(8);
+ med.take(7);
+ med.take(6);
+ med.take(5);
+ med.take(4);
+ med.take(3);
+ med.take(2);
+ med.take(1);
+ med.take(0);
+
+ mln_assertion(med.to_result() == 5u);
+ }
+
+ {
+ accu::stat::median_h<value::int_u8> med;
+
+ med.take(10);
+ med.take(7);
+ med.take(0);
+
+ mln_assertion(med.to_result() == 7u);
+ }
+}
Property changes on: trunk/milena/tests/accu/stat/median_h.cc
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/tests/accu/stat/Makefile.am
===================================================================
--- trunk/milena/tests/accu/stat/Makefile.am (revision 4030)
+++ trunk/milena/tests/accu/stat/Makefile.am (revision 4031)
@@ -8,9 +8,13 @@
min_h \
min_max \
max \
- max_h
+ max_h \
+ median_h \
+ mean
var_SOURCES = var.cc
+mean_SOURCES = min.cc
+median_h_SOURCES = min_h.cc
min_SOURCES = min.cc
min_h_SOURCES = min_h.cc
max_SOURCES = max.cc
Index: trunk/milena/tests/accu/tuple.cc
===================================================================
--- trunk/milena/tests/accu/tuple.cc (revision 4030)
+++ trunk/milena/tests/accu/tuple.cc (revision 4031)
@@ -39,14 +39,14 @@
#include <mln/accu/count.hh>
#include <mln/accu/stat/max.hh>
#include <mln/accu/stat/min.hh>
-#include <mln/accu/mean.hh>
+#include <mln/accu/stat/mean.hh>
int main()
{
using namespace mln;
- typedef accu::tuple<int, 4, accu::count<int>, accu::stat::max<int>,
accu::stat::min<int>, accu::mean<int> > teratuple;
+ typedef accu::tuple<int, 4, accu::count<int>, accu::stat::max<int>,
accu::stat::min<int>, accu::stat::mean<int> > teratuple;
teratuple tuple1;
teratuple tuple2;
Index: trunk/milena/tests/estim/mean.cc
===================================================================
--- trunk/milena/tests/estim/mean.cc (revision 4030)
+++ trunk/milena/tests/estim/mean.cc (revision 4031)
@@ -49,5 +49,5 @@
// 7 8 9
mln_assertion(estim::mean(ima) == 5);
- // FIXME: Add example on accu::mean used several times.
+ // FIXME: Add example on accu::stat::mean used several times.
}
Index: trunk/milena/doc/examples/trash/accu.cc
===================================================================
--- trunk/milena/doc/examples/trash/accu.cc (revision 4030)
+++ trunk/milena/doc/examples/trash/accu.cc (revision 4031)
@@ -1,13 +1,13 @@
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
int main()
{
using namespace mln;
- mlc_bool(accu::mean<int>::proxy_level == 1)::check();
+ mlc_bool(accu::stat::mean<int>::proxy_level == 1)::check();
- accu::mean<int> m;
+ accu::stat::mean<int> m;
m.take(100);
m.take(2);
mln_assertion(m == 51);
Index: trunk/milena/doc/examples/trash/tuto_bis.cc
===================================================================
--- trunk/milena/doc/examples/trash/tuto_bis.cc (revision 4030)
+++ trunk/milena/doc/examples/trash/tuto_bis.cc (revision 4031)
@@ -13,7 +13,7 @@
# include <mln/literal/origin.hh>
# include <mln/accu/stat/min_max.hh>
-# include <mln/accu/mean.hh>
+# include <mln/accu/stat/mean.hh>
# include <mln/fun/i2v/array.hh>
# include <mln/fun/p2v/iota.hh>
@@ -259,7 +259,7 @@
fun::i2v::array<int> m(nbasins + 1);
- accu::compute<accu::meta::mean>(cell, label, m);
+ accu::compute<accu::meta::stat::mean>(cell, label, m);
for (unsigned i = 1; i <= nbasins; ++i)
std::cout << "mean value of basin #" << i << " is
" << m(i) << std::endl;