URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-06-16 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Move rank accus in stat directory.
* mln/accu/rank.hh,
* mln/accu/rank_bool.hh,
* mln/accu/rank_high_quant.hh: Move to...
* mln/accu/stat/rank.hh,
* mln/accu/stat/rank_bool.hh,
* mln/accu/stat/rank_high_quant.hh:
Move rank accus to stat directory.
* mln/accu/all.hh,
* mln/accu/essential.hh,
* mln/accu/stat/all.hh,
* mln/accu/stat/essential.hh:
Update all and essential respecting new locations.
* tests/accu/rank.cc,
* tests/accu/stat/rank.cc:
Move tests in stat directory.
* tests/accu/Makefile.am,
* tests/accu/stat/Makefile.am:
Update makefiles.
* mln/morpho/includes.hh,
* mln/morpho/rank_filter.hh,
* mln/morpho/tree/compute_attribute_image.hh,
* sandbox/theo/tufa_2008/filter_n.cc:
Replace accu::accu_name by accu::stat::accu_name,
accu::meta::accu_name by accu::meta::stat::accu_name,
accu/accu_name by accu/stat/accu_name.
---
mln/accu/all.hh | 1
mln/accu/essential.hh | 1
mln/accu/stat/all.hh | 4
mln/accu/stat/essential.hh | 1
mln/accu/stat/rank.hh | 358 +++++++++++++++++++++++++++++
mln/accu/stat/rank_bool.hh | 171 +++++++++++++
mln/accu/stat/rank_high_quant.hh | 224 ++++++++++++++++++
mln/morpho/includes.hh | 2
mln/morpho/rank_filter.hh | 6
mln/morpho/tree/compute_attribute_image.hh | 2
sandbox/theo/tufa_2008/filter_n.cc | 2
tests/accu/Makefile.am | 2
tests/accu/stat/Makefile.am | 5
tests/accu/stat/rank.cc | 108 ++++++++
14 files changed, 876 insertions(+), 11 deletions(-)
Index: trunk/milena/mln/accu/rank.hh (deleted)
===================================================================
Index: trunk/milena/mln/accu/rank_high_quant.hh (deleted)
===================================================================
Index: trunk/milena/mln/accu/rank_bool.hh (deleted)
===================================================================
Index: trunk/milena/mln/accu/all.hh
===================================================================
--- trunk/milena/mln/accu/all.hh (revision 4151)
+++ trunk/milena/mln/accu/all.hh (revision 4152)
@@ -61,7 +61,6 @@
# include <mln/accu/line.hh>
# include <mln/accu/nil.hh>
# include <mln/accu/pair.hh>
-# include <mln/accu/rank.hh>
# include <mln/accu/rms.hh>
// << # include <mln/accu/tuple.hh> >>
Index: trunk/milena/mln/accu/essential.hh
===================================================================
--- trunk/milena/mln/accu/essential.hh (revision 4151)
+++ trunk/milena/mln/accu/essential.hh (revision 4152)
@@ -32,7 +32,6 @@
# include <mln/accu/center.hh>
# include <mln/accu/histo.hh>
-# include <mln/accu/rank.hh>
# include <mln/accu/stat/essential.hh>
# include <mln/accu/image/essential.hh>
Index: trunk/milena/mln/accu/stat/essential.hh
===================================================================
--- trunk/milena/mln/accu/stat/essential.hh (revision 4151)
+++ trunk/milena/mln/accu/stat/essential.hh (revision 4152)
@@ -37,5 +37,6 @@
# include <mln/accu/stat/min_max.hh>
# include <mln/accu/stat/mean.hh>
# include <mln/accu/stat/median_h.hh>
+# include <mln/accu/stat/rank.hh>
#endif // ! MLN_ACCU_STAT_ESSENTIAL_HH
Index: trunk/milena/mln/accu/stat/rank.hh
===================================================================
--- trunk/milena/mln/accu/stat/rank.hh (revision 0)
+++ trunk/milena/mln/accu/stat/rank.hh (revision 4152)
@@ -0,0 +1,358 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_RANK_HH
+# define MLN_ACCU_STAT_RANK_HH
+
+/// \file
+///
+/// Define an rank accumulator.
+///
+/// \todo It should be renamed as rank_h since it relies on histogram
+/// (thus low quantization).
+
+# include <vector>
+# include <mln/accu/internal/base.hh>
+# include <mln/accu/histo.hh>
+# include <mln/core/concept/meta_accumulator.hh>
+# include <mln/trait/value_.hh>
+# include <mln/util/pix.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace stat
+ {
+
+
+ /// \brief Generic rank accumulator class.
+ ///
+ /// The parameter \c T is the type of values.
+ ///
+ /// \ingroup modaccuvalues
+ template <typename T>
+ struct rank : public mln::accu::internal::base< const T&, rank<T> >
+ {
+ typedef T argument;
+ typedef mln::value::set<T> S;
+
+ rank();
+ explicit rank(unsigned k);
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take(const argument& t);
+ void take(const rank<T>& other);
+ void untake(const argument& t);
+ void untake(const rank<T>& other);
+ /// \}
+
+ unsigned card() const { return h_.sum(); }
+
+ /// Get the value of the accumulator.
+ const T& to_result() const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ /// Give the rank.
+ unsigned k() const;
+
+ protected:
+
+ unsigned k_; // 0 <= k_ < n
+
+ mutable accu::histo<T> h_;
+ const S& s_; // derived from h_
+
+ mutable unsigned sum_minus_, sum_plus_;
+
+ mutable bool valid_;
+ mutable unsigned i_; // the median index
+ mutable argument t_; // the median value
+
+ // Auxiliary methods
+ void update_() const;
+ void go_minus_() const;
+ void go_plus_() const;
+ };
+
+
+ template <typename I> struct rank< util::pix<I> >;
+
+
+ } // end of mln::accu::stat
+
+
+ namespace meta
+ {
+
+ namespace stat
+ {
+
+ /// Meta accumulator for rank.
+
+ struct rank : public Meta_Accumulator< rank >
+ {
+ rank(unsigned k_) : k(k_) {}
+
+ template <typename T>
+ struct with
+ {
+ typedef accu::stat::rank<T> ret;
+ };
+
+ unsigned k;
+ };
+
+ } // end of namespace mln::accu::meta::stat
+
+ } // end of namespace mln::accu::meta
+
+
+ template <typename T>
+ stat::rank<T> unmeta(const meta::stat::rank& m, T)
+ {
+ stat::rank<T> a(m.k);
+ return a;
+ }
+
+
+
+
+ namespace stat
+ {
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T>
+ inline
+ rank<T>::rank()
+ : h_(),
+ s_(h_.vset())
+ {
+ init();
+ }
+
+ template <typename T>
+ inline
+ rank<T>::rank(unsigned k)
+ : k_(k),
+ h_(),
+ s_(h_.vset())
+ {
+ init();
+ }
+
+ template <typename T>
+ inline
+ unsigned
+ rank<T>::k() const
+ {
+ return k_;
+ }
+
+ template <typename T>
+ inline
+ void rank<T>::take(const argument& t)
+ {
+ h_.take(t);
+
+ if (t < t_)
+ ++sum_minus_;
+ else if (t > t_)
+ ++sum_plus_;
+
+ if (valid_)
+ valid_ = false;
+ }
+
+ template <typename T>
+ inline
+ void
+ rank<T>::take(const rank<T>& 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 T>
+ inline
+ void
+ rank<T>::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 T>
+ inline
+ void
+ rank<T>::untake(const rank<T>& other)
+ {
+ // h_
+ h_.untake(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 T>
+ inline
+ void
+ rank<T>::update_() const
+ {
+ valid_ = true;
+
+ if (h_.sum() == 0)
+ return;
+
+ if (sum_minus_ > k_)
+ go_minus_();
+ else
+ if ((sum_minus_ + h_[i_]) < k_)
+ 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 T>
+ inline
+ void
+ rank<T>::go_minus_() const
+ {
+ do
+ {
+ sum_plus_ += h_[i_];
+ do
+ --i_;
+ while (h_[i_] == 0);
+ sum_minus_ -= h_[i_];
+ }
+ while (sum_minus_ > k_);
+ t_ = s_[i_];
+ }
+
+ template <typename T>
+ inline
+ void
+ rank<T>::go_plus_() const
+ {
+ do
+ {
+ sum_minus_ += h_[i_];
+ do
+ ++i_;
+ while (h_[i_] == 0);
+ sum_plus_ -= h_[i_];
+ }
+ while ((sum_minus_ + h_[i_]) < k_);
+ t_ = s_[i_];
+ }
+
+ template <typename T>
+ inline
+ void
+ rank<T>::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 T>
+ inline
+ const T&
+ rank<T>::to_result() const
+ {
+ if (! valid_)
+ update_();
+ return t_;
+ }
+
+ template <typename T>
+ inline
+ bool
+ rank<T>::is_valid() const
+ {
+ return valid_;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::stat
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+#include <mln/accu/stat/rank_bool.hh>
+
+#endif // ! MLN_ACCU_STAT_RANK_HH
Property changes on: trunk/milena/mln/accu/stat/rank.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/mln/accu/stat/rank_high_quant.hh
===================================================================
--- trunk/milena/mln/accu/stat/rank_high_quant.hh (revision 0)
+++ trunk/milena/mln/accu/stat/rank_high_quant.hh (revision 4152)
@@ -0,0 +1,224 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_RANK_HIGH_QUANT_HH
+# define MLN_ACCU_STAT_RANK_HIGH_QUANT_HH
+
+/// \file
+///
+/// Define an rank accumulator.
+
+# include <vector>
+# include <mln/accu/internal/base.hh>
+# include <mln/core/concept/meta_accumulator.hh>
+# include <mln/trait/value_.hh>
+# include <mln/util/pix.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace stat
+ {
+
+
+ /// \brief Generic rank accumulator class.
+ /*!
+ * The parameter \c T is the type of values.
+ *
+ * \ingroup modaccuvalues
+ */
+ template <typename T>
+ struct rank_high_quant : public mln::accu::internal::base< const T&, rank_high_quant<T> >
+ {
+ typedef T argument;
+
+ rank_high_quant(unsigned k, unsigned n);
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take_as_init_(const argument& t);
+ void take(const argument& t);
+ void take(const rank_high_quant<T>& other);
+ void sort();
+ /// \}
+
+ /// Get the value of the accumulator.
+ const T& to_result() const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ protected:
+
+ std::vector<T> elts_;
+ bool is_sorted_;
+ unsigned k_; // 0 <= k_ < n
+ unsigned n_;
+ };
+
+
+ template <typename I> struct rank_high_quant< util::pix<I> >;
+
+
+ } // end of mln::accu::stat
+
+
+ namespace meta
+ {
+
+ namespace stat
+ {
+
+ /// Meta accumulator for rank_high_quant.
+
+ struct rank_high_quant : public Meta_Accumulator< rank_high_quant >
+ {
+ rank_high_quant(unsigned k_, unsigned n_) : k(k_), n(n_) {}
+
+ template <typename T>
+ struct with
+ {
+ typedef accu::stat::rank_high_quant<T> ret;
+ };
+
+ unsigned k;
+ unsigned n;
+ };
+
+ } // end of namespace mln::accu::meta::stat
+
+ } // end of namespace mln::accu::meta
+
+
+ template <typename T>
+ stat::rank_high_quant<T> unmeta(const meta::stat::rank_high_quant& m, T)
+ {
+ stat::rank_high_quant<T> a(m.k, m.n);
+ return a;
+ }
+
+
+ namespace stat
+ {
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T>
+ inline
+ rank_high_quant<T>::rank_high_quant(unsigned k, unsigned n)
+ : k_(k),
+ n_(n),
+ is_sorted_(false)
+ {
+ mln_assertion(k_ < n_);
+ init();
+ }
+
+ template <typename T>
+ inline
+ void
+ rank_high_quant<T>::init()
+ {
+ elts_.clear();
+ }
+
+ template <typename T>
+ inline
+ void rank_high_quant<T>::take_as_init_(const argument& t)
+ {
+ elts_.push_back(t);
+ is_sorted_ = false;
+ }
+
+ template <typename T>
+ inline
+ void rank_high_quant<T>::take(const argument& t)
+ {
+ elts_.push_back(t);
+ is_sorted_ = false;
+ }
+
+ template <typename T>
+ inline
+ void
+ rank_high_quant<T>::take(const rank_high_quant<T>& other)
+ {
+ elts_.insert(elts_.end(),
+ other.elts_.begin(),
+ other.elts_.end());
+ is_sorted_ = false;
+ }
+
+ template <typename T>
+ inline
+ const T&
+ rank_high_quant<T>::to_result() const
+ {
+ const_cast<rank_high_quant<T>&>(*this).sort();
+
+ if (n_ == elts_.size())
+ return elts_[k_];
+ else
+ // FIXME : This alternative is used to handle images edges.
+ return elts_[(elts_.size() * k_) / n_];
+ }
+
+ template <typename T>
+ inline
+ bool
+ rank_high_quant<T>::is_valid() const
+ {
+ return true;
+ }
+
+ template <typename T>
+ inline
+ void
+ rank_high_quant<T>::sort()
+ {
+ if (! is_sorted_)
+ {
+ is_sorted_ = true;
+ std::sort(elts_.begin(), elts_.end());
+ }
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::stat
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+// #include <mln/accu/stat/rank_bool.hh> ??
+
+#endif // ! MLN_ACCU_STAT_RANK_HIGH_QUANT_HH
Property changes on: trunk/milena/mln/accu/stat/rank_high_quant.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/mln/accu/stat/rank_bool.hh
===================================================================
--- trunk/milena/mln/accu/stat/rank_bool.hh (revision 0)
+++ trunk/milena/mln/accu/stat/rank_bool.hh (revision 4152)
@@ -0,0 +1,171 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_RANK_BOOL_HH
+# define MLN_ACCU_STAT_RANK_BOOL_HH
+
+/// \file
+///
+/// Define an rank accumulator.
+///
+/// \todo There is no-arg-ctor so this accumulator does not support
+/// deferred initialization!
+///
+/// \todo Add untake routines...
+
+# include <mln/accu/internal/base.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace stat
+ {
+
+ // Forward declaration.
+ template <typename T> struct rank;
+
+ /// \brief rank accumulator class for Boolean.
+ ///
+ /// \ingroup modaccuvalues
+ //
+ template <>
+ struct rank<bool> : public mln::accu::internal::base< bool, rank<bool> >
+ {
+ typedef bool argument;
+
+ rank();
+ rank(unsigned k);
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take_as_init_(const argument& t);
+ void take(const argument& t);
+ void take(const rank<bool>& other);
+ void untake(const argument& t);
+ void untake(const rank<bool>& other);
+ /// \}
+
+ /// Get the value of the accumulator.
+ bool to_result() const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ protected:
+ unsigned nfalse_;
+ unsigned k_; // 0 <= k_
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ inline
+ rank<bool>::rank()
+ {
+ init();
+ }
+
+ inline
+ rank<bool>::rank(unsigned k)
+ : k_(k)
+ {
+ init();
+ }
+
+ inline
+ void
+ rank<bool>::init()
+ {
+ nfalse_ = 0;
+ }
+
+ inline
+ void rank<bool>::take_as_init_(const argument& t)
+ {
+ nfalse_ = t ? 0 : 1;
+ }
+
+ inline
+ void rank<bool>::take(const argument& t)
+ {
+ if (t == false)
+ ++nfalse_;
+ }
+
+ inline
+ void rank<bool>::untake(const argument& t)
+ {
+ if (t == false)
+ {
+ mln_assertion(nfalse_ > 0);
+ --nfalse_;
+ }
+ }
+
+ inline
+ void
+ rank<bool>::take(const rank<bool>& other)
+ {
+ nfalse_ += other.nfalse_;
+ }
+
+ inline
+ void
+ rank<bool>::untake(const rank<bool>& other)
+ {
+ mln_precondition(other.nfalse_ <= nfalse_);
+ nfalse_ -= other.nfalse_;
+ }
+
+ inline
+ bool
+ rank<bool>::to_result() const
+ {
+ return k_ >= nfalse_;
+ }
+
+ inline
+ bool
+ rank<bool>::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_RANK_BOOL_HH
Property changes on: trunk/milena/mln/accu/stat/rank_bool.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/mln/accu/stat/all.hh
===================================================================
--- trunk/milena/mln/accu/stat/all.hh (revision 4151)
+++ trunk/milena/mln/accu/stat/all.hh (revision 4152)
@@ -64,5 +64,9 @@
# include <mln/accu/stat/mean.hh>
# include <mln/accu/stat/median_h.hh>
# include <mln/accu/stat/median_alt.hh>
+# include <mln/accu/stat/rank_bool.hh>
+# include <mln/accu/stat/rank_high_quant.hh>
+# include <mln/accu/stat/rank.hh>
#endif // ! MLN_ACCU_STAT_ALL_HH
+
Index: trunk/milena/mln/morpho/rank_filter.hh
===================================================================
--- trunk/milena/mln/morpho/rank_filter.hh (revision 4151)
+++ trunk/milena/mln/morpho/rank_filter.hh (revision 4152)
@@ -102,7 +102,7 @@
mln_concrete(I) output;
initialize(output, input);
- accu::rank<mln_value(I)> accu(k);
+ accu::stat::rank<mln_value(I)> accu(k);
extension::adjust_fill(input, geom::delta(win) + 1, accu);
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
@@ -133,7 +133,7 @@
internal::rank_filter_tests(input, win, k);
- accu::rank<mln_value(I)> accu(k);
+ accu::stat::rank<mln_value(I)> accu(k);
extension::adjust_fill(input, geom::delta(win) + 1, accu);
mln_concrete(I) output = accu::transform_line(accu, input, exact(win).length(), dir);
@@ -151,7 +151,7 @@
internal::rank_filter_tests(input, win, k);
- accu::rank<mln_value(I)> accu(k);
+ accu::stat::rank<mln_value(I)> accu(k);
extension::adjust_fill(input, geom::delta(win) + 1, accu);
mln_concrete(I) output = accu::transform_directional(accu, input, win, dir);
Index: trunk/milena/mln/morpho/tree/compute_attribute_image.hh
===================================================================
--- trunk/milena/mln/morpho/tree/compute_attribute_image.hh (revision 4151)
+++ trunk/milena/mln/morpho/tree/compute_attribute_image.hh (revision 4152)
@@ -144,7 +144,7 @@
{
// Transmit "dynamic data" (state) of 'a' to every values of
// 'acc'. It is usually a no-op (so useless) except for a
- // few accumulators, e.g., for accu::rank which has the 'k'
+ // few accumulators, e.g., for accu::stat::rank which has the 'k'
// attribute.
A a = exact(a_);
mln::data::fill(acc, a);
Index: trunk/milena/mln/morpho/includes.hh
===================================================================
--- trunk/milena/mln/morpho/includes.hh (revision 4151)
+++ trunk/milena/mln/morpho/includes.hh (revision 4152)
@@ -39,7 +39,7 @@
# include <mln/value/ops.hh>
-# include <mln/accu/rank.hh>
+# include <mln/accu/stat/rank.hh>
# include <mln/accu/transform.hh>
# include <mln/accu/transform_stop.hh>
Index: trunk/milena/sandbox/theo/tufa_2008/filter_n.cc
===================================================================
--- trunk/milena/sandbox/theo/tufa_2008/filter_n.cc (revision 4151)
+++ trunk/milena/sandbox/theo/tufa_2008/filter_n.cc (revision 4152)
@@ -147,7 +147,7 @@
{
// Transmit "dynamic data" (state) of 'a' to every values of
// 'acc'. It is usually a no-op (so useless) except for a
- // few accumulators, e.g., for accu::rank which has the 'k'
+ // few accumulators, e.g., for accu::stat::rank which has the 'k'
// attribute.
data::fill(acc, a);
}
Index: trunk/milena/tests/accu/rank.cc (deleted)
===================================================================
Index: trunk/milena/tests/accu/Makefile.am
===================================================================
--- trunk/milena/tests/accu/Makefile.am (revision 4151)
+++ trunk/milena/tests/accu/Makefile.am (revision 4152)
@@ -34,7 +34,6 @@
max_site \
nil \
pair \
- rank \
transform \
transform_diagonal \
transform_directional \
@@ -49,7 +48,6 @@
max_site_SOURCES = max_site.cc
nil_SOURCES = nil.cc
pair_SOURCES = pair.cc
-rank_SOURCES = rank.cc
transform_SOURCES = transform.cc
transform_diagonal_SOURCES = transform_diagonal.cc
transform_directional_SOURCES = transform_directional.cc
Index: trunk/milena/tests/accu/stat/rank.cc
===================================================================
--- trunk/milena/tests/accu/stat/rank.cc (revision 0)
+++ trunk/milena/tests/accu/stat/rank.cc (revision 4152)
@@ -0,0 +1,108 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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.
+
+#include <mln/accu/stat/rank.hh>
+#include <mln/value/int_u8.hh>
+
+
+
+template <typename A>
+void fill(mln::Accumulator<A>& accu_)
+{
+ A& accu = exact(accu_);
+ accu.take(2);
+ accu.take(3);
+ accu.take(1);
+ accu.take(4);
+ accu.take(5);
+ accu.take(5);
+ accu.take(2);
+ accu.take(5);
+}
+
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ {
+ accu::meta::stat::rank r(4);
+ accu::stat::rank<int_u8> a = accu::unmeta(r, int_u8());
+ mln_assertion(a.k() == 4);
+// Meta_Accumulator<accu::meta::stat::rank>& R = r;
+// accu::unmeta(R, int_u8());
+ }
+
+ {
+ accu::stat::rank<int_u8> accu(0);
+ fill(accu);
+ mln_assertion(accu.to_result() == 1u);
+ }
+ {
+ accu::stat::rank<int_u8> accu(1);
+ fill(accu);
+ mln_assertion(accu.to_result() == 2u);
+ }
+ {
+ accu::stat::rank<int_u8> accu(2);
+ fill(accu);
+ mln_assertion(accu.to_result() == 2u);
+ }
+ {
+ accu::stat::rank<int_u8> accu(3);
+ fill(accu);
+ mln_assertion(accu.to_result() == 3u);
+ }
+ {
+ accu::stat::rank<int_u8> accu(4);
+ fill(accu);
+ mln_assertion(accu.to_result() == 4u);
+ }
+ {
+ accu::stat::rank<int_u8> accu(5);
+ fill(accu);
+ mln_assertion(accu.to_result() == 5u);
+ }
+ {
+ accu::stat::rank<int_u8> accu(6);
+ fill(accu);
+ mln_assertion(accu.to_result() == 5u);
+ }
+ {
+ accu::stat::rank<int_u8> accu(7);
+ fill(accu);
+ mln_assertion(accu.to_result() == 5u);
+ }
+ {
+ accu::stat::rank<bool> accu_bool(1);
+ accu_bool.take(true);
+ accu_bool.take(true);
+ accu_bool.take(true);
+ accu_bool.take(true);
+ accu_bool.take(false);
+ mln_assertion(accu_bool == true);
+ }
+}
Property changes on: trunk/milena/tests/accu/stat/rank.cc
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/tests/accu/stat/Makefile.am
===================================================================
--- trunk/milena/tests/accu/stat/Makefile.am (revision 4151)
+++ trunk/milena/tests/accu/stat/Makefile.am (revision 4152)
@@ -27,7 +27,8 @@
max \
max_h \
median_h \
- mean
+ mean \
+ rank
var_SOURCES = var.cc
mean_SOURCES = min.cc
@@ -37,5 +38,7 @@
max_SOURCES = max.cc
max_h_SOURCES = max_h.cc
min_max_SOURCES = min_max.cc
+rank_SOURCES = rank.cc
TESTS = $(check_PROGRAMS)
+
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-06-15 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Move inf and sup accumulators into math directory.
* mln/accu/inf.hh,
* mln/accu/sup.hh: Move to...
* mln/accu/math/inf.hh,
* mln/accu/math/sup.hh:
Move inf, sup accus.
* mln/accu/math/all.hh:
Update all.hh with respect to new location.
* sandbox/theo/esiee/slides_2009_may/dilation.hh:
Replace accu::accu_name by accu::math::accu_name,
accu/accu_name by accu/math/accu_name.
---
mln/accu/math/all.hh | 2
mln/accu/math/inf.hh | 178 ++++++++++++++++++++++++
mln/accu/math/sup.hh | 180 +++++++++++++++++++++++++
sandbox/theo/esiee/slides_2009_may/dilation.hh | 2
4 files changed, 361 insertions(+), 1 deletion(-)
Index: trunk/milena/mln/accu/inf.hh (deleted)
===================================================================
Index: trunk/milena/mln/accu/sup.hh (deleted)
===================================================================
Index: trunk/milena/mln/accu/math/sup.hh
===================================================================
--- trunk/milena/mln/accu/math/sup.hh (revision 0)
+++ trunk/milena/mln/accu/math/sup.hh (revision 4148)
@@ -0,0 +1,180 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_MATH_SUP_HH
+# define MLN_ACCU_MATH_SUP_HH
+
+/// \file
+///
+/// Define an accumulator that computes a sup.
+
+# include <mln/accu/internal/base.hh>
+# include <mln/core/concept/meta_accumulator.hh>
+# include <mln/trait/value_.hh>
+# include <mln/util/pix.hh>
+# include <mln/fun/math/sup.hh>
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace math
+ {
+
+
+ /// \brief Generic sup accumulator class.
+ /*!
+ * The parameter \c T is the type of values.
+ *
+ * \ingroup modaccuvalues
+ */
+ template <typename T>
+ struct sup : public mln::accu::internal::base< const T&, sup<T> >
+ {
+ typedef T argument;
+
+ sup();
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take_as_init_(const argument& t);
+ void take(const argument& t);
+ void take(const sup<T>& other);
+ /// \}
+
+ /// Get the value of the accumulator.
+ const T& to_result() const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ protected:
+
+ T t_;
+ typename mln::fun::sup::with<T, T>::ret fun_;
+ };
+
+
+ template <typename I> struct sup< util::pix<I> >;
+
+
+ } // end of mln::accu::math
+
+
+ namespace meta
+ {
+
+ namespace math
+ {
+
+ /// Meta accumulator for sup.
+
+ struct sup : public Meta_Accumulator< sup >
+ {
+ template <typename T>
+ struct with
+ {
+ typedef accu::math::sup<T> ret;
+ };
+ };
+
+ } // end of namespace mln::accu::meta::math
+
+ } // end of namespace mln::accu::meta
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace math
+ {
+
+ template <typename T>
+ inline
+ sup<T>::sup()
+ {
+ init();
+ }
+
+ template <typename T>
+ inline
+ void
+ sup<T>::init()
+ {
+ t_ = mln_min(T);
+ }
+
+ template <typename T>
+ inline
+ void sup<T>::take_as_init_(const argument& t)
+ {
+ t_ = t;
+ }
+
+ template <typename T>
+ inline
+ void sup<T>::take(const argument& t)
+ {
+ this->t_ = this->fun_(t_, t);
+ }
+
+ template <typename T>
+ inline
+ void
+ sup<T>::take(const sup<T>& other)
+ {
+ this->t_ = this->fun_(t_, other.t_);
+ }
+
+ template <typename T>
+ inline
+ const T&
+ sup<T>::to_result() const
+ {
+ return t_;
+ }
+
+ template <typename T>
+ inline
+ bool
+ sup<T>::is_valid() const
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::math
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_MATH_SUP_HH
Property changes on: trunk/milena/mln/accu/math/sup.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/mln/accu/math/all.hh
===================================================================
--- trunk/milena/mln/accu/math/all.hh (revision 4147)
+++ trunk/milena/mln/accu/math/all.hh (revision 4148)
@@ -54,5 +54,7 @@
# include <mln/accu/math/sum.hh>
# include <mln/accu/math/count.hh>
+# include <mln/accu/math/inf.hh>
+# include <mln/accu/math/sup.hh>
#endif // ! MLN_ACCU_MATH_ALL_HH
Index: trunk/milena/mln/accu/math/inf.hh
===================================================================
--- trunk/milena/mln/accu/math/inf.hh (revision 0)
+++ trunk/milena/mln/accu/math/inf.hh (revision 4148)
@@ -0,0 +1,178 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_MATH_INF_HH
+# define MLN_ACCU_MATH_INF_HH
+
+/// \file
+///
+/// Define an accumulator that computes a inf.
+
+# include <mln/accu/internal/base.hh>
+# include <mln/core/concept/meta_accumulator.hh>
+# include <mln/trait/value_.hh>
+# include <mln/util/pix.hh>
+# include <mln/fun/math/inf.hh>
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace math
+ {
+
+
+ /// \brief Generic inf accumulator class.
+ ///
+ /// The parameter \c T is the type of values.
+ ///
+ /// \ingroup modaccuvalues
+ //
+ template <typename T>
+ struct inf : public mln::accu::internal::base< const T&, inf<T> >
+ {
+ typedef T argument;
+
+ inf();
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take_as_init_(const argument& t);
+ void take(const argument& t);
+ void take(const inf<T>& other);
+ /// \}
+
+ /// Get the value of the accumulator.
+ const T& to_result() const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ protected:
+
+ T t_;
+ typename mln::fun::inf::with<T, T>::ret fun_;
+ };
+
+
+ template <typename I> struct inf< util::pix<I> >;
+
+ } // end of mln::accu::math
+
+
+ namespace meta
+ {
+
+ namespace math
+ {
+
+ /// Meta accumulator for inf.
+
+ struct inf : public Meta_Accumulator< inf >
+ {
+ template <typename T>
+ struct with
+ {
+ typedef accu::math::inf<T> ret;
+ };
+ };
+
+ } // end of namespace mln::accu::meta::math
+
+ } // end of namespace mln::accu::meta
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace math
+ {
+
+ template <typename T>
+ inline
+ inf<T>::inf()
+ {
+ init();
+ }
+
+ template <typename T>
+ inline
+ void
+ inf<T>::init()
+ {
+ t_ = mln_max(T);
+ }
+
+ template <typename T>
+ inline
+ void inf<T>::take_as_init_(const argument& t)
+ {
+ t_ = t;
+ }
+
+ template <typename T>
+ inline
+ void inf<T>::take(const argument& t)
+ {
+ this->t_ = this->fun_(t_, t);
+ }
+
+ template <typename T>
+ inline
+ void
+ inf<T>::take(const inf<T>& other)
+ {
+ this->t_ = this->fun_(t_, other.t_);
+ }
+
+ template <typename T>
+ inline
+ const T&
+ inf<T>::to_result() const
+ {
+ return t_;
+ }
+
+ template <typename T>
+ inline
+ bool
+ inf<T>::is_valid() const
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::math
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_MATH_INF_HH
Property changes on: trunk/milena/mln/accu/math/inf.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: trunk/milena/sandbox/theo/esiee/slides_2009_may/dilation.hh
===================================================================
--- trunk/milena/sandbox/theo/esiee/slides_2009_may/dilation.hh (revision 4147)
+++ trunk/milena/sandbox/theo/esiee/slides_2009_may/dilation.hh (revision 4148)
@@ -52,7 +52,7 @@
mln_piter(I) p(ima.domain());
mln_qiter(W) q(win, p);
- accu::sup<mln_value(I)> sup;
+ accu::math::sup<mln_value(I)> sup;
for_all(p)
{
* doc/examples/tuto4_genericity_and_algorithms.cc,
* doc/tutorial/tutorial.tex: comment non working code and
documentation related to that code.
* doc/examples/split/tuto4_genericity_and_algorithms-11.cc,
* doc/examples/split/tuto4_genericity_and_algorithms-12.cc: fix
associated reference files.
---
milena/ChangeLog | 12 +++
.../split/tuto4_genericity_and_algorithms-11.cc | 2 +-
.../split/tuto4_genericity_and_algorithms-12.cc | 4 +-
.../examples/tuto4_genericity_and_algorithms.cc | 40 ++++++-----
milena/doc/tutorial/tutorial.tex | 77 ++++++++++----------
5 files changed, 76 insertions(+), 59 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 04066f3..4ae66d8 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,17 @@
2009-06-15 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+ Comments parts of the documentation related to fun_image.
+
+ * doc/examples/tuto4_genericity_and_algorithms.cc,
+ * doc/tutorial/tutorial.tex: comment non working code and
+ documentation related to that code.
+
+ * doc/examples/split/tuto4_genericity_and_algorithms-11.cc,
+ * doc/examples/split/tuto4_genericity_and_algorithms-12.cc: fix
+ associated reference files.
+
+2009-06-15 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
Update doc reference files.
* doc/examples/Makefile.am: fix the script comparing reference files
diff --git a/milena/doc/examples/split/tuto4_genericity_and_algorithms-11.cc b/milena/doc/examples/split/tuto4_genericity_and_algorithms-11.cc
index 6eb4e9b..af852ed 100644
--- a/milena/doc/examples/split/tuto4_genericity_and_algorithms-11.cc
+++ b/milena/doc/examples/split/tuto4_genericity_and_algorithms-11.cc
@@ -1 +1 @@
- data::fill(extract::green(lena).rw(), literal::max);
+// data::fill(extract::green(lena).rw(), literal::max);
diff --git a/milena/doc/examples/split/tuto4_genericity_and_algorithms-12.cc b/milena/doc/examples/split/tuto4_genericity_and_algorithms-12.cc
index 9091157..d5f4ec8 100644
--- a/milena/doc/examples/split/tuto4_genericity_and_algorithms-12.cc
+++ b/milena/doc/examples/split/tuto4_genericity_and_algorithms-12.cc
@@ -1,2 +1,2 @@
- mln_VAR(object, pw::value(label) == pw::cst(0u));
- data::fill((extract::green(lena).rw() | object).rw(), literal::max);
+// mln_VAR(object, pw::value(label) == pw::cst(0u));
+// data::fill((extract::green(lena).rw() | object).rw(), literal::max);
diff --git a/milena/doc/examples/tuto4_genericity_and_algorithms.cc b/milena/doc/examples/tuto4_genericity_and_algorithms.cc
index 151d7d8..2fd1413 100644
--- a/milena/doc/examples/tuto4_genericity_and_algorithms.cc
+++ b/milena/doc/examples/tuto4_genericity_and_algorithms.cc
@@ -120,24 +120,26 @@ int main()
- lena = duplicate(lena_bak);
- // \{
- data::fill(extract::green(lena).rw(), literal::max);
- // \}
- //FIXME: we would like to save the green component in rgb8.
- doc::pgmsave(extract::green(lena), "tuto4_genericity_and_algorithms");
- doc::ppmsave(lena, "tuto4_genericity_and_algorithms");
-
-
-
-
- lena = duplicate(lena_bak);
- // \{
- mln_VAR(object, pw::value(label) == pw::cst(0u));
- data::fill((extract::green(lena).rw() | object).rw(), literal::max);
- // \}
- //FIXME: how to display an image which is not defined on a box!?
-// doc::ppmsave(lena | object, "tuto4_genericity_and_algorithms");
- doc::ppmsave(lena, "tuto4_genericity_and_algorithms");
+// Disabled until thru_image/fun_image provide working read/write access.
+//
+// lena = duplicate(lena_bak);
+// // \{
+// data::fill(extract::green(lena).rw(), literal::max);
+// // \}
+// //FIXME: we would like to save the green component in rgb8.
+// doc::pgmsave(extract::green(lena), "tuto4_genericity_and_algorithms");
+// doc::ppmsave(lena, "tuto4_genericity_and_algorithms");
+//
+//
+//
+//
+// lena = duplicate(lena_bak);
+// // \{
+// mln_VAR(object, pw::value(label) == pw::cst(0u));
+// data::fill((extract::green(lena).rw() | object).rw(), literal::max);
+// // \}
+// //FIXME: how to display an image which is not defined on a box!?
+//// doc::ppmsave(lena | object, "tuto4_genericity_and_algorithms");
+// doc::ppmsave(lena, "tuto4_genericity_and_algorithms");
}
diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex
index 91a7eb6..aac5d52 100644
--- a/milena/doc/tutorial/tutorial.tex
+++ b/milena/doc/tutorial/tutorial.tex
@@ -1538,44 +1538,47 @@ value in \var{label} is equal to 16'.
\end{center}
-%**************************
-\doxysection{tuto4component}{Image component restricted to a domain}
-
-%FIXME: be more verbose?
-
-It is also possible to restrict an image to one of its component and apply
-various operators upon it. In the following code, the green component of
-this color image is extracted and filled with the maximum value allowed.
-Other components such as red and blue are left unchanged.
-
-\doxycode[11]{tuto4_genericity_and_algorithms}
-
-\begin{center}
- \begin{tabular}{c c c c}
- \doxyimg{small-enlarged}{3cm} &
-% \doxyfigure[7]{tuto4_genericity_and_algorithms}{3cm} &
- ~\huge{$\rightarrow$}~ &
- \doxyfigure[8]{tuto4_genericity_and_algorithms}{3cm} \\
- \multicolumn{4}{c}{Set the image green component to its maximum value.} \\
- \end{tabular}
-\end{center}
-
-
-Thanks to Milena's genericity, it is also possible to combine this operator
-with others. Here the green component is extracted from a region of interest
-and only that part is modified.
-
-\doxycode[12]{tuto4_genericity_and_algorithms}
+%Disabled until thru_image/fun_image provide working read/write access.
+%
+%%**************************
+%\doxysection{tuto4component}{Image component restricted to a domain}
+%
+%%FIXME: be more verbose?
+%
+%It is also possible to restrict an image to one of its component and apply
+%various operators upon it. In the following code, the green component of
+%this color image is extracted and filled with the maximum value allowed.
+%Other components such as red and blue are left unchanged.
+%
+%\doxycode[11]{tuto4_genericity_and_algorithms}
+%
+%\begin{center}
+% \begin{tabular}{c c c c}
+% \doxyimg{small-enlarged}{3cm} &
+%% \doxyfigure[7]{tuto4_genericity_and_algorithms}{3cm} &
+% ~\huge{$\rightarrow$}~ &
+% \doxyfigure[8]{tuto4_genericity_and_algorithms}{3cm} \\
+% \multicolumn{4}{c}{Set the image green component to its maximum value.} \\
+% \end{tabular}
+%\end{center}
+%
+%
+%Thanks to Milena's genericity, it is also possible to combine this operator
+%with others. Here the green component is extracted from a region of interest
+%and only that part is modified.
+%
+%\doxycode[12]{tuto4_genericity_and_algorithms}
+%
+%\begin{center}
+% \begin{tabular}{c c c c}
+% \doxyimg{small-enlarged}{3cm} &
+% ~\huge{$\rightarrow$}~ &
+% \doxyfigure[9]{tuto4_genericity_and_algorithms}{3cm} \\
+% \multicolumn{4}{c}{Set the green component of a region of interest
+% to its maximum value.} \\
+% \end{tabular}
+%\end{center}
-\begin{center}
- \begin{tabular}{c c c c}
- \doxyimg{small-enlarged}{3cm} &
- ~\huge{$\rightarrow$}~ &
- \doxyfigure[9]{tuto4_genericity_and_algorithms}{3cm} \\
- \multicolumn{4}{c}{Set the green component of a region of interest
- to its maximum value.} \\
- \end{tabular}
-\end{center}
\vspace{2cm}
--
1.5.6.5