* mln/accu/stat/variance.hh,
* mln/io/plot/save.hh: fix missing includes.
* mln/level/abs.hh: fix invalid assignment.
* mln/make/rag_and_labeled_wsl.hh: add more doc.
* mln/util/tree_to_image.hh: fix a typo.
* tests/labeling/n_max.cc: use a smaller image.
* tests/make/rag_and_labeled_wsl.cc: Fix an invalid test and make the
test more readable.
---
milena/ChangeLog | 18 ++++++++++++++++++
milena/mln/accu/stat/variance.hh | 1 +
milena/mln/io/plot/save.hh | 2 ++
milena/mln/level/abs.hh | 2 +-
milena/mln/make/rag_and_labeled_wsl.hh | 24 ++++++++++++++++++++++++
milena/mln/util/tree_to_image.hh | 4 ++--
milena/tests/labeling/n_max.cc | 19 +++++++++----------
milena/tests/make/rag_and_labeled_wsl.cc | 19 +++++++++++--------
8 files changed, 68 insertions(+), 21 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 0e13e64..20968b2 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,23 @@
2009-04-14 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Fix tests.
+
+ * mln/accu/stat/variance.hh,
+ * mln/io/plot/save.hh: fix missing includes.
+
+ * mln/level/abs.hh: fix invalid assignment.
+
+ * mln/make/rag_and_labeled_wsl.hh: add more doc.
+
+ * mln/util/tree_to_image.hh: fix a typo.
+
+ * tests/labeling/n_max.cc: use a smaller image.
+
+ * tests/make/rag_and_labeled_wsl.cc: Fix an invalid test and make the
+ test more readable.
+
+2009-04-14 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Add new tests.
* tests/make/Makefile.am,
diff --git a/milena/mln/accu/stat/variance.hh b/milena/mln/accu/stat/variance.hh
index 5c2ca3a..0b4dc0b 100644
--- a/milena/mln/accu/stat/variance.hh
+++ b/milena/mln/accu/stat/variance.hh
@@ -34,6 +34,7 @@
# include <cmath>
# include <mln/accu/internal/base.hh>
+# include <mln/util/pix.hh>
namespace mln
diff --git a/milena/mln/io/plot/save.hh b/milena/mln/io/plot/save.hh
index ecec666..a86e3f7 100644
--- a/milena/mln/io/plot/save.hh
+++ b/milena/mln/io/plot/save.hh
@@ -33,6 +33,8 @@
///
/// Define a routine which saves in a plot format.
+# include <iostream>
+# include <fstream>
# include <mln/core/image/image1d.hh>
# include <mln/metal/equal.hh>
# include <mln/util/array.hh>
diff --git a/milena/mln/level/abs.hh b/milena/mln/level/abs.hh
index d2b48b4..8889d1a 100644
--- a/milena/mln/level/abs.hh
+++ b/milena/mln/level/abs.hh
@@ -72,7 +72,7 @@ namespace mln
trace::entering("level::abs");
mln_precondition(exact(input).domain() == exact(output).domain());
- output = level::transform(input, fun::v2v::abs<mln_value(I)>());
+ exact(output) = level::transform(input, fun::v2v::abs<mln_value(I)>());
trace::exiting("level::abs");
}
diff --git a/milena/mln/make/rag_and_labeled_wsl.hh
b/milena/mln/make/rag_and_labeled_wsl.hh
index d80b954..7ace36f 100644
--- a/milena/mln/make/rag_and_labeled_wsl.hh
+++ b/milena/mln/make/rag_and_labeled_wsl.hh
@@ -63,6 +63,30 @@ namespace mln
///
/// \return A couple. First element is the graph, second element is an
/// image with a labeled watershed line.
+ /*!
+ **
+ ** |-----------------| |-----------------| \n
+ ** | 1 1 1 0 2 2 0 3 | | . . . 1 . . 2 . | \n
+ ** | 1 1 0 2 2 2 0 3 | | . . 1 . . . 2 . | \n
+ ** | 1 0 4 0 2 0 3 3 | ----> | . 1 . 3 . 4 . . | \n
+ ** | 0 4 4 4 0 5 0 3 | | 1 . . . 5 . 6 . | \n
+ ** |-----------------| |-----------------| \n
+ ** \n
+ ** Watershed image Labeled watershed line \n
+ ** (watershed line labeled with 0) \n
+ ** \n
+ ** \n
+ ** | \n
+ ** | \n
+ ** | \n
+ ** v \n
+ ** \n
+ ** 1 -- 2 - 3 \n
+ ** \ / / \n
+ ** 4 -- 5 \n
+ ** \n
+ ** Region Adjacency graph (RAG) \n
+ */
template <typename I, typename N>
util::couple<util::graph,mln_concrete(I)>
rag_and_labeled_wsl(const Image<I>& wshd_,
diff --git a/milena/mln/util/tree_to_image.hh b/milena/mln/util/tree_to_image.hh
index f2364de..55f89e8 100644
--- a/milena/mln/util/tree_to_image.hh
+++ b/milena/mln/util/tree_to_image.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of the Olena Library. This library is free
@@ -56,7 +56,7 @@ namespace mln
/// Convert a tree into an image.
///
/// \param[in] tree The tree to convert.
- /// \param[out] output_ The image containing tree informations.
+ /// \param[out] output_ The image containing tree information.
///
template <typename T, typename I>
void
diff --git a/milena/tests/labeling/n_max.cc b/milena/tests/labeling/n_max.cc
index 10b0ff9..6900f40 100644
--- a/milena/tests/labeling/n_max.cc
+++ b/milena/tests/labeling/n_max.cc
@@ -32,7 +32,7 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/alias/neighb2d.hh>
#include <mln/value/int_u8.hh>
-#include <mln/value/label_16.hh>
+#include <mln/value/label_8.hh>
#include <mln/labeling/flat_zones.hh>
#include <mln/labeling/compute.hh>
@@ -47,24 +47,23 @@
#include "tests/data.hh"
-
int main()
{
using namespace mln;
using value::int_u8;
- using value::label_16;
+ using value::label_8;
- image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR
"/lena.pgm");
+ image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR
"/tiny.pgm");
image2d<bool> threshold = level::transform(lena,
fun::v2b::threshold<int_u8>(100));
- label_16 nlabels;
- image2d<label_16> labels = labeling::flat_zones(threshold, c4(), nlabels);
+ label_8 nlabels;
+ image2d<label_8> labels = labeling::flat_zones(threshold, c4(), nlabels);
accu::count<int_u8> a_;
util::array<unsigned> a = labeling::compute(a_, threshold, labels, nlabels);
- util::array<label_16> arr_big = labeling::n_max<label_16>(a, 3);
+ util::array<label_8> arr_big = labeling::n_max<label_8>(a, 3);
- mln_assertion(arr_big[1] == 4);
- mln_assertion(arr_big[2] == 6);
- mln_assertion(arr_big[3] == 323);
+ mln_assertion(arr_big[1] == 1u);
+ mln_assertion(arr_big[2] == 4u);
+ mln_assertion(arr_big[3] == 5u);
}
diff --git a/milena/tests/make/rag_and_labeled_wsl.cc
b/milena/tests/make/rag_and_labeled_wsl.cc
index 5abb031..602bca6 100644
--- a/milena/tests/make/rag_and_labeled_wsl.cc
+++ b/milena/tests/make/rag_and_labeled_wsl.cc
@@ -55,11 +55,14 @@ int main()
util::couple<util::graph, wst_t>
res = make::rag_and_labeled_wsl(ima, c4(), 4u);
+ wst_t& lwsl = res.second();
+ util::graph& g = res.first();
+
// check that adjacency labels map edge labels.
- mln_piter_(wst_t) p(res.second().domain());
+ mln_piter_(wst_t) p(lwsl.domain());
mln_niter_(neighb2d) n(c4(),p);
for_all(p)
- if (res.second()(p) != mln_max(value::label_8))
+ if (lwsl(p) != mln_max(value::label_8).prev())
{
value::label_8 l1 = 0, l2 = 0;
for_all(n)
@@ -77,14 +80,14 @@ int main()
}
if (l2 < l1)
std::swap(l1, l2);
- mln_assertion(res.first().v1(res.second()(p)) == l1);
- mln_assertion(res.first().v2(res.second()(p)) == l2);
+ mln_assertion(g.v1(lwsl(p)) == l1);
+ mln_assertion(g.v2(lwsl(p)) == l2);
}
- mln_assertion(res.first().e_nmax() == 4u);
- mln_assertion(res.first().v_nmax() == 5u);
- mln_assertion(res.first().v_nmax_nbh_edges(0) == 0);
+ mln_assertion(g.e_nmax() == 4u);
+ mln_assertion(g.v_nmax() == 5u);
+ mln_assertion(g.v_nmax_nbh_edges(0) == 0);
for (unsigned i = 1; i < 4; ++i)
- mln_assertion(res.first().v_nmax_nbh_edges(i) == 2);
+ mln_assertion(g.v_nmax_nbh_edges(i) == 2);
}
--
1.5.6.5