* 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.
---
milena/ChangeLog | 12 +++
milena/mln/canvas/morpho/attribute_filter.hh | 18 ++++-
milena/mln/registration/icp.hh | 80 +++++++++++---------
.../transform/internal/closest_point_functor.hh | 14 +++-
4 files changed, 82 insertions(+), 42 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c1c56a1..7040630 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,15 @@
+2009-03-03 Guillaume Lazzara <lazzara(a)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(a)lrde.epita.fr>
Add standard deviation accumulator.
diff --git a/milena/mln/canvas/morpho/attribute_filter.hh
b/milena/mln/canvas/morpho/attribute_filter.hh
index e605f18..298c236 100644
--- a/milena/mln/canvas/morpho/attribute_filter.hh
+++ b/milena/mln/canvas/morpho/attribute_filter.hh
@@ -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
diff --git a/milena/mln/registration/icp.hh b/milena/mln/registration/icp.hh
index a5ad215..6adc0b3 100644
--- a/milena/mln/registration/icp.hh
+++ b/milena/mln/registration/icp.hh
@@ -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;
}
diff --git a/milena/mln/transform/internal/closest_point_functor.hh
b/milena/mln/transform/internal/closest_point_functor.hh
index 8df47b7..a1ab93c 100644
--- a/milena/mln/transform/internal/closest_point_functor.hh
+++ b/milena/mln/transform/internal/closest_point_functor.hh
@@ -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>
--
1.5.6.5