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/metal/if.hh>
40 # include <mln/metal/equal.hh>
47 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;
79 typedef mlc_equal(mln_trait_value_quant(mln_result(F)),
80 trait::value::quant::high) is_high_quant_;
82 typedef mln_trait_value_kind(mln_result(F))
kind;
83 typedef mln_trait_value_nature(mln_result(F))
nature;
84 typedef mlc_if(is_high_quant_,
85 trait::image::
quant::high,
98 template <typename F, typename I>
100 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>
177 fun_image<F,I>::fun_image()
182 template <
typename F,
typename I>
184 fun_image<F,I>::fun_image(
const Function_v2v<F>& f,
const Image<I>& ima)
189 template <
typename F,
typename I>
191 fun_image<F,I>::fun_image(
const Image<I>& ima)
197 template <
typename F,
typename I>
200 fun_image<F,I>::init_(
const Function_v2v<F>& f,
const Image<I>& ima)
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>
209 fun_image<F,I>::operator()(const mln_psite(I)& p)
const
211 mln_precondition(this->data_->ima_.has(p));
212 return this->data_->f_( this->data_->ima_(p) );
215 template <
typename F,
typename I>
218 fun_image<F,I>::operator()(const mln_psite(I)& p)
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