27 #ifndef MLN_CORE_IMAGE_VMORPH_FUN_IMAGE_HH
28 # define MLN_CORE_IMAGE_VMORPH_FUN_IMAGE_HH
35 # include <mln/core/internal/image_value_morpher.hh>
36 # include <mln/trait/images.hh>
37 # include <mln/value/set.hh>
39 # include <mln/value/shell.hh>
41 # include <mln/metal/if.hh>
42 # include <mln/metal/equal.hh>
49 template <
typename F,
typename I>
struct fun_image;
54 template <
typename F,
typename I>
55 struct data< fun_image<F,I> >
57 data(
const F& f,
const I& ima);
69 template <
typename F,
typename I>
70 struct image_< fun_image<F,I> > : default_image_morpher< I, mln_result(F), fun_image<F,I> >
73 typedef trait::image::category::primary category;
74 typedef trait::image::value_io::read_only value_io;
75 typedef trait::image::value_access::computed value_access;
76 typedef trait::image::value_storage::disrupted value_storage;
78 mlc_if(mlc_equal(
typename value_<mln_result(F)>::quant, trait::value::quant::low),
80 trait::image::quant::low,
82 mlc_if(mlc_equal(
typename value_<mln_result(F)>::quant, trait::value::quant::high),
84 trait::image::quant::high,
100 template <typename F, typename I>
102 public internal::image_value_morpher< I, mln_result(F),
fun_image<F,I> >
130 mln_result(F) operator()(const mln_psite(I)& p) const;
133 mln_result(F) operator()(const mln_psite(I)& p);
139 template <typename F, typename I>
145 # ifndef MLN_INCLUDE_ONLY
148 template <
typename F,
typename I>
151 operator << (const Function_v2v<F>& f,
const Image<I>& ima)
163 template <
typename F,
typename I>
175 template <
typename F,
typename I>
182 template <
typename F,
typename I>
189 template <
typename F,
typename I>
197 template <
typename F,
typename I>
202 mln_precondition(exact(ima).is_valid());
203 this->data_ =
new internal::data<fun_image<F,I> >(exact(f), exact(ima));
206 template <
typename F,
typename I>
211 mln_precondition(this->data_->ima_.has(p));
212 return this->data_->f_( this->data_->ima_(p) );
215 template <
typename F,
typename I>
220 mln_precondition(this->data_->ima_.has(p));
221 return this->data_->f_( this->data_->ima_(p) );
233 # endif // ! MLN_INCLUDE_ONLY
238 #endif // ! MLN_CORE_IMAGE_VMORPH_FUN_IMAGE_HH