26 #ifndef MLN_MORPHO_INTERNAL_ELEMENTARY_HH
27 # define MLN_MORPHO_INTERNAL_ELEMENTARY_HH
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/neighborhood.hh>
36 # include <mln/core/concept/accumulator.hh>
37 # include <mln/core/concept/meta_accumulator.hh>
50 template <
typename A,
typename I,
typename N,
typename O>
52 elementary(
const I& input,
const N& nbh, O oper);
55 # ifndef MLN_INCLUDE_ONLY
62 template <
typename I,
typename N,
typename A,
typename O>
64 elementary_(mln::trait::image::speed::any,
65 const I& input,
const N& nbh, A accu, O oper)
67 mln_concrete(I) output;
70 mln_piter(I)
p(input.domain());
71 mln_niter(N) n(nbh,
p);
74 accu.take_as_init(input(
p));
75 for_all(n)
if (input.has(n))
77 output(
p) = oper(accu, input(
p));
85 template <
typename A,
typename I,
typename N,
typename O>
87 elementary_selector_(
const I& input,
const N& nbh, O oper)
89 mln_accu_with(A, mln_value(I)) accu;
90 return elementary_(mln_trait_image_speed(I)(),
100 template <
typename A,
typename I,
typename N,
typename O>
102 elementary(
const I& input,
const N& nbh, O oper)
104 return impl::elementary_selector_<A>(
exact(input),
exact(nbh), oper);
107 # endif // ! MLN_INCLUDE_ONLY
116 #endif // ! MLN_MORPHO_INTERNAL_ELEMENTARY_HH