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;
55 struct data< hexa<I> >
72 struct image_< hexa<I> > : default_image_morpher< I, mln_value(I),
80 typedef trait::image::category::domain_morpher
category;
82 typedef mln_trait_image_pw_io(I)
pw_io;
83 typedef mln_trait_image_dimension(I)
dimension;
86 typedef mln_trait_image_ext_domain(I)
ext_domain;
87 typedef mln_trait_image_ext_value(I)
ext_value;
88 typedef mln_trait_image_ext_io(I)
ext_io;
120 template <typename I>
122 public internal::image_domain_morpher< I,
box2d_h,
hexa<I> >
160 const box2d_h& domain() const;
163 bool has(const psite&
p) const;
174 template <typename I, typename J>
175 void init_(tag::image_t,
hexa<I>& target, const J& model);
178 # ifndef MLN_INCLUDE_ONLY
183 template <
typename I,
typename J>
185 void init_(tag::image_t,
hexa<I>& target,
const J& model)
199 template <
typename I>
210 template <
typename I>
213 hexa<I>::init_(I& ima)
215 mln_precondition(! this->is_valid());
217 box2d_h b = make::box2d_h(b_in.pmin()[0] * 2, b_in.pmin()[1],
218 b_in.pmax()[0] * 2, (b_in.pmax()[1] + 1) * 2 - 1);
219 this->data_ =
new internal::data< hexa<I> >(ima, b);
223 template <
typename I>
230 template <
typename I>
232 hexa<I>::hexa(I& ima)
237 template <
typename I>
239 typename hexa<I>::rvalue
240 hexa<I>::operator()(
const point2d_h& p)
const
242 mln_precondition(this->is_valid());
243 mln_precondition(this->
has(p));
244 return this->data_->ima_(
point2d(p[0] / 2, p[1] / 2));
247 template <
typename I>
249 typename hexa<I>::lvalue
250 hexa<I>::operator()(
const point2d_h& p)
252 mln_precondition(this->is_valid());
253 mln_precondition(this->
has(p));
254 return this->data_->ima_(
point2d(p[0] / 2, p[1] / 2));
257 template <
typename I>
260 hexa<I>::domain()
const
262 mln_precondition(this->is_valid());
263 return this->data_->b_;
266 template <
typename I>
269 hexa<I>::has(
const psite& p)
const
271 mln_precondition(this->is_valid());
272 return this->data_->ima_.has(
point2d(p[0] / 2, p[1] / 2));
276 # endif // ! MLN_INCLUDE_ONLY
281 #endif // ! MLN_CORE_IMAGE_DMORPH_HEXA_HH