* mln/world/k1/fill_0_from_1_faces.hh,
* mln/world/k1/fill_1_from_2_faces.hh: New overloads.
---
milena/ChangeLog | 7 +++++
milena/mln/world/k1/fill_0_from_1_faces.hh | 34 ++++++++++++++++++++++++-
milena/mln/world/k1/fill_1_from_2_faces.hh | 38 +++++++++++++++++++++++++++-
3 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d7d8e1e..0095a12 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2012-10-26 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add new overloads of fill routines in k1.
+
+ * mln/world/k1/fill_0_from_1_faces.hh,
+ * mln/world/k1/fill_1_from_2_faces.hh: New overloads.
+
+2012-10-26 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Do not read outside images in fill functions with accumulators.
* mln/world/k2/fill_non_primary_from_primary_2_faces.hh,
diff --git a/milena/mln/world/k1/fill_0_from_1_faces.hh
b/milena/mln/world/k1/fill_0_from_1_faces.hh
index c0f6eb7..0568220 100644
--- a/milena/mln/world/k1/fill_0_from_1_faces.hh
+++ b/milena/mln/world/k1/fill_0_from_1_faces.hh
@@ -70,11 +70,15 @@ namespace mln
template <typename I, typename F>
void fill_0_from_1_faces(Image<I>& inout, const
Function_vvvv2v<F>& f);
+ /// \overload
+ template <typename I, typename A>
+ void fill_0_from_1_faces(Image<I>& inout, const Accumulator<A>&
accu);
+
# ifndef MLN_INCLUDE_ONLY
- // Facade
+ // Facades
template <typename I, typename F>
@@ -95,6 +99,34 @@ namespace mln
trace::exiting("mln::world::k1::fill_0_from_1_faces");
}
+ template <typename I, typename A>
+ void fill_0_from_1_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::k1::fill_0_from_1_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+
+ A accu(exact(accu_));
+
+ mln_box(I) b = inout.domain();
+ mln_piter(I) p(b);
+ for_all(p)
+ if (kn::is_0_face(p))
+ {
+ if (inout.domain().has(p + up))
+ accu.take(inout(p + up));
+ if (inout.domain().has(p + left))
+ accu.take(inout(p + left));
+ if (inout.domain().has(p + right))
+ accu.take(inout(p + right));
+ if (inout.domain().has(p + down))
+ accu.take(inout(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::k1::fill_0_from_1_faces");
+ }
# endif // ! MLN_INCLUDE_ONLY
diff --git a/milena/mln/world/k1/fill_1_from_2_faces.hh
b/milena/mln/world/k1/fill_1_from_2_faces.hh
index 74e6b25..b8bf9cd 100644
--- a/milena/mln/world/k1/fill_1_from_2_faces.hh
+++ b/milena/mln/world/k1/fill_1_from_2_faces.hh
@@ -69,11 +69,15 @@ namespace mln
template <typename I, typename F>
void fill_1_from_2_faces(Image<I>& inout, const
Function_vv2v<F>& f);
+ /// \overload
+ template <typename I, typename A>
+ void fill_1_from_2_faces(Image<I>& inout, const Accumulator<A>&
accu);
+
# ifndef MLN_INCLUDE_ONLY
- // Facade
+ // Facades
template <typename I, typename F>
@@ -95,6 +99,38 @@ namespace mln
trace::exiting("mln::world::k1::fill_1_from_2_faces");
}
+ template <typename I, typename A>
+ void fill_1_from_2_faces(Image<I>& inout_, const
Accumulator<A>& accu_)
+ {
+ trace::entering("mln::world::k1::fill_1_from_2_faces");
+
+ mln_precondition(exact(inout_).is_valid());
+ I& inout = exact(inout_);
+ A accu(accu_);
+
+ mln_box(I) b = inout.domain();
+ mln_piter(I) p(b);
+ for_all(p)
+ if (kn::is_1_face_vertical(p))
+ {
+ if (inout.domain().has(p + left))
+ accu.take(inout(p + left));
+ if (inout.domain().has(p + right))
+ accu.take(inout(p + right));
+ inout(p) = accu.to_result();
+ }
+ else if (kn::is_1_face_horizontal(p))
+ {
+ if (inout.domain().has(p + up))
+ accu.take(inout(p + up));
+ if (inout.domain().has(p + down))
+ accu.take(inout(p + down));
+ inout(p) = accu.to_result();
+ }
+
+ trace::exiting("mln::world::k1::fill_1_from_2_faces");
+ }
+
# endif // ! MLN_INCLUDE_ONLY
--
1.7.2.5
Show replies by date