Commit f7bc7e13 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Fix tests in Milena.

	* tests/geom/rotate.cc: Fix test.

	* mln/labeling/blobs_and_compute.hh: Add comments.

	* mln/labeling/flat_zones.hh: Add missing members to functors.

	* tests/labeling/blobs_and_compute.cc: Fix return type.

	* tests/labeling/flat_zones.cc,
	* tests/labeling/foreground.cc: Fix functor template parameters.

	* tests/labeling/relabel.cc: The number of components is not
	updated anymore.

	* tests/labeling/colorize.cc: Fix reference according to last
	changes in labeling::colorize routine

	* mln/core/point.hh: Add mln:: namespace prefix.
parent 3c2ce9bb
2010-08-10 Guillaume Lazzara <z@lrde.epita.fr>
Fix tests in Milena.
* tests/geom/rotate.cc: Fix test.
* mln/labeling/blobs_and_compute.hh: Add comments.
* mln/labeling/flat_zones.hh: Add missing members to functors.
* tests/labeling/blobs_and_compute.cc: Fix return type.
* tests/labeling/flat_zones.cc,
* tests/labeling/foreground.cc: Fix functor template parameters.
* tests/labeling/relabel.cc: The number of components is not
updated anymore.
* tests/labeling/colorize.cc: Fix reference according to last
changes in labeling::colorize routine.
* mln/core/point.hh: Add mln:: namespace prefix.
2010-08-10 Guillaume Lazzara <z@lrde.epita.fr>
 
* mln/io/dicom/get_header.hh: Add missing headers.
......@@ -317,7 +317,7 @@ namespace mln
enum { dim = G::dim };
for (unsigned i = 0; i < dim; ++i)
to[i] = internal::convert_data<C2>(from[i]);
to[i] = mln::internal::convert_data<C2>(from[i]);
}
......@@ -337,9 +337,9 @@ namespace mln
else
{
for (unsigned i = dim - 2; i < dim; ++i)
to[i] = internal::convert_data<C2>(from[j++]);
to[i] = mln::internal::convert_data<C2>(from[j++]);
for (unsigned i = 2; i < dim; ++i, ++j)
to[i-j] = internal::convert_data<C2>(from[j]);
to[i-j] = mln::internal::convert_data<C2>(from[j]);
}
}
......
......@@ -52,6 +52,9 @@ namespace mln
\param[in,out] nlabels The number of labels found.
\param[in] accu An accumulator to be computed while labeling.
\return The labeled image, computed attributes for each regions
and an array of the accumulators used to compute the
attributes.
*/
template <typename I, typename N, typename L, typename A>
util::couple<mln_ch_value(I,L),
......
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
......@@ -51,7 +51,8 @@ namespace mln
///
template <typename I, typename N, typename L>
mln_ch_value(I, L)
flat_zones(const Image<I>& input, const Neighborhood<N>& nbh, L& nlabels);
flat_zones(const Image<I>& input, const Neighborhood<N>& nbh,
L& nlabels);
......@@ -62,7 +63,7 @@ namespace mln
// Flat zone functor for the labeling canvas.
template <typename I>
template <typename I, typename L>
struct flat_zones_functor
{
const I& input;
......@@ -72,24 +73,37 @@ namespace mln
typedef mln_psite(I) P;
void init() {}
bool handles(const P&) const { return true; }
bool equiv(const P& n, const P& p) const { return input(n) ==
input(p); }
bool handles(const P&) const { return true; }
bool equiv(const P& n, const P& p) const
{ return input(n) == input(p); }
bool labels(const P&) const { return true; }
void do_no_union(const P&, const P&) {}
void init_attr(const P&) {}
void merge_attr(const P&, const P&) {}
void set_new_label(const P& p, const L& l){}
void set_label(const P& p, const L& l) {}
void finalize() {}
// Fastest implementation.
void init_() {}
bool handles_(unsigned) const { return true; }
bool equiv_(unsigned n, unsigned p) const { return input.element(n) ==
input.element(p); }
bool handles_(unsigned) const
{ return true; }
bool equiv_(unsigned n, unsigned p) const
{ return input.element(n) == input.element(p); }
bool labels_(unsigned) const { return true; }
void do_no_union_(unsigned, unsigned) {}
void init_attr_(unsigned) {}
void merge_attr_(unsigned, unsigned) {}
void set_new_label_(unsigned, const L&) {}
void set_label_(unsigned, const L&) {}
void finalize_() {}
// end of requirements.
......@@ -117,7 +131,7 @@ namespace mln
mln_precondition(input.is_valid());
// Call the labeling canvas.
typedef impl::flat_zones_functor<I> F;
typedef impl::flat_zones_functor<I,L> F;
F f(input);
mln_ch_value(I, L)
output = canvas::labeling::video(input, nbh, nlabels, f);
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -33,8 +34,12 @@ int main()
{
using namespace mln;
bool ref_values[][5] = { { 0, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 0 } };
bool ref_values[][5] = { { 0, 1, 0, 0, 0 },
{ 0, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 0 },
{ 0, 0, 0, 1, 1 },
{ 0, 0, 0, 0, 1 } };
bool values[][5] = { { 0, 0, 1, 0, 0 },
{ 0, 0, 1, 0, 0 },
......@@ -45,10 +50,7 @@ int main()
image2d<bool> ima = make::image(values);
image2d<bool> ref(make::box2d(1,0, 2,4), 0);
for (unsigned i = 0; i < 2; ++i)
for (unsigned j = 0; j < 5; ++j)
ref(ref.point_at_index(i + j + 4 * i)) = ref_values[i][j];
image2d<bool> ref = make::image(ref_values);
image2d<bool> ima_rot = geom::rotate(ima, 45);
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -45,12 +46,16 @@ int main()
typedef image2d<value::label_8> L;
typedef util::array<point2d> arr_t;
typedef util::couple<L,arr_t> res_t;
typedef accu::center<point2d,point2d> accu_t;
typedef util::array<accu_t> accu_arr_t;
typedef util::couple<L,util::couple<arr_t, accu_arr_t> > res_t;
res_t result = labeling::blobs_and_compute(pic, c4(), n,
accu::center<point2d,point2d>());
accu_t());
mln_assertion(result.second().size() == 34);
mln_assertion(result.second()[1] == point2d(10,30));
mln_assertion(result.second()[33] == point2d(310,66));
mln_assertion(result.second().first().size() == 34);
mln_assertion(result.second().second().size() == 34);
mln_assertion(result.second().first()[1] == point2d(10,30));
mln_assertion(result.second().second()[33] == point2d(310,66));
mln_assertion(n == 33);
}
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -35,6 +36,7 @@
#include <mln/labeling/colorize.hh>
#include <mln/data/compare.hh>
#include <mln/debug/println.hh>
int main()
{
......@@ -44,7 +46,7 @@ int main()
{ 0, 0 } };
typedef value::rgb8 rgb_t;
value::rgb8 ref_data[][2] = { { rgb_t(171,46,231), rgb_t(171,46,231) },
value::rgb8 ref_data[][2] = { { rgb_t(220,80,117), rgb_t(220,80,117) },
{ rgb_t(0,0,0), rgb_t(0,0,0) } };
image2d<value::int_u8> ima = make::image(values);
......
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
......@@ -65,7 +65,7 @@ int main()
{
typedef image2d<int_u8> I;
labeling::impl::flat_zones_functor<I> f(lena);
labeling::impl::flat_zones_functor<I,unsigned> f(lena);
unsigned nlabels_generic, nlabels_fastest;
mln_assertion(canvas::labeling::impl::generic::labeling(lena,
......
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
......@@ -54,7 +54,7 @@ int main()
// which calls canvas::labeling_video and its generic dispatch
// leads to canvas::impl::generic::labeling.
labeling::impl::value_functor<I> f(pic, true);
labeling::impl::value_functor<I,unsigned> f(pic, true);
unsigned n_;
ref = canvas::labeling::impl::generic::labeling(pic, nbh, n_,
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -26,7 +27,6 @@
#include <mln/core/image/image2d.hh>
#include <mln/labeling/relabel.hh>
#include <mln/value/label_16.hh>
#include <mln/debug/println.hh>
struct not_to_remove : public mln::Function_v2b< not_to_remove >
......@@ -76,11 +76,9 @@ int main()
}
{
label_16 new_nlabels;
labeling::relabel_inplace(lbl,
nlabels,
not_to_remove());
mln_assertion(nlabels == 2u);
mln_piter_(image2d<label_16>) p(lbl.domain());
for_all(p)
mln_assertion(is_valid(lbl(p)));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment