26 #ifndef MLN_MORPHO_ELEMENTARY_GRADIENT_INTERNAL_HH
27 # define MLN_MORPHO_ELEMENTARY_GRADIENT_INTERNAL_HH
33 # include <mln/morpho/elementary/like_ero_fun.hh>
34 # include <mln/morpho/elementary/like_ero_set.hh>
47 template <
typename I,
typename N>
52 # ifndef MLN_INCLUDE_ONLY
59 template <
typename V,
typename A>
60 V operator()(
const V& input_p,
const A& a)
const
62 return input_p - a.to_result();
68 template <
typename I,
typename N>
70 gradient_internal_dispatch(trait::image::kind::any,
71 const Image<I>& input, const Neighborhood<N>& nbh)
76 template <
typename I,
typename N>
78 gradient_internal_dispatch(trait::image::kind::logic,
79 const Image<I>& input, const Neighborhood<N>& nbh)
92 template <
typename I,
typename N>
94 gradient_internal_dispatch(const Image<I>& input, const Neighborhood<N>& nbh)
96 return gradient_internal_dispatch(mln_trait_image_kind(I)(),
105 template <
typename I,
typename N>
109 mln_trace(
"morpho::elementary::gradient_internal");
111 mln_precondition(
exact(input).is_valid());
112 mln_precondition(
exact(nbh).is_valid());
114 mln_concrete(I) output = internal::gradient_internal_dispatch(input, nbh);
116 mln_postcondition(output <= input);
120 # endif // ! MLN_INCLUDE_ONLY
129 #endif // ! MLN_MORPHO_ELEMENTARY_GRADIENT_INTERNAL_HH