
* apps/generic-skel/image3d-skel-with-1d-isthmuses.cc: New. * apps/generic-skel/Makefile.am (bin_PROGRAMS): Add image3d-skel-with-1d-isthmuses. (image3d_skel_with_1d_isthmuses_SOURCES): New. (TESTS): Add image3d-skel-with-1d-isthmuses. (MOSTLYCLEANFILES): Add image3d-skel-with-1d-isthmuses-input.raw, image3d-skel-with-1d-isthmuses-input.vtk, image3d-skel-with-1d-isthmuses-skel.raw and image3d-skel-with-1d-isthmuses-skel.vtk. --- milena/ChangeLog | 15 +++++++++++++++ milena/apps/generic-skel/Makefile.am | 13 ++++++++++--- ...points.cc => image3d-skel-with-1d-isthmuses.cc} | 16 ++++++++-------- 3 files changed, 33 insertions(+), 11 deletions(-) copy milena/apps/generic-skel/{image3d-skel-with-end-points.cc => image3d-skel-with-1d-isthmuses.cc} (88%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 8c49faa..3e2adbf 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,20 @@ 2011-07-13 Roland Levillain <roland@lrde.epita.fr> + Exercise breadth-first thinning with predicate is_not_1d_isthmus. + + * apps/generic-skel/image3d-skel-with-1d-isthmuses.cc: New. + * apps/generic-skel/Makefile.am (bin_PROGRAMS): + Add image3d-skel-with-1d-isthmuses. + (image3d_skel_with_1d_isthmuses_SOURCES): New. + (TESTS): Add image3d-skel-with-1d-isthmuses. + (MOSTLYCLEANFILES): Add + image3d-skel-with-1d-isthmuses-input.raw, + image3d-skel-with-1d-isthmuses-input.vtk, + image3d-skel-with-1d-isthmuses-skel.raw and + image3d-skel-with-1d-isthmuses-skel.vtk. + +2011-07-13 Roland Levillain <roland@lrde.epita.fr> + Add a non 1D isthmus predicate for (2D and 3D) binary images. * mln/topo/is_not_1d_isthmus.hh: New. diff --git a/milena/apps/generic-skel/Makefile.am b/milena/apps/generic-skel/Makefile.am index ad89544..961fef2 100644 --- a/milena/apps/generic-skel/Makefile.am +++ b/milena/apps/generic-skel/Makefile.am @@ -29,7 +29,8 @@ bin_PROGRAMS = \ image2d-skel-with-end-points \ \ image3d-skel-unconstrained \ - image3d-skel-with-end-points + image3d-skel-with-end-points \ + image3d-skel-with-1d-isthmuses # 2D cases. image2d_skel_unconstrained_SOURCES = image2d-skel-unconstrained.cc image2d-skel.hh @@ -37,8 +38,9 @@ image2d_skel_with_end_points_SOURCES = image2d-skel-with-end-points.cc image2d-s # 3D cases, slow versions. noinst_HEADERS = image3d-skel.hh -image3d_skel_with_end_points_SOURCES = image3d-skel-with-end-points.cc image3d_skel_unconstrained_SOURCES = image3d-skel-unconstrained.cc +image3d_skel_with_end_points_SOURCES = image3d-skel-with-end-points.cc +image3d_skel_with_1d_isthmuses_SOURCES = image3d-skel-with-1d-isthmuses.cc EXTRA_DIST = \ test-image2d-skel-unconstrained.in \ @@ -74,7 +76,8 @@ TESTS = $(generated_tests) # FIXME: Create real test cases with inputs passed as argument. TESTS += \ image3d-skel-unconstrained \ - image3d-skel-with-end-points + image3d-skel-with-end-points \ + image3d-skel-with-1d-isthmuses # FIXME: Rename all outputs to have their names use their generator as prefix. MOSTLYCLEANFILES = \ @@ -86,6 +89,10 @@ MOSTLYCLEANFILES = \ image3d-skel-with-end-points-input.vtk \ image3d-skel-with-end-points-skel.raw \ image3d-skel-with-end-points-skel.vtk \ + image3d-skel-with-1d-isthmuses-input.raw \ + image3d-skel-with-1d-isthmuses-input.vtk \ + image3d-skel-with-1d-isthmuses-skel.raw \ + image3d-skel-with-1d-isthmuses-skel.vtk \ picasso-skel-unconstrained.pbm \ picasso-skel-with-end-points.pbm \ tiny-skel-unconstrained.pbm \ diff --git a/milena/apps/generic-skel/image3d-skel-with-end-points.cc b/milena/apps/generic-skel/image3d-skel-with-1d-isthmuses.cc similarity index 88% copy from milena/apps/generic-skel/image3d-skel-with-end-points.cc copy to milena/apps/generic-skel/image3d-skel-with-1d-isthmuses.cc index 32f3634..fc1ad61 100644 --- a/milena/apps/generic-skel/image3d-skel-with-end-points.cc +++ b/milena/apps/generic-skel/image3d-skel-with-1d-isthmuses.cc @@ -25,7 +25,7 @@ /// \file /// \brief A program computing a binary skeleton of a 3D image, -/// preserving end points. +/// preserving 1D isthmuses. #include <fstream> @@ -44,7 +44,7 @@ #include <mln/topo/is_simple_point3d.hh> #include <mln/topo/detach_point.hh> -#include <mln/topo/is_not_end_point.hh> +#include <mln/topo/is_not_1d_isthmus.hh> #include "apps/data.hh" @@ -76,8 +76,8 @@ int main() I input = make_triple_torus(20); std::cerr << input.domain() << std::endl; - save_raw_3d(input, "image3d-skel-with-end-points-input.raw"); - save_vtk_polyhedrons(input, "image3d-skel-with-end-points-input.vtk"); + save_raw_3d(input, "image3d-skel-with-1d-isthmuses-input.raw"); + save_vtk_polyhedrons(input, "image3d-skel-with-1d-isthmuses-input.vtk"); // FIXME: Debug. unsigned n_fg_comps; @@ -98,17 +98,17 @@ int main() topo::is_simple_point3d<I, N> is_simple(nbh_fg, nbh_bg); // Simple point detach procedure. topo::detach_point<I> detach; - // Constraint: do not collapse end points. + // Constraint: do not remove 1D isthmuses. /* FIXME: This criterion is static, e.g. it is attached to INPUT (fixed), not OUTPUT (changing during the thinning). This is not as good as a dynamic critertion (attached to OUTPUT). Maybe it is time to introduce/use `breadth_first_thinning_inplace'. */ - topo::is_not_end_point<I, N> constraint(c6(), input); + topo::is_not_1d_isthmus<I, N> constraint(c6(), c26(), input); I output = topo::skeleton::breadth_first_thinning(input, nbh_fg, is_simple, detach, constraint); - save_raw_3d(output, "image3d-skel-with-end-points-skel.raw"); - save_vtk_polyhedrons(output, "image3d-skel-with-end-points-skel.vtk"); + save_raw_3d(output, "image3d-skel-with-1d-isthmuses-skel.raw"); + save_vtk_polyhedrons(output, "image3d-skel-with-1d-isthmuses-skel.vtk"); } -- 1.7.2.5