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;
53 template <
typename I,
typename F>
54 struct data< transformed_image<I,F> >
56 data(I& ima,
const F& f);
60 p_transformed< mln_domain(I), F> domain_;
70 template <
typename I,
typename F>
71 struct image_< transformed_image<I,F> > : default_image_morpher< I,
73 transformed_image<I,F> >
75 typedef trait::image::category::domain_morpher category;
77 typedef trait::image::ext_domain::none ext_domain;
78 typedef trait::image::ext_value::irrelevant ext_value;
79 typedef trait::image::ext_io::irrelevant ext_io;
81 typedef trait::image::vw_io::none vw_io;
82 typedef trait::image::vw_set::none vw_set;
83 typedef trait::image::value_alignment::not_aligned value_alignment;
84 typedef trait::image::value_storage::disrupted value_storage;
95 template <
typename I,
typename F>
97 p_transformed< mln_domain(I), F>,
98 transformed_image<I,F> >
110 void init_(I& ima,
const F& f);
118 mln_rvalue(I) operator()(const mln_psite(I)& p) const;
122 mln_morpher_lvalue(I) operator()(const mln_psite(I)& p);
133 template <typename I, typename F>
137 template <typename I, typename F>
144 # ifndef MLN_INCLUDE_ONLY
148 template <
typename I,
typename F,
typename J>
153 init_(tag::image, ima, exact(model));
155 init_(tag::function, f, exact(model));
156 target.init_(ima, f);
159 template <
typename I,
typename F>
162 f = model.
domain().function();
171 template <
typename I,
typename F>
185 template <
typename I,
typename F>
191 template <
typename I,
typename F>
198 template <
typename I,
typename F>
203 mln_precondition(! this->is_valid());
204 this->data_ =
new internal::data< transformed_image<I,F> >(ima, f);
207 template <
typename I,
typename F>
209 const p_transformed< mln_domain(I), F>&
212 return this->data_->domain_;
215 template <
typename I,
typename F>
220 mln_precondition(this->delegatee_() != 0);
221 mln_precondition(exact(
this)->has(p));
222 mln_precondition(this->delegatee_()->has(this->data_->f_(p)));
223 return this->delegatee_()->operator()(this->data_->f_(p));
226 template <
typename I,
typename F>
228 mln_morpher_lvalue(I)
231 mln_precondition(this->delegatee_() != 0);
232 mln_precondition(exact(
this)->has(p));
233 mln_precondition(this->delegatee_()->has(this->data_->f_(p)));
234 return this->delegatee_()->operator()(this->data_->f_(p));
238 template <
typename I,
typename F>
250 template <
typename I,
typename F>
259 template <
typename I,
typename F>
261 transformed_image<I, F>
262 transform_domain(Image<I>& ima,
const Function_v2v<F>& f)
264 transformed_image<I, F> tmp(exact(ima), exact(f));
268 # endif // ! MLN_INCLUDE_ONLY
273 #endif // ! MLN_CORE_IMAGE_DMORPH_TRANSFORMED_IMAGE_HH