[PATCH 19/19] New application: apps/graph-morpho/asf-image2d.
* apps/graph-morpho/asf-image2d.cc: New. * apps/graph-morpho/Makefile.am (noinst_PROGRAMS): Add asf-image2d. (asf_image2d_SOURCES): New. (TESTS): Remove asf-complex1d. --- milena/ChangeLog | 10 +++++ milena/apps/graph-morpho/Makefile.am | 5 ++- milena/apps/graph-morpho/asf-image2d.cc | 57 +++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 milena/apps/graph-morpho/asf-image2d.cc diff --git a/milena/ChangeLog b/milena/ChangeLog index 64302c1..4b18664 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,15 @@ 2009-09-21 Roland Levillain <roland@lrde.epita.fr> + New application: apps/graph-morpho/asf-image2d. + + * apps/graph-morpho/asf-image2d.cc: New. + * apps/graph-morpho/Makefile.am + (noinst_PROGRAMS): Add asf-image2d. + (asf_image2d_SOURCES): New. + (TESTS): Remove asf-complex1d. + +2009-09-21 Roland Levillain <roland@lrde.epita.fr> + New application: apps/graph-morpho/samples-image2d. * apps/graph-morpho/samples-image2d.cc: New. diff --git a/milena/apps/graph-morpho/Makefile.am b/milena/apps/graph-morpho/Makefile.am index 3c2ee26..70e177e 100644 --- a/milena/apps/graph-morpho/Makefile.am +++ b/milena/apps/graph-morpho/Makefile.am @@ -22,12 +22,13 @@ AM_CXXFLAGS = $(APPS_CXXFLAGS) noinst_HEADERS = io.hh morpho.hh make_complex2d.hh -noinst_PROGRAMS = samples-complex1d samples-image2d asf-complex1d +noinst_PROGRAMS = samples-complex1d samples-image2d asf-complex1d asf-image2d samples_complex1d_SOURCES = samples-complex1d.cc samples_image2d_SOURCES = samples-image2d.cc asf_complex1d_SOURCES = asf-complex1d.cc +asf_image2d_SOURCES = asf-image2d.cc -TESTS = samples-complex1d asf-complex1d samples-image2d +TESTS = samples-complex1d samples-image2d # Graph images stored in 2D PBM files. EXTRA_DIST = x.pbm y.pbm z.pbm diff --git a/milena/apps/graph-morpho/asf-image2d.cc b/milena/apps/graph-morpho/asf-image2d.cc new file mode 100644 index 0000000..395d20d --- /dev/null +++ b/milena/apps/graph-morpho/asf-image2d.cc @@ -0,0 +1,57 @@ +// Copyright (C) 2009 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 Alternate Sequential Filters in graph space implemented on +/// mln::image2d-based cubical complexes. + +#include <mln/io/pbm/load.hh> +#include <mln/io/pbm/save.hh> + +#include "apps/graph-morpho/morpho.hh" + +#include "apps/graph-morpho/make_complex2d.hh" +#include "apps/data.hh" + + +int main() +{ + using namespace mln; + + // Remove borders so as to avoid side effects. + border::thickness = 0; + + // Input image. + image2d<bool> input = + io::pbm::load(MLN_APPS_DIR "/graph-morpho/zebra-noisy.pbm"); + + // Create an binary 2d image representing a 4-connexity graph image + // (actually, a cubical 2-complex) by doubling the resolution of the + // input image to insert edges (and squares) between pixels. + image2d<bool> input_x2 = make_complex2d(input); + + // ASF. + io::pbm::save(unmake_complex2d(asf(input_x2, 2)), "asf_ima_2.pbm"); +} -- 1.6.4.2
participants (1)
-
Roland Levillain