This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/khalimsky has been updated
via 42e50d9744a45238055e9a2723b257382100e738 (commit)
via 38aa07e7ca583edcf3012f0f725df829333fa018 (commit)
from c25ed6a187c7d75585f80250fa3a6c83f1b8d9c7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
42e50d9 Add new overloads of fill routines in k1.
38aa07e Do not read outside images in fill functions with accumulators.
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 19 ++++++++++
milena/mln/world/k1/fill_0_from_1_faces.hh | 34 +++++++++++++++++-
milena/mln/world/k1/fill_1_from_2_faces.hh | 38 +++++++++++++++++++-
.../k2/fill_non_primary_from_primary_2_faces.hh | 34 +++++++++++------
milena/mln/world/kn/fill_0_from_1_faces.hh | 15 +++++---
milena/mln/world/kn/fill_0_from_2_faces.hh | 15 +++++---
milena/mln/world/kn/fill_1_from_2_faces.hh | 17 ++++++---
milena/mln/world/kn/fill_1_from_aux_2_faces.hh | 17 ++++++---
milena/mln/world/kn/fill_2_from_1_faces.hh | 15 +++++---
9 files changed, 163 insertions(+), 41 deletions(-)
hooks/post-receive
--
Olena, a generic and efficient image processing platform
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/khalimsky has been updated
via c25ed6a187c7d75585f80250fa3a6c83f1b8d9c7 (commit)
via 5ce0f97d66852e3b437f08832b88373a6c1b15cd (commit)
via 5905ba6ba6a33fdc38d465b37262d39681b6fa38 (commit)
from 6d6224d4a0f67f17038744b587f1c8491a7c6549 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
c25ed6a Various fixes.
5ce0f97 Add specific accumulators to work in kn.
5905ba6 configure.ac: Configure milena/tests/world/kn/accu/Makefile.am.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 4 +
configure.ac | 5 +-
milena/ChangeLog | 37 ++++
milena/mln/accu/stat/median_h_interval.hh | 170 -----------------
milena/mln/util/hqueue.hh | 1 +
milena/mln/value/interval.hh | 35 +---
milena/mln/value/intsub.hh | 11 -
milena/mln/world/kn/accu/max_interval.hh | 223 +++++++++++++++++++++++
milena/mln/world/kn/accu/median_h_interval.hh | 192 +++++++++++++++++++
milena/mln/world/kn/accu/min_interval.hh | 210 +++++++++++++++++++++
milena/mln/world/kn/compute_tree_of_shapes.hh | 84 +++++----
milena/tests/accu/stat/Makefile.am | 2 -
milena/tests/accu/stat/median_h_interval.cc | 96 ----------
milena/tests/value/interval.cc | 18 ++
milena/tests/value/intsub.cc | 11 +-
milena/tests/world/kn/Makefile.am | 2 +
milena/tests/world/kn/accu/Makefile.am | 28 +++
milena/tests/world/kn/accu/max_interval.cc | 108 +++++++++++
milena/tests/world/kn/accu/median_h_interval.cc | 96 ++++++++++
milena/tests/world/kn/accu/min_interval.cc | 108 +++++++++++
20 files changed, 1097 insertions(+), 344 deletions(-)
delete mode 100644 milena/mln/accu/stat/median_h_interval.hh
create mode 100644 milena/mln/world/kn/accu/max_interval.hh
create mode 100644 milena/mln/world/kn/accu/median_h_interval.hh
create mode 100644 milena/mln/world/kn/accu/min_interval.hh
delete mode 100644 milena/tests/accu/stat/median_h_interval.cc
create mode 100644 milena/tests/world/kn/accu/Makefile.am
create mode 100644 milena/tests/world/kn/accu/max_interval.cc
create mode 100644 milena/tests/world/kn/accu/median_h_interval.cc
create mode 100644 milena/tests/world/kn/accu/min_interval.cc
hooks/post-receive
--
Olena, a generic and efficient image processing platform
* mln/accu/stat/median_h_interval.hh,
* tests/accu/stat/median_h_interval.cc: Move...
* mln/world/kn/accu/median_h_interval.hh,
* tests/world/kn/accu/median_h_interval.cc: ... Here.
* mln/world/kn/accu/max_interval.hh,
* mln/world/kn/accu/min_interval.hh,
* tests/world/kn/accu/Makefile.am,
* tests/world/kn/accu/max_interval.cc,
* tests/world/kn/accu/min_interval.cc: New.
* tests/accu/stat/Makefile.am,
* tests/world/kn/Makefile.am: Update targets.
---
milena/ChangeLog | 18 ++
milena/mln/accu/stat/median_h_interval.hh | 170 -----------------
milena/mln/world/kn/accu/max_interval.hh | 223 +++++++++++++++++++++++
milena/mln/world/kn/accu/median_h_interval.hh | 192 +++++++++++++++++++
milena/mln/world/kn/accu/min_interval.hh | 210 +++++++++++++++++++++
milena/tests/accu/stat/Makefile.am | 2 -
milena/tests/accu/stat/median_h_interval.cc | 96 ----------
milena/tests/world/kn/Makefile.am | 2 +
milena/tests/world/kn/accu/Makefile.am | 28 +++
milena/tests/world/kn/accu/max_interval.cc | 108 +++++++++++
milena/tests/world/kn/accu/median_h_interval.cc | 96 ++++++++++
milena/tests/world/kn/accu/min_interval.cc | 108 +++++++++++
12 files changed, 985 insertions(+), 268 deletions(-)
delete mode 100644 milena/mln/accu/stat/median_h_interval.hh
create mode 100644 milena/mln/world/kn/accu/max_interval.hh
create mode 100644 milena/mln/world/kn/accu/median_h_interval.hh
create mode 100644 milena/mln/world/kn/accu/min_interval.hh
delete mode 100644 milena/tests/accu/stat/median_h_interval.cc
create mode 100644 milena/tests/world/kn/accu/Makefile.am
create mode 100644 milena/tests/world/kn/accu/max_interval.cc
create mode 100644 milena/tests/world/kn/accu/median_h_interval.cc
create mode 100644 milena/tests/world/kn/accu/min_interval.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 45480d5..41719b9 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,23 @@
2012-10-26 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add specific accumulators to work in kn.
+
+ * mln/accu/stat/median_h_interval.hh,
+ * tests/accu/stat/median_h_interval.cc: Move...
+ * mln/world/kn/accu/median_h_interval.hh,
+ * tests/world/kn/accu/median_h_interval.cc: ... Here.
+
+ * mln/world/kn/accu/max_interval.hh,
+ * mln/world/kn/accu/min_interval.hh,
+ * tests/world/kn/accu/Makefile.am,
+ * tests/world/kn/accu/max_interval.cc,
+ * tests/world/kn/accu/min_interval.cc: New.
+
+ * tests/accu/stat/Makefile.am,
+ * tests/world/kn/Makefile.am: Update targets.
+
+2012-10-26 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add kn::holes() and kn::saturate().
* mln/world/kn/holes.hh,
diff --git a/milena/mln/accu/stat/median_h_interval.hh b/milena/mln/accu/stat/median_h_interval.hh
deleted file mode 100644
index ebe6b8d..0000000
--- a/milena/mln/accu/stat/median_h_interval.hh
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (C) 2012 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_MEDIAN_H_INTERVAL_HH
-# define MLN_ACCU_STAT_MEDIAN_H_INTERVAL_HH
-
-/// \file
-///
-/// \brief Define a median accumulator class based on a histogram and
-/// working on a specific interval.
-
-# include <vector>
-# include <mln/accu/internal/base.hh>
-# include <mln/value/interval.hh>
-# include <mln/trait/routine/mean.hh>
-
-
-
-namespace mln
-{
-
- namespace accu
- {
-
- namespace stat
- {
-
- /// \brief Define a median accumulator class based on a histogram and
- /// working on a specific interval.
- template <typename T,
- typename R = mln_trait_routine_mean(2,T) >
- struct median_h_interval
- : public mln::accu::internal::base< R, median_h_interval<T,R> >
- {
- typedef T argument;
- typedef R result;
-
- median_h_interval(const value::interval<argument>& inter);
- median_h_interval(const argument& first, const argument& last);
-
- void init();
-
- void take(const argument& v);
- void take(const median_h_interval<T,R>& v);
-
- // nota bene: no untake with this accumulator
-
- result to_result() const;
-
- bool is_valid() const;
-
- protected:
-
- value::interval<argument> inter_;
- std::vector<unsigned> h_;
- unsigned nitems_;
- };
-
-# ifndef MLN_INCLUDE_ONLY
-
- template <typename T, typename R>
- median_h_interval<T,R>::median_h_interval(const value::interval<argument>& inter)
- : inter_(inter)
- {
- h_.resize(inter_.nelements());
- init();
- }
-
- template <typename T, typename R>
- median_h_interval<T,R>::median_h_interval(const argument& first,
- const argument& last)
- : inter_(first, last)
- {
- h_.resize(inter_.nelements());
- init();
- }
-
- template <typename T, typename R>
- void
- median_h_interval<T,R>::init()
- {
- std::fill(h_.begin(), h_.end(), 0u);
- nitems_ = 0;
- }
-
- template <typename T, typename R>
- void
- median_h_interval<T,R>::take(const argument& v)
- {
- h_[inter_.index_of(v)] += 1;
- nitems_ += 1;
- }
-
- template <typename T, typename R>
- void
- median_h_interval<T,R>::take(const median_h_interval<T,R>& other)
- {
- mln_precondition(other.inter_ == inter_);
- for (unsigned i = 0; i < other.h_.size(); ++i)
- h_[i] += other.h_[i];
- nitems_ += other.nitems_;
- }
-
- template <typename T, typename R>
- typename median_h_interval<T,R>::result
- median_h_interval<T,R>::to_result() const
- {
- mln_precondition(is_valid());
- unsigned i = 0, n = h_.size();
- unsigned sum = h_[0], mid = (nitems_ + 1) / 2;
- while (i < n && sum < mid)
- {
- ++i;
- sum += h_[i];
- }
- if (nitems_ % 2) // nitems_ is odd.
- return inter_.ith_element(i);
-
- // nitems_ is even.
- if (sum > mid)
- return inter_.ith_element(i);
- // looking for next non null value
- unsigned i_memo = i;
- do
- ++i;
- while (h_[i] == 0);
- return (result(inter_.ith_element(i_memo))
- + result(inter_.ith_element(i))) / 2;
- }
-
- template <typename T, typename R>
- bool
- median_h_interval<T,R>::is_valid() const
- {
- return nitems_ != 0;
- }
-
-
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::accu::stat
-
- } // end of namespace mln::accu
-
-} // end of namespace mln
-
-
-#endif // ! MLN_ACCU_STAT_MEDIAN_H_INTERVAL_HH
diff --git a/milena/mln/world/kn/accu/max_interval.hh b/milena/mln/world/kn/accu/max_interval.hh
new file mode 100644
index 0000000..8d49932
--- /dev/null
+++ b/milena/mln/world/kn/accu/max_interval.hh
@@ -0,0 +1,223 @@
+// Copyright (C) 2012 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_WORLD_KN_ACCU_MAX_INTERVAL_HH
+# define MLN_WORLD_KN_ACCU_MAX_INTERVAL_HH
+
+/// \file
+///
+/// \brief Define an accumulator that computes a max on a specific
+/// interval.
+
+# include <mln/core/concept/meta_accumulator.hh>
+# include <mln/accu/internal/base.hh>
+# include <mln/trait/value_.hh>
+# include <mln/util/pix.hh>
+# include <mln/value/interval.hh>
+
+
+namespace mln
+{
+
+
+ // Forward declaration.
+ namespace world {
+ namespace kn {
+ namespace accu {
+ template <typename T> struct max_interval;
+ }
+ }
+ }
+
+
+ // Traits.
+
+ namespace trait
+ {
+
+ template <typename T>
+ struct accumulator_< world::kn::accu::max_interval<T> >
+ {
+ typedef accumulator::has_untake::no has_untake;
+ typedef accumulator::has_set_value::yes has_set_value;
+ typedef accumulator::has_stop::no has_stop;
+ typedef accumulator::when_pix::use_v when_pix;
+ };
+
+ } // end of namespace mln::trait
+
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ namespace accu
+ {
+
+ /// \brief Minimum accumulator restricted to a specific
+ /// interval.
+ ///
+ /// The parameter \c T is the type of values.
+ ///
+ /// \ingroup modaccuvalues
+ template <typename T>
+ struct max_interval
+ : public mln::accu::internal::base< const T& , max_interval<T> >
+ {
+ typedef T argument;
+
+ max_interval();
+ max_interval(const value::interval<T>& inter);
+ template <typename U, typename V>
+ max_interval(const U& first, const V& last);
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take_as_init_(const argument& t);
+ void take(const argument& t);
+ void take(const max_interval<T>& other);
+ /// \}
+
+ /// Force the value of the min to \a t.
+ void set_value(const T& t);
+
+ /// 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_;
+ value::interval<T> inter_;
+ };
+
+
+ template <typename I> struct max_interval< util::pix<I> >;
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T>
+ inline
+ max_interval<T>::max_interval()
+ {
+ inter_ = value::interval<T>(mln_min(T), mln_max(T));
+ init();
+ }
+
+ template <typename T>
+ inline
+ max_interval<T>::max_interval(const value::interval<T>& inter)
+ {
+ inter_ = inter;
+ init();
+ }
+
+ template <typename T>
+ template <typename U, typename V>
+ max_interval<T>::max_interval(const U& first, const V& last)
+ {
+ mlc_converts_to(U,T)::check();
+ mlc_converts_to(V,T)::check();
+ inter_ = value::interval<T>(first, last);
+ init();
+ }
+
+ template <typename T>
+ inline
+ void
+ max_interval<T>::init()
+ {
+ t_ = inter_.first();
+ }
+
+ template <typename T>
+ inline
+ void
+ max_interval<T>::take_as_init_(const argument& t)
+ {
+ t_ = t;
+ }
+
+ template <typename T>
+ inline
+ void
+ max_interval<T>::take(const argument& t)
+ {
+ if (t > t_)
+ t_ = t;
+ }
+
+ template <typename T>
+ inline
+ void
+ max_interval<T>::take(const max_interval<T>& other)
+ {
+ if (other.t_ > t_)
+ t_ = other.t_;
+ }
+
+ template <typename T>
+ inline
+ void
+ max_interval<T>::set_value(const T& t)
+ {
+ t_ = t;
+ }
+
+ template <typename T>
+ inline
+ const T&
+ max_interval<T>::to_result() const
+ {
+ return t_;
+ }
+
+ template <typename T>
+ inline
+ bool
+ max_interval<T>::is_valid() const
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn::accu
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WORLD_KN_ACCU_MAX_INTERVAL_HH
diff --git a/milena/mln/world/kn/accu/median_h_interval.hh b/milena/mln/world/kn/accu/median_h_interval.hh
new file mode 100644
index 0000000..1d81339
--- /dev/null
+++ b/milena/mln/world/kn/accu/median_h_interval.hh
@@ -0,0 +1,192 @@
+// Copyright (C) 2012 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_WORLD_KN_ACCU_MEDIAN_H_INTERVAL_HH
+# define MLN_WORLD_KN_ACCU_MEDIAN_H_INTERVAL_HH
+
+/// \file
+///
+/// \brief Define a median accumulator class based on a histogram and
+/// working on a specific interval.
+
+# include <vector>
+# include <mln/accu/internal/base.hh>
+# include <mln/value/interval.hh>
+# include <mln/trait/routine/mean.hh>
+# include <mln/math/mean.hh>
+
+
+namespace mln
+{
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ namespace accu
+ {
+
+ /// \brief Define a median accumulator class based on a histogram and
+ /// working on a specific interval.
+ template <typename T,
+ typename R = mln_trait_routine_mean(2,T) >
+ struct median_h_interval
+ : public mln::accu::internal::base< R, median_h_interval<T,R> >
+ {
+ typedef T argument;
+ typedef R result;
+
+ median_h_interval(const value::interval<argument>& inter);
+ median_h_interval(const argument& first, const argument& last);
+ template <typename U, typename V>
+ median_h_interval(const U& first, const V& last);
+
+ void init();
+
+ void take(const argument& v);
+ void take(const median_h_interval<T,R>& v);
+
+ // nota bene: no untake with this accumulator
+
+ result to_result() const;
+
+ bool is_valid() const;
+
+ protected:
+
+ value::interval<argument> inter_;
+ std::vector<unsigned> h_;
+ unsigned nitems_;
+ };
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T, typename R>
+ median_h_interval<T,R>::median_h_interval(const value::interval<argument>& inter)
+ : inter_(inter)
+ {
+ h_.resize(inter_.nelements());
+ init();
+ }
+
+ template <typename T, typename R>
+ median_h_interval<T,R>::median_h_interval(const argument& first,
+ const argument& last)
+ : inter_(first, last)
+ {
+ h_.resize(inter_.nelements());
+ init();
+ }
+
+ template <typename T, typename R>
+ template <typename U, typename V>
+ median_h_interval<T,R>::median_h_interval(const U& first,
+ const V& last)
+ {
+ mlc_converts_to(U,T)::check();
+ mlc_converts_to(V,T)::check();
+
+ inter_ = value::interval<T>(first, last);
+ h_.resize(inter_.nelements());
+ init();
+ }
+
+ template <typename T, typename R>
+ void
+ median_h_interval<T,R>::init()
+ {
+ std::fill(h_.begin(), h_.end(), 0u);
+ nitems_ = 0;
+ }
+
+ template <typename T, typename R>
+ void
+ median_h_interval<T,R>::take(const argument& v)
+ {
+ h_[inter_.index_of(v)] += 1;
+ nitems_ += 1;
+ }
+
+ template <typename T, typename R>
+ void
+ median_h_interval<T,R>::take(const median_h_interval<T,R>& other)
+ {
+ mln_precondition(other.inter_ == inter_);
+ for (unsigned i = 0; i < other.h_.size(); ++i)
+ h_[i] += other.h_[i];
+ nitems_ += other.nitems_;
+ }
+
+ template <typename T, typename R>
+ typename median_h_interval<T,R>::result
+ median_h_interval<T,R>::to_result() const
+ {
+ if (!nitems_)
+ return result(math::mean(inter_.first(), inter_.last()));
+
+ mln_precondition(is_valid());
+ unsigned i = 0, n = h_.size();
+ unsigned sum = h_[0], mid = (nitems_ + 1) / 2;
+ while (i < n && sum < mid)
+ {
+ ++i;
+ sum += h_[i];
+ }
+ if (nitems_ % 2) // nitems_ is odd.
+ return inter_.ith_element(i);
+
+ // nitems_ is even.
+ if (sum > mid)
+ return inter_.ith_element(i);
+ // looking for next non null value
+ unsigned i_memo = i;
+ do
+ ++i;
+ while (h_[i] == 0);
+ return (result(inter_.ith_element(i_memo))
+ + result(inter_.ith_element(i))) / 2;
+ }
+
+ template <typename T, typename R>
+ bool
+ median_h_interval<T,R>::is_valid() const
+ {
+ return nitems_ != 0;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn::accu
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+#endif // ! MLN_WORLD_KN_ACCU_MEDIAN_H_INTERVAL_HH
diff --git a/milena/mln/world/kn/accu/min_interval.hh b/milena/mln/world/kn/accu/min_interval.hh
new file mode 100644
index 0000000..df6120d
--- /dev/null
+++ b/milena/mln/world/kn/accu/min_interval.hh
@@ -0,0 +1,210 @@
+// Copyright (C) 2012 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_WORLD_KN_ACCU_MIN_INTERVAL_HH
+# define MLN_WORLD_KN_ACCU_MIN_INTERVAL_HH
+
+/// \file
+///
+/// Define an accumulator that computes a min on a specific interval.
+
+# 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/value/interval.hh>
+
+namespace mln
+{
+
+
+ // Forward declaration.
+ namespace world {
+ namespace kn {
+ namespace accu {
+ template <typename T> struct min_interval;
+ }
+ }
+ }
+
+
+ // Traits.
+
+ namespace trait
+ {
+
+ template <typename T>
+ struct accumulator_< world::kn::accu::min_interval<T> >
+ {
+ typedef accumulator::has_untake::no has_untake;
+ typedef accumulator::has_set_value::yes has_set_value;
+ typedef accumulator::has_stop::no has_stop;
+ typedef accumulator::when_pix::use_v when_pix;
+ };
+
+ } // end of namespace mln::trait
+
+
+ namespace world
+ {
+
+ namespace kn
+ {
+
+ namespace accu
+ {
+
+ /// \brief Minimum accumulator restricted to a specific
+ /// interval.
+ /*!
+ * The parameter \c T is the type of values.
+ *
+ * \ingroup modaccuvalues
+ */
+ template <typename T>
+ struct min_interval
+ : public mln::accu::internal::base< const T&, min_interval<T> >
+ {
+ typedef T argument;
+
+ min_interval();
+ min_interval(const value::interval<T>& inter);
+ template <typename U, typename V>
+ min_interval(const U& first, const V& last);
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take_as_init_(const argument& t);
+ void take(const argument& t);
+ void take(const min_interval<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_;
+ value::interval<T> inter_;
+ };
+
+
+ template <typename I> struct min_interval< util::pix<I> >;
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T>
+ inline
+ min_interval<T>::min_interval()
+ {
+ inter_ = value::interval<T>(mln_min(T), mln_max(T));
+ init();
+ }
+
+ template <typename T>
+ inline
+ min_interval<T>::min_interval(const value::interval<T>& inter)
+ {
+ inter_ = inter;
+ init();
+ }
+
+ template <typename T>
+ template <typename U, typename V>
+ inline
+ min_interval<T>::min_interval(const U& first, const V& last)
+ {
+ mlc_converts_to(U,T)::check();
+ mlc_converts_to(V,T)::check();
+ inter_ = value::interval<T>(first, last);
+ init();
+ }
+
+ template <typename T>
+ inline
+ void
+ min_interval<T>::init()
+ {
+ t_ = inter_.last();
+ }
+
+ template <typename T>
+ inline
+ void min_interval<T>::take_as_init_(const argument& t)
+ {
+ t_ = t;
+ }
+
+ template <typename T>
+ inline
+ void min_interval<T>::take(const argument& t)
+ {
+ if (t < t_)
+ t_ = t;
+ }
+
+ template <typename T>
+ inline
+ void
+ min_interval<T>::take(const min_interval<T>& other)
+ {
+ if (other.t_ < t_)
+ t_ = other.t_;
+ }
+
+ template <typename T>
+ inline
+ const T&
+ min_interval<T>::to_result() const
+ {
+ return t_;
+ }
+
+ template <typename T>
+ inline
+ bool
+ min_interval<T>::is_valid() const
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::world::kn::accu
+
+ } // end of namespace mln::world::kn
+
+ } // end of namespace mln::world
+
+} // end of namespace mln
+
+
+#endif // ! MLN_WORLD_KN_ACCU_MIN_INTERVAL_HH
diff --git a/milena/tests/accu/stat/Makefile.am b/milena/tests/accu/stat/Makefile.am
index f86dd88..cb647d2 100644
--- a/milena/tests/accu/stat/Makefile.am
+++ b/milena/tests/accu/stat/Makefile.am
@@ -27,7 +27,6 @@ check_PROGRAMS = \
max_h \
median_few \
median_h \
- median_h_interval \
mean \
rank
@@ -36,7 +35,6 @@ var_SOURCES = var.cc
mean_SOURCES = mean.cc
median_h_SOURCES = median_h.cc
median_few_SOURCES = median_few.cc
-median_h_interval_SOURCES = median_h_interval.cc
min_SOURCES = min.cc
min_h_SOURCES = min_h.cc
max_SOURCES = max.cc
diff --git a/milena/tests/accu/stat/median_h_interval.cc b/milena/tests/accu/stat/median_h_interval.cc
deleted file mode 100644
index b20489d..0000000
--- a/milena/tests/accu/stat/median_h_interval.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (C) 2012 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/value/interval.hh>
-#include <mln/value/intsub.hh>
-#include <mln/accu/stat/median_h_interval.hh>
-
-
-template <typename T>
-void doit(const mln::value::interval<T>& inter)
-{
- typedef mln::accu::stat::median_h_interval<T> M;
-
- {
- M m(inter);
- m.init();
- m.take(6);
- mln_postcondition(m.to_result() == 6);
- }
-
- {
- M m(inter);
- m.init();
- m.take(6);
- m.take(6);
- mln_postcondition(m.to_result() == 6);
- }
-
- {
- M m(inter);
- m.init();
- m.take(6);
- m.take(6);
- m.take(0);
- mln_postcondition(m.to_result() == 6);
- }
-
- {
- M m(inter);
- m.init();
- m.take(12);
- m.take(0);
- m.take(0);
- m.take(24);
- mln_postcondition(m.to_result() == 6);
- }
-
- {
- M m(inter);
- m.init();
- m.take(1);
- m.take(0);
- mln_postcondition(m.to_result() == 0.5);
- }
-}
-
-
-int main()
-{
- using namespace mln;
-
- {
- typedef int T;
- value::interval<T> inter(0, 30);
- doit(inter);
- }
-
- {
- typedef value::intsub<2> T;
- value::interval<T> inter(0, 30);
- doit(inter);
- }
-
-}
diff --git a/milena/tests/world/kn/Makefile.am b/milena/tests/world/kn/Makefile.am
index 2a89e48a..5147ad9 100644
--- a/milena/tests/world/kn/Makefile.am
+++ b/milena/tests/world/kn/Makefile.am
@@ -16,6 +16,8 @@
include $(top_srcdir)/milena/tests/tests.mk
+SUBDIRS = accu
+
check_PROGRAMS = \
fill_0_1_faces_internal_border \
fill_0_from_1_faces \
diff --git a/milena/tests/world/kn/accu/Makefile.am b/milena/tests/world/kn/accu/Makefile.am
new file mode 100644
index 0000000..98651eb
--- /dev/null
+++ b/milena/tests/world/kn/accu/Makefile.am
@@ -0,0 +1,28 @@
+# Copyright (C) 2012 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/>.
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ max_interval \
+ median_h_interval \
+ min_interval
+
+max_interval_SOURCES = max_interval.cc
+median_h_interval_SOURCES = median_h_interval.cc
+min_interval_SOURCES = min_interval.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/world/kn/accu/max_interval.cc b/milena/tests/world/kn/accu/max_interval.cc
new file mode 100644
index 0000000..9686ad7
--- /dev/null
+++ b/milena/tests/world/kn/accu/max_interval.cc
@@ -0,0 +1,108 @@
+// Copyright (C) 2012 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/value/interval.hh>
+#include <mln/value/intsub.hh>
+#include <mln/world/kn/accu/max_interval.hh>
+
+
+template <typename T>
+void doit(const mln::value::interval<T>& inter)
+{
+ typedef mln::world::kn::accu::max_interval<T> M;
+
+ {
+ M m(inter);
+ m.init();
+ mln_assertion(m.to_result() == inter.first());
+ }
+
+ {
+ M m;
+ m.init();
+ mln_assertion(m.to_result() == mln_min(T));
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ mln_assertion(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ m.take(6);
+ mln_assertion(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ m.take(6);
+ m.take(0);
+ mln_assertion(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(12);
+ m.take(0);
+ m.take(0);
+ m.take(24);
+ mln_assertion(m.to_result() == 24);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(1);
+ m.take(0);
+ mln_assertion(m.to_result() == 1);
+ }
+}
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ typedef int T;
+ value::interval<T> inter(0, 30);
+ doit(inter);
+ }
+
+ {
+ typedef value::intsub<2> T;
+ value::interval<T> inter(0, 30);
+ doit(inter);
+ }
+
+}
diff --git a/milena/tests/world/kn/accu/median_h_interval.cc b/milena/tests/world/kn/accu/median_h_interval.cc
new file mode 100644
index 0000000..509bec4
--- /dev/null
+++ b/milena/tests/world/kn/accu/median_h_interval.cc
@@ -0,0 +1,96 @@
+// Copyright (C) 2012 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/value/interval.hh>
+#include <mln/value/intsub.hh>
+#include <mln/world/kn/accu/median_h_interval.hh>
+
+
+template <typename T>
+void doit(const mln::value::interval<T>& inter)
+{
+ typedef mln::world::kn::accu::median_h_interval<T> M;
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ mln_postcondition(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ m.take(6);
+ mln_postcondition(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ m.take(6);
+ m.take(0);
+ mln_postcondition(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(12);
+ m.take(0);
+ m.take(0);
+ m.take(24);
+ mln_postcondition(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(1);
+ m.take(0);
+ mln_postcondition(m.to_result() == 0.5);
+ }
+}
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ typedef int T;
+ value::interval<T> inter(0, 30);
+ doit(inter);
+ }
+
+ {
+ typedef value::intsub<2> T;
+ value::interval<T> inter(0, 30);
+ doit(inter);
+ }
+
+}
diff --git a/milena/tests/world/kn/accu/min_interval.cc b/milena/tests/world/kn/accu/min_interval.cc
new file mode 100644
index 0000000..7b5a0e2
--- /dev/null
+++ b/milena/tests/world/kn/accu/min_interval.cc
@@ -0,0 +1,108 @@
+// Copyright (C) 2012 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/value/interval.hh>
+#include <mln/value/intsub.hh>
+#include <mln/world/kn/accu/min_interval.hh>
+
+
+template <typename T>
+void doit(const mln::value::interval<T>& inter)
+{
+ typedef mln::world::kn::accu::min_interval<T> M;
+
+ {
+ M m(inter);
+ m.init();
+ mln_assertion(m.to_result() == inter.last());
+ }
+
+ {
+ M m;
+ m.init();
+ mln_assertion(m.to_result() == mln_max(T));
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ mln_assertion(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ m.take(6);
+ mln_assertion(m.to_result() == 6);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(6);
+ m.take(6);
+ m.take(0);
+ mln_assertion(m.to_result() == 0);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(12);
+ m.take(0);
+ m.take(0);
+ m.take(24);
+ mln_assertion(m.to_result() == 0);
+ }
+
+ {
+ M m(inter);
+ m.init();
+ m.take(1);
+ m.take(0);
+ mln_assertion(m.to_result() == 0);
+ }
+}
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ typedef int T;
+ value::interval<T> inter(0, 30);
+ doit(inter);
+ }
+
+ {
+ typedef value::intsub<2> T;
+ value::interval<T> inter(0, 30);
+ doit(inter);
+ }
+
+}
--
1.7.2.5
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Olena, a generic and efficient image processing platform".
The branch exp/khalimsky has been updated
via 6d6224d4a0f67f17038744b587f1c8491a7c6549 (commit)
from 104c7b7044973cc4da49295f06294ddc2aa552ea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
6d6224d Add kn::holes() and kn::saturate().
-----------------------------------------------------------------------
Summary of changes:
milena/ChangeLog | 12 ++
...{fill_0_1_faces_internal_border.hh => holes.hh} | 68 ++++++-----
.../mln/world/kn/internal/get_background_label.hh | 122 ++++++++++++++++++++
...ll_0_1_faces_internal_border.hh => saturate.hh} | 70 ++++++-----
milena/tests/world/kn/Makefile.am | 4 +
.../{k1/fill_1_from_2_faces.cc => kn/holes.cc} | 88 +++++++--------
.../{k1/fill_1_from_2_faces.cc => kn/saturate.cc} | 89 +++++++--------
7 files changed, 295 insertions(+), 158 deletions(-)
copy milena/mln/world/kn/{fill_0_1_faces_internal_border.hh => holes.hh} (58%)
create mode 100644 milena/mln/world/kn/internal/get_background_label.hh
copy milena/mln/world/kn/{fill_0_1_faces_internal_border.hh => saturate.hh} (57%)
copy milena/tests/world/{k1/fill_1_from_2_faces.cc => kn/holes.cc} (59%)
copy milena/tests/world/{k1/fill_1_from_2_faces.cc => kn/saturate.cc} (58%)
hooks/post-receive
--
Olena, a generic and efficient image processing platform