26 #ifndef MLN_CORE_IMAGE_DMORPH_UNPROJECT_IMAGE_HH
27 # define MLN_CORE_IMAGE_DMORPH_UNPROJECT_IMAGE_HH
34 # include <mln/core/internal/image_domain_morpher.hh>
35 # include <mln/core/grids.hh>
36 # include <mln/core/site_set/box.hh>
44 template <
typename I,
typename D,
typename F>
struct unproject_image;
51 template <
typename I,
typename D,
typename F>
52 struct data< unproject_image<I,D,F> >
54 data(I& ima,
const D& dom,
const F& f);
67 template <
typename I,
typename D,
typename F>
68 struct image_< unproject_image<I,D,F> > : default_image_morpher< I,
70 unproject_image<I,D,F> >
72 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 D,
typename F>
98 unproject_image<I,D,F> >
101 typedef void skeleton;
112 void init_(I& ima,
const D& dom,
const F& f);
119 mln_rvalue(I)
operator()(
const mln_psite(D)& p)
const;
122 mln_morpher_lvalue(I)
operator()(
const mln_psite(D)& p);
131 template <
typename I,
typename D,
typename F>
135 template <
typename I,
typename D,
typename F>
158 # ifndef MLN_INCLUDE_ONLY
166 template <
typename I,
typename D,
typename F>
180 template <
typename I,
typename D,
typename F>
186 template <
typename I,
typename D,
typename F>
193 template <
typename I,
typename D,
typename F>
198 mln_precondition(! this->is_valid());
199 this->data_ =
new internal::data< unproject_image<I,D,F> >(ima, dom, f);
202 template <
typename I,
typename D,
typename F>
207 mln_precondition(this->is_valid());
208 return this->data_->dom_;
211 template <
typename I,
typename D,
typename F>
216 mln_precondition(this->has(p));
217 mln_result(F) p_ = this->data_->f_(p);
218 mln_precondition(this->data_->ima_.has(p_));
219 return this->data_->ima_(p_);
222 template <
typename I,
typename D,
typename F>
224 mln_morpher_lvalue(I)
227 mln_precondition(this->has(p));
228 mln_result(F) p_ = this->data_->f_(p);
229 mln_precondition(this->data_->ima_.has(p_));
230 return this->data_->ima_(p_);
236 template <
typename I,
typename D,
typename F>
241 mlc_converts_to(mln_psite(D), mln_argument(F))::check();
242 mlc_converts_to(mln_result(F), mln_psite(I))::check();
244 I& ima = exact(ima_);
245 mln_precondition(ima.is_valid());
251 template <
typename I,
typename D,
typename F>
253 unproject_image<const I, D, F>
254 unproject(
const Image<I>& ima_,
const Site_Set<D>& dom,
const Function_v2v<F>& f)
256 mlc_converts_to(mln_psite(D), mln_argument(F))::check();
257 mlc_converts_to(mln_result(F), mln_psite(I))::check();
259 const I& ima = exact(ima_);
260 mln_precondition(ima.is_valid());
262 unproject_image<const I,D,F> tmp(ima, exact(dom), exact(f));
267 # endif // ! MLN_INCLUDE_ONLY
273 #endif // ! MLN_CORE_IMAGE_DMORPH_UNPROJECT_IMAGE_HH