26 #ifndef MLN_MORPHO_ELEMENTARY_GRADIENT_EXTERNAL_HH
27 # define MLN_MORPHO_ELEMENTARY_GRADIENT_EXTERNAL_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>
49 gradient_external(const Image<I>& input, const Neighborhood<N>& nbh);
52 # ifndef MLN_INCLUDE_ONLY
59 template <
typename V,
typename A>
60 V operator()(
const V& input_p,
const A& a)
const
62 return a.to_result() - input_p;
68 template <
typename I,
typename N>
70 gradient_external_dispatch(trait::image::kind::any,
71 const Image<I>& input, const Neighborhood<N>& nbh)
73 return like_ero_fun(accu::meta::stat::max(), f_grad_ext(), input, nbh);
76 template <
typename I,
typename N>
78 gradient_external_dispatch(trait::image::kind::logic,
79 const Image<I>& input, const Neighborhood<N>& nbh)
89 return like_ero_set(val, input, nbh);
92 template <
typename I,
typename N>
94 gradient_external_dispatch(const Image<I>& input, const Neighborhood<N>& nbh)
96 return gradient_external_dispatch(mln_trait_image_kind(I)(),
105 template <
typename I,
typename N>
107 gradient_external(const Image<I>& input, const Neighborhood<N>& nbh)
109 trace::entering(
"morpho::elementary::gradient_external");
111 mln_precondition(exact(input).is_valid());
112 mln_precondition(exact(nbh).is_valid());
114 mln_concrete(I) output = internal::gradient_external_dispatch(input, nbh);
116 trace::exiting("morpho::elementary::gradient_external");
120 # endif // ! MLN_INCLUDE_ONLY
129 #endif // ! MLN_MORPHO_ELEMENTARY_GRADIENT_EXTERNAL_HH