27 #ifndef MLN_CORE_IMAGE_DMORPH_TRANSFORMED_IMAGE_HH
28 # define MLN_CORE_IMAGE_DMORPH_TRANSFORMED_IMAGE_HH
37 # include <mln/core/internal/image_domain_morpher.hh>
38 # include <mln/core/site_set/p_transformed.hh>
46 template <
typename I,
typename F>
struct transformed_image;
55 template <
typename I,
typename F>
56 struct data< transformed_image<I,F> >
58 data(I& ima,
const F& f);
62 p_transformed< mln_domain(I), F> domain_;
72 template <
typename I,
typename F>
73 struct image_< transformed_image<I,F> > : default_image_morpher< I,
75 transformed_image<I,F> >
77 typedef trait::image::category::domain_morpher
category;
79 typedef trait::image::ext_domain::none
ext_domain;
80 typedef trait::image::ext_value::irrelevant
ext_value;
81 typedef trait::image::ext_io::irrelevant
ext_io;
83 typedef trait::image::vw_io::none
vw_io;
84 typedef trait::image::vw_set::none
vw_set;
97 template <
typename I,
typename F>
99 p_transformed< mln_domain(I), F>,
100 transformed_image<I,F> >
113 void init_(I& ima,
const F& f);
122 mln_rvalue(I) operator()(const mln_psite(I)&
p) const;
126 mln_morpher_lvalue(I) operator()(const mln_psite(I)&
p);
137 template <typename I, typename F>
141 template <typename I, typename F>
148 # ifndef MLN_INCLUDE_ONLY
152 template <
typename I,
typename F,
typename J>
160 target.
init_(ima, f);
163 template <
typename I,
typename F>
166 f = model.
domain().function();
175 template <
typename I,
typename F>
189 template <
typename I,
typename F>
191 transformed_image<I,F>::transformed_image()
195 template <
typename I,
typename F>
197 transformed_image<I,F>::transformed_image(I& ima,
const F& f)
202 template <
typename I,
typename F>
205 transformed_image<I,F>::init_(I& ima,
const F& f)
207 mln_precondition(! this->is_valid());
208 this->data_ =
new internal::data< transformed_image<I,F> >(ima, f);
211 template <
typename I,
typename F>
213 const p_transformed< mln_domain(I), F>&
214 transformed_image<I,F>::domain()
const
216 return this->data_->domain_;
219 template <
typename I,
typename F>
222 transformed_image<I,F>::operator()(const mln_psite(I)& p)
const
224 mln_precondition(this->delegatee_() != 0);
225 mln_precondition(
exact(
this)->
has(p));
226 mln_precondition(this->delegatee_()->
has(this->data_->f_(p)));
227 return this->delegatee_()->operator()(this->data_->f_(p));
230 template <
typename I,
typename F>
232 mln_morpher_lvalue(I)
233 transformed_image<I,F>::operator()(const mln_psite(I)& p)
235 mln_precondition(this->delegatee_() != 0);
236 mln_precondition(
exact(
this)->
has(p));
237 mln_precondition(this->delegatee_()->
has(this->data_->f_(p)));
238 return this->delegatee_()->operator()(this->data_->f_(p));
242 template <
typename I,
typename F>
244 transformed_image<I,F>::operator transformed_image<const I, F>()
const
246 transformed_image<const I, F> tmp(this->data_->ima_,
254 template <
typename I,
typename F>
256 transformed_image<const I, F>
259 transformed_image<const I, F> tmp(
exact(ima),
exact(f));
263 template <
typename I,
typename F>
265 transformed_image<I, F>
268 transformed_image<I, F> tmp(
exact(ima),
exact(f));
272 # endif // ! MLN_INCLUDE_ONLY
277 #endif // ! MLN_CORE_IMAGE_DMORPH_TRANSFORMED_IMAGE_HH