URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-02 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Refactoring of image_if.
* mln/core/image_if.hh: For functions.
* mln/core/image_if_interval.hh: New, for interval.
* mln/core/image_if_value.hh: New, for values.
* mln/core/internal/image_if_base.hh: Abstraction of image_if.
* mln/trait/images.hh: Update.
---
core/image_if.hh | 226 -----------------------------------------
core/image_if_interval.hh | 135 ++++++++++++++++++++++++
core/image_if_value.hh | 123 ++++++++++++++++++++++
core/internal/image_if_base.hh | 213 ++++++++++++++++++++++++++++++++++++++
trait/images.hh | 2
5 files changed, 476 insertions(+), 223 deletions(-)
Index: trunk/milena/mln/trait/images.hh
===================================================================
--- trunk/milena/mln/trait/images.hh (revision 1219)
+++ trunk/milena/mln/trait/images.hh (revision 1220)
@@ -85,7 +85,7 @@
template <typename P, typename T> class sparse_image;
// Morphers.
- template <typename I, typename F> struct image_if;
+ template <typename I, typename F> struct image_if_base;
template <typename I, typename D> class decorated_image;
template <typename I, typename S> class sub_image;
template <typename I> struct t_image;
Index: trunk/milena/mln/core/image_if.hh
===================================================================
--- trunk/milena/mln/core/image_if.hh (revision 1219)
+++ trunk/milena/mln/core/image_if.hh (revision 1220)
@@ -33,73 +33,19 @@
* \brief Definition of a image_if image.
*/
-# include <mln/core/internal/image_domain_morpher.hh>
-# include <mln/core/pset_if.hh>
-# include <mln/pw/all.hh>
-# include <mln/value/interval.hh>
-
+# include <mln/core/internal/image_if_base.hh>
namespace mln
{
- // Fwd decl.
- template <typename I, typename F> struct image_if;
-
-
- namespace internal
- {
- template <typename I, typename F>
- struct data_< image_if<I,F> >
- {
- data_(I& ima, const F& f);
- data_(I& ima, const pset_if<mln_pset(I), F>& pset);
-
- I ima_;
- pset_if<mln_pset(I), F> pset_;
- };
-
- } // end of namespace mln::internal
-
-
-
- namespace trait
- {
-
- template <typename I, typename F>
- struct image_< image_if<I,F> > : default_image_morpher_< I,
mln_value(I),
- image_if<I,F> >
- {
- private:
- typedef mln_trait_image_data(I) I_data_;
- typedef mlc_equal(I_data_, trait::data::linear) I_data_are_linear_;
- public:
-
- typedef trait::category::domain_morpher category;
-
- typedef mlc_if( mlc_is_const(I),
- trait::io::read_only, // I const => read_only
- mln_trait_image_io(I) ) io; // otherwise like I
-
- typedef mlc_if( I_data_are_linear_,
- trait::data::stored, // if linear then just stored
- I_data_ ) data; // otherwise like I
- };
-
- } // end of namespace mln::trait
-
-
-
-
/*! \brief An image class FIXME.
*
*/
template <typename I, typename F>
- struct image_if : public internal::image_domain_morpher_< I,
- pset_if<mln_pset(I),F>,
- image_if<I,F> >
+ struct image_if : public internal::image_if_base< I, F >
{
/// Skeleton.
- typedef image_if< tag::image_<I>, tag::function_<F> > skeleton;
+ typedef image_if< tag::image_<I>, F > skeleton;
/// Constructor from an image \p ima and a predicate \p f.
image_if(I& ima, const F& f);
@@ -107,25 +53,11 @@
/// Constructor without argument.
image_if();
- /// Initialization.
- void init_(I& ima, const F& f);
-
- /// Initialization.
- void init_(I& ima, const pset_if<mln_pset(I), F>& pset);
-
- /// Test if a pixel value is accessible at \p p.
- bool owns_(const mln_psite(I)& p) const;
-
- /// Give the definition domain.
- const pset_if<mln_pset(I), F>& domain() const;
-
/// Const promotion via convertion.
operator image_if<const I, F>() const;
};
-
-
// Operators.
// Image | Function_p2b.
@@ -138,85 +70,9 @@
image_if<const I, F>
operator | (const Image<I>& ima, const Function_p2b<F>& f);
- // Image | value.
-
- template <typename I>
- image_if< I,
- fun::eq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> > >
- operator | (Image<I>& ima, const mln_value(I)& v);
-
- template <typename I>
- image_if< const I,
- fun::eq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> > >
- operator | (const Image<I>& ima, const mln_value(I)& v);
-
- // Image | [from, to].
-
- template <typename I>
- image_if< I,
- fun::and_p2b_expr_< fun::geq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> >,
- fun::leq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> > > >
- operator | (Image<I>& ima, const value::interval_<mln_value(I)>&
vv);
-
- template <typename I>
- image_if< const I,
- fun::and_p2b_expr_< fun::geq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> >,
- fun::leq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> > > >
- operator | (const Image<I>& ima, const
value::interval_<mln_value(I)>& vv);
-
-
# ifndef MLN_INCLUDE_ONLY
- // init_
-
- template <typename I, typename F>
- void init_(tag::function_t, F& f, const image_if<I,F>& model)
- {
- f = model.domain().predicate();
- }
-
- template <typename I, typename F, typename J>
- void init_(tag::image_t, image_if<I,F>& target, const J& model)
- {
- I ima;
- init_(tag::image, ima, model);
- F f;
- init_(tag::function, f, model);
- target.init_(ima, f);
- // Alternative code:
- // pset_if<mln_pset(I), F> pset;
- // init_(tag::domain, pset, model);
- // target.init_(ima, pset);
- }
-
- // internal::data_< image_if<I,S> >
-
- namespace internal
- {
-
- template <typename I, typename F>
- data_< image_if<I,F> >::data_(I& ima, const F& f)
- : ima_(ima),
- pset_(ima.domain() | f)
- {
- }
-
- template <typename I, typename F>
- data_< image_if<I,F> >::data_(I& ima, const pset_if<mln_pset(I),
F>& pset)
- : ima_(ima),
- pset_(pset)
- {
- }
-
- } // end of namespace mln::internal
-
// image_if<I,F>
template <typename I, typename F>
@@ -227,23 +83,7 @@
template <typename I, typename F>
image_if<I,F>::image_if(I& ima, const F& f)
{
- init_(ima, f);
- }
-
- template <typename I, typename F>
- void
- image_if<I,F>::init_(I& ima, const F& f)
- {
- mln_precondition(! this->has_data());
- this->data_ = new internal::data_< image_if<I,F> >(ima, f);
- }
-
- template <typename I, typename F>
- void
- image_if<I,F>::init_(I& ima, const pset_if<mln_pset(I), F>& pset)
- {
- mln_precondition(! this->has_data());
- this->data_ = new internal::data_< image_if<I,F> >(ima, pset);
+ this->init_(ima, f);
}
template <typename I, typename F>
@@ -253,22 +93,6 @@
return tmp;
}
- template <typename I, typename F>
- bool
- image_if<I,F>::owns_(const mln_psite(I)& p) const
- {
- return this->data_->pset_.has(p);
- }
-
- template <typename I, typename F>
- const pset_if<mln_pset(I), F>&
- image_if<I,F>::domain() const
- {
- return this->data_->pset_;
- }
-
-
-
// Operators.
template <typename I, typename F>
@@ -287,48 +111,6 @@
return tmp;
}
- template <typename I>
- image_if< I,
- fun::eq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> > >
- operator | (Image<I>& ima, const mln_value(I)& v)
- {
- return ima | (pw::value(ima) == pw::cst(v));
- }
-
- template <typename I>
- image_if< const I,
- fun::eq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> > >
- operator | (const Image<I>& ima, const mln_value(I)& v)
- {
- return ima | (pw::value(ima) == pw::cst(v));
- }
-
- template <typename I>
- image_if< I,
- fun::and_p2b_expr_< fun::geq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> >,
- fun::leq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> > > >
- operator | (Image<I>& ima, const value::interval_<mln_value(I)>&
vv)
- {
- return ima | ( (pw::value(ima) >= pw::cst(vv.from)) &&
- (pw::value(ima) <= pw::cst(vv.to)) );
- }
-
- template <typename I>
- image_if< const I,
- fun::and_p2b_expr_< fun::geq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> >,
- fun::leq_p2b_expr_< pw::value_<I>,
- pw::cst_<mln_value(I)> > > >
- operator | (const Image<I>& ima, const
value::interval_<mln_value(I)>& vv)
- {
- return ima | ( (pw::value(ima) >= pw::cst(vv.from)) &&
- (pw::value(ima) <= pw::cst(vv.to)) );
- }
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: trunk/milena/mln/core/internal/image_if_base.hh
===================================================================
--- trunk/milena/mln/core/internal/image_if_base.hh (revision 0)
+++ trunk/milena/mln/core/internal/image_if_base.hh (revision 1220)
@@ -0,0 +1,213 @@
+// 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_IMAGE_IF_BASE_HH
+# define MLN_CORE_IMAGE_IF_BASE_HH
+
+/*! \file mln/core/internal/image_if_base.hh
+ *
+ * \brief Definition of a image_if_base image.
+ */
+
+# include <mln/core/internal/image_domain_morpher.hh>
+# include <mln/core/pset_if.hh>
+# include <mln/pw/all.hh>
+# include <mln/value/interval.hh>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+
+ // Fwd decl.
+ template <typename I, typename F> struct image_if_base;
+
+ template <typename I, typename F>
+ struct data_< image_if_base<I,F> >
+ {
+ data_(I& ima, const F& f);
+ data_(I& ima, const pset_if<mln_pset(I), F>& pset);
+
+ I ima_;
+ pset_if<mln_pset(I), F> pset_;
+ };
+ } // end of namespace mln::internal
+
+ namespace trait
+ {
+
+ template <typename I, typename F>
+ struct image_< image_if_base<I,F> > : default_image_morpher_< I,
mln_value(I),
+ image_if_base<I,F> >
+ {
+ private:
+ typedef mln_trait_image_data(I) I_data_;
+ typedef mlc_equal(I_data_, trait::data::linear) I_data_are_linear_;
+ public:
+
+ typedef trait::category::domain_morpher category;
+
+ typedef mlc_if( mlc_is_const(I),
+ trait::io::read_only, // I const => read_only
+ mln_trait_image_io(I) ) io; // otherwise like I
+
+ typedef mlc_if( I_data_are_linear_,
+ trait::data::stored, // if linear then just stored
+ I_data_ ) data; // otherwise like I
+ };
+
+ } // end of namespace mln::trait
+
+ namespace internal
+ {
+
+ /*! \brief An base image class for image_if FIXME.
+ *
+ */
+ template <typename I, typename F>
+ struct image_if_base : public internal::image_domain_morpher_< I,
+ pset_if<mln_pset(I),F>,
+ image_if_base<I,F> >
+ {
+ /// Skeleton.
+ typedef image_if_base< tag::image_<I>, F > skeleton;
+
+ /// Constructor from an image \p ima and a predicate \p f.
+ image_if_base(I& ima, const F& f);
+
+ /// Constructor without argument.
+ image_if_base();
+
+ /// Initialization.
+ void init_(I& ima, const F& f);
+
+ /// Initialization.
+ void init_(I& ima, const pset_if<mln_pset(I), F>& pset);
+
+ /// Test if a pixel value is accessible at \p p.
+ bool owns_(const mln_psite(I)& p) const;
+
+ /// Give the definition domain.
+ const pset_if<mln_pset(I), F>& domain() const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // init_
+
+ template <typename I, typename F>
+ void init_(tag::function_t, F& f, const image_if_base<I,F>& model)
+ {
+ f = model.domain().predicate();
+ }
+
+ template <typename I, typename F, typename J>
+ void init_(tag::image_t, image_if_base<I,F>& target, const J& model)
+ {
+ I ima;
+ init_(tag::image, ima, model);
+ F f;
+ init_(tag::function, f, model);
+ target.init_(ima, f);
+ // Alternative code:
+ // pset_if<mln_pset(I), F> pset;
+ // init_(tag::domain, pset, model);
+ // target.init_(ima, pset);
+ }
+
+ // internal::data_< image_if_base<I,S> >
+
+ template <typename I, typename F>
+ data_< image_if_base<I,F> >::data_(I& ima, const F& f)
+ : ima_(ima),
+ pset_(ima.domain() | f)
+ {
+ }
+
+ template <typename I, typename F>
+ data_< image_if_base<I,F> >::data_(I& ima, const
pset_if<mln_pset(I), F>& pset)
+ : ima_(ima),
+ pset_(pset)
+ {
+ }
+
+ // image_if_base<I,F>
+
+ template <typename I, typename F>
+ image_if_base<I,F>::image_if_base()
+ {
+ }
+
+ template <typename I, typename F>
+ image_if_base<I,F>::image_if_base(I& ima, const F& f)
+ {
+ init_(ima, f);
+ }
+
+ template <typename I, typename F>
+ void
+ image_if_base<I,F>::init_(I& ima, const F& f)
+ {
+ mln_precondition(! this->has_data());
+ this->data_ = new internal::data_< image_if_base<I,F> >(ima, f);
+ }
+
+ template <typename I, typename F>
+ void
+ image_if_base<I,F>::init_(I& ima, const pset_if<mln_pset(I), F>&
pset)
+ {
+ mln_precondition(! this->has_data());
+ this->data_ = new internal::data_< image_if_base<I,F> >(ima, pset);
+ }
+
+ template <typename I, typename F>
+ bool
+ image_if_base<I,F>::owns_(const mln_psite(I)& p) const
+ {
+ return this->data_->pset_.has(p);
+ }
+
+ template <typename I, typename F>
+ const pset_if<mln_pset(I), F>&
+ image_if_base<I,F>::domain() const
+ {
+ return this->data_->pset_;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_IMAGE_IF_BASE_HH
+
Index: trunk/milena/mln/core/image_if_value.hh
===================================================================
--- trunk/milena/mln/core/image_if_value.hh (revision 0)
+++ trunk/milena/mln/core/image_if_value.hh (revision 1220)
@@ -0,0 +1,123 @@
+// 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_IMAGE_IF_VALUE_HH
+# define MLN_CORE_IMAGE_IF_VALUE_HH
+
+/*! \file mln/core/image_if_value.hh
+ *
+ * \brief Definition of a image_if_value image.
+ */
+
+# include <mln/core/internal/image_if_base.hh>
+
+namespace mln
+{
+
+ /*! \brief An image class FIXME.
+ *
+ */
+ template <typename I, typename F>
+ struct image_if_value : public internal::image_if_base< I, F >
+ {
+ /// Skeleton.
+ typedef image_if_value< tag::image_<I>, tag::function_<F> >
skeleton;
+
+ /// Constructor from an image \p ima and a predicate \p f.
+ image_if_value(I& ima, const F& f);
+
+ /// Constructor without argument.
+ image_if_value();
+
+ /// Const promotion via convertion.
+ operator image_if_value<const I, F>() const;
+ };
+
+ // Operators.
+
+ // Image | value.
+
+ template <typename I>
+ image_if_value< I,
+ fun::eq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> > >
+ operator | (Image<I>& ima, const mln_value(I)& v);
+
+ template <typename I>
+ image_if_value< const I,
+ fun::eq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> > >
+ operator | (const Image<I>& ima, const mln_value(I)& v);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // image_if_value<I,F>
+
+ template <typename I, typename F>
+ image_if_value<I,F>::image_if_value()
+ {
+ }
+
+ template <typename I, typename F>
+ image_if_value<I,F>::image_if_value(I& ima, const F& f)
+ {
+ this->init_(ima, f);
+ }
+
+ template <typename I, typename F>
+ image_if_value<I,F>::operator image_if_value<const I, F>() const
+ {
+ image_if_value<const I, F> tmp(this->data_->ima_,
this->data_->pset_);
+ return tmp;
+ }
+
+ // Operators.
+
+ template <typename I>
+ image_if_value< I,
+ fun::eq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> > >
+ operator | (Image<I>& ima, const mln_value(I)& v)
+ {
+ return ima | (pw::value(ima) == pw::cst(v));
+ }
+
+ template <typename I>
+ image_if_value< const I,
+ fun::eq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> > >
+ operator | (const Image<I>& ima, const mln_value(I)& v)
+ {
+ return ima | (pw::value(ima) == pw::cst(v));
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_IMAGE_IF_VALUE_HH
Index: trunk/milena/mln/core/image_if_interval.hh
===================================================================
--- trunk/milena/mln/core/image_if_interval.hh (revision 0)
+++ trunk/milena/mln/core/image_if_interval.hh (revision 1220)
@@ -0,0 +1,135 @@
+// 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_IMAGE_IF_INTERVAL_HH
+# define MLN_CORE_IMAGE_IF_INTERVAL_HH
+
+/*! \file mln/core/image_if_interval.hh
+ *
+ * \brief Definition of a image_if_interval image.
+ */
+
+# include <mln/core/internal/image_if_base.hh>
+
+namespace mln
+{
+
+ /*! \brief An image class FIXME.
+ *
+ */
+ template <typename I, typename F>
+ struct image_if_interval : public internal::image_if_base< I, F >
+ {
+ /// Skeleton.
+ typedef image_if_interval< tag::image_<I>, tag::function_<F> >
skeleton;
+
+ /// Constructor from an image \p ima and a predicate \p f.
+ image_if_interval(I& ima, const F& f);
+
+ /// Constructor without argument.
+ image_if_interval();
+
+ /// Const promotion via convertion.
+ operator image_if_interval<const I, F>() const;
+ };
+
+ // Operators.
+
+ // Image | [from, to].
+
+ template <typename I>
+ image_if_interval< I,
+ fun::and_p2b_expr_< fun::geq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> >,
+ fun::leq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> > > >
+ operator | (Image<I>& ima, const value::interval_<mln_value(I)>&
vv);
+
+ template <typename I>
+ image_if_interval< const I,
+ fun::and_p2b_expr_< fun::geq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> >,
+ fun::leq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> > > >
+ operator | (const Image<I>& ima, const
value::interval_<mln_value(I)>& vv);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // image_if_interval<I,F>
+
+ template <typename I, typename F>
+ image_if_interval<I,F>::image_if_interval()
+ {
+ }
+
+ template <typename I, typename F>
+ image_if_interval<I,F>::image_if_interval(I& ima, const F& f)
+ {
+ this->init_(ima, f);
+ }
+
+ template <typename I, typename F>
+ image_if_interval<I,F>::operator image_if_interval<const I, F>() const
+ {
+ image_if_interval<const I, F> tmp(this->data_->ima_,
this->data_->pset_);
+ return tmp;
+ }
+
+ // Operators.
+
+ template <typename I>
+ image_if_interval< I,
+ fun::and_p2b_expr_< fun::geq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> >,
+ fun::leq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> > > >
+ operator | (Image<I>& ima, const value::interval_<mln_value(I)>&
vv)
+ {
+ return ima | ( (pw::value(ima) >= pw::cst(vv.from)) &&
+ (pw::value(ima) <= pw::cst(vv.to)) );
+ }
+
+ template <typename I>
+ image_if_interval< const I,
+ fun::and_p2b_expr_< fun::geq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> >,
+ fun::leq_p2b_expr_< pw::value_<I>,
+ pw::cst_<mln_value(I)> > > >
+ operator | (const Image<I>& ima, const
value::interval_<mln_value(I)>& vv)
+ {
+ return ima | ( (pw::value(ima) >= pw::cst(vv.from)) &&
+ (pw::value(ima) <= pw::cst(vv.to)) );
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_IMAGE_IF_INTERVAL_HH