27 #ifndef MLN_CORE_IMAGE_IMORPH_INTERPOLATED_HH
28 # define MLN_CORE_IMAGE_IMORPH_INTERPOLATED_HH
40 # include <mln/core/internal/image_identity.hh>
41 # include <mln/algebra/vec.hh>
42 # include <mln/value/set.hh>
48 template <
typename I,
template <
class>
class F>
struct interpolated;
56 template <
typename I,
template <
class>
class F>
57 struct data< interpolated<I,F> >
70 template <
typename I,
template <
class>
class F>
71 struct image_< interpolated<I,F> >
75 typedef trait::image::value_io::read_only
value_io;
85 template <
typename I,
template <
class>
class F>
91 interpolated<I,F> > super_;
94 typedef mln_psite(I)
psite;
97 typedef mln_value(I)
value;
100 typedef mln_lvalue(I) lvalue;
103 typedef mln_rvalue(I) rvalue;
106 typedef interpolated< tag::image_<I>, F > skeleton;
111 interpolated(I& ima);
121 bool is_valid() const;
127 template <typename C>
128 bool has(const mln::algebra::vec<I::psite::dim, C>& v) const;
132 using super_::operator();
134 mln_value(I) operator()(const mln::algebra::vec<psite::dim,
float>& v) const;
135 mln_value(I) operator()(const mln::algebra::vec<psite::dim,
float>& v);
153 template <template <class> class F, typename I>
154 interpolated<I, F> interpolate(Image<I>& ima);
158 # ifndef MLN_INCLUDE_ONLY
165 template <
typename I,
template <
class>
class F>
174 template <
typename I,
template <
class>
class F>
176 interpolated<I,F>::interpolated(I& ima)
179 mln_precondition(ima.is_valid());
183 template <
typename I,
template <
class>
class F>
185 interpolated<I,F>::interpolated()
189 template <
typename I,
template <
class>
class F>
194 mln_precondition(ima.is_valid());
195 this->data_ =
new internal::data< interpolated<I,F> >(ima);
198 template <
typename I,
template <
class>
class F>
200 bool interpolated<I,F>::is_valid()
const
202 mln_invariant(this->data_->ima_.is_valid());
206 template <
typename I,
template <
class>
class F>
207 template <
typename C>
212 for (
unsigned i = 0; i < I::psite::dim; ++i)
213 p[i] = static_cast<
int>(
round(v[i]));
214 return this->data_->ima_.has(p);
218 template <typename I, template <class> class F>
221 interpolated<I,F>::operator()(const mln::algebra::vec<psite::dim,
float>& v)
const
226 template <
typename I,
template <
class>
class F>
229 interpolated<I,F>::operator()(const mln::algebra::vec<psite::dim,
float>& v)
237 template <
template <
class>
class F,
typename I>
238 interpolated<I, F> interpolate(Image<I>& ima)
240 interpolated<I, F> tmp(
exact(ima));
244 # endif // ! MLN_INCLUDE_ONLY
249 #endif // ! MLN_CORE_IMAGE_IMORPH_INTERPOLATED_HH