Commit fd81df40 authored by Roland Levillain's avatar Roland Levillain
Browse files

New app: apps/generic-skel/image3d-skel-unconstrained.

	* apps/generic-skel/image3d-skel-unconstrained.cc: New.
	* apps/generic-skel/Makefile.am (bin_PROGRAMS):
	Add image3d-skel-unconstrained.
	(image3d_skel_unconstrained_SOURCES): New.
	(TESTS): Rename as...
	(generated_tests): New variable.
	($(generated_tests)): New target.
	Supersede...
	(test-image2d-skel-unconstrained test-image2d-skel-with-end-points):
	...this target.
	(CLEANFILES): Set to $(generated_tests).
	(TESTS): Add $(generated_tests).
	Add image3d-skel-unconstrained and image3d-skel-with-end-points.
	(MOSTLYCLEANFILES): Add image3d-skel-unconstrained-input.raw and
	image3d-skel-unconstrained-skel.raw.
parent 2a45daf1
2011-06-14 Roland Levillain <roland@lrde.epita.fr>
New app: apps/generic-skel/image3d-skel-unconstrained.
* apps/generic-skel/image3d-skel-unconstrained.cc: New.
* apps/generic-skel/Makefile.am (bin_PROGRAMS):
Add image3d-skel-unconstrained.
(image3d_skel_unconstrained_SOURCES): New.
(TESTS): Rename as...
(generated_tests): New variable.
($(generated_tests)): New target.
Supersede...
(test-image2d-skel-unconstrained test-image2d-skel-with-end-points):
...this target.
(CLEANFILES): Set to $(generated_tests).
(TESTS): Add $(generated_tests).
Add image3d-skel-unconstrained and image3d-skel-with-end-points.
(MOSTLYCLEANFILES): Add image3d-skel-unconstrained-input.raw and
image3d-skel-unconstrained-skel.raw.
2011-06-14 Roland Levillain <roland@lrde.epita.fr>
 
Isolate reusable code from image3d-skel-with-end-points.
......@@ -23,24 +23,38 @@ APPS_CXXFLAGS = @APPS_CXXFLAGS@
AM_CXXFLAGS = $(APPS_CXXFLAGS)
# FIXME: Really install these programs?
bin_PROGRAMS = \
image2d-skel-unconstrained \
image2d-skel-with-end-points \
image3d_skel_with_end_points
\
image3d-skel-unconstrained \
image3d-skel-with-end-points
# 2D cases.
image2d_skel_unconstrained_SOURCES = image2d-skel-unconstrained.cc image2d-skel.hh
image2d_skel_with_end_points_SOURCES = image2d-skel-with-end-points.cc image2d-skel.hh
# 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
EXTRA_DIST = test-image2d-skel-unconstrained.in test-image2d-skel-with-end-points.in
EXTRA_DIST = \
test-image2d-skel-unconstrained.in \
test-image2d-skel-with-end-points.in
# Use Make to generate Doxyfile instead of `configure', as advised by
# Autoconf's manual (see section ``Installation Directory
# Variables'').
edit = sed -e 's|@top_srcdir[@]|$(top_srcdir)|g'
test-image2d-skel-unconstrained test-image2d-skel-with-end-points: Makefile
# Tests for the 2D case.
generated_tests = \
test-image2d-skel-unconstrained \
test-image2d-skel-with-end-points
$(generated_tests): Makefile
rm -f $@ $@.tmp
srcdir=''; \
test -f ./$@.in || srcdir=$(srcdir)/; \
......@@ -52,14 +66,20 @@ test-image2d-skel-unconstrained test-image2d-skel-with-end-points: Makefile
test-image2d-skel-unconstrained: $(srcdir)/test-image2d-skel-unconstrained.in
test-image2d-skel-with-end-points: $(srcdir)/test-image2d-skel-with-end-points.in
TESTS = test-image2d-skel-unconstrained test-image2d-skel-with-end-points
CLEANFILES = test-image2d-skel-unconstrained test-image2d-skel-with-end-points
CLEANFILES = $(generated_tests)
TESTS = $(generated_tests)
# FIXME: Exercise image3d-skel-with-end-points (when its input can be
# passed as a command-line argument).
# Tests for the 3D case.
# FIXME: Create real test cases with inputs passed as argument.
TESTS += \
image3d-skel-unconstrained \
image3d-skel-with-end-points
# FIXME: Rename outputs to have their names use their generator as prefix.
# FIXME: Rename all outputs to have their names use their generator as prefix.
MOSTLYCLEANFILES = \
image3d-skel-unconstrained-input.raw \
image3d-skel-unconstrained-skel.raw \
image3d-skel-with-end-points-input.raw \
image3d-skel-with-end-points-skel.raw \
picasso-skel-unconstrained.pbm \
......
// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, version 2 of the License.
//
// Olena is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to produce
// an executable, this file does not by itself cause the resulting
// executable to be covered by the GNU General Public License. This
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
/// \file
/// \brief A program computing a binary skeleton of a 3D image.
#include <fstream>
#include <mln/core/image/image3d.hh>
#include <mln/core/alias/neighb3d.hh>
#include <mln/make/box3d.hh>
#include <mln/core/image/vmorph/fun_image.hh>
#include <mln/fun/v2b/lnot.hh>
#include <mln/border/fill.hh>
#include <mln/labeling/blobs.hh>
#include <mln/topo/skeleton/breadth_first_thinning.hh>
#include <mln/topo/is_simple_point3d.hh>
#include <mln/topo/detach_point.hh>
#include <mln/topo/is_not_end_point.hh>
#include "apps/data.hh"
#include "image3d-skel.hh"
// FIXME: Have this program take a 3D image as input (instead of
// hard-coding it here).
int main()
{
using namespace mln;
typedef image3d<bool> I;
typedef neighb3d N;
border::thickness = 1;
// I whole_input = load_pgm_3d(MLN_IMG_DIR "/bunny.pgm");
// // FIXME: Work on a small image in a first time, then process the
// // whole image.
// I input = subsampling_3d(whole_input, 4);
// Input image.
//
// Use a smaller half-length than the default one (100) as this
// program does not use the fast version of the simple 3D point
// criterion.
I input = make_triple_torus(20);
std::cerr << input.domain() << std::endl;
save_raw_3d(input, "image3d-skel-unconstrained-input.raw");
// 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.
N nbh_fg = c26();
// Background neighborhood.
N nbh_bg = c6();
// Simplicity criterion functor.
topo::is_simple_point3d<I, N> is_simple(nbh_fg, nbh_bg);
// Simple point detach procedure.
topo::detach_point<I> detach;
I output = topo::skeleton::breadth_first_thinning(input, nbh_fg,
is_simple,
detach);
save_raw_3d(output, "image3d-skel-unconstrained-skel.raw");
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment