* apps/mesh-segm-skel/mesh-complex-skel.cc,
* apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc,
* apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc:
Here.
---
milena/ChangeLog | 9 ++++++++
.../mesh-segm-skel/mesh-complex-max-curv-skel.cc | 22 ++++++++++----------
.../mesh-segm-skel/mesh-complex-pinv-curv-skel.cc | 22 ++++++++++----------
milena/apps/mesh-segm-skel/mesh-complex-skel.cc | 22 ++++++++++----------
4 files changed, 42 insertions(+), 33 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 40e876c..279f0a6 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,14 @@
2010-09-09 Roland Levillain <roland(a)lrde.epita.fr>
+ Use mln::data::paste to simplify mesh skeleton applications.
+
+ * apps/mesh-segm-skel/mesh-complex-skel.cc,
+ * apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc,
+ * apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc:
+ Here.
+
+2010-09-09 Roland Levillain <roland(a)lrde.epita.fr>
+
Update mesh skeleton applications.
* apps/mesh-segm-skel/mesh-complex-skel.cc,
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
index 641b0b4..2d55ff2 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-skel.cc
@@ -42,6 +42,7 @@
#include <mln/core/image/dmorph/image_if.hh>
#include <mln/core/image/dmorph/mutable_extension_ima.hh>
#include <mln/core/routine/mutable_extend.hh>
+#include <mln/data/paste.hh>
#include <mln/value/label_16.hh>
@@ -267,9 +268,6 @@ main(int argc, char* argv[])
// to triangles.
typedef mln::mutable_extension_ima<bin_triangle_only_ima_t, bin_ima_t>
bin_triangle_ima_t;
- // FIXME: Find a shorter name (skel_ima ? Careful, there is already a `skel' image
below).
- bin_triangle_ima_t bin_triangle_ima =
- mln::mutable_extend((surface | is_a_triangle).rw(), surface);
// ------------------------ //
// Simple point predicate. //
@@ -302,11 +300,15 @@ main(int argc, char* argv[])
// Functor detaching a cell.
mln::topo::detach_cell<bin_triangle_ima_t, adj_nbh_t> detach(adj_nbh);
- mln_concrete_(bin_triangle_ima_t) skel =
- mln::topo::skeleton::breadth_first_thinning(bin_triangle_ima,
- nbh,
- is_simple_triangle,
- detach);
+ mln_concrete_(bin_ima_t) skel;
+ mln::initialize(skel, surface);
+ mln::data::paste
+ (mln::topo::skeleton::breadth_first_thinning
+ (mln::mutable_extend((surface | is_a_triangle).rw(), surface),
+ nbh,
+ is_simple_triangle,
+ detach),
+ skel);
/*---------.
@@ -324,7 +326,5 @@ main(int argc, char* argv[])
mln::io::off::save(skel | mln::pw::value(skel) == mln::pw::cst(true),
output_filename);
#endif
- // FIXME: We have to ``unmorph'' (twice!) SKEL first, since save_bin_alt only
- // handles complex_image's.
- mln::io::off::save_bin_alt(skel.unmorph_().unmorph_(), output_filename);
+ mln::io::off::save_bin_alt(skel, output_filename);
}
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc
b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc
index 5096efa..bf92305 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc
@@ -42,6 +42,7 @@
#include <mln/core/image/dmorph/image_if.hh>
#include <mln/core/image/dmorph/mutable_extension_ima.hh>
#include <mln/core/routine/mutable_extend.hh>
+#include <mln/data/paste.hh>
#include <mln/value/label_16.hh>
@@ -272,9 +273,6 @@ main(int argc, char* argv[])
// to triangles.
typedef mln::mutable_extension_ima<bin_triangle_only_ima_t, bin_ima_t>
bin_triangle_ima_t;
- // FIXME: Find a shorter name (skel_ima ? Careful, there is already a `skel' image
below).
- bin_triangle_ima_t bin_triangle_ima =
- mln::mutable_extend((surface | is_a_triangle).rw(), surface);
// ------------------------ //
// Simple point predicate. //
@@ -307,11 +305,15 @@ main(int argc, char* argv[])
// Functor detaching a cell.
mln::topo::detach_cell<bin_triangle_ima_t, adj_nbh_t> detach(adj_nbh);
- mln_concrete_(bin_triangle_ima_t) skel =
- mln::topo::skeleton::breadth_first_thinning(bin_triangle_ima,
- nbh,
- is_simple_triangle,
- detach);
+ mln_concrete_(bin_ima_t) skel;
+ mln::initialize(skel, surface);
+ mln::data::paste
+ (mln::topo::skeleton::breadth_first_thinning
+ (mln::mutable_extend((surface | is_a_triangle).rw(), surface),
+ nbh,
+ is_simple_triangle,
+ detach),
+ skel);
/*---------.
@@ -329,7 +331,5 @@ main(int argc, char* argv[])
mln::io::off::save(skel | mln::pw::value(skel) == mln::pw::cst(true),
output_filename);
#endif
- // FIXME: We have to ``unmorph'' (twice!) SKEL first, since save_bin_alt only
- // handles complex_image's.
- mln::io::off::save_bin_alt(skel.unmorph_().unmorph_(), output_filename);
+ mln::io::off::save_bin_alt(skel, output_filename);
}
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-skel.cc
b/milena/apps/mesh-segm-skel/mesh-complex-skel.cc
index 4f5ca78..fcd37e5 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-skel.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-skel.cc
@@ -39,6 +39,7 @@
#include <mln/core/image/dmorph/image_if.hh>
#include <mln/core/image/dmorph/mutable_extension_ima.hh>
#include <mln/core/routine/mutable_extend.hh>
+#include <mln/data/paste.hh>
#include <mln/value/label_16.hh>
@@ -225,9 +226,6 @@ main(int argc, char* argv[])
// to triangles.
typedef mln::mutable_extension_ima<bin_triangle_only_ima_t, bin_ima_t>
bin_triangle_ima_t;
- // FIXME: Find a shorter name (skel_ima ? Careful, there is already a `skel' image
below).
- bin_triangle_ima_t bin_triangle_ima =
- mln::mutable_extend((surface | is_a_triangle).rw(), surface);
// ------------------------ //
// Simple point predicate. //
@@ -260,11 +258,15 @@ main(int argc, char* argv[])
// Functor detaching a cell.
mln::topo::detach_cell<bin_triangle_ima_t, adj_nbh_t> detach(adj_nbh);
- mln_concrete_(bin_triangle_ima_t) skel =
- mln::topo::skeleton::breadth_first_thinning(bin_triangle_ima,
- nbh,
- is_simple_triangle,
- detach);
+ mln_concrete_(bin_ima_t) skel;
+ mln::initialize(skel, surface);
+ mln::data::paste
+ (mln::topo::skeleton::breadth_first_thinning
+ (mln::mutable_extend((surface | is_a_triangle).rw(), surface),
+ nbh,
+ is_simple_triangle,
+ detach),
+ skel);
/*---------.
@@ -282,7 +284,5 @@ main(int argc, char* argv[])
mln::io::off::save(skel | mln::pw::value(skel) == mln::pw::cst(true),
output_filename);
#endif
- // FIXME: We have to ``unmorph'' (twice!) SKEL first, since save_bin_alt only
- // handles complex_image's.
- mln::io::off::save_bin_alt(skel.unmorph_().unmorph_(), output_filename);
+ mln::io::off::save_bin_alt(skel, output_filename);
}
--
1.5.6.5