Commit 9198885e authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Fix tests.

	* generate_dist_headers.sh: add only .hh and .hxx to headers.mk.

	* headers.mk: update.

	* mln/canvas/morpho/algebraic_filter.hh: fix wrong merge.

	* mln/debug/println_with_border.spe.hh: check the right guards.

	* mln/fun/v2v/rgb_to_hsl.hh: do not include rgb aliases.

	* mln/labeling/fill_holes.hh: use unsigned instead of int. Avoid
	warnings.

	* tests/labeling/compute.cc,
	* mln/morpho/attribute/card.hh
	* mln/morpho/attribute/sum.hh
	* mln/morpho/attribute/volume.hh
	* mln/labeling/mean_values.hh: add missing includes.

	* mln/math/abs.hh: include only int_u.hh.

	* tests/registration/multiscale.cc,
	* mln/registration/multiscale.hh: remove.

	* tests/registration/Makefile.am: remove multiscale.cc from test list.

	* mln/value/rgb.hh: fix a recursive inclusion.

	* tests/morpho/watershed/flooding.cc: fix path to test image.

	* tests/registration/registration.cc: fix according update made in
	registration.hh.

	* tests/unit_test/unit-tests.mk: update list.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3399 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent eac6c74b
2009-02-20 Guillaume Lazzara <z@lrde.epita.fr>
Fix tests.
* generate_dist_headers.sh: add only .hh and .hxx to headers.mk.
* headers.mk: update.
* mln/canvas/morpho/algebraic_filter.hh: fix wrong merge.
* mln/debug/println_with_border.spe.hh: check the right guards.
* mln/fun/v2v/rgb_to_hsl.hh: do not include rgb aliases.
* mln/labeling/fill_holes.hh: use unsigned instead of int. Avoid
warnings.
* tests/labeling/compute.cc,
* mln/morpho/attribute/card.hh
* mln/morpho/attribute/sum.hh
* mln/morpho/attribute/volume.hh
* mln/labeling/mean_values.hh: add missing includes.
* mln/math/abs.hh: include only int_u.hh.
* tests/registration/multiscale.cc,
* mln/registration/multiscale.hh: remove.
* tests/registration/Makefile.am: remove multiscale.cc from test list.
* mln/value/rgb.hh: fix a recursive inclusion.
* tests/morpho/watershed/flooding.cc: fix path to test image.
* tests/registration/registration.cc: fix according update made in
registration.hh.
* tests/unit_test/unit-tests.mk: update list.
2009-02-20 Guillaume Lazzara <z@lrde.epita.fr>
 
Fix doc generation.
......@@ -10,7 +10,8 @@ echo "nobase_include_HEADERS = \\" >> headers.mk
echo "mln/version.hh \\" >> headers.mk
echo "generating headers.mk"
find mln -type f | grep -v "\.svn" | sed -e 's/$/ \\/g' | grep -v "version.hh.in" >> headers.mk
find mln -type f -name '*.hh'| grep -v "\.svn" | sed -e 's/$/ \\/g' >> headers.mk
find mln -type f -name '*.hxx'| grep -v "\.svn" | sed -e 's/$/ \\/g' >> headers.mk
last_line=`tail -n 1 headers.mk | sed -e 's/\\\//g'` # remove '\' in last line
sed '$d' < headers.mk > headers.mk.tmp # remove last line
......
This diff is collapsed.
......@@ -108,6 +108,7 @@ namespace mln
const I& input = exact(input_);
const N& nbh = exact(nbh_);
const S& s = exact(s_);
(void) accu_;
mln_concrete(I) output;
initialize(output, input);
......@@ -231,6 +232,7 @@ namespace mln
const I& input = exact(input_);
const N& nbh = exact(nbh_);
(void) accu_;
extension::adjust(input, nbh);
......
......@@ -53,7 +53,7 @@ namespace mln
namespace impl
{
# ifdef MLN_CORE_SITE_SET_BOX2D_HH
# ifdef MLN_CORE_ALIAS_BOX2D_HH
// 2D version.
template <typename I>
......@@ -70,10 +70,10 @@ namespace mln
}
std::cout << std::endl;
}
# endif // MLN_CORE_SITE_SET_BOX2D_HH
# endif // MLN_CORE_ALIAS_BOX2D_HH
# ifdef MLN_CORE_SITE_SET_BOX3D_HH
# ifdef MLN_CORE_ALIAS_BOX3D_HH
// 3D version.
template <typename I>
......@@ -105,7 +105,7 @@ namespace mln
std::cout << std::endl;
}
# endif // MLN_CORE_SITE_SET_BOX3D_HH
# endif // MLN_CORE_ALIAS_BOX3D_HH
} // end of namespace mln::debug::impl
......
......@@ -36,8 +36,7 @@
# include <mln/trait/value_.hh>
# include <mln/value/rgb8.hh>
# include <mln/value/rgb16.hh>
# include <mln/value/rgb.hh>
namespace mln
{
......
......@@ -89,11 +89,11 @@ namespace mln
accu::count<mln_value(I)> a_;
util::array<unsigned> arr = labeling::compute(a_, input, lbls, nlabels);
int bg_count = 0;
int bg_lbl = 0;
unsigned bg_count = 0;
unsigned bg_lbl = 0;
// We start at 1 to ignore the object.
for (int i = 1; i < arr.nelements(); ++i)
for (unsigned i = 1; i < arr.nelements(); ++i)
{
if (arr[i] > bg_count)
{
......
......@@ -33,6 +33,8 @@
# include <mln/accu/mean.hh>
# include <mln/level/transform.hh>
# include <mln/labeling/compute.hh>
# include <mln/literal/colors.hh>
......
......@@ -36,7 +36,7 @@
# include <cmath>
# include <cstdlib>
# include <mln/value/all.hh>
# include <mln/value/int_u.hh>
namespace mln
......
......@@ -34,6 +34,7 @@
/// component.
# include <mln/accu/internal/base.hh>
# include <mln/util/pix.hh>
namespace mln
......
......@@ -38,6 +38,7 @@
# include <mln/value/builtin/all.hh> // In the case of summing builtin values.
# include <mln/literal/zero.hh> // For initialization.
# include <mln/util/pix.hh>
namespace mln
{
......
......@@ -36,6 +36,7 @@
# include <mln/accu/internal/base.hh>
# include <mln/math/diff_abs.hh>
# include <mln/util/pix.hh>
namespace mln
......
// Copyright (C) 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License version 2 as published by the
// Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to
// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
// Boston, MA 02111-1307, USA.
//
// As a special exception, you may use this file as part of a free
// software library without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to
// produce an executable, this file does not by itself cause the
// resulting executable to be covered by the GNU General Public
// License. This exception does not however invalidate any other
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef MLN_REGISTRATION_MULTISCALE_HH
# define MLN_REGISTRATION_MULTISCALE_HH
# include <mln/core/concept/image.hh>
# include <mln/core/image/lazy_image.hh>
# include <mln/core/site_set/p_array.hh>
# include <mln/registration/icp.hh>
# include <mln/fun/x2p/closest_point.hh>
namespace mln
{
namespace registration
{
/*! Register point in \p c using a multiscale icp algorithm
*
* \param[in] cloud Image to register
* \param[in] surface Image using to register onto
* \param[in] q Subsampling quotient
* \param[in] nb_it Number of registrations
* \param[out] The rigid transformation obtained.
*
* \pre \p cloud has to be initialized.
* \pre \p surface has to be initialized.
*/
template <typename I, typename J>
inline
composed< rotation<I::psite::dim, float>, translation<I::Psite::dim, float> >
multiscale(const Image<I>& cloud,
const Image<J>& surface,
const float q,
const unsigned nb_it);
# ifndef MLN_INCLUDE_ONLY
namespace impl
{
// FIXME: move elsewhere
template <typename P>
void shuffle(p_array<P>& a)
{
for (unsigned int i = 0; i < a.nsites(); i++)
{
unsigned int r = rand() % a.nsites();
P tmp;
tmp = a[i];
a[i] = a[r];
a[r] = tmp;
}
}
template <typename P>
box<P> bigger(const box<P>& a, const box<P>& b)
{
P pmin,pmax;
for (unsigned i = 0; i < P::dim; i++)
{
pmin[i] = (a.pmin()[i] < b.pmin()[i]) ? a.pmin()[i] : b.pmin()[i];
pmax[i] = (a.pmax()[i] > b.pmax()[i]) ? a.pmax()[i] : b.pmax()[i];
}
return box<P>(pmin, pmax);
}
template <typename P>
inline
box<P> //dif
enlarge(const box<P>& box, unsigned b)
{
mln::box<P> nbox(box);
for (unsigned i = 0; i < P::dim; ++i)
{
nbox.pmin()[i] -= b;
nbox.pmax()[i] += b;
}
return nbox;
}
template <typename I, typename J>
inline
composed< rotation<I::site::dim, float>, translation<I::site::dim, float> >
multiscale_(const I& cloud,
const J& surface,
const float q,
const unsigned nb_it)
{
p_array<mln_psite(I)> c = convert::to< p_array<mln_psite(I)> >(cloud);
p_array<mln_psite(J)> x = convert::to< p_array<mln_psite(J)> >(surface);
// Shuffle cloud
shuffle(c);
//working box
const box<mln_psite(I)> working_box =
enlarge(bigger(geom::bbox(c), geom::bbox(x)), 1000); //warning 100 could be insufficient
//make a lazy_image map via function closest_point
fun::x2p::closest_point<mln_psite(I)> fun(x, working_box);
const lazy_image<I, fun::x2p::closest_point<mln_psite(I)>, box2d >
map(fun, fun.domain());
//init rigid transform qk
// FIXME: check qk initialisation.
composed< rotation<I::psite::dim, float>, translation<I::psite::dim, float> > qk;
//run registration
for (int e = nb_it-1; e >= 0; e--)
{
unsigned int l = c.nsites() / std::pow(q, e);
l = (l < 1) ? 1 : l;
icp_subset(c, l, map, qk);
}
return qk;
}
}
template <typename I, typename J>
inline
composed< rotation<I::site::dim, float>, translation<I::site::dim, float> >
multiscale(const Image<I>& cloud,
const Image<J>& surface,
const float q,
const unsigned nb_it)
{
trace::entering("registration::registration");
mln_precondition(I::site::dim == 3 || I::site::dim == 2);
composed< rotation<I::site::dim, float>, translation<I::site::dim, float> >
qk = impl::multiscale_(exact(cloud), exact(surface), q, nb_it);
trace::exiting("registration::registration");
return qk;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::registration
} // end of namespace mln
#endif // ! MLN_REGISTRATION_MULTISCALE_HH
......@@ -45,9 +45,6 @@
# include <mln/value/int_u.hh>
# include <mln/algebra/vec.hh>
// Needed by from_to_.
# include <mln/fun/v2v/rgb_to_hsl.hh>
namespace mln
{
......@@ -378,8 +375,23 @@ namespace mln
/// \}
} // end of namespace mln::value
} // end of namespace mln
// Needed by from_to_.
# include <mln/fun/v2v/rgb_to_hsl.hh>
# ifndef MLN_INCLUDE_ONLY
namespace mln
{
namespace value
{
/*---------------.
| Construction. |
`---------------*/
......
......@@ -37,6 +37,7 @@
#include <mln/accu/count.hh>
#include <mln/accu/sum.hh>
#include <mln/value/int_u8.hh>
#include <mln/value/label_8.hh>
#include <mln/util/array.hh>
int main()
......
......@@ -46,6 +46,7 @@
#include <mln/util/timer.hh>
#include "tests/data.hh"
struct f_16_to_8 : mln::Function_v2v< f_16_to_8 >
{
......@@ -66,7 +67,7 @@ int main()
using value::int_u16;
image2d<int_u8> input;
io::pgm::load(input, "/squares.pgm");
io::pgm::load(input, MLN_IMG_DIR "/squares.pgm");
typedef int_u16 L;
L n_basins;
......
......@@ -3,10 +3,8 @@
include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
registration \
multiscale
registration
registration_SOURCES = registration.cc
multiscale_SOURCES = multiscale.cc
TESTS = $(check_PROGRAMS)
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License version 2 as published by the
// Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to
// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
// Boston, MA 02111-1307, USA.
//
// As a special exception, you may use this file as part of a free
// software library without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to
// produce an executable, this file does not by itself cause the
// resulting executable to be covered by the GNU General Public
// License. This exception does not however invalidate any other
// reasons why the executable file might be covered by the GNU General
// Public License.
/// \file tests/registration/multiscale.cc
///
/// Test on mln::registration::multiscale.cc
///
/// FIXME: write a test!
#include "tests/data.hh"
#include <mln/io/pbm/all.hh>
#include <mln/registration/multiscale.hh>
int main()
{
using namespace mln;
image2d< bool > img1;
image2d< bool > img2;
//load images
io::pbm::load(img1, MLN_IMG_DIR "/fly.pbm");
io::pbm::load(img2, MLN_IMG_DIR "/fly.pbm");
//FIXME: Auto test result
//FIXME: Make it pass
registration::multiscale(img1,img2, 5, 2);
}
......@@ -31,20 +31,29 @@
///
#include "tests/data.hh"
#include <mln/io/pbm/all.hh>
#include <mln/core/image/image2d.hh>
#include <mln/core/image/image3d.hh>
#include <mln/registration/registration.hh>
#include <mln/make/image3d.hh>
#include <mln/io/pbm/all.hh>
int main()
{
using namespace mln;
image2d< bool > img1;
image2d< bool > img2;
image2d<bool> img1_;
image2d<bool> img2_;
//load images
io::pbm::load(img1, MLN_IMG_DIR "/lena.pbm");
io::pbm::load(img2, MLN_IMG_DIR "/lena.pbm");
io::pbm::load(img1_, MLN_IMG_DIR "/fly.pbm");
io::pbm::load(img2_, MLN_IMG_DIR "/fly.pbm");
image3d<bool> img1 = make::image3d(img1_);
image3d<bool> img2 = make::image3d(img2_);
registration::registration(img1,img2);
typedef p_array<point3d> arr_t;
arr_t arr1 = convert::to<arr_t>(img1);
arr_t arr2 = convert::to<arr_t>(img2);
registration::registration1(arr1,arr2);
//FIXME: Auto test result
}
This diff is collapsed.
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