URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2008-01-18 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Modify lemmings utilisation.
* mln/util/lemmings.hh: The lemmings use the image domain
and don't ask another domain definition.
* tests/util/lemmings.cc: Update tests.
---
mln/util/lemmings.hh | 27 ++++++++++-----------------
tests/util/lemmings.cc | 10 +++++-----
2 files changed, 15 insertions(+), 22 deletions(-)
Index: trunk/milena/tests/util/lemmings.cc
===================================================================
--- trunk/milena/tests/util/lemmings.cc (revision 1672)
+++ trunk/milena/tests/util/lemmings.cc (revision 1673)
@@ -60,11 +60,11 @@
mln_value_(I) vl4 = ima(pt4);
mln_value_(I) vl5 = ima(pt5);
- mln_point_(I) ptl1 = util::lemmings(ima, ima.domain(), pt1, right, vl1);
- mln_point_(I) ptl2 = util::lemmings(ima, ima.domain(), pt2, down, vl2);
- mln_point_(I) ptl3 = util::lemmings(ima, ima.domain(), pt3, left, vl3);
- mln_point_(I) ptl4 = util::lemmings(ima, ima.domain(), pt4, up, vl4);
- mln_point_(I) ptl5 = util::lemmings(ima, ima.domain(), pt5, up, vl5);
+ mln_point_(I) ptl1 = util::lemmings(ima, pt1, right, vl1);
+ mln_point_(I) ptl2 = util::lemmings(ima, pt2, down, vl2);
+ mln_point_(I) ptl3 = util::lemmings(ima, pt3, left, vl3);
+ mln_point_(I) ptl4 = util::lemmings(ima, pt4, up, vl4);
+ mln_point_(I) ptl5 = util::lemmings(ima, pt5, up, vl5);
mln_assertion(ptl1 == point2d(1, 2));
mln_assertion(ptl2 == point2d(2, 2));
Index: trunk/milena/mln/util/lemmings.hh
===================================================================
--- trunk/milena/mln/util/lemmings.hh (revision 1672)
+++ trunk/milena/mln/util/lemmings.hh (revision 1673)
@@ -49,14 +49,12 @@
template <typename I>
struct lemmings_ : public Object< lemmings_<I> >
{
- lemmings_(const Image<I>& ima, const mln_pset(I)& domain,
- const mln_point(I)& pt, const mln_dpoint(I)& dpt,
- const mln_value(I)& val);
+ lemmings_(const Image<I>& ima, const mln_point(I)& pt,
+ const mln_dpoint(I)& dpt, const mln_value(I)& val);
mln_point(I) operator()();
const I& ima_;
- const mln_pset(I)& domain_;
mln_point(I) pt_;
const mln_dpoint(I)& dpt_;
const mln_value(I)& val_;
@@ -77,9 +75,8 @@
*/
template <typename I>
mln_point(I)
- lemmings(const Image<I>& ima, const mln_pset(I)& domain,
- const mln_point(I)& pt, const mln_dpoint(I)& dpt,
- const mln_value(I)& val);
+ lemmings(const Image<I>& ima, const mln_point(I)& pt,
+ const mln_dpoint(I)& dpt, const mln_value(I)& val);
# ifndef MLN_INCLUDE_ONLY
@@ -87,34 +84,30 @@
template <typename I>
inline
- lemmings_<I>::lemmings_(const Image<I>& ima, const mln_pset(I)&
domain,
- const mln_point(I)& pt, const mln_dpoint(I)& dpt,
- const mln_value(I)& val)
+ lemmings_<I>::lemmings_(const Image<I>& ima, const mln_point(I)&
pt,
+ const mln_dpoint(I)& dpt, const mln_value(I)& val)
: ima_(exact(ima)),
- domain_(domain),
pt_(pt),
dpt_(dpt),
val_(val)
{
- mln_precondition(set::is_subset_of(domain, ima_.domain()));
}
template <typename I>
mln_point(I)
lemmings_<I>::operator()()
{
- while (domain_.has(pt_) && ima_(pt_) == val_)
+ while (ima_.domain().has(pt_) && ima_(pt_) == val_)
pt_ += dpt_;
return pt_;
}
template <typename I>
mln_point(I)
- lemmings(const Image<I>& ima, const mln_pset(I)& domain,
- const mln_point(I)& pt, const mln_dpoint(I)& dpt,
- const mln_value(I)& val)
+ lemmings(const Image<I>& ima, const mln_point(I)& pt,
+ const mln_dpoint(I)& dpt, const mln_value(I)& val)
{
- lemmings_<I> lm(ima, domain, pt, dpt, val);
+ lemmings_<I> lm(ima, pt, dpt, val);
return lm();
}