27 #ifndef MLN_CORE_IMAGE_DMORPH_HEXA_HH
28 # define MLN_CORE_IMAGE_DMORPH_HEXA_HH
36 # include <mln/core/internal/image_domain_morpher.hh>
37 # include <mln/core/alias/point2d_h.hh>
38 # include <mln/core/alias/box2d_h.hh>
39 # include <mln/core/image/dmorph/hexa_piter.hh>
46 template <
typename I>
struct hexa;
53 struct data< hexa<I> >
68 struct image_< hexa<I> > : default_image_morpher< I, mln_value(I),
76 typedef trait::image::category::domain_morpher category;
78 typedef mln_trait_image_pw_io(I) pw_io;
79 typedef mln_trait_image_dimension(I) dimension;
82 typedef mln_trait_image_ext_domain(I) ext_domain;
83 typedef mln_trait_image_ext_value(I) ext_value;
84 typedef mln_trait_image_ext_io(I) ext_io;
116 template <typename I>
118 public internal::image_domain_morpher< I,
box2d_h,
hexa<I> >
154 const box2d_h& domain() const;
157 bool has(const psite& p) const;
160 rvalue operator()(const
point2d_h& p) const;
166 template <typename I, typename J>
167 void init_(tag::image_t,
hexa<I>& target, const J& model);
169 # ifndef MLN_INCLUDE_ONLY
174 template <
typename I,
typename J>
176 void init_(tag::image_t,
hexa<I>& target,
const J& model)
179 init_(tag::image, ima, model);
190 template <
typename I>
201 template <
typename I>
204 hexa<I>::init_(I& ima)
206 mln_precondition(! this->is_valid());
207 box2d b_in = ima.bbox();
208 box2d_h b = make::box2d_h(b_in.pmin()[0] * 2, b_in.pmin()[1],
209 b_in.pmax()[0] * 2, (b_in.pmax()[1] + 1) * 2 - 1);
210 this->data_ =
new internal::data< hexa<I> >(ima, b);
214 template <
typename I>
221 template <
typename I>
228 template <
typename I>
233 mln_precondition(this->is_valid());
234 mln_precondition(this->has(p));
235 return this->data_->ima_(
point2d(p[0] / 2, p[1] / 2));
238 template <
typename I>
243 mln_precondition(this->is_valid());
244 mln_precondition(this->has(p));
245 return this->data_->ima_(
point2d(p[0] / 2, p[1] / 2));
248 template <
typename I>
253 mln_precondition(this->is_valid());
254 return this->data_->b_;
257 template <
typename I>
262 mln_precondition(this->is_valid());
263 return this->data_->ima_.has(
point2d(p[0] / 2, p[1] / 2));
267 # endif // ! MLN_INCLUDE_ONLY
272 #endif // ! MLN_CORE_IMAGE_DMORPH_HEXA_HH