https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Introduce accumulators and point-wise operations in mln.
* tests/pw_value.cc: New.
* mln/estim/mean.hh: New.
* mln/fun/chess.hh (result): New.
* mln/fun/ops.hh: New.
* mln/fun/val.hh: New.
* mln/fun/pw_value.hh: New.
* mln/fun/var.hh: New.
* mln/core/concept/doc/accumulator.hh: New.
* mln/core/concept/accumulator.hh: New.
* mln/core/concept/function.hh (Function_i2v): New.
* mln/core/macros.hh (mln_result): New.
* mln/arith: New.
* mln/arith/plus.hh: New.
* mln/level/apply.hh: New.
* mln/level/transform.hh: New.
* mln/accu/counter.hh: New.
* mln/accu/mean.hh: New.
* mln/value/kind.hh: New.
* mln/value/props.hh (mln_kind, kind): New.
* mln/estim/count.hh: Remove; useless.
* mln/fun/all.hh (all): Change inheritance.
* mln/core/point.hh (point_): Strenghten sigs.
* mln/core/dpoint.hh (dpoint_): Likewise.
* mln/accu/histo.hh: Add inheritance.
* mln/accu/median.hh: Likewise.
mln/accu/counter.hh | 109 ++++++++++++++++++++++++++
mln/accu/histo.hh | 6 +
mln/accu/mean.hh | 116 ++++++++++++++++++++++++++++
mln/accu/median.hh | 8 +
mln/arith/plus.hh | 82 ++++++++++++++++++++
mln/core/concept/accumulator.hh | 80 +++++++++++++++++++
mln/core/concept/doc/accumulator.hh | 56 +++++++++++++
mln/core/concept/function.hh | 18 ++++
mln/core/dpoint.hh | 4
mln/core/macros.hh | 3
mln/core/point.hh | 4
mln/estim/mean.hh | 55 ++++++-------
mln/fun/all.hh | 3
mln/fun/chess.hh | 1
mln/fun/ops.hh | 147 ++++++++++++++++++++++++++++++++++++
mln/fun/pw_value.hh | 130 +++++++++++++++++++++++++++++++
mln/fun/val.hh | 97 +++++++++++++++++++++++
mln/fun/var.hh | 98 ++++++++++++++++++++++++
mln/level/apply.hh | 111 +++++++++++++++++++++++++++
mln/level/transform.hh | 85 ++++++++++++++++++++
mln/value/kind.hh | 60 ++++++++++++++
mln/value/props.hh | 20 ++++
tests/pw_value.cc | 48 +++++++++++
23 files changed, 1304 insertions(+), 37 deletions(-)
Index: tests/pw_value.cc
--- tests/pw_value.cc (revision 0)
+++ tests/pw_value.cc (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/pw_value.cc
+ *
+ * \brief Test on mln::fun::pw_value_.
+ */
+
+#include <mln/core/image2d_b.hh>
+#include <mln/fun/pw_value.hh>
+#include <mln/fun/ops.hh>
+#include <mln/fun/val.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d_b<int> ima(3, 3);
+ point2d p = make::point2d(1, 1);
+ ima(p) = 51;
+
+ std::cout << (pw_value(ima) = val(51))(p) << std::endl;
+}
Index: mln/estim/mean.hh
--- mln/estim/mean.hh (revision 1014)
+++ mln/estim/mean.hh (working copy)
@@ -25,14 +25,17 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_ESTIM_COUNT_HH
-# define MLN_ESTIM_COUNT_HH
+#ifndef MLN_ESTIM_MEAN_HH
+# define MLN_ESTIM_MEAN_HH
-/*! \file mln/estim/count.hh
+/*! \file mln/estim/mean.hh
*
- * \brief Several routines to count the number of points.
+ * \brief Compute the mean pixel value.
*/
+# include <mln/core/concept/image.hh>
+# include <mln/accu/mean.hh>
+
namespace mln
{
@@ -41,39 +44,31 @@
{
- /// Compute the number FIXME minimum and maximum points when browsing with
- /// iterator \p p.
- template <typename S>
- std::size_t count(const Point_Set<S>& pset);
+ /*! \brief Compute the mean value of the pixels of image \p input.
+ *
+ * Parameter \c S is the type of the mean value.
+ */
+ template <typename S, typename I>
+ S mean(const Image<I>& input);
# ifndef MLN_INCLUDE_ONLY
- template <typename I>
- std::pair<mln_point(I), mln_point(I)>
- count(const Piter<I>& p_)
+ template <typename S, typename I>
+ S
+ mean(const Image<I>& input_)
{
- const I& p = exact(p_);
+ const I& input = exact(input_);
+ mln_precondition(input.has_data());
+
+ accu::mean<mln_value(I), S> m;
- typedef mln_point(I) P;
- std::pair<P, P> tmp;
- P& pmin = tmp.first;
- P& pmax = tmp.second;
-
- // init with first point
- p.start();
- pmin = pmax = p;
-
- // update with remaining points
- for_all_remaining(p)
- for (unsigned i = 0; i < P::dim; ++i)
- if (p[i] < pmin[i])
- pmin()[i] = p[i];
- else if (p[i] > pmax[i])
- pmax[i] = p[i];
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ m.take(input(p));
- return tmp;
+ return m;
}
# endif // ! MLN_INCLUDE_ONLY
@@ -83,4 +78,4 @@
} // end of namespace mln
-#endif // ! MLN_ESTIM_COUNT_HH
+#endif // ! MLN_ESTIM_MEAN_HH
Index: mln/fun/ops.hh
--- mln/fun/ops.hh (revision 0)
+++ mln/fun/ops.hh (revision 0)
@@ -0,0 +1,147 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_FUN_OPS_HH
+# define MLN_FUN_OPS_HH
+
+/*! \file mln/fun/ops.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/function.hh>
+
+
+
+# define mln_decl_binary_expr_(In, Out, Name, Symbol) \
+ \
+ namespace fun \
+ { \
+ \
+ template <typename L, typename R> \
+ struct Name##_expr_ : public Function_##Out < Name##_expr_<L,R> > \
+ { \
+ typedef mln_result(L) result; \
+ \
+ Name##_expr_(const L& l, const R& r) \
+ : l_(l), r_(r) \
+ { \
+ } \
+ \
+ template <typename P> \
+ result operator()(const P& p) const \
+ { \
+ return l_(p) Symbol r_(p); \
+ } \
+ \
+ protected: \
+ L l_; \
+ R r_; \
+ }; \
+ \
+ } \
+ \
+ template <typename L, typename R> \
+ fun::Name##_expr_<L,R> \
+ operator Symbol (const Function_##In<L>& lhs, const
Function_##In<R>& rhs) \
+ { \
+ fun::Name##_expr_<L,R> tmp(exact(lhs), exact(rhs)); \
+ return tmp; \
+ } \
+ \
+ struct dummy
+
+
+# define mln_decl_unary_expr_(In, Out, Name, Symbol) \
+ \
+ namespace fun \
+ { \
+ \
+ template <typename F> \
+ struct Name##_expr_ : public Function_##Out< Name##_expr_<F> > \
+ { \
+ typedef mln_result(F) result; \
+ \
+ Name##_expr_(const F& f) \
+ : f_(f) \
+ { \
+ } \
+ \
+ template <typename P> \
+ result operator()(const P& p) const \
+ { \
+ return Symbol f_(p); \
+ } \
+ \
+ protected: \
+ F f_; \
+ }; \
+ \
+ } \
+ \
+ template <typename F> \
+ fun::Name##_expr_<F> \
+ operator Symbol (const Function_##In<F>& f) \
+ { \
+ fun::Name##_expr_<F> tmp(exact(f)); \
+ return tmp; \
+ } \
+ \
+ struct dummy
+
+
+
+namespace mln
+{
+
+ mln_decl_binary_expr_(p2v, p2b, equal, =);
+ mln_decl_binary_expr_(p2v, p2b, not_equal, !=);
+
+ mln_decl_binary_expr_(p2v, p2b, less, <);
+ mln_decl_binary_expr_(p2v, p2b, less_or_equal, <=);
+ mln_decl_binary_expr_(p2v, p2b, greater_or_equal, >=);
+ mln_decl_binary_expr_(p2v, p2b, greater, >);
+
+ mln_decl_binary_expr_(p2b, p2b, and, &&);
+ mln_decl_binary_expr_(p2b, p2b, or, ||);
+ mln_decl_binary_expr_(p2b, p2b, xor, ^);
+
+ mln_decl_unary_expr_(p2b, p2b, not, !);
+
+ mln_decl_binary_expr_(p2v, p2v, plus, +);
+ mln_decl_binary_expr_(p2v, p2v, minus, -);
+ mln_decl_binary_expr_(p2v, p2v, times, *);
+ mln_decl_binary_expr_(p2v, p2v, div, /);
+ mln_decl_binary_expr_(p2v, p2v, mod, %);
+
+ mln_decl_unary_expr_(p2v, p2v, uplus, +);
+ mln_decl_unary_expr_(p2v, p2v, uminus, -);
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_OPS_HH
Index: mln/fun/val.hh
--- mln/fun/val.hh (revision 0)
+++ mln/fun/val.hh (revision 0)
@@ -0,0 +1,97 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_FUN_VAL_HH
+# define MLN_FUN_VAL_HH
+
+/*! \file mln/fun/val.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/function.hh>
+
+
+namespace mln
+{
+
+ // FIXME: Doc!
+
+ namespace fun
+ {
+
+ template <typename T>
+ struct val_ : public Function_p2v< val_<T> >
+ {
+ typedef T result;
+ val_(T t);
+ template <typename P>
+ T operator()(const P&) const;
+ private:
+ T t_;
+ };
+
+ } // end of namespace mln::fun
+
+ template <typename T>
+ fun::val_<T> val(T t);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace fun
+ {
+
+ template <typename T>
+ val_<T>::val_(T t)
+ : t_(t)
+ {
+ }
+
+ template <typename T>
+ template <typename P>
+ T
+ val_<T>::operator()(const P&) const
+ {
+ return t_;
+ }
+
+ } // end of namespace mln::fun
+
+ template <typename T>
+ fun::val_<T> val(T t)
+ {
+ fun::val_<T> tmp(t);
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_VAL_HH
Index: mln/fun/pw_value.hh
--- mln/fun/pw_value.hh (revision 0)
+++ mln/fun/pw_value.hh (revision 0)
@@ -0,0 +1,130 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_FUN_PW_VALUE_HH
+# define MLN_FUN_PW_VALUE_HH
+
+/*! \file mln/fun/pw_value.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/function.hh>
+# include <mln/core/concept/image.hh>
+# include <mln/value/props.hh>
+
+
+
+namespace mln
+{
+
+ // Fwd decl.
+ namespace fun { template <typename I> struct pw_value; }
+
+
+
+ // FIXME: Doc!
+
+ template <typename I>
+ fun::pw_value<I> pw_value(const Image<I>& ima);
+
+
+
+ namespace fun
+ {
+
+ // FIXME: Move!
+
+ namespace internal
+ {
+
+ template <typename K, typename E>
+ struct function_ : Function_p2v<E>
+ {};
+
+ template <typename E>
+ struct function_< value::binary_kind, E > : Function_p2b<E>
+ {};
+
+ } // end of namespace mln::fun::internal
+
+
+ // FIXME: Doc!
+
+ template <typename I>
+ struct pw_value : public internal::function_< mln_kind(I), pw_value<I> >
+ {
+ typedef mln_value(I) result;
+ pw_value(const I& ima);
+ mln_rvalue(I) operator()(const mln_psite(I)& p) const;
+ protected:
+ const I& ima_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // fun::pw_value<I>
+
+ template <typename I>
+ pw_value<I>::pw_value(const I& ima)
+ : ima_(ima)
+ {
+ }
+
+ template <typename I>
+ mln_rvalue(I)
+ pw_value<I>::operator()(const mln_psite(I)& p) const
+ {
+ mln_precondition(ima_.owns_(p));
+ return ima_(p);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // pw_value
+
+ template <typename I>
+ fun::pw_value<I>
+ pw_value(const Image<I>& ima)
+ {
+ mln_precondition(exact(ima).has_data());
+ fun::pw_value<I> tmp(exact(ima));
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_PW_VALUE_HH
Index: mln/fun/chess.hh
--- mln/fun/chess.hh (revision 1014)
+++ mln/fun/chess.hh (working copy)
@@ -47,6 +47,7 @@
struct chess_t : public Function_p2b< chess_t >
{
+ typedef bool result;
bool operator()(const point2d& p) const;
}
Index: mln/fun/all.hh
--- mln/fun/all.hh (revision 1014)
+++ mln/fun/all.hh (working copy)
@@ -45,8 +45,9 @@
{
template <typename T>
- struct all : public Function< all<T> >
+ struct all : public Function_i2v< all<T> >
{
+ typedef T result;
all(T t);
template <typename U>
T operator()(const U&) const;
Index: mln/fun/var.hh
--- mln/fun/var.hh (revision 0)
+++ mln/fun/var.hh (revision 0)
@@ -0,0 +1,98 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_FUN_VAR_HH
+# define MLN_FUN_VAR_HH
+
+/*! \file mln/fun/var.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/function.hh>
+
+
+namespace mln
+{
+
+ // FIXME: Doc!
+
+ namespace fun
+ {
+
+ template <typename V>
+ struct var_ : public Function_p2v< var_<V> >
+ {
+ typedef V result;
+ var_(const V& v);
+ template <typename P>
+ const V& operator()(const P&) const;
+ private:
+ const V& v_;
+ };
+
+ } // end of namespace mln::fun
+
+
+ template <typename V>
+ fun::var_<V> var(const V& v);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace fun
+ {
+
+ template <typename V>
+ var_<V>::var_(const V& v)
+ : v_(v)
+ {
+ }
+
+ template <typename V>
+ template <typename P>
+ const V&
+ var_<V>::operator()(const P&) const
+ {
+ return v_;
+ }
+
+ } // end of namespace mln::fun
+
+ template <typename V>
+ fun::var_<V> var(const V& v)
+ {
+ fun::var_<V> tmp(v);
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_VAR_HH
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 1014)
+++ mln/core/macros.hh (working copy)
@@ -138,6 +138,9 @@
// r
+/// Shortcut to access the result type associated to T.
+# define mln_result(T) typename T::result
+
/// Shortcut to access the rvalue type associated to T.
# define mln_rvalue(T) typename T::rvalue
Index: mln/core/point.hh
--- mln/core/point.hh (revision 1014)
+++ mln/core/point.hh (working copy)
@@ -87,7 +87,7 @@
/*! \brief Constructor; coordinates are set by function \p f.
*/
template <typename F>
- point_(const Function<F>& f);
+ point_(const Function_i2v<F>& f);
/*! \brief Set all coordinates to the value \p c.
*/
@@ -124,7 +124,7 @@
template <unsigned n, typename C>
template <typename F>
- point_<n,C>::point_(const Function<F>& f_)
+ point_<n,C>::point_(const Function_i2v<F>& f_)
{
const F& f = exact(f_);
for (unsigned i = 0; i < n; ++i)
Index: mln/core/dpoint.hh
--- mln/core/dpoint.hh (revision 1014)
+++ mln/core/dpoint.hh (working copy)
@@ -87,7 +87,7 @@
/*! \brief Constructor; coordinates are set by function \p f.
*/
template <typename F>
- dpoint_(const Function<F>& f);
+ dpoint_(const Function_i2v<F>& f);
/*! \brief Set all coordinates to the value \p c.
*/
@@ -124,7 +124,7 @@
template <unsigned n, typename C>
template <typename F>
- dpoint_<n,C>::dpoint_(const Function<F>& f_)
+ dpoint_<n,C>::dpoint_(const Function_i2v<F>& f_)
{
const F& f = exact(f_);
for (unsigned i = 0; i < n; ++i)
Index: mln/core/concept/function.hh
--- mln/core/concept/function.hh (revision 1014)
+++ mln/core/concept/function.hh (working copy)
@@ -68,6 +68,18 @@
};
+ // Index -> Value.
+
+ /// Base class for implementation of function-objects from index to
+ /// value.
+ template <typename E>
+ struct Function_i2v : public Function_v2v<E>
+ {
+ protected:
+ Function_i2v();
+ };
+
+
// Point -> Value.
/// Base class for implementation of function-objects from point to
@@ -110,6 +122,7 @@
template <typename E>
Function<E>::Function()
{
+ typedef mln_result(E) result;
}
template <typename E>
@@ -118,6 +131,11 @@
}
template <typename E>
+ Function_i2v<E>::Function_i2v()
+ {
+ }
+
+ template <typename E>
Function_p2v<E>::Function_p2v()
{
}
Index: mln/core/concept/doc/accumulator.hh
--- mln/core/concept/doc/accumulator.hh (revision 0)
+++ mln/core/concept/doc/accumulator.hh (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file mln/core/concept/doc/accumulator.hh
+ * \brief This file documents the concept of mln::Accumulator.
+ */
+
+namespace mln
+{
+
+ namespace doc
+ {
+
+ /*! \brief Documentation class for mln::Accumulator.
+ * \see mln::Accumulator
+ */
+ template <typename E>
+ struct Accumulator
+ {
+ /// The value type of elements to accumulate.
+ typedef void value;
+
+ /// Initialize the accumulator.
+ void init();
+
+ /// Take into account a value \p v (an element).
+ void take(const value& v);
+ };
+
+ } // end of namespace mln::doc
+
+} // end of namespace mln
Index: mln/core/concept/accumulator.hh
--- mln/core/concept/accumulator.hh (revision 0)
+++ mln/core/concept/accumulator.hh (revision 0)
@@ -0,0 +1,80 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_CONCEPT_ACCUMULATOR_HH
+# define MLN_CORE_CONCEPT_ACCUMULATOR_HH
+
+/*! \file mln/core/concept/accumulator.hh
+ *
+ * \brief Definition of the concept of mln::Accumulator.
+ */
+
+# include <mln/core/concept/object.hh>
+
+
+namespace mln
+{
+
+
+ /*! \brief Base class for implementation of accumulators.
+ *
+ * The parameter \a E is the exact type.
+ *
+ * \see mln::doc::Accumulator for a complete documentation of this
+ * class contents.
+ */
+ template <typename E>
+ struct Accumulator : public Object<E>
+ {
+ /*
+ typedef value;
+ void init();
+ void take(const value& v);
+ */
+ protected:
+ Accumulator();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ Accumulator<E>::Accumulator()
+ {
+ typedef mln_value(E) value;
+ void (E::*m1)() = & E::init;
+ m1 = 0;
+ void (E::*m2)(const value&) = & E::take;
+ m2 = 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_ACCUMULATOR_HH
Index: mln/arith/plus.hh
--- mln/arith/plus.hh (revision 0)
+++ mln/arith/plus.hh (revision 0)
@@ -0,0 +1,82 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_ARITH_PLUS_HH
+# define MLN_ARITH_PLUS_HH
+
+/*! \file mln/arith/plus.hh
+ *
+ * \brief Point-wise addition between images.
+ */
+
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace arith
+ {
+
+ /*! Point-wise addition of images \p lhs and \p rhs.
+ *
+ * \param[in] lhs First operand image.
+ * \param[in] rhs Second operand image.
+ * \param[out] output The result image.
+ *
+ * \pre \p output.domain = \p lhs.domain = \p rhs.domain
+ */
+ template <typename L, typename R, typename O>
+ void plus(const Image<L>& lhs, const Image<R>& rhs,
Image<O>& output);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L, typename R, typename O>
+ void plus(const Image<L>& lhs_, const Image<R>& rhs_,
Image<O>& output_)
+ {
+ const L& lhs = exact(lhs_);
+ const R& rhs = exact(rhs_);
+ O& output = exact(output_);
+
+ mln_precondition(rhs.domain() = lhs.domain());
+ mln_precondition(output.domain() = lhs.domain());
+
+ mln_piter(I) p(output.domain());
+ for_all(p)
+ output(p) = lhs(p) + rhs(p);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::arith
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ARITH_PLUS_HH
Index: mln/level/apply.hh
--- mln/level/apply.hh (revision 0)
+++ mln/level/apply.hh (revision 0)
@@ -0,0 +1,111 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_LEVEL_APPLY_HH
+# define MLN_LEVEL_APPLY_HH
+
+/*! \file mln/level/apply.hh
+ *
+ * \brief Apply some function-objects on an image.
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/accumulator.hh>
+
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ /*! Apply a function-object to the image \p input.
+ *
+ * \param[in] input The input image.
+ * \param[in] f The function-object.
+ * \result A copy of the function-object.
+ *
+ * This routine runs: \n
+ * for all p of \p input, \p f( \p input(p) ) \n
+ * return \p f
+ */
+ template <typename I, typename F>
+ F apply(const Image<I>& input, const Function<F>& f);
+
+
+ /*! Apply an accumulator to the image \p input.
+ *
+ * \param[in] input The input image.
+ * \param[in] a The accumulator.
+ * \result A copy of the accumulator.
+ *
+ * This routine runs: \n
+ * a.init() \n
+ * for all p of \p input, \p a.take( \p input(p) ) \n
+ * return \p a
+ */
+ template <typename I, typename A>
+ A apply(const Image<I>& input, const Accumulator<A>& a);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename F>
+ F apply(const Image<I>& input_, const Function<F>& f_)
+ {
+ const I& input = exact(input_);
+ F f = exact(f_);
+ mln_precondition(input.has_data());
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ f(input(p));
+ return f;
+ }
+
+ template <typename I, typename A>
+ A apply(const Image<I>& input_, const Accumulator<A>& a_)
+ {
+ const I& input = exact(input_);
+ A a = exact(a_);
+ mln_precondition(input.has_data());
+
+ a.init();
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ a.take(input(p));
+ return a;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LEVEL_APPLY_HH
Index: mln/level/transform.hh
--- mln/level/transform.hh (revision 0)
+++ mln/level/transform.hh (revision 0)
@@ -0,0 +1,85 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_LEVEL_TRANSFORM_HH
+# define MLN_LEVEL_TRANSFORM_HH
+
+/*! \file mln/level/transform.hh
+ *
+ * \brief Transform the contents of an image into another one.
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/function.hh>
+
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ /*! Transform the image \p input through a function \p f to set
+ * the \p output image.
+ *
+ * \param[in] input The input image.
+ * \param[in] f The function.
+ * \param[out] output The result image.
+ *
+ * This routine runs: \n
+ * for all p of \p input, \p output(p) = \p f( \p input(p) ).
+ *
+ * \pre \p output.domain >= \p input.domain
+ */
+ template <typename I, typename F, typename O>
+ void transform(const Image<I>& input, const Function_v2v<F>& f,
Image<O>& output);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename F, typename O>
+ void transform(const Image<I>& input_, const Function_v2v<F>& f_,
Image<O>& output_)
+ {
+ const I& input = exact(input_);
+ const F& f = exact(f_);
+ O& output = exact(output_);
+
+ mln_precondition(output.domain() >= input.domain());
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ output(p) = f( input(p) );
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LEVEL_TRANSFORM_HH
Index: mln/accu/histo.hh
--- mln/accu/histo.hh (revision 1014)
+++ mln/accu/histo.hh (working copy)
@@ -37,6 +37,7 @@
# include <algorithm>
# include <mln/core/concept/value_set.hh>
+# include <mln/core/concept/accumulator.hh>
# include <mln/value/set.hh>
@@ -50,7 +51,7 @@
/*! Generic histogram class over a value set with type \c S.
*/
template <typename S>
- struct histo_on_set
+ struct histo_on_set : public Accumulator< histo_on_set<S> >
{
histo_on_set(const Value_Set<S>& s);
@@ -84,6 +85,9 @@
/*! Generic histogram class over the set of values of type \c T.
+ *
+ * \todo Inheritance is badly formed since this concrete class
+ * derives from another concrete class.
*/
template <typename T>
struct histo_on_type : public histo_on_set< value::set_<T> >
Index: mln/accu/median.hh
--- mln/accu/median.hh (revision 1014)
+++ mln/accu/median.hh (working copy)
@@ -33,6 +33,7 @@
* \brief Define FIXME
*/
+# include <mln/core/concept/accumulator.hh>
# include <mln/accu/histo.hh>
@@ -47,7 +48,7 @@
* with type \c S.
*/
template <typename S>
- struct median
+ struct median : public Accumulator< median<S> >
{
typedef mln_value(S) value;
@@ -91,6 +92,11 @@
};
+ /*! Generic median class over the set of values of type \c T.
+ *
+ * \todo Inheritance is badly formed since this concrete class
+ * derives from another concrete class.
+ */
template <typename T>
struct median_on : public median< value::set_<T> >
{
Index: mln/accu/counter.hh
--- mln/accu/counter.hh (revision 0)
+++ mln/accu/counter.hh (revision 0)
@@ -0,0 +1,109 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_ACCU_COUNTER_HH
+# define MLN_ACCU_COUNTER_HH
+
+/*! \file mln/accu/counter.hh
+ *
+ * \brief Define an accumulator that counts.
+ */
+
+# include <mln/core/concept/accumulator.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+
+ /*! Generic counter accumulator class.
+ */
+ template <typename V>
+ struct counter : public Accumulator< counter<V> >
+ {
+ typedef V value;
+
+ counter();
+ void take(const value&);
+ void init();
+
+ operator std::size_t() const;
+ std::size_t to_value() const;
+
+ protected:
+
+ std::size_t count_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename V>
+ counter<V>::counter()
+ {
+ init();
+ }
+
+ template <typename V>
+ void
+ counter<V>::take(const value&)
+ {
+ ++count_;
+ }
+
+ template <typename V>
+ void
+ counter<V>::init()
+ {
+ count_ = 0;
+ }
+
+ template <typename V>
+ counter<V>::operator std::size_t() const
+ {
+ return to_value();
+ }
+
+ template <typename V>
+ std::size_t
+ counter<V>::to_value() const
+ {
+ return count_;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_COUNTER_HH
Index: mln/accu/mean.hh
--- mln/accu/mean.hh (revision 0)
+++ mln/accu/mean.hh (revision 0)
@@ -0,0 +1,116 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_ACCU_MEAN_HH
+# define MLN_ACCU_MEAN_HH
+
+/*! \file mln/accu/mean.hh
+ *
+ * \brief Define an accumulator that computes a mean.
+ */
+
+# include <mln/core/concept/accumulator.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+
+ /*! Generic mean accumulator class.
+ *
+ * Parameter \c V is the type of values that we sum. Parameter \c
+ * S is the type to store the sum of values; the default type of
+ * \c S is \c V. Parameter \c M is the type of the mean value;
+ * the default type of \c M is \c S.
+ */
+ template <typename V, typename S = V, typename M = S>
+ struct mean : public Accumulator< mean<V,S,M> >
+ {
+ typedef V value;
+
+ mean();
+ void take(const value& v);
+ void init();
+
+ operator M() const;
+ M to_value() const;
+
+ protected:
+
+ std::size_t count_;
+ S sum_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename V, typename S, typename M>
+ mean<V,S,M>::mean()
+ {
+ init();
+ }
+
+ template <typename V, typename S, typename M>
+ void mean<V,S,M>::take(const value& v)
+ {
+ ++count_;
+ sum_ += v;
+ }
+
+ template <typename V, typename S, typename M>
+ void
+ mean<V,S,M>::init()
+ {
+ count_ = 0;
+ sum_ = 0;
+ }
+
+ template <typename V, typename S, typename M>
+ mean<V,S,M>::operator M() const
+ {
+ return to_value;
+ }
+
+ template <typename V, typename S, typename M>
+ M
+ mean<V,S,M>::to_value() const
+ {
+ return sum_ / count_;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_MEAN_HH
Index: mln/value/props.hh
--- mln/value/props.hh (revision 1014)
+++ mln/value/props.hh (working copy)
@@ -36,6 +36,9 @@
# include <climits>
# include <cfloat>
+# include <mln/core/macros.hh>
+# include <mln/value/kind.hh>
+
/// Get the minimum value of type \c T.
# define mln_min(T) mln::value::props<T>::min()
@@ -49,6 +52,11 @@
# define mln_card(T) mln::value::props<T>::card()
+/// Get the kind of the value type of image \c I.
+# define mln_kind(I) typename mln::value::props< mln_value(I) >::kind
+
+
+
namespace mln
{
@@ -56,6 +64,7 @@
namespace value
{
+
/*! Class that defines the properties of the value type \c T.
*/
template <typename T>
@@ -80,6 +89,7 @@
static bool min() { return false; }
static bool max() { return true; }
static std::size_t card() { return 2; }
+ typedef binary_kind kind;
};
// integers
@@ -90,6 +100,7 @@
static unsigned char min() { return 0; }
static unsigned char max() { return 255; }
static std::size_t card() { return 256; }
+ typedef data_kind kind;
};
template <>
@@ -98,6 +109,7 @@
static signed char min() { return -128; }
static signed char max() { return 127; }
static std::size_t card() { return 256; }
+ typedef data_kind kind;
};
template <>
@@ -106,6 +118,7 @@
static unsigned short min() { return 0; }
static unsigned short max() { return 65535; }
static std::size_t card() { return 65536; }
+ typedef data_kind kind;
};
template <>
@@ -114,6 +127,7 @@
static signed short min() { return -32768; }
static signed short max() { return 32767; }
static std::size_t card() { return 655356; }
+ typedef data_kind kind;
};
template <>
@@ -122,6 +136,7 @@
static unsigned int min() { return 0; }
static unsigned int max() { return UINT_MAX; }
static std::size_t card() { return std::size_t(UINT_MAX) + 1; }
+ typedef data_kind kind;
};
template <>
@@ -130,6 +145,7 @@
static signed int min() { return INT_MIN; }
static signed int max() { return INT_MAX; }
static std::size_t card() { return std::size_t(UINT_MAX) + 1; }
+ typedef data_kind kind;
};
template <>
@@ -137,6 +153,7 @@
{
static unsigned long int min() { return 0; }
static unsigned long int max() { return ULONG_MAX; }
+ typedef data_kind kind;
};
template <>
@@ -144,6 +161,7 @@
{
static signed long int min() { return LONG_MIN; }
static signed long int max() { return LONG_MAX; }
+ typedef data_kind kind;
};
// floating
@@ -153,6 +171,7 @@
{
static float min() { return FLT_MIN; }
static float max() { return FLT_MAX; }
+ typedef data_kind kind;
};
template <>
@@ -160,6 +179,7 @@
{
static double min() { return DBL_MIN; }
static double max() { return DBL_MAX; }
+ typedef data_kind kind;
};
# endif // ! MLN_INCLUDE_ONLY
Index: mln/value/kind.hh
--- mln/value/kind.hh (revision 0)
+++ mln/value/kind.hh (revision 0)
@@ -0,0 +1,60 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_VALUE_KIND_HH
+# define MLN_VALUE_KIND_HH
+
+/*! \file mln/value/tags.hh
+ *
+ * \brief Define the set of kinds of value.
+ */
+
+
+namespace mln
+{
+
+ namespace value
+ {
+
+ // FIXME: Doc!
+
+ struct kind
+ {
+ };
+
+ struct gray_level_kind : kind {};
+ struct color_kind : kind {};
+ struct label_kind : kind {};
+ struct binary_kind : kind {};
+ struct data_kind : kind {};
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_KIND_HH