Commit 923a18d9 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Fix compilation issues.

	* mln/canvas/morpho/attribute_filter.hh: move MLN_INCLUDE_ONLY guards.

	* mln/registration/icp.hh: add missing to_vec(). Fix use of the new
	closest_point_functor.

	* mln/transform/internal/closest_point_functor.hh: fix a wrong index
	propagation.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3473 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 4597bfe2
2009-03-03 Guillaume Lazzara <lazzara@lrde.epita.fr>
Fix compilation issues.
* mln/canvas/morpho/attribute_filter.hh: move MLN_INCLUDE_ONLY guards.
* mln/registration/icp.hh: add missing to_vec(). Fix use of the new
closest_point_functor.
* mln/transform/internal/closest_point_functor.hh: fix a wrong index
propagation.
2009-03-03 Fabien Freling <fabien.freling@lrde.epita.fr>
 
Add standard deviation accumulator.
......@@ -47,9 +47,14 @@
# include <mln/data/fill.hh>
# include <mln/level/sort_psites.hh>
namespace mln {
namespace canvas {
namespace morpho {
namespace mln
{
namespace canvas
{
namespace morpho
{
// Facade Fwd Declaration
template <typename I, typename N, typename A>
......@@ -433,10 +438,10 @@ namespace mln {
};
return attribute_filter_dispatch(metal::bool_<test>(), input, nbh, a, lambda, increasing);
}
} // end of namespace mln::canvas::morpho::internal
# endif // ! MLN_INCLUDE_ONLY
// Facade.
......@@ -451,8 +456,13 @@ namespace mln {
return internal::attribute_filter_dispatch(input, nbh, a, lambda, increasing);
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::canvas::morpho
} // end of namespace mln::canvas
} // end of namespace mln
......
......@@ -55,7 +55,7 @@
# include <mln/core/alias/neighb3d.hh>
# include <mln/transform/internal/closest_point_functor.hh>
# include <mln/transform/distance_and_closest_point_geodesic.hh>
# include <mln/canvas/distance_geodesic.hh>
# include <mln/pw/all.hh>
......@@ -76,6 +76,8 @@
# include <mln/util/timer.hh>
# include <mln/io/cloud/save.hh>
namespace mln
{
......@@ -165,17 +167,15 @@ namespace mln
data::fill(model, false);
data::fill((model | X).rw(), true);
transform::internal::closest_point_functor<model_t> f(X);
util::timer t;
t.start();
dmap_X_ = canvas::distance_geodesic(model, c6(),
mln_max(value::int_u16),
f);
std::cout << "distance_geodesic = " << t << "s" << std::endl;
typedef util::couple<mln_ch_value(model_t, value::int_u16),
mln_ch_value(model_t, unsigned)> couple_t;
couple_t cpl = transform::distance_and_closest_point_geodesic(X, box,
c6(),
mln_max(value::int_u16));
initialize(this->cp_ima_, f.cp_ima);
this->cp_ima_ = f.cp_ima;
dmap_X_ = cpl.first();
cp_ima_ = cpl.second();
mln_postcondition(cp_ima_.is_valid());
mln_postcondition(cp_ima_.domain().is_valid());
......@@ -183,27 +183,27 @@ namespace mln
std::cout << "pmax = " << cp_ima_.domain().pmax() << std::endl;;
#ifndef NDEBUG
// mln_ch_value(I, bool) debug2(box);
// data::fill(debug2, false);
// mln_ch_value(I, value::rgb8) debug(box);
// mln_piter(p_array<P>) p(X);
// for_all(p)
// {
// debug(p) = debug::internal::random_color(value::rgb8());
// debug2(p) = true;
// }
// io::pbm::save(slice(debug2,0), "debug2-a.ppm");
//
// mln_piter(I) pi(cp_ima_.domain());
// for_all(pi)
// {
// debug(pi) = debug(cp_ima_(pi));
// debug2(pi) = debug2(cp_ima_(pi));
// }
//
// io::pbm::save(slice(debug2,0), "debug2-b.ppm");
// io::ppm::save(slice(debug,0), "debug.ppm");
// std::cout << "map saved" << std::endl;
mln_ch_value(I, bool) debug2(box);
data::fill(debug2, false);
mln_ch_value(I, value::rgb8) debug(box);
mln_piter(p_array<P>) p(X);
for_all(p)
{
debug(p) = debug::internal::random_color(value::rgb8());
debug2(p) = true;
}
io::pbm::save(slice(debug2,0), "debug2-a.ppm");
mln_piter(I) pi(cp_ima_.domain());
for_all(pi)
{
debug(pi) = debug(cp_ima_(pi));
debug2(pi) = debug2(cp_ima_(pi));
}
io::pbm::save(slice(debug2,0), "debug2-b.ppm");
io::ppm::save(slice(debug,0), "debug.ppm");
std::cout << "map saved" << std::endl;
#endif
}
......@@ -278,11 +278,11 @@ namespace mln
mln_piter(p_array<P>) p(kept);
for_all(p)
ext_result(qR.rotate(p) + qT) = literal::green;
ext_result(qR.rotate(p.to_vec()) + qT) = literal::green;
mln_piter(p_array<P>) p2(removed);
for_all(p2)
ext_result(qR.rotate(p2) + qT) = literal::red;
ext_result(qR.rotate(p2.to_vec()) + qT) = literal::red;
io::ppm::save(slice(ext_result,0), "registered-2.ppm");
}
......@@ -427,6 +427,16 @@ namespace mln
}
}
{
std::ostringstream ss2;
ss2 << method << "_" << r << "_removed_sites" << ".cloud";
io::cloud::save(removed_set, ss2.str());
}
{
std::ostringstream ss2;
ss2 << method << "_" << r << "_kept_sites" << ".cloud";
io::cloud::save(tmp, ss2.str());
}
# ifndef NDEBUG
std::ostringstream ss2;
......@@ -458,14 +468,14 @@ namespace mln
mln_piter(p_array<P>) p1(P_);
for_all(p1)
{
vec3d_f Pk_i = pair.first.rotate(p1) + pair.second;
vec3d_f Pk_i = pair.first.rotate(p1.to_vec()) + pair.second;
out(Pk_i) = literal::red;
}
mln_piter(p_array<P>) p2(P_sub);
for_all(p2)
{
vec3d_f Pk_i = pair.first.rotate(p2) + pair.second;
vec3d_f Pk_i = pair.first.rotate(p2.to_vec()) + pair.second;
out(Pk_i) = c;
}
......
......@@ -46,6 +46,11 @@ namespace mln
namespace internal
{
/// Functor to be passed to a canvas.
/// Computes an image of closest points.
///
/// The image values are initialized with \p pset.nsites().
template <typename I>
struct closest_point_functor_with_indexes
{
......@@ -72,7 +77,10 @@ namespace mln
void process_(unsigned p, unsigned n);
};
/// Functor to be passed to a canvas.
/// Computes an image of closest points.
///
/// The image values are initialized with \p literal::origin.
template <typename I>
struct closest_point_functor_with_sites
{
......@@ -115,11 +123,11 @@ namespace mln
closest_point_functor_with_indexes<I>::init(const I& input)
{
initialize(cp_ima, input);
data::fill(cp_ima, 0u);
data::fill(cp_ima, pset_.nsites());
mln_piter(p_array<mln_psite(I)>) p(pset_);
for_all(p)
cp_ima(p) = cp_ima.index_of_point(p);
cp_ima(p) = p.index();
}
template <typename I>
......
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