* headers.mk: add new headers to distribution.
* mln/canvas/distance_geodesic.hh: add a call to init_p() in the
functor passed as argument.
* mln/transform/internal/distance_functor.hh: add missing init_p()
member.
* mln/transform/internal/closest_point_functor.hh: New. Construct an
image of closest point.
* tests/unit_test/Makefile.am,
* tests/unit_test/mln_transform_internal_closest_point_functor.cc: add
new unit test.
---
milena/ChangeLog | 19 ++++++++++
milena/headers.mk | 1 +
milena/mln/canvas/distance_geodesic.hh | 3 ++
...istance_functor.hh => closest_point_functor.hh} | 39 +++++++++++++-------
milena/mln/transform/internal/distance_functor.hh | 10 +++++-
milena/tests/unit_test/Makefile.am | 9 +++++
...mln_transform_internal_closest_point_functor.cc | 11 ++++++
7 files changed, 77 insertions(+), 15 deletions(-)
copy milena/mln/transform/internal/{distance_functor.hh => closest_point_functor.hh}
(71%)
create mode 100644
milena/tests/unit_test/mln_transform_internal_closest_point_functor.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 9e9189d..5b3607e 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,24 @@
2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add closest_point_functor.
+
+ * headers.mk: add new headers to distribution.
+
+ * mln/canvas/distance_geodesic.hh: add a call to init_p() in the
+ functor passed as argument.
+
+ * mln/transform/internal/distance_functor.hh: add missing init_p()
+ member.
+
+ * mln/transform/internal/closest_point_functor.hh: New. Construct an
+ image of closest point.
+
+ * tests/unit_test/Makefile.am,
+ * tests/unit_test/mln_transform_internal_closest_point_functor.cc: add
+ new unit test.
+
+2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add io::cloud.
* headers.mk: add new headers to distribution.
diff --git a/milena/headers.mk b/milena/headers.mk
index 28e24e7..bb97122 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -962,6 +962,7 @@ mln/test/positive.hh \
mln/test/essential.hh \
mln/transform/distance_geodesic.hh \
mln/transform/internal/all.hh \
+mln/transform/internal/closest_point_functor.hh \
mln/transform/internal/distance_functor.hh \
mln/transform/internal/influence_zone_functor.hh \
mln/transform/all.hh \
diff --git a/milena/mln/canvas/distance_geodesic.hh
b/milena/mln/canvas/distance_geodesic.hh
index 7d7362b..123bb24 100644
--- a/milena/mln/canvas/distance_geodesic.hh
+++ b/milena/mln/canvas/distance_geodesic.hh
@@ -31,6 +31,8 @@
/// \file mln/canvas/distance_geodesic.hh
///
/// Discrete geodesic distance canvas.
+///
+/// \todo add fast version. Use extension(input) = true and extension(map) = 0.
# include <mln/core/concept/image.hh>
# include <mln/core/concept/neighborhood.hh>
@@ -85,6 +87,7 @@ namespace mln
for_all(p)
if (functor.inqueue_p_wrt_input_p(input(p))) // <-- inqueue_p_wrt_input_p
{
+ functor.init_p(p);
dmap(p) = 0;
for_all(n)
if (input.domain().has(n) &&
diff --git a/milena/mln/transform/internal/distance_functor.hh
b/milena/mln/transform/internal/closest_point_functor.hh
similarity index 71%
copy from milena/mln/transform/internal/distance_functor.hh
copy to milena/mln/transform/internal/closest_point_functor.hh
index 1214feb..634d44c 100644
--- a/milena/mln/transform/internal/distance_functor.hh
+++ b/milena/mln/transform/internal/closest_point_functor.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 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
@@ -25,36 +25,37 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_TRANSFORM_INTERNAL_DISTANCE_FUNCTOR_HH
-# define MLN_TRANSFORM_INTERNAL_DISTANCE_FUNCTOR_HH
+#ifndef MLN_TRANSFORM_INTERNAL_CLOSEST_POINT_FUNCTOR_HH
+# define MLN_TRANSFORM_INTERNAL_CLOSEST_POINT_FUNCTOR_HH
-/// \file mln/transform/internal/distance_functor.hh
+/// \file mln/transform/internal/closest_point_functor.hh
///
-/// Distance functor.
+/// Closest point functor.
# include <mln/core/macros.hh>
-
-
namespace mln
{
namespace transform
{
-
+
namespace internal
{
template <typename I>
- struct distance_functor
+ struct closest_point_functor
{
typedef mln_value(I) V;
typedef mln_site(I) P;
void init(const I&);
bool inqueue_p_wrt_input_p(const V& input_p);
+ void init_p(const P&);
bool inqueue_p_wrt_input_n(const V& input_n);
void process(const P&, const P&);
+
+ mln_ch_value(I,P) cp_ima;
};
@@ -63,30 +64,40 @@ namespace mln
template <typename I>
inline
void
- distance_functor<I>::init(const I&)
+ closest_point_functor<I>::init(const I& input)
{
+ initialize(cp_ima, input);
}
template <typename I>
inline
bool
- distance_functor<I>::inqueue_p_wrt_input_p(const V& input_p)
+ closest_point_functor<I>::inqueue_p_wrt_input_p(const V& input_p)
{
return input_p == true;
}
template <typename I>
inline
+ void
+ closest_point_functor<I>::init_p(const P& p)
+ {
+ cp_ima(p) = p;
+ }
+
+ template <typename I>
+ inline
bool
- distance_functor<I>::inqueue_p_wrt_input_n(const V& input_n)
+ closest_point_functor<I>::inqueue_p_wrt_input_n(const V& input_n)
{
return input_n == false;
}
template <typename I>
inline
- void distance_functor<I>::process(const P&, const P&)
+ void closest_point_functor<I>::process(const P& p, const P& n)
{
+ cp_ima(n) = p;
}
# endif // ! MLN_INCLUDE_ONLY
@@ -98,4 +109,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_TRANSFORM_INTERNAL_DISTANCE_FUNCTOR_HH
+#endif // ! MLN_TRANSFORM_INTERNAL_CLOSEST_POINT_FUNCTOR_HH
diff --git a/milena/mln/transform/internal/distance_functor.hh
b/milena/mln/transform/internal/distance_functor.hh
index 1214feb..1c1295e 100644
--- a/milena/mln/transform/internal/distance_functor.hh
+++ b/milena/mln/transform/internal/distance_functor.hh
@@ -41,7 +41,7 @@ namespace mln
namespace transform
{
-
+
namespace internal
{
@@ -53,6 +53,7 @@ namespace mln
void init(const I&);
bool inqueue_p_wrt_input_p(const V& input_p);
+ void init_p(const P&);
bool inqueue_p_wrt_input_n(const V& input_n);
void process(const P&, const P&);
};
@@ -77,6 +78,13 @@ namespace mln
template <typename I>
inline
+ void
+ distance_functor<I>::init_p(const P&)
+ {
+ }
+
+ template <typename I>
+ inline
bool
distance_functor<I>::inqueue_p_wrt_input_n(const V& input_n)
{
diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am
index 7139e44..09177d7 100644
--- a/milena/tests/unit_test/Makefile.am
+++ b/milena/tests/unit_test/Makefile.am
@@ -931,6 +931,7 @@ mln_test_positive \
mln_test_essential \
mln_transform_distance_geodesic \
mln_transform_internal_all \
+mln_transform_internal_closest_point_functor \
mln_transform_internal_distance_functor \
mln_transform_internal_influence_zone_functor \
mln_transform_all \
@@ -1164,6 +1165,7 @@ mln_trace_stop_SOURCES = mln_trace_stop.cc
mln_trace_essential_SOURCES = mln_trace_essential.cc
mln_make_graph_SOURCES = mln_make_graph.cc
mln_make_double_neighb2d_SOURCES = mln_make_double_neighb2d.cc
+mln_make_image3d_SOURCES = mln_make_image3d.cc
mln_make_dpoint2d_h_SOURCES = mln_make_dpoint2d_h.cc
mln_make_w_window_SOURCES = mln_make_w_window.cc
mln_make_image_SOURCES = mln_make_image.cc
@@ -1177,6 +1179,7 @@ mln_make_w_window2d_int_SOURCES = mln_make_w_window2d_int.cc
mln_make_box1d_SOURCES = mln_make_box1d.cc
mln_make_voronoi_SOURCES = mln_make_voronoi.cc
mln_make_box2d_SOURCES = mln_make_box2d.cc
+mln_make_h_mat_SOURCES = mln_make_h_mat.cc
mln_make_w_window2d_SOURCES = mln_make_w_window2d.cc
mln_make_box3d_SOURCES = mln_make_box3d.cc
mln_make_relabelfun_SOURCES = mln_make_relabelfun.cc
@@ -1393,6 +1396,7 @@ mln_accu_transform_snake_SOURCES = mln_accu_transform_snake.cc
mln_accu_rank_high_quant_SOURCES = mln_accu_rank_high_quant.cc
mln_accu_count_SOURCES = mln_accu_count.cc
mln_accu_median_h_SOURCES = mln_accu_median_h.cc
+mln_accu_rms_SOURCES = mln_accu_rms.cc
mln_accu_all_SOURCES = mln_accu_all.cc
mln_accu_land_basic_SOURCES = mln_accu_land_basic.cc
mln_accu_p_SOURCES = mln_accu_p.cc
@@ -1824,11 +1828,13 @@ mln_core_alias_p_run2d_SOURCES = mln_core_alias_p_run2d.cc
mln_core_alias_point3d_SOURCES = mln_core_alias_point3d.cc
mln_core_alias_neighb3d_SOURCES = mln_core_alias_neighb3d.cc
mln_core_alias_window3d_SOURCES = mln_core_alias_window3d.cc
+mln_core_alias_all_SOURCES = mln_core_alias_all.cc
mln_core_alias_neighb2d_SOURCES = mln_core_alias_neighb2d.cc
mln_core_alias_complex_image_SOURCES = mln_core_alias_complex_image.cc
mln_core_alias_w_window1d_float_SOURCES = mln_core_alias_w_window1d_float.cc
mln_core_alias_neighb1d_SOURCES = mln_core_alias_neighb1d.cc
mln_core_alias_w_window2d_float_SOURCES = mln_core_alias_w_window2d_float.cc
+mln_core_alias_vec3d_SOURCES = mln_core_alias_vec3d.cc
mln_core_alias_w_window2d_int_SOURCES = mln_core_alias_w_window2d_int.cc
mln_core_alias_box1d_SOURCES = mln_core_alias_box1d.cc
mln_core_alias_box2d_SOURCES = mln_core_alias_box2d.cc
@@ -1959,6 +1965,7 @@ mln_test_positive_SOURCES = mln_test_positive.cc
mln_test_essential_SOURCES = mln_test_essential.cc
mln_transform_distance_geodesic_SOURCES = mln_transform_distance_geodesic.cc
mln_transform_internal_all_SOURCES = mln_transform_internal_all.cc
+mln_transform_internal_closest_point_functor_SOURCES =
mln_transform_internal_closest_point_functor.cc
mln_transform_internal_distance_functor_SOURCES =
mln_transform_internal_distance_functor.cc
mln_transform_internal_influence_zone_functor_SOURCES =
mln_transform_internal_influence_zone_functor.cc
mln_transform_all_SOURCES = mln_transform_all.cc
@@ -1987,6 +1994,8 @@ mln_io_pfm_save_SOURCES = mln_io_pfm_save.cc
mln_io_raw_load_SOURCES = mln_io_raw_load.cc
mln_io_raw_all_SOURCES = mln_io_raw_all.cc
mln_io_raw_save_SOURCES = mln_io_raw_save.cc
+mln_io_cloud_load_SOURCES = mln_io_cloud_load.cc
+mln_io_cloud_save_SOURCES = mln_io_cloud_save.cc
mln_io_all_SOURCES = mln_io_all.cc
mln_io_pbm_load_SOURCES = mln_io_pbm_load.cc
mln_io_pbm_all_SOURCES = mln_io_pbm_all.cc
diff --git a/milena/tests/unit_test/mln_transform_internal_closest_point_functor.cc
b/milena/tests/unit_test/mln_transform_internal_closest_point_functor.cc
new file mode 100644
index 0000000..96b7c96
--- /dev/null
+++ b/milena/tests/unit_test/mln_transform_internal_closest_point_functor.cc
@@ -0,0 +1,11 @@
+// Unit test for mln/transform/internal/closest_point_functor.hh.
+// Generated by ./build_unit_test.sh, do not modify.
+
+// Include the file twice, so we detect missing inclusion guards.
+#include <mln/transform/internal/closest_point_functor.hh>
+#include <mln/transform/internal/closest_point_functor.hh>
+
+int main()
+{
+ // Nothing.
+}
--
1.5.6.5