* apps/generic-skel/image2d-skel-unconstrained.cc,
* apps/generic-skel/image2d-skel-with-end-points.cc,
* apps/generic-skel/image3d-skel-unconstrained.cc,
* apps/mesh-segm-skel/mesh-complex-max-curv-1-collapse.cc,
* apps/mesh-segm-skel/mesh-complex-max-curv-2-collapse.cc,
* apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc:
Display the size of the input.
Time the thinning step.
* milena/apps/generic-skel/test-mixed.in,
* milena/apps/mesh-segm-skel/test-mixed.in:
New.
* apps/generic-skel/Makefile.am (generated_tests): Add test-mixed.
(test-mixed): New target.
(check-mixed): New (phony) target.
* apps/mesh-segm-skel/Makefile.am: Likewise.
($(generated_tests)): New target.
(AM_CPPFLAGS): Add -I$(top_builddir)/milena so that
mln/version.hh, which is a generated header, can be found by the
compiler.
---
milena/ChangeLog | 24 +++++++++++++++
milena/apps/generic-skel/Makefile.am | 11 ++++++-
.../generic-skel/image2d-skel-unconstrained.cc | 12 +++++++-
.../generic-skel/image2d-skel-with-end-points.cc | 12 +++++++-
.../generic-skel/image3d-skel-unconstrained.cc | 21 +++++++------
...age2d-skel-with-end-points.in => test-mixed.in} | 5 ++-
milena/apps/mesh-segm-skel/Makefile.am | 31 ++++++++++++++++++-
.../mesh-complex-max-curv-1-collapse.cc | 15 ++++++++-
.../mesh-complex-max-curv-2-collapse.cc | 15 ++++++++-
.../mesh-segm-skel/mesh-complex-pinv-curv-skel.cc | 14 ++++++++-
...omplex-max-curv-2-collapse.in => test-mixed.in} | 7 ++--
11 files changed, 143 insertions(+), 24 deletions(-)
copy milena/apps/generic-skel/{test-image2d-skel-with-end-points.in => test-mixed.in}
(81%)
copy milena/apps/mesh-segm-skel/{test-mesh-complex-max-curv-2-collapse.in =>
test-mixed.in} (62%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index c990714..2599894 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,27 @@
+2012-02-17 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Add tests to generate figures for the WADGMM 2010/LNCS submission.
+
+ * apps/generic-skel/image2d-skel-unconstrained.cc,
+ * apps/generic-skel/image2d-skel-with-end-points.cc,
+ * apps/generic-skel/image3d-skel-unconstrained.cc,
+ * apps/mesh-segm-skel/mesh-complex-max-curv-1-collapse.cc,
+ * apps/mesh-segm-skel/mesh-complex-max-curv-2-collapse.cc,
+ * apps/mesh-segm-skel/mesh-complex-pinv-curv-skel.cc:
+ Display the size of the input.
+ Time the thinning step.
+ * milena/apps/generic-skel/test-mixed.in,
+ * milena/apps/mesh-segm-skel/test-mixed.in:
+ New.
+ * apps/generic-skel/Makefile.am (generated_tests): Add test-mixed.
+ (test-mixed): New target.
+ (check-mixed): New (phony) target.
+ * apps/mesh-segm-skel/Makefile.am: Likewise.
+ ($(generated_tests)): New target.
+ (AM_CPPFLAGS): Add -I$(top_builddir)/milena so that
+ mln/version.hh, which is a generated header, can be found by the
+ compiler.
+
2011-06-13 Roland Levillain <roland(a)lrde.epita.fr>
Introduce a no-constraint functor to replace fun::p2b::tautology.
diff --git a/milena/apps/generic-skel/Makefile.am b/milena/apps/generic-skel/Makefile.am
index fd9febc..41f022e 100644
--- a/milena/apps/generic-skel/Makefile.am
+++ b/milena/apps/generic-skel/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2010, 2011 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2010-2012 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -97,3 +97,12 @@ MOSTLYCLEANFILES = \
picasso-skel-with-end-points.pbm \
tiny-skel-unconstrained.pbm \
tiny-skel-with-end-points.pbm
+
+# Mixed tests corresponding to illustrations of the WADGMM 2010/LNCS
+# submission. Not part of the `check' target; triggered by the
+# `check-mixed' target.
+generated_tests += test-mixed
+test-mixed: $(srcdir)/test-mixed.in
+.PHONY: check-mixed
+check-mixed: test-mixed $(bin_PROGRAMS)
+ ./test-mixed
diff --git a/milena/apps/generic-skel/image2d-skel-unconstrained.cc
b/milena/apps/generic-skel/image2d-skel-unconstrained.cc
index 7a33334..68578f6 100644
--- a/milena/apps/generic-skel/image2d-skel-unconstrained.cc
+++ b/milena/apps/generic-skel/image2d-skel-unconstrained.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010-2012 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -38,6 +38,8 @@
#include <mln/io/pbm/all.hh>
+#include <mln/util/timer.hh>
+
int
main(int argc, char* argv[])
@@ -64,6 +66,9 @@ main(int argc, char* argv[])
border::thickness = 1;
I input = io::pbm::load(input_filename);
+ std::cout << input.nrows() << " x " << input.ncols()
<< " = "
+ << input.nrows() * input.ncols() << " pixels"
+ << std::endl;
// FIXME: Use a dual neighborhood instead?
@@ -77,8 +82,13 @@ main(int argc, char* argv[])
// Simple point detach procedure.
topo::detach_point<I> detach;
+ util::timer t;
+ t.start();
I output = topo::skeleton::breadth_first_thinning(input, nbh_fg,
is_simple,
detach);
+ t.stop();
+ std::cout << t.read() << " s" << std::endl;
+
io::pbm::save(output, output_filename);
}
diff --git a/milena/apps/generic-skel/image2d-skel-with-end-points.cc
b/milena/apps/generic-skel/image2d-skel-with-end-points.cc
index d22f281..ed7fc22 100644
--- a/milena/apps/generic-skel/image2d-skel-with-end-points.cc
+++ b/milena/apps/generic-skel/image2d-skel-with-end-points.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010, 2012 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -40,6 +40,8 @@
#include <mln/io/pbm/all.hh>
+#include <mln/util/timer.hh>
+
int
main(int argc, char* argv[])
@@ -66,6 +68,9 @@ main(int argc, char* argv[])
border::thickness = 1;
I input = io::pbm::load(input_filename);
+ std::cout << input.nrows() << " x " << input.ncols()
<< " = "
+ << input.nrows() * input.ncols() << " pixels"
+ << std::endl;
// Foreground neighborhood.
neighb2d nbh_fg = c4();
@@ -79,8 +84,13 @@ main(int argc, char* argv[])
// Constraint: do not remove end points.
topo::is_not_end_point<I, N> constraint(nbh_fg, input);
+ util::timer t;
+ t.start();
I output = topo::skeleton::breadth_first_thinning(input, nbh_fg,
is_simple, detach,
constraint);
+ t.stop();
+ std::cout << t.read() << " s" << std::endl;
+
io::pbm::save(output, output_filename);
}
diff --git a/milena/apps/generic-skel/image3d-skel-unconstrained.cc
b/milena/apps/generic-skel/image3d-skel-unconstrained.cc
index 0a16232..986782f 100644
--- a/milena/apps/generic-skel/image3d-skel-unconstrained.cc
+++ b/milena/apps/generic-skel/image3d-skel-unconstrained.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2011-2012 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -44,6 +44,8 @@
#include <mln/topo/is_simple_point3d.hh>
#include <mln/topo/detach_point.hh>
+#include <mln/util/timer.hh>
+
#include "apps/data.hh"
#include "image3d-skel.hh"
@@ -72,19 +74,15 @@ int main()
// program does not use the fast version of the simple 3D point
// criterion.
I input = make_triple_torus(20);
+ std::cout
+ << input.nslices() << " x " << input.nrows() <<
" x " << input.ncols()
+ << " = " << input.nslices() * input.nrows() * input.ncols()
<< " voxels"
+ << std::endl;
std::cerr << input.domain() << std::endl;
save_raw_3d(input, "image3d-skel-unconstrained-input.raw");
save_vtk_polyhedrons(input, "image3d-skel-unconstrained-input.vtk");
- // FIXME: Debug.
- unsigned n_fg_comps;
- labeling::blobs(input, c26(), n_fg_comps);
- unsigned n_bg_comps;
- labeling::blobs((fun::v2b::lnot<bool>() << input), c6(), n_bg_comps);
- std::cerr << "n_fg_comps = " << n_fg_comps << std::endl;
- std::cerr << "n_bg_comps = " << n_bg_comps << std::endl;
-
// FIXME: Use a dual neighborhood instead?
// Foreground neighborhood.
@@ -97,9 +95,14 @@ int main()
// Simple point detach procedure.
topo::detach_point<I> detach;
+ util::timer t;
+ t.start();
I output = topo::skeleton::breadth_first_thinning(input, nbh_fg,
is_simple,
detach);
+ t.stop();
+ std::cout << t.read() << " s" << std::endl;
+
save_raw_3d(output, "image3d-skel-unconstrained-skel.raw");
save_vtk_polyhedrons(output, "image3d-skel-unconstrained-skel.vtk");
}
diff --git a/milena/apps/generic-skel/test-image2d-skel-with-end-points.in
b/milena/apps/generic-skel/test-mixed.in
similarity index 81%
copy from milena/apps/generic-skel/test-image2d-skel-with-end-points.in
copy to milena/apps/generic-skel/test-mixed.in
index 946e8fd..4fa67bb 100644
--- a/milena/apps/generic-skel/test-image2d-skel-with-end-points.in
+++ b/milena/apps/generic-skel/test-mixed.in
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -20,5 +20,6 @@ set -ex
img_dir=@top_srcdir@/milena/img
-./image2d-skel-with-end-points $img_dir/tiny.pbm tiny-skel-with-end-points.pbm
+./image2d-skel-unconstrained $img_dir/picasso.pbm picasso-skel-unconstrained.pbm
./image2d-skel-with-end-points $img_dir/picasso.pbm picasso-skel-with-end-points.pbm
+./image3d-skel-unconstrained
diff --git a/milena/apps/mesh-segm-skel/Makefile.am
b/milena/apps/mesh-segm-skel/Makefile.am
index 4e06baf..861a970 100644
--- a/milena/apps/mesh-segm-skel/Makefile.am
+++ b/milena/apps/mesh-segm-skel/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+# Copyright (C) 2008-2010, 2012 EPITA Research and Development
# Laboratory (LRDE).
#
# This file is part of Olena.
@@ -20,7 +20,7 @@ gluit_builddir = $(top_builddir)/external/trimesh/gluit
include $(top_srcdir)/external/trimesh/gluit/gluit.mk
# Find Milena and trimesh headers.
-AM_CPPFLAGS = -I$(top_srcdir)/milena
+AM_CPPFLAGS = -I$(top_srcdir)/milena -I$(top_builddir)/milena
CPPFLAGS_trimesh = -I$(top_srcdir)/external/trimesh/include
# Produce fast code.
APPS_CXXFLAGS = @APPS_CXXFLAGS@
@@ -285,3 +285,30 @@ MOSTLYCLEANFILES += \
# VTK file.
bin_PROGRAMS += off-to-vtk-bin
off_to_vtk_bin_SOURCES = off-to-vtk-bin.cc
+
+## ------------- ##
+## Mixed tests. ##
+## ------------- ##
+
+# Use Make to generate Doxyfile instead of `configure', as advised by
+# Autoconf's manual (see section ``Installation Directory
+# Variables'').
+# FIXME: Generalize this approach to other tests.
+
+$(generated_tests): Makefile
+ rm -f $@ $@.tmp
+ srcdir=''; \
+ test -f ./$@.in || srcdir=$(srcdir)/; \
+ $(edit) $${srcdir}$@.in >$@.tmp
+ chmod +x $@.tmp
+ chmod a-w $@.tmp
+ mv $@.tmp $@
+
+# Mixed tests corresponding to illustrations of the WADGMM 2010/LNCS
+# submission. Not part of the `check' target; triggered by the
+# `check-mixed' target.
+generated_tests = test-mixed
+test-mixed: $(srcdir)/test-mixed.in
+.PHONY: check-mixed
+check-mixed: test-mixed $(bin_PROGRAMS)
+ ./test-mixed
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-1-collapse.cc
b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-1-collapse.cc
index 4716a42..47a5a20 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-1-collapse.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-1-collapse.cc
@@ -1,5 +1,4 @@
-// Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2008-2012 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -61,6 +60,8 @@
#include <mln/io/vtk/load.hh>
#include <mln/io/vtk/save.hh>
+#include <mln/util/timer.hh>
+
#include "trimesh/misc.hh"
@@ -91,6 +92,11 @@ main(int argc, char* argv[])
mln::bin_2complex_image3df bin_input;
mln::io::vtk::load(bin_input, input_filename);
+ // FIXME: mln::complex_image should provide shorcuts for this.
+ const mln::topo::complex<D>& cplx = bin_input.domain().cplx();
+ for (unsigned n = 0; n <= D; ++n)
+ std::cout << cplx.nfaces_of_dim(n) << ' ' << n <<
"-faces" << std::endl;
+
std::pair<float_ima_t, float_ima_t> curv =
mln::geom::mesh_curvature(bin_input.domain());
@@ -353,6 +359,9 @@ main(int argc, char* argv[])
mln_concrete_(bin_ima_t) surface_1_collapse;
mln::initialize(surface_1_collapse, surface_2_collapse);
+
+ mln::util::timer time;
+ time.start();
mln::data::paste
(mln::topo::skeleton::priority_driven_thinning
(mln::mutable_extend((surface_2_collapse | is_an_edge).rw(),
@@ -368,6 +377,8 @@ main(int argc, char* argv[])
undirectly processed). */
| surface_2_collapse.domain(),
surface_1_collapse);
+ time.stop();
+ std::cout << time.read() << " s" << std::endl;
/*---------.
| Output. |
diff --git a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-2-collapse.cc
b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-2-collapse.cc
index 7df256e..7c779e3 100644
--- a/milena/apps/mesh-segm-skel/mesh-complex-max-curv-2-collapse.cc
+++ b/milena/apps/mesh-segm-skel/mesh-complex-max-curv-2-collapse.cc
@@ -1,5 +1,4 @@
-// Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2008-2012 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Milena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -61,6 +60,8 @@
#include <mln/io/vtk/load.hh>
#include <mln/io/vtk/save.hh>
+#include <mln/util/timer.hh>
+
#include "trimesh/misc.hh"
@@ -91,6 +92,11 @@ main(int argc, char* argv[])
mln::bin_2complex_image3df bin_input;
mln::io::vtk::load(bin_input, input_filename);
+ // FIXME: mln::complex_image should provide shorcuts for this.
+ const mln::topo::complex<D>& cplx = bin_input.domain().cplx();
+ for (unsigned n = 0; n <= D; ++n)
+ std::cout << cplx.nfaces_of_dim(n) << ' ' << n <<
"-faces" << std::endl;
+
std::pair<float_ima_t, float_ima_t> curv =
mln::geom::mesh_curvature(bin_input.domain());
@@ -296,6 +302,9 @@ main(int argc, char* argv[])
mln_concrete_(bin_ima_t) surface_2_collapse;
mln::initialize(surface_2_collapse, surface);
+
+ mln::util::timer time;
+ time.start();
mln::data::paste
(mln::topo::skeleton::priority_driven_thinning
(mln::mutable_extend((surface | is_a_triangle).rw(), surface),
@@ -310,6 +319,8 @@ main(int argc, char* argv[])
undirectly processed). */
| surface.domain(),
surface_2_collapse);
+ time.stop();
+ std::cout << time.read() << " s" << std::endl;
/*---------.
| Output. |
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 bf92305..c4b9bb8 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
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+// Copyright (C) 2008-2010, 2012 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of the Milena Library. This library is free
@@ -54,6 +54,8 @@
#include <mln/topo/detach_cell.hh>
#include <mln/topo/skeleton/breadth_first_thinning.hh>
+#include <mln/util/timer.hh>
+
#include <mln/io/off/load.hh>
/* FIXME: Remove as soon as mln::io::off::save is able to save a
morphed mln::complex_image (i.e., seen through image_if). */
@@ -93,6 +95,11 @@ main(int argc, char* argv[])
mln::bin_2complex_image3df bin_input;
mln::io::off::load(bin_input, input_filename);
+ // FIXME: mln::complex_image should provide shorcuts for this.
+ const mln::topo::complex<D>& cplx = bin_input.domain().cplx();
+ for (unsigned n = 0; n <= D; ++n)
+ std::cout << cplx.nfaces_of_dim(n) << ' ' << n <<
"-faces" << std::endl;
+
std::pair<float_ima_t, float_ima_t> curv =
mln::geom::mesh_curvature(bin_input.domain());
@@ -307,6 +314,9 @@ main(int argc, char* argv[])
mln_concrete_(bin_ima_t) skel;
mln::initialize(skel, surface);
+
+ mln::util::timer time;
+ time.start();
mln::data::paste
(mln::topo::skeleton::breadth_first_thinning
(mln::mutable_extend((surface | is_a_triangle).rw(), surface),
@@ -314,6 +324,8 @@ main(int argc, char* argv[])
is_simple_triangle,
detach),
skel);
+ time.stop();
+ std::cout << time.read() << " s" << std::endl;
/*---------.
diff --git a/milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-2-collapse.in
b/milena/apps/mesh-segm-skel/test-mixed.in
similarity index 62%
copy from milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-2-collapse.in
copy to milena/apps/mesh-segm-skel/test-mixed.in
index 4edf55f..1bc2f0e 100644
--- a/milena/apps/mesh-segm-skel/test-mesh-complex-max-curv-2-collapse.in
+++ b/milena/apps/mesh-segm-skel/test-mixed.in
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2012 EPITA Research and Development Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -20,5 +20,6 @@ set -ex
mesh_dir=@top_srcdir@/milena/mesh
-time ./mesh-complex-max-curv-2-collapse $mesh_dir/teapot.vtk 20
teapot-max-curv-2-collapse.vtk
-time ./mesh-complex-max-curv-2-collapse $mesh_dir/bunny-holefilled.vtk 50
bunny-holefilled-max-curv-2-collapse.vtk
+./mesh-complex-pinv-curv-skel $mesh_dir/bunny-holefilled.off 50
bunny-holefilled-complex-pinv-curv-skel.off
+./mesh-complex-max-curv-2-collapse $mesh_dir/bunny-holefilled.vtk 50
bunny-holefilled-max-curv-2-collapse.vtk
+./mesh-complex-max-curv-1-collapse $mesh_dir/bunny-holefilled.vtk 50
bunny-holefilled-max-curv-1-collapse.vtk
--
1.7.2.5