Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
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)
+
1
0
16 Jun '09
* mln/extract/blue.hh,
* mln/extract/green.hh,
* mln/extract/hue.hh,
* mln/extract/lum.hh,
* mln/extract/red.hh,
* mln/extract/sat.hh:
Use mln::thru_image instead of mln::fun_image.
---
milena/ChangeLog | 12 ++++++++++++
milena/mln/extract/blue.hh | 10 +++++-----
milena/mln/extract/green.hh | 10 +++++-----
milena/mln/extract/hue.hh | 10 +++++-----
milena/mln/extract/lum.hh | 10 +++++-----
milena/mln/extract/red.hh | 10 +++++-----
milena/mln/extract/sat.hh | 10 +++++-----
7 files changed, 42 insertions(+), 30 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7289e4b..f1582fa 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,15 @@
+2009-06-15 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Implement mln::extract moophers over mln::thru_image.
+
+ * mln/extract/blue.hh,
+ * mln/extract/green.hh,
+ * mln/extract/hue.hh,
+ * mln/extract/lum.hh,
+ * mln/extract/red.hh,
+ * mln/extract/sat.hh:
+ Use mln::thru_image instead of mln::fun_image.
+
2009-06-16 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
Small fixes.
diff --git a/milena/mln/extract/blue.hh b/milena/mln/extract/blue.hh
index d839b51..e7214fd 100644
--- a/milena/mln/extract/blue.hh
+++ b/milena/mln/extract/blue.hh
@@ -30,8 +30,7 @@
///
/// Extract the blue component of an image.
-
-# include <mln/core/image/vmorph/fun_image.hh>
+# include <mln/core/image/vmorph/thru_image.hh>
# include <mln/fun/meta/blue.hh>
namespace mln
@@ -41,16 +40,17 @@ namespace mln
{
template <typename I>
- fun_image<meta::blue<mln_value(I)>,I>
+ thru_image< I, meta::blue<mln_value(I)> >
blue(Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- fun_image<meta::blue<mln_value(I)>,I>
+ thru_image< I, meta::blue<mln_value(I)> >
blue(Image<I>& ima)
{
- fun_image<meta::blue<mln_value(I)>,I> result(ima);
+ typedef meta::blue<mln_value(I)> blue_t;
+ thru_image<I, blue_t> result(exact(ima), blue_t());
return result;
}
diff --git a/milena/mln/extract/green.hh b/milena/mln/extract/green.hh
index a7858cc..59cf2d9 100644
--- a/milena/mln/extract/green.hh
+++ b/milena/mln/extract/green.hh
@@ -30,8 +30,7 @@
///
/// Extract the green component of an image.
-
-# include <mln/core/image/vmorph/fun_image.hh>
+# include <mln/core/image/vmorph/thru_image.hh>
# include <mln/fun/meta/green.hh>
namespace mln
@@ -41,16 +40,17 @@ namespace mln
{
template <typename I>
- fun_image<meta::green<mln_value(I)>,I>
+ thru_image< I, meta::green<mln_value(I)> >
green(Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- fun_image<meta::green<mln_value(I)>,I>
+ thru_image< I, meta::green<mln_value(I)> >
green(Image<I>& ima)
{
- fun_image<meta::green<mln_value(I)>,I> result(ima);
+ typedef meta::green<mln_value(I)> green_t;
+ thru_image<I, green_t> result(exact(ima), green_t());
return result;
}
diff --git a/milena/mln/extract/hue.hh b/milena/mln/extract/hue.hh
index f5a8049..66c2cbd 100644
--- a/milena/mln/extract/hue.hh
+++ b/milena/mln/extract/hue.hh
@@ -30,8 +30,7 @@
///
/// Extract the hue component of an image.
-
-# include <mln/core/image/vmorph/fun_image.hh>
+# include <mln/core/image/vmorph/thru_image.hh>
# include <mln/fun/meta/hue.hh>
namespace mln
@@ -41,16 +40,17 @@ namespace mln
{
template <typename I>
- fun_image<meta::hue<mln_value(I)>,I>
+ thru_image< I, meta::hue<mln_value(I)> >
hue(Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- fun_image<meta::hue<mln_value(I)>,I>
+ thru_image< I, meta::hue<mln_value(I)> >
hue(Image<I>& ima)
{
- fun_image<meta::hue<mln_value(I)>,I> result(ima);
+ typedef meta::hue<mln_value(I)> hue_t;
+ thru_image<I, hue_t> result(exact(ima), hue_t());
return result;
}
diff --git a/milena/mln/extract/lum.hh b/milena/mln/extract/lum.hh
index b073ab4..6299dd7 100644
--- a/milena/mln/extract/lum.hh
+++ b/milena/mln/extract/lum.hh
@@ -30,8 +30,7 @@
///
/// Extract the lum component of an image.
-
-# include <mln/core/image/vmorph/fun_image.hh>
+# include <mln/core/image/vmorph/thru_image.hh>
# include <mln/fun/meta/lum.hh>
namespace mln
@@ -41,16 +40,17 @@ namespace mln
{
template <typename I>
- fun_image<meta::lum<mln_value(I)>,I>
+ thru_image< I, meta::lum<mln_value(I)> >
lum(Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- fun_image<meta::lum<mln_value(I)>,I>
+ thru_image< I, meta::lum<mln_value(I)> >
lum(Image<I>& ima)
{
- fun_image<meta::lum<mln_value(I)>,I> result(ima);
+ typedef meta::lum<mln_value(I)> lum_t;
+ thru_image<I, lum_t> result(exact(ima), lum_t());
return result;
}
diff --git a/milena/mln/extract/red.hh b/milena/mln/extract/red.hh
index ccf1d96..6be28a9 100644
--- a/milena/mln/extract/red.hh
+++ b/milena/mln/extract/red.hh
@@ -30,8 +30,7 @@
///
/// Extract the red component of an image.
-
-# include <mln/core/image/vmorph/fun_image.hh>
+# include <mln/core/image/vmorph/thru_image.hh>
# include <mln/fun/meta/red.hh>
namespace mln
@@ -41,16 +40,17 @@ namespace mln
{
template <typename I>
- fun_image<meta::red<mln_value(I)>,I>
+ thru_image< I, meta::red<mln_value(I)> >
red(Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- fun_image<meta::red<mln_value(I)>,I>
+ thru_image< I, meta::red<mln_value(I)> >
red(Image<I>& ima)
{
- fun_image<meta::red<mln_value(I)>,I> result(ima);
+ typedef meta::red<mln_value(I)> red_t;
+ thru_image<I, red_t> result(exact(ima), red_t());
return result;
}
diff --git a/milena/mln/extract/sat.hh b/milena/mln/extract/sat.hh
index 22f4205..b45b1b7 100644
--- a/milena/mln/extract/sat.hh
+++ b/milena/mln/extract/sat.hh
@@ -30,8 +30,7 @@
///
/// Extract the sat component of an image.
-
-# include <mln/core/image/vmorph/fun_image.hh>
+# include <mln/core/image/vmorph/thru_image.hh>
# include <mln/fun/meta/sat.hh>
namespace mln
@@ -41,16 +40,17 @@ namespace mln
{
template <typename I>
- fun_image<meta::sat<mln_value(I)>,I>
+ thru_image< I, meta::sat<mln_value(I)> >
sat(Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- fun_image<meta::sat<mln_value(I)>,I>
+ thru_image< I, meta::sat<mln_value(I)> >
sat(Image<I>& ima)
{
- fun_image<meta::sat<mln_value(I)>,I> result(ima);
+ typedef meta::sat<mln_value(I)> sat_t;
+ thru_image<I, sat_t> result(exact(ima), sat_t());
return result;
}
--
1.6.1.2
1
0
* mln/accu/math/inf.hh,
* mln/accu/math/sup.hh,
* mln/accu/shape/height.hh,
* mln/accu/shape/volume.hh,
* mln/accu/stat/median_alt.hh,
* mln/value/stack.hh: fix invalid namespace closing.
* mln/util/internal/graph_iter.hh,
* mln/fun/v2v/rgb_to_hsl.hh: fix ambiguities with operators.
* mln/value/internal/gray_f.hh: repair header.
* tests/registration/Makefile.am: disable registration test.
---
milena/ChangeLog | 18 ++++++++++++++++++
milena/mln/accu/math/inf.hh | 4 ++--
milena/mln/accu/math/sup.hh | 4 ++--
milena/mln/accu/shape/height.hh | 7 ++++---
milena/mln/accu/shape/volume.hh | 4 ++--
milena/mln/accu/stat/median_alt.hh | 6 +++---
milena/mln/fun/v2v/rgb_to_hsl.hh | 5 +++--
milena/mln/util/internal/graph_iter.hh | 8 ++++----
milena/mln/value/internal/gray_f.hh | 3 ++-
milena/mln/value/stack.hh | 7 ++++---
milena/tests/registration/Makefile.am | 6 +++---
11 files changed, 47 insertions(+), 25 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index a7d79fa..7289e4b 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,21 @@
+2009-06-16 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
+ Small fixes.
+
+ * mln/accu/math/inf.hh,
+ * mln/accu/math/sup.hh,
+ * mln/accu/shape/height.hh,
+ * mln/accu/shape/volume.hh,
+ * mln/accu/stat/median_alt.hh,
+ * mln/value/stack.hh: fix invalid namespace closing.
+
+ * mln/util/internal/graph_iter.hh,
+ * mln/fun/v2v/rgb_to_hsl.hh: fix ambiguities with operators.
+
+ * mln/value/internal/gray_f.hh: repair header.
+
+ * tests/registration/Makefile.am: disable registration test.
+
2009-06-15 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Move inf and sup accumulators into math directory.
diff --git a/milena/mln/accu/math/inf.hh b/milena/mln/accu/math/inf.hh
index e2bcfef..17780b9 100644
--- a/milena/mln/accu/math/inf.hh
+++ b/milena/mln/accu/math/inf.hh
@@ -166,10 +166,10 @@ namespace mln
return true;
}
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln::accu::math
+# endif // ! MLN_INCLUDE_ONLY
+
} // end of namespace mln::accu
} // end of namespace mln
diff --git a/milena/mln/accu/math/sup.hh b/milena/mln/accu/math/sup.hh
index b4eb2d2..7ebcff2 100644
--- a/milena/mln/accu/math/sup.hh
+++ b/milena/mln/accu/math/sup.hh
@@ -168,10 +168,10 @@ namespace mln
return true;
}
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln::accu::math
+# endif // ! MLN_INCLUDE_ONLY
+
} // end of namespace mln::accu
} // end of namespace mln
diff --git a/milena/mln/accu/shape/height.hh b/milena/mln/accu/shape/height.hh
index c3874de..596ccb8 100644
--- a/milena/mln/accu/shape/height.hh
+++ b/milena/mln/accu/shape/height.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -200,10 +201,10 @@ namespace mln
return true;
}
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln::accu::shape
+# endif // ! MLN_INCLUDE_ONLY
+
} // end of namespace mln::accu
} // end of namespace mln
diff --git a/milena/mln/accu/shape/volume.hh b/milena/mln/accu/shape/volume.hh
index 6feb5bc..dbfc020 100644
--- a/milena/mln/accu/shape/volume.hh
+++ b/milena/mln/accu/shape/volume.hh
@@ -217,10 +217,10 @@ namespace mln
return true;
}
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln::accu::shape
+# endif // ! MLN_INCLUDE_ONLY
+
} // end of namespace mln::accu
} // end of namespace mln
diff --git a/milena/mln/accu/stat/median_alt.hh b/milena/mln/accu/stat/median_alt.hh
index 8cfa39c..e22d4d6 100644
--- a/milena/mln/accu/stat/median_alt.hh
+++ b/milena/mln/accu/stat/median_alt.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -326,11 +327,10 @@ namespace mln
return ostr << m.to_result();
}
+ } // end of namespace mln::accu::stat
# endif // ! MLN_INCLUDE_ONLY
- } // end of namespace mln::accu::stat
-
} // end of namespace mln::accu
} // end of namespace mln
diff --git a/milena/mln/fun/v2v/rgb_to_hsl.hh b/milena/mln/fun/v2v/rgb_to_hsl.hh
index 6619c60..11b4f38 100644
--- a/milena/mln/fun/v2v/rgb_to_hsl.hh
+++ b/milena/mln/fun/v2v/rgb_to_hsl.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -102,7 +103,7 @@ namespace mln
else
hsl.hue() = (60. * (rgb.red() - rgb.green()) / (rmax - rmin)) + 240;
- hsl.lum() = ((double) rmax + rmin) / 2;
+ hsl.lum() = ((double) rmax + (double) rmin) / 2;
// We want min and max between 0 and 1
rmax -= mln_min(typename T_rgb::red_t);
diff --git a/milena/mln/util/internal/graph_iter.hh b/milena/mln/util/internal/graph_iter.hh
index a5c3e9c..09e0bb4 100644
--- a/milena/mln/util/internal/graph_iter.hh
+++ b/milena/mln/util/internal/graph_iter.hh
@@ -189,7 +189,7 @@ namespace mln
util::vertex_id_t
vertex_fwd_iterator<G>::next_id_() const
{
- return this->p_.id() + 1;
+ return this->p_.id().value() + 1;
}
@@ -224,7 +224,7 @@ namespace mln
util::vertex_id_t
vertex_bkd_iterator<G>::next_id_() const
{
- return this->p_.id() - 1;
+ return this->p_.id().value() - 1;
}
@@ -259,7 +259,7 @@ namespace mln
util::edge_id_t
edge_fwd_iterator<G>::next_id_() const
{
- return this->p_.id() + 1;
+ return this->p_.id().value() + 1;
}
@@ -294,7 +294,7 @@ namespace mln
util::edge_id_t
edge_bkd_iterator<G>::next_id_() const
{
- return this->p_.id() - 1;
+ return this->p_.id().value() - 1;
}
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/value/internal/gray_f.hh b/milena/mln/value/internal/gray_f.hh
index c1f9f9c..0408ae4 100644
--- a/milena/mln/value/internal/gray_f.hh
+++ b/milena/mln/value/internal/gray_f.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
diff --git a/milena/mln/value/stack.hh b/milena/mln/value/stack.hh
index 93c893f..1782c1c 100644
--- a/milena/mln/value/stack.hh
+++ b/milena/mln/value/stack.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -323,10 +324,10 @@ namespace mln
return imas;
}
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln::value
+# endif // ! MLN_INCLUDE_ONLY
+
} // end of namespace mln
diff --git a/milena/tests/registration/Makefile.am b/milena/tests/registration/Makefile.am
index f2a953c..79372c7 100644
--- a/milena/tests/registration/Makefile.am
+++ b/milena/tests/registration/Makefile.am
@@ -20,9 +20,9 @@
include $(top_srcdir)/milena/tests/tests.mk
#<<lrde
-# FIXME: Not distributed (yet).
-check_PROGRAMS = registration
-registration_SOURCES = registration.cc
+# FIXME: Not distributed (yet) and currently disabled.
+# check_PROGRAMS = registration
+# registration_SOURCES = registration.cc
#>>
TESTS = $(check_PROGRAMS)
--
1.5.6.5
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix io magick save.
* milena/mln/io/magick/save.hh (get_colo): Magic fix.
* milena/tests/io/magick/save.cc: Update.
mln/io/magick/save.hh | 10 +++++-----
tests/io/magick/save.cc | 10 ++++++++--
2 files changed, 13 insertions(+), 7 deletions(-)
Index: milena/mln/io/magick/save.hh
--- milena/mln/io/magick/save.hh (revision 4148)
+++ milena/mln/io/magick/save.hh (working copy)
@@ -31,7 +31,7 @@
/// Define a function which saves an image of kind magick with
/// given path.
///
-/// FIXME: there seems to be roundness errors while computing rgb values.
+/// \todo At the moment it works; is it a miracle?
# include <mln/core/image/image2d.hh>
# include <mln/metal/equal.hh>
@@ -71,15 +71,15 @@
inline
Magick::Color get_color(const value::int_u8& value)
{
- return Magick::ColorGray(value / (double)256.0f);
+ return Magick::ColorGray(256 - value);
}
inline
Magick::Color get_color(const value::rgb8& value)
{
- return Magick::ColorRGB(value.red() / (double)256.0f,
- value.green() / (double)256.0f,
- value.blue() / (double)256.0f);
+ return Magick::ColorRGB(256 - value.red(),
+ 256 - value.green(),
+ 256 - value.blue());
}
template <typename I>
Index: milena/tests/io/magick/save.cc
--- milena/tests/io/magick/save.cc (revision 4148)
+++ milena/tests/io/magick/save.cc (working copy)
@@ -27,24 +27,30 @@
#include <mln/io/magick/load.hh>
#include <mln/io/magick/save.hh>
#include <mln/io/ppm/load.hh>
-
+#include <mln/io/ppm/save.hh>
#include <mln/data/compare.hh>
+#include "tests/data.hh"
#include <mln/io/magick/load.hh>
-#include "tests/data.hh"
int main()
{
using namespace mln;
+ point2d p(0,0);
+
image2d<value::rgb8> lena_mln;
io::ppm::load(lena_mln, MLN_IMG_DIR "/tiny.ppm");
+ value::rgb8 c = lena_mln(p);
io::magick::save(lena_mln, "tiny.png");
image2d<value::rgb8> lena_im;
io::magick::load(lena_im, "tiny.png");
+ mln_assertion(lena_im(p) == c);
+
+ io::ppm::save(lena_im, "tiny.ppm");
mln_assertion(lena_im.domain() == lena_mln.domain());
mln_assertion(lena_im == lena_mln);
1
0
15 Jun '09
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)
{
1
0
* mln/core/image/imorph/labeled_image.hh: add bboxes() and subdomain()
members.
* mln/morpho/tree/compute_attribute_image.hh: re-indent.
* mln/registration/registration.hh: remove deprecated fixmes.
* tests/accu/stat/max.cc,
* tests/accu/stat/max_h.cc,
* tests/accu/stat/min.cc,
* tests/accu/stat/min_h.cc,
* tests/accu/stat/min_max.cc: add missing '\file' doxygen command.
---
milena/ChangeLog | 17 ++++++++
milena/mln/core/image/imorph/labeled_image.hh | 42 ++++++++++++---------
milena/mln/morpho/tree/compute_attribute_image.hh | 6 +-
milena/mln/registration/registration.hh | 3 -
milena/tests/accu/stat/max.cc | 7 +++-
milena/tests/accu/stat/max_h.cc | 7 +++-
milena/tests/accu/stat/min.cc | 4 ++
milena/tests/accu/stat/min_h.cc | 7 +++-
milena/tests/accu/stat/min_max.cc | 7 +++-
9 files changed, 72 insertions(+), 28 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 7267a17..7e22f55 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,22 @@
2009-06-15 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+ Small fixes.
+
+ * mln/core/image/imorph/labeled_image.hh: add bboxes() and subdomain()
+ members.
+
+ * mln/morpho/tree/compute_attribute_image.hh: re-indent.
+
+ * mln/registration/registration.hh: remove deprecated fixmes.
+
+ * tests/accu/stat/max.cc,
+ * tests/accu/stat/max_h.cc,
+ * tests/accu/stat/min.cc,
+ * tests/accu/stat/min_h.cc,
+ * tests/accu/stat/min_max.cc: add missing '\file' doxygen command.
+
+2009-06-15 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
Fix few dependencies related to the documentation.
* doc/Makefile.am: convert reference figure to the right format before
diff --git a/milena/mln/core/image/imorph/labeled_image.hh b/milena/mln/core/image/imorph/labeled_image.hh
index 9185b6b..da11df3 100644
--- a/milena/mln/core/image/imorph/labeled_image.hh
+++ b/milena/mln/core/image/imorph/labeled_image.hh
@@ -45,6 +45,9 @@
# include <mln/util/array.hh>
+# include <mln/pw/cst.hh>
+# include <mln/pw/value.hh>
+
# ifndef NDEBUG
# include <mln/accu/stat/max.hh>
# include <mln/data/compute.hh>
@@ -175,14 +178,13 @@ namespace mln
/// Return the bounding box of the component \p label.
const bbox_t& bbox(const mln_value(I)& label) const;
- const util::array<bbox_t>& bboxes() const
- {
- return this->data_->bboxes_;
- }
+ /// Return the component bounding boxes.
+ const util::array<bbox_t>& bboxes() const;
/// Return the domain of the component with label \p label.
- /// This is an optimized version.
-// p_if<mln_psite(I)> domain(const mln_value(I)& label) const;
+ p_if<mln_box(I),
+ fun::eq_v2b_expr_<pw::value_<I>, pw::cst_<mln_value(I)> > >
+ subdomain(const mln_value(I)& label) const;
};
@@ -348,18 +350,22 @@ namespace mln
}
-// template <typename I, typename V, typename E>
-//// p_if<mln_psite(I)>
-// unsigned
-// extended_impl_selector<I,
-// accu::pair<accu::shape::bbox<mln_psite(I)>,
-// accu::center<mln_psite(I),V> >,
-// E>::domain(const mln_value(I)& label) const
-// {
-// const E& ima = internal::force_exact<E>(*this);
-// return ((ima.hook_data_() | bbox(label))
-// | (pw::value(ima.hook_data_()) == pw::cst(label))).domain();
-// }
+ template <typename I>
+ const util::array<typename labeled_image<I>::bbox_t>&
+ labeled_image<I>::bboxes() const
+ {
+ return this->data_->bboxes_;
+ }
+
+
+ template <typename I>
+ p_if<mln_box(I),
+ fun::eq_v2b_expr_<pw::value_<I>, pw::cst_<mln_value(I)> > >
+ labeled_image<I>::subdomain(const mln_value(I)& label) const
+ {
+ return ((this->data_->ima_ | bbox(label))
+ | (pw::value(this->data_->ima_) == pw::cst(label))).domain();
+ }
// Make routines.
diff --git a/milena/mln/morpho/tree/compute_attribute_image.hh b/milena/mln/morpho/tree/compute_attribute_image.hh
index d28a1a8..d388866 100644
--- a/milena/mln/morpho/tree/compute_attribute_image.hh
+++ b/milena/mln/morpho/tree/compute_attribute_image.hh
@@ -78,9 +78,9 @@ namespace mln
*/
template <typename A, typename T>
mln_ch_value(typename T::function, mln_result(A))
- compute_attribute_image(const Accumulator<A>& a,
- const T& t,
- mln_ch_value(typename T::function, A)* accu_image = 0);
+ compute_attribute_image(const Accumulator<A>& a,
+ const T& t,
+ mln_ch_value(typename T::function, A)* accu_image = 0);
diff --git a/milena/mln/registration/registration.hh b/milena/mln/registration/registration.hh
index a141a78..dd03d97 100644
--- a/milena/mln/registration/registration.hh
+++ b/milena/mln/registration/registration.hh
@@ -50,7 +50,6 @@ namespace mln
using namespace mln::fun::x2x;
- //FIXME: move to registration.hh
/// Call ICP once and return the resulting transformation.
template <typename P>
inline
@@ -59,7 +58,6 @@ namespace mln
const p_array<P>& P_,
const p_array<P>& X);
- //FIXME: move to registration.hh
/// Call ICP 10 times.
/// Do the first call to ICP with all sites then work on a subset of
/// which size is decreasing.
@@ -74,7 +72,6 @@ namespace mln
const p_array<P>& P_,
const p_array<P>& X);
- //FIXME: move to registration.hh
/// Call ICP 10 times.
/// Do the first call to ICP with all sites then work on a subset.
/// For each call, a distance criterion is computed on a subset.
diff --git a/milena/tests/accu/stat/max.cc b/milena/tests/accu/stat/max.cc
index d988ff5..3a9d495 100644
--- a/milena/tests/accu/stat/max.cc
+++ b/milena/tests/accu/stat/max.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,6 +24,10 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \file
+///
+/// Tests on mln::accu::max.
+
#include <mln/core/image/image2d.hh>
#include <mln/debug/iota.hh>
diff --git a/milena/tests/accu/stat/max_h.cc b/milena/tests/accu/stat/max_h.cc
index 886714e..d338b6d 100644
--- a/milena/tests/accu/stat/max_h.cc
+++ b/milena/tests/accu/stat/max_h.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,6 +24,10 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \file
+///
+/// \brief Tests on mln::accu::max_h.
+
#include <mln/value/int_u8.hh>
#include <mln/accu/stat/max_h.hh>
diff --git a/milena/tests/accu/stat/min.cc b/milena/tests/accu/stat/min.cc
index 4f82ddb..6236a98 100644
--- a/milena/tests/accu/stat/min.cc
+++ b/milena/tests/accu/stat/min.cc
@@ -23,6 +23,10 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \file
+///
+/// \brief Tests on mln::accu::min.
+
#include <mln/core/image/image2d.hh>
#include <mln/debug/iota.hh>
diff --git a/milena/tests/accu/stat/min_h.cc b/milena/tests/accu/stat/min_h.cc
index 058d71e..f92dd26 100644
--- a/milena/tests/accu/stat/min_h.cc
+++ b/milena/tests/accu/stat/min_h.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,6 +24,10 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \file
+///
+/// \brief Tests on mln::accu::min_h.
+
#include <mln/value/int_u8.hh>
#include <mln/accu/stat/min_h.hh>
diff --git a/milena/tests/accu/stat/min_max.cc b/milena/tests/accu/stat/min_max.cc
index 9e852df..ebf93e9 100644
--- a/milena/tests/accu/stat/min_max.cc
+++ b/milena/tests/accu/stat/min_max.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,6 +24,10 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \file
+///
+/// \brief Tests on mln::accu::stat::min_max.
+
#include <mln/value/builtin/integers.hh>
#include <mln/accu/stat/min_max.hh>
--
1.5.6.5
1
0
* doc/Makefile.am: convert reference figure to the right format before
generating the doc.
* doc/examples/Makefile.am: compile examples only if requested. There
are not compile thanks to the 'all' rule.
---
milena/ChangeLog | 10 ++++++++++
milena/doc/Makefile.am | 12 ++++++------
milena/doc/examples/Makefile.am | 35 +++++++++++++++++++----------------
3 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4ae66d8..7267a17 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,15 @@
2009-06-15 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+ Fix few dependencies related to the documentation.
+
+ * doc/Makefile.am: convert reference figure to the right format before
+ generating the doc.
+
+ * doc/examples/Makefile.am: compile examples only if requested. There
+ are not compile thanks to the 'all' rule.
+
+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,
diff --git a/milena/doc/Makefile.am b/milena/doc/Makefile.am
index 7d20939..d8078fe 100644
--- a/milena/doc/Makefile.am
+++ b/milena/doc/Makefile.am
@@ -59,9 +59,9 @@ doc-devel-html: tutorial-html ref-guide-html white-paper-html ref-doc-devel-html
# complicated. Simplify.
# Shared dependencies on the products of tutorial/ and ref_guide/.
EXTRA_DEPS = tutorial/tutorial.hh ref_guide/ref_guide.hh
-tutorial/tutorial.hh:
+tutorial/tutorial.hh: fig-convert
cd tutorial && $(MAKE) $(AM_MAKEFLAGS) tutorial.hh
-ref_guide/ref_guide.hh:
+ref_guide/ref_guide.hh: fig-convert
cd ref_guide && $(MAKE) $(AM_MAKEFLAGS) ref_guide.hh
# Doxygen PDF documentation outputs.
@@ -89,9 +89,9 @@ $(DEVEL_REFMAN_HTML): Doxyfile_devel $(FIGURES_BUILDDIR) $(EXTRA_DEPS)
$(DOXYGEN) Doxyfile_devel
# Tutorial.
-tutorial-pdf:
+tutorial-pdf: fig-convert
cd tutorial && $(MAKE) $(AM_MAKEFLAGS) $@
-tutorial-html:
+tutorial-html: fig-convert
cd tutorial && $(MAKE) $(AM_MAKEFLAGS) $@
# White Paper.
@@ -102,10 +102,10 @@ white-paper-html:
cd white_paper && $(MAKE) $(AM_MAKEFLAGS) $@
# Reference Guide.
-ref-guide-pdf:
+ref-guide-pdf: fig-convert
cd ref_guide && $(MAKE) $(AM_MAKEFLAGS) $@
-ref-guide-html:
+ref-guide-html: fig-convert
cd ref_guide && $(MAKE) $(AM_MAKEFLAGS) $@
diff --git a/milena/doc/examples/Makefile.am b/milena/doc/examples/Makefile.am
index 356336e..3ba5630 100644
--- a/milena/doc/examples/Makefile.am
+++ b/milena/doc/examples/Makefile.am
@@ -19,7 +19,7 @@
include $(top_srcdir)/milena/doc/doc.mk
-noinst_PROGRAMS = \
+EXTRA_PROGRAMS = \
accu-right-instanciation \
borderthickness \
box2d-bbox \
@@ -63,21 +63,22 @@ noinst_PROGRAMS = \
win-create-1 \
win-create-2
-noinst_PROGRAMS += \
-tuto2_first_image \
-tuto3_rw_image \
-tuto4_genericity_and_algorithms
+EXTRA_PROGRAMS += \
+ tuto2_first_image \
+ tuto3_rw_image \
+ tuto4_genericity_and_algorithms
# Tuto3
-noinst_PROGRAMS += \
-tuto3_colorize \
-tuto3_println \
-tuto3_trace
+EXTRA_PROGRAMS += \
+ tuto3_colorize \
+ tuto3_println \
+ tuto3_trace
# Tuto4
-noinst_PROGRAMS += \
-tuto4_point2d \
-tuto4_site_set_create
+EXTRA_PROGRAMS += \
+ tuto4_point2d \
+ tuto4_site_set_create
+
accu_right_instanciation_SOURCES = accu-right-instanciation.cc
borderthickness_SOURCES = borderthickness.cc
@@ -134,11 +135,13 @@ tuto3_trace_SOURCES = tuto3/trace.cc
tuto4_site_set_create_SOURCES = tuto4/site_set_create.cc
tuto4_point2d_SOURCES = tuto4/point2d.cc
-.PHONY : run-examples examples diff-data fix-refdata split-examples \
- split-outputs
+.PHONY : examples run-examples diff-data fix-refdata \
+ split-examples split-outputs
+
+examples: $(EXTRA_PROGRAMS)
-run-examples:
+run-examples: examples
mkdir -p $(OUTPUTS_BUILDDIR)
mkdir -p $(FIGURES_BUILDDIR)
@failcom='exit 1'; \
@@ -148,7 +151,7 @@ run-examples:
done
-data-regen: run-examples split-examples split-outputs diff-data
+data-regen: examples run-examples split-examples split-outputs diff-data
diff-data: run-examples split-examples
--
1.5.6.5
1
0
15 Jun '09
* 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
1
0
* doc/examples/Makefile.am: fix the script comparing reference files
and new produced files.
* doc/examples/split/tuto3_first_routine-1.cc,
* doc/examples/split/tuto3_first_routine-5.cc,
* doc/figures/fill-subdomain-2.ppm,
* doc/figures/fill-subdomain-3.ppm,
* doc/figures/labeling-compute-2.ppm,
* doc/figures/tuto3_colorize-2.ppm,
* doc/figures/tuto4_genericity_and_algorithms-5.ppm: Update reference
files.
---
milena/ChangeLog | 16 ++++++++++++++++
milena/doc/examples/Makefile.am | 8 ++++----
milena/doc/examples/split/tuto3_first_routine-1.cc | 2 +-
milena/doc/examples/split/tuto3_first_routine-5.cc | 2 +-
milena/doc/figures/fill-subdomain-2.ppm | Bin 206 -> 206 bytes
milena/doc/figures/fill-subdomain-3.ppm | Bin 206 -> 206 bytes
milena/doc/figures/labeling-compute-2.ppm | Bin 206 -> 206 bytes
milena/doc/figures/tuto3_colorize-2.ppm | Bin 191 -> 191 bytes
.../figures/tuto4_genericity_and_algorithms-5.ppm | Bin 12406 -> 12406 bytes
9 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 9acd79e..04066f3 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,21 @@
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
+ and new produced files.
+
+ * doc/examples/split/tuto3_first_routine-1.cc,
+ * doc/examples/split/tuto3_first_routine-5.cc,
+ * doc/figures/fill-subdomain-2.ppm,
+ * doc/figures/fill-subdomain-3.ppm,
+ * doc/figures/labeling-compute-2.ppm,
+ * doc/figures/tuto3_colorize-2.ppm,
+ * doc/figures/tuto4_genericity_and_algorithms-5.ppm: Update reference
+ files.
+
+2009-06-15 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
Make labeling::colorize deterministic.
* mln/labeling/colorize.hh: use our own random generator.
diff --git a/milena/doc/examples/Makefile.am b/milena/doc/examples/Makefile.am
index 66468bd..356336e 100644
--- a/milena/doc/examples/Makefile.am
+++ b/milena/doc/examples/Makefile.am
@@ -157,25 +157,25 @@ diff-data: run-examples split-examples
txtlist="$(OUTPUTS_BUILDDIR)/*.txt"; for txt in $$txtlist; do \
echo "Diff `basename $$txt`"; \
diff $$txt $(OUTPUTS_SRCDIR)/`basename $$txt` >/dev/null 2>&1 \
- || has_txt_diff+=" `basename $$txt`"; \
+ || has_txt_diff="$$has_txt_diff `basename $$txt`"; \
done; \
has_fig_diff=""; \
figlist="$(FIGURES_BUILDDIR)/*.p*m"; for fig in $$figlist; do \
echo "Diff `basename $$fig`"; \
diff $$fig $(FIGURES_SRCDIR)/`basename $$fig` >/dev/null 2>&1 \
- || has_fig_diff+=" `basename $$fig`"; \
+ || has_fig_diff="$$has_fig_diff `basename $$fig`"; \
done; \
has_split_out_diff=""; \
split_outlist="$(SPLIT_OUTPUTS_BUILDDIR)/*"; for split_out in $$split_outlist; do \
echo "Diff `basename $$split_out`"; \
diff $$split_out $(SPLIT_OUTPUTS_SRCDIR)/`basename $$split_out` >/dev/null 2>&1 \
- || has_split_out_diff+=" `basename $$split_out`"; \
+ || has_split_out_diff="$$has_split_out_diff `basename $$split_out`"; \
done; \
has_split_ex_diff=""; \
split_exlist="$(SPLIT_EXAMPLES_BUILDDIR)/*"; for split_ex in $$split_exlist; do \
echo "Diff `basename $$split_ex`"; \
diff $$split_ex $(SPLIT_EXAMPLES_SRCDIR)/`basename $$split_ex` >/dev/null 2>&1 \
- || has_split_ex_diff+=" `basename $$split_ex`"; \
+ || has_split_ex_diff="$$has_split_ex_diff `basename $$split_ex`"; \
done; \
(test -z "$$has_txt_diff" && test -z "$$has_fig_diff" && \
test -z "$$has_split_out_diff" && test -z "$$has_split_ex_diff")\
diff --git a/milena/doc/examples/split/tuto3_first_routine-1.cc b/milena/doc/examples/split/tuto3_first_routine-1.cc
index c9fd1ab..4470aa7 100644
--- a/milena/doc/examples/split/tuto3_first_routine-1.cc
+++ b/milena/doc/examples/split/tuto3_first_routine-1.cc
@@ -17,7 +17,7 @@ namespace mln
V nlabels;
mln_ch_value(I,V) lbl = labeling::blobs(ima, nbh, nlabels);
util::array<unsigned>
- count = labeling::compute(accu::meta::count(), lbl, nlabels);
+ count = labeling::compute(accu::meta::math::count(), lbl, nlabels);
mln_concrete(I) output;
initialize(output, ima);
diff --git a/milena/doc/examples/split/tuto3_first_routine-5.cc b/milena/doc/examples/split/tuto3_first_routine-5.cc
index 998dc2d..3d16132 100644
--- a/milena/doc/examples/split/tuto3_first_routine-5.cc
+++ b/milena/doc/examples/split/tuto3_first_routine-5.cc
@@ -2,4 +2,4 @@
V nlabels;
mln_ch_value(I,V) lbl = labeling::blobs(ima, nbh, nlabels);
util::array<unsigned>
- count = labeling::compute(accu::meta::count(), lbl, nlabels);
+ count = labeling::compute(accu::meta::math::count(), lbl, nlabels);
diff --git a/milena/doc/figures/fill-subdomain-2.ppm b/milena/doc/figures/fill-subdomain-2.ppm
index 7bfa0e4c45344b8acdbefee7347dd890f15031a2..c2b8ad5041095b3cbe001c4cdf880dda6c44fc1c 100644
GIT binary patch
delta 94
wcmX@dc#d&GdAMe82M{s902&u245BARZvY}7<GJ2y2p7Tza)AgU1r&h*00TJ{X#fBK
delta 94
wcmX@dc#d&GdARDibRc4Y0W>a57(^@2GzTIeBQhoo!iBJbTp)r-0YxAH0E}l4T>t<8
diff --git a/milena/doc/figures/fill-subdomain-3.ppm b/milena/doc/figures/fill-subdomain-3.ppm
index 037dec623f7a3629cc0b4cc0523eb091071ccfc4..a59ff430a2ceecec3ffe82c0858b93d5020a8cf4 100644
GIT binary patch
delta 52
bcmX@dc#d(xLS4<?4j^KH0c18%42=r_FysgI
delta 52
bcmX@dc#d(xLS5B!=|IE)1ITQk7#bG<KUfH5
diff --git a/milena/doc/figures/labeling-compute-2.ppm b/milena/doc/figures/labeling-compute-2.ppm
index 7bfa0e4c45344b8acdbefee7347dd890f15031a2..c2b8ad5041095b3cbe001c4cdf880dda6c44fc1c 100644
GIT binary patch
delta 94
wcmX@dc#d&GdAMe82M{s902&u245BARZvY}7<GJ2y2p7Tza)AgU1r&h*00TJ{X#fBK
delta 94
wcmX@dc#d&GdARDibRc4Y0W>a57(^@2GzTIeBQhoo!iBJbTp)r-0YxAH0E}l4T>t<8
diff --git a/milena/doc/figures/tuto3_colorize-2.ppm b/milena/doc/figures/tuto3_colorize-2.ppm
index c7b0c0151897e22f7a089ef8d7f16af669a11061..391715375171f95fd9c18c45b748ce6691aff241 100644
GIT binary patch
delta 82
tcmdnbxSw%CiMMFU95~wgTo0Lz%w+%r6{)Z}@)kg{L$m~lfD8zNZ~^;{8@m7i
delta 82
zcmdnbxSw%CiMNP^6cG6-ZUrL6NoH^^kPSo^bCy960~l;Nc)c({6iB|;+5$vC1_VL4
E0GcWzGynhq
diff --git a/milena/doc/figures/tuto4_genericity_and_algorithms-5.ppm b/milena/doc/figures/tuto4_genericity_and_algorithms-5.ppm
index caa01857a968090f4ef06142068aa3c47e3c090d..e7bf28faa4d0213c2d901b053b81fa36318c13c0 100644
GIT binary patch
literal 12406
zcmdUtv1%Px6h%|3cjLwbaS=7oNw9@+7qAHd2aE}BR6R!%Y)~Ze@(B13)TmMIKTxB_
zzv0Fo;ory!8y1^$@7$SrnU};yT=qR@pMBO`zZXXbUw1$DXZ>cq?N7Sb@4BDgp7v+!
z?z`2uUH4|Yy?FBA!TH~n)#>J>U-cJnx9in!o0xj`;-_DJ=w9}J^y|&9Z@Tr_N%yq>
zvp+q*_`N^dcF)(Z&m;7F^RD~m`OBxz4iAnVc1I5nzJK)S;PC3Q`uElRf7i#i@i%?0
zx|d?)gl?yOUftk#(VkkW>l>?j$|npBE(O`nscxtEKj(+DAx1x;I@^A<S>2DHJ~aH*
z?Otrms^w<%=v2cnD+F^@#FnUYR+lm;o32%7qew_q>^7*W2uvcSIWXIkXXuK5il~N^
zgQYDzQPerqRh_ib)~GNwD$0;@#68~iy6f<8#ZP6TU~p8VK>Vu5H3VnsrrGj3*Y63;
zRt3)JqC;R-k*f>$Cw>3!E3Yu+#VMM>QpC85<iyo=+4T^dNd&q6yw0E(M>SKUf~asx
zGeRqbx@vjd^?$+-c7pV}ASc4_@cT)-v}pRt8!CrEuhXLFf|uXn_oHM_a}7*eFyb~9
zRdE9vu{eJ$jc|vVt9=|T5vTu4@NxAnd%fsds9up~a4Au)h)M~+2>(*dp0hvx*y7>7
zbaCyAs*k_J`#b+WfXQ_D&|d^U@cv2-_<#8Rk?b2AT94T<sD({}bLjDR=8ts|KEwk?
zq8jomjX<y^8t}XEYh4wF)p($)`pY5-hz0q9K>(l%OA#2VBIPiJXv5Eaf7U7Ak<{WW
z4Q@ueO*)<b0)N^V*T7Q|&W6BQ=0s(${MC&@jaGx%TMCIvnKlZ)!|#W6)r~MXVOtZ(
zEMl+x+VcM1W7fH7GkaH4QStH6Q{d;mf4QZ~?|9NcrdDG1>$3d5S6hO76yABH%N#uE
zG55jGE{Qh3n*&={_~R;#ZGZe}X>8Qvm;A}e71Xj)<)8TY>5~a3Gej!JRb738J24}e
z9TGn7FiY|KUZ}LR<d<1pA9PKKn>Dfz{<JQZY8R*fgc6ctqf;O`Ar|LnX%fB^etEo=
zrsAruMCpfr;*TeNa$MQSA}TJ_^|OTWG-k_K51Ga9gJ>3oD0k7tk5G&2&@6^()Smcb
zDeFp3TCgE#4GEkGeM0;9gSiyGNL?z8YnelZ@v6Xv*atu16B+P_(1=$kMl03h+J1R`
zT{%T15k{RYspVJ3tAYfjF<3RX`Ku#dBwS0=>0PvsSGAn9(v`ZzKKNMyGlEt_V0JO&
zUzR^@ae&aN+qkB|#_V){oW8fcsNMCPq^A!CRm{Sc1hJ}fMff6$2=AilHU#D*%8?SR
z{DkDWyt9ozMOE`}53iydEuG1udP(Aya>Og{ENSURD|CX7ium;j9$N)dan#1r5Xqdb
zGT=}AC9S>!zXbmUWjM~8>tpHU(G^=Ms(vrVNL)2I#1A&Y7ghP)ko3^@Wb><!BptRk
zzdkB#Rrsin@_+ceau{uNjMS}O-S67XLQN-zS^T^S<1U5(+#^knkGPiY)yGdE61lE2
z48cd2_YY07riM;zA%;ApVel!}VHo0%mdNMwx4~d*+XOj<ACG|b@}uOMn*09g>3nt4
zIH^-{q3+}Rcd<$E6^+Lar}*OxO>Bxv*NHX)eVkbrVJP{ds88_mQt!YYA=+N1r3#SL
zskn&l5I=)1w(sw8oz8!Cc}G(d;lu2Zp?%z2z)TSiFTXw^G?~>L_;FTksYqs9C{we?
hw}&ajuRHLsZmuIC`1Pl>;PKcY-NsJcp%Cf`{x1*nX*B=<
literal 12406
zcmdUtzl&W}6osv)x6<N55TeB!CnO`-sF)~1lrRKA(Bj3pn!q?SJRd?z!T&*Q)2Fep
zOru~Sq!+<P#DBvr3qBV6oO|xQ&-?rlhQm60uf6tnPu`v5gDc(J{dvDxZ~N2k-ox(Q
z2WS2Hx;t9E+;#W2+sjuE4=?_ztj;#4{i?rwuwAb{*~HYXJMY|mqdVz8@7J4;?|19-
z)9z;fMSpg2`B{Iy?QXB{T}0@`=3#gB_Q}m#FCH9U?~bn@T)T1O;Dx83R{x%v|L@8-
zuf*T<x$0hukrTR|_Q8km<9E@XTB_?Ct9r^O3=J*?+0LnMr}!V|hqEC@KcPC?ezaNL
z=e~Qk;jeD@Vq;b<H={?V8irXRn5!bTM4hv`ltI~atvVY;LaJi7K}|(q5-H7r*`7Q@
zSNu~%HKZIYZQ+Tc&Y`aAq?NWtg{e_dhLj`j@vhfhhleYEDiZ~Rqap?3S3RyFI8!&x
zme;v{Phhqxa7Gs$0<(%-UARB#pMHGe6{fs6MKf567*~;;xVkR89)dH8AlIMQ8T8_)
zW@=Or6;5eJXoXN$Ew8)&SNOqBkX{$$MED(kKWUd1O+R@<<uK@VS`=OI@;m%~l<aA)
zfoTgy+@_)`Za^az=Z~ck?l5z;kE12x^nVFHuHI#@7hMb0E7A-uCCU|1Dd894Uy9jt
z_QxMvJlvNqu6<GU@ppKC=idh~nGPTNf58vDzfuGKZ@zyd`^JXWV>S$GVUyq-di<UF
zV_k#~@qm%2hWtt+5NwGC{BHbOSA}6U9;mARvPc4AL4IHm0I0%J1cs_eIZPqi@N?gv
zb;@@nwKz+Io6&BQPUk<spEkxd@Kl7eA#j#CQQ0ehb)!(D)nN9PLZVWpjl%En`(a&m
zBMeU1)&w$(*ek!bJiWSNor^ZJcQq9i9}hhRe(w91TdMqyCk<q3C1$@a%kO)&CCEqN
zokzON!IK_yAN=f+X!E-{uyut$uF}}{$DfwQMm>JXpPXDlEh|<2iI1N?nQ$^gq+(pv
z)hD<UGlJP6;o}ao6u<9<N=r+Anbq|{*MzuPBm3Y_>td;Par#dvAvrcW1(FkDaekI2
z;Y;C{$6IMCuIfsZe)uQ;c+w}wm5nT-;zC_NOBhdMwv6?VS^PeTW>JW87hU`awYUz=
zVyH&#i9eRIuH>Wz8-mu5z=_Z&w0}RCOW}*urP8>TIaC<03T%jd@Do0f0e=XMc!grL
zQa!Him)F;oQ&bXR)Y+0+er3EWNKhJsRdbuaI^spbwKSdHMf-SF%SkI;sY~pGpA|48
zXf*_87eoGK`O_8$2%Wl(YZ`3KPUpwzd)tfJUC&8+`e0DSENn>-t2$SNFQSO>E}Cvb
zU{0bODZ$E5NS?2M_$vMsRn7nX@cHOQOK0+^UXpmF9Px@fOIo_o3Z3AiB7S{>$5z2q
z9JR4DL^7wV4EPg&Nvp5GFTsC78IJR%w|<pQ9$m4OqU!fzjKo!gL;PSPd{LF(4M`7e
zPd2~$NYY_z^XsF+R)vrHDF63wzUDC6=oqP6y}IAEn}wQA472!o6UJQ(0k}t+93OEl
z+oO{&LnLxtWf+2wF7F?jWK9j7*g_0>NW<V$uEQ|IA1#s3<!^(**0u?93O^nJ>*Ytu
zH8uDB)6@Ctq;XQG;zHfuj^4v2!B;dMKb+!^Gc>U&DqSbq2=sAgU4)_JkD@-o$4k8f
ze}rgznU*R*Qm5h~x<mX7y7*)J5!dPbkB=T{Y9f4?9Wu0!dkdH;!r|rDCxj-mngc)1
ssx1}CYzt*-_Vr)-6ynz%`0sxEb0h@6{*)Fx9y_Gl*r_`dLOsF%2~_1-8vp<R
--
1.5.6.5
1
0
* mln/labeling/colorize.hh: use our own random generator.
* tests/labeling/colorize.cc: add an assertion.
---
milena/ChangeLog | 8 +++++++
milena/mln/labeling/colorize.hh | 40 +++++++++++++++++++++++++++++++++---
milena/tests/labeling/colorize.cc | 5 ++-
3 files changed, 47 insertions(+), 6 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 384b9ac..9acd79e 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,11 @@
+2009-06-15 Guillaume Lazzara <guillaume.lazzara(a)lrde.epita.fr>
+
+ Make labeling::colorize deterministic.
+
+ * mln/labeling/colorize.hh: use our own random generator.
+
+ * tests/labeling/colorize.cc: add an assertion.
+
2009-06-14 Roland Levillain <roland(a)lrde.epita.fr>
Aesthetic changes.
diff --git a/milena/mln/labeling/colorize.hh b/milena/mln/labeling/colorize.hh
index 3f8b6c4..19d00af 100644
--- a/milena/mln/labeling/colorize.hh
+++ b/milena/mln/labeling/colorize.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -71,12 +72,23 @@ namespace mln
const mln_value(L)& nlabels);
+ /// \overload
+ //
template <typename V, typename L>
mln_ch_value(L, V)
colorize(const V& value,
const Image<L>& labeled_image);
+ /// \overload
+ //
+ template <typename L>
+ inline
+ mln_ch_value(L, value::rgb8)
+ colorize(const Image<L>& input,
+ const mln_value(L)& nlabels);
+
+
# ifndef MLN_INCLUDE_ONLY
namespace colorize_
@@ -89,6 +101,15 @@ namespace mln
namespace internal
{
+ unsigned random_number()
+ {
+ static unsigned last = 1;
+
+ last = (323 * last + 6603) % 1025;
+
+ return colorize_::min_value + last % colorize_::max_value;
+ }
+
template <typename V>
V random_color(const V&);
@@ -96,9 +117,9 @@ namespace mln
mln::value::rgb<n>
random_color(const mln::value::rgb<n>&)
{
- return mln::value::rgb<n>(colorize_::min_value + (rand() % colorize_::max_value),
- colorize_::min_value + (rand() % colorize_::max_value),
- colorize_::min_value + (rand() % colorize_::max_value));
+ return mln::value::rgb<n>(random_number(),
+ random_number(),
+ random_number());
}
}
@@ -159,6 +180,17 @@ namespace mln
return output;
}
+
+ template <typename L>
+ inline
+ mln_ch_value(L, value::rgb8)
+ colorize(const Image<L>& input,
+ const mln_value(L)& nlabels)
+ {
+ return colorize(value::rgb8(), input, nlabels);
+ }
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::labeling
diff --git a/milena/tests/labeling/colorize.cc b/milena/tests/labeling/colorize.cc
index 18ae5ae..c0bba3c 100644
--- a/milena/tests/labeling/colorize.cc
+++ b/milena/tests/labeling/colorize.cc
@@ -29,7 +29,6 @@
# include <mln/labeling/colorize.hh>
# include <mln/data/compare.hh>
-
int main()
{
using namespace mln;
@@ -38,11 +37,13 @@ int main()
{ 0, 0 } };
typedef value::rgb8 rgb_t;
- value::rgb8 ref_data[][2] = { { rgb_t(89,92,86), rgb_t(89,92,86) },
+ value::rgb8 ref_data[][2] = { { rgb_t(231,46,171), rgb_t(231,46,171) },
{ rgb_t(0,0,0), rgb_t(0,0,0) } };
image2d<value::int_u8> ima = make::image(values);
image2d<rgb_t> ref = make::image(ref_data);
image2d<value::rgb8> ima_color = labeling::colorize(value::rgb8(), ima);
+
+ mln_assertion(ima_color == ref);
}
--
1.5.6.5
1
0