olena-2.0-151-g5ee0431 mln/world/kn/fill_0_from_1_faces.hh: Add an overload with functions.

--- milena/ChangeLog | 5 +++++ milena/mln/world/kn/fill_0_from_1_faces.hh | 25 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 9393cd2..9c34521 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,10 @@ 2012-10-29 Guillaume Lazzara <z@lrde.epita.fr> + * mln/world/kn/fill_0_from_1_faces.hh: Add an overload with + functions. + +2012-10-29 Guillaume Lazzara <z@lrde.epita.fr> + Cleanup code. * mln/world/k1/fill_0_from_1_faces.hh, diff --git a/milena/mln/world/kn/fill_0_from_1_faces.hh b/milena/mln/world/kn/fill_0_from_1_faces.hh index 3d1548d..adcea78 100644 --- a/milena/mln/world/kn/fill_0_from_1_faces.hh +++ b/milena/mln/world/kn/fill_0_from_1_faces.hh @@ -33,7 +33,6 @@ # include <mln/core/alias/point2d.hh> # include <mln/world/kn/is_0_face.hh> - namespace mln { @@ -69,6 +68,10 @@ namespace mln void fill_0_from_1_faces(Image<I>& inout, const Accumulator<A>& accu); + template <typename I, typename F> + void fill_0_from_1_faces(Image<I>& inout, + const Function_vvvv2v<F>& f); + # ifndef MLN_INCLUDE_ONLY @@ -108,6 +111,26 @@ namespace mln } + template <typename I, typename F> + void fill_0_from_1_faces(Image<I>& inout_, + const Function_vvvv2v<F>& f_) + { + trace::entering("mln::world::kn::fill_0_from_1_faces"); + + mln_precondition(exact(inout_).is_valid()); + I& inout = exact(inout_); + const F& f = exact(f_); + + mln_piter(I) p(inout.domain()); + for_all(p) + if (is_0_face(p)) + inout(p) = f(inout(p + left), inout(p + right), + inout(p + up), inout(p + down)); + + trace::exiting("mln::world::kn::fill_0_from_1_faces"); + } + + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::world::kn -- 1.7.2.5
participants (1)
-
Guillaume Lazzara