
* mln/morpho/meyer_wst.hh: Remove. Superseded by mln/morpho/watershed/flooding.hh. * headers.mk, * tests/unit_test/unit-tests.mk: Regen * tests/morpho/meyer_wst.cc, * tests/morpho/meyer_wst_long.cc: Remove tests. * tests/morpho/Makefile.am (check_PROGRAMS): Remove meyer_wst.cc and meyer_wst_long.cc. (meyer_wst_long_CXXFLAGS): Remove. (MOSTLYCLEANFILES): Adjust. --- milena/ChangeLog | 17 +++ milena/headers.mk | 1 - milena/mln/morpho/meyer_wst.hh | 215 --------------------------------- milena/tests/morpho/Makefile.am | 8 +- milena/tests/morpho/meyer_wst.cc | 56 --------- milena/tests/morpho/meyer_wst_long.cc | 73 ----------- milena/tests/unit_test/unit-tests.mk | 1 - 7 files changed, 18 insertions(+), 353 deletions(-) delete mode 100644 milena/mln/morpho/meyer_wst.hh delete mode 100644 milena/tests/morpho/meyer_wst.cc delete mode 100644 milena/tests/morpho/meyer_wst_long.cc diff --git a/milena/ChangeLog b/milena/ChangeLog index a371d41..e6a45ea 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,22 @@ 2013-03-05 Roland Levillain <roland@lrde.epita.fr> + Remove morpho::meyer_wst. + + * mln/morpho/meyer_wst.hh: Remove. + Superseded by mln/morpho/watershed/flooding.hh. + * headers.mk, + * tests/unit_test/unit-tests.mk: + Regen + * tests/morpho/meyer_wst.cc, + * tests/morpho/meyer_wst_long.cc: + Remove tests. + * tests/morpho/Makefile.am (check_PROGRAMS): Remove + meyer_wst.cc and meyer_wst_long.cc. + (meyer_wst_long_CXXFLAGS): Remove. + (MOSTLYCLEANFILES): Adjust. + +2013-03-05 Roland Levillain <roland@lrde.epita.fr> + Replace remaining uses of morpho::meyer_wst in Milena. * doc/examples/trash/tuto_bis.cc, diff --git a/milena/headers.mk b/milena/headers.mk index 8997e6b..1bf94d3 100644 --- a/milena/headers.mk +++ b/milena/headers.mk @@ -933,7 +933,6 @@ mln/morpho/internal/elementary.hh \ mln/morpho/laplacian.hh \ mln/morpho/leveling_filter.hh \ mln/morpho/line_gradient.hh \ -mln/morpho/meyer_wst.hh \ mln/morpho/min.hh \ mln/morpho/minus.hh \ mln/morpho/opening/algebraic.hh \ diff --git a/milena/mln/morpho/meyer_wst.hh b/milena/mln/morpho/meyer_wst.hh deleted file mode 100644 index 575c38c..0000000 --- a/milena/mln/morpho/meyer_wst.hh +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (C) 2008, 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. - -#ifndef MLN_MORPHO_MEYER_WST_HH -# define MLN_MORPHO_MEYER_WST_HH - -/** \file - \brief Meyer's Watershed Transform (WST) algorithm. - - The Watershed Transform algorithm from Meyer using a hierarchical - queue. - - Reference: - Fernand Meyer. Un algorithme optimal de ligne de partage des - eaux. In: Actes du 8ème Congrès AFCET, Lyon-Villeurbanne, France - (1991), pages 847--859. */ - - -/* FIXME: This file is outdated. Compare this file with - mln/morpho/watershed/flooding.hh, and remove the former when - - 1. it is entirely covered by the latter; - 2. clients (including tests and Milena) are updated to use - mln::morpho::watershed::flooding. */ - - -# include <mln/trait/ch_value.hh> - -// FIXME: See below. -# include <mln/util/greater_psite.hh> -# include <mln/morpho/includes.hh> -# include <mln/literal/zero.hh> -# include <mln/labeling/regional_minima.hh> - -# include <mln/core/site_set/p_queue_fast.hh> -# include <mln/core/site_set/p_priority.hh> - - -namespace mln -{ - - namespace morpho - { - /** \brief Meyer's Watershed Transform (WST) algorithm. - - \param[in] input The input image. - \param[in] nbh The connexity of markers. - \param[out] nbasins The number of basins. - - \li \p L is the type of labels, used to number the watershed - itself (with the minimal value), and the basins. - \li \p I is the exact type of the input image. - \li \p N is the exact type of the neighborhood used to express - \a input's connexity. */ - template <typename L, typename I, typename N> - mln_ch_value(I, L) - meyer_wst(const Image<I>& input, const Neighborhood<N>& nbh, - L& nbasins); - - /** \brief Meyer's Watershed Transform (WST) algorithm, with no - count of basins. - - \param[in] input The input image. - \param[in] nbh The connexity of markers. - - \li \p L is the type of labels, used to number the watershed - itself (with the minimal value), and the basins. - \li \p I is the exact type of the input image. - \li \p N is the exact type of the neighborhood used to express - \a input's connexity. - - Note that the first parameter, \p L, is not automatically - valued from the type of the actual argument during implicit - instantiation: you have to explicitly pass this parameter at - call sites. */ - template <typename L, typename I, typename N> - mln_ch_value(I, L) - meyer_wst(const Image<I>& input, const Neighborhood<N>& nbh); - - - -# ifndef MLN_INCLUDE_ONLY - - template <typename L, typename I, typename N> - mln_ch_value(I, L) - meyer_wst(const Image<I>& input_, const Neighborhood<N>& nbh_, - L& nbasins) - { - trace::entering("morpho::meyer_wst"); - /* FIXME: Ensure the input image has scalar values. */ - - const I input = exact(input_); - const N nbh = exact(nbh_); - - typedef L marker; - const marker unmarked = literal::zero; - - typedef mln_value(I) V; - const V max = mln_max(V); - - // Initialize the output with the markers (minima components). - mln_ch_value(I, marker) output = - labeling::regional_minima (input, nbh, nbasins); - - typedef mln_psite(I) psite; - - // Ordered queue. - typedef p_queue_fast<psite> Q; - p_priority<V, Q> queue; - - // In_queue structure to avoid processing sites several times. - mln_ch_value(I, bool) in_queue; - initialize(in_queue, input); - data::fill(in_queue, false); - - // Insert every neighbor P of every marked area in a - // hierarchical queue, with a priority level corresponding to - // the grey level input(P). - mln_piter(I) p(output.domain()); - mln_niter(N) n(nbh, p); - for_all (p) - if (output(p) == unmarked) - for_all(n) - if (output.domain().has(n) && output(n) != unmarked) - { - queue.push(max - input(p), p); - in_queue(p) = true; - break; - } - - /* Until the queue is empty, extract a psite P from the - hierarchical queue, at the highest priority level, that is, - the lowest level. */ - while (! queue.is_empty()) - { - psite p = queue.front(); - queue.pop(); - // Last seen marker adjacent to P. - marker adjacent_marker = unmarked; - // Has P a single adjacent marker? - bool single_adjacent_marker_p = true; - mln_niter(N) n(nbh, p); - for_all(n) - if (output.domain().has(n) && output(n) != unmarked) - { - if (adjacent_marker == unmarked) - { - adjacent_marker = output(n); - single_adjacent_marker_p = true; - } - else - if (adjacent_marker != output(n)) - { - single_adjacent_marker_p = false; - break; - } - } - /* If the neighborhood of P contains only psites with the - same label, then P is marked with this label, and its - neighbors that are not yet marked are put into the - hierarchical queue. */ - if (single_adjacent_marker_p) - { - output(p) = adjacent_marker; - for_all(n) - if (output.domain().has(n) && output(n) == unmarked - && ! in_queue(n)) - { - queue.push(max - input(n), n); - in_queue(n) = true; - } - } - } - trace::exiting("morpho::meyer_wst"); - return output; - } - - template <typename L, typename I, typename N> - mln_ch_value(I, L) - meyer_wst(const Image<I>& input, const Neighborhood<N>& nbh) - { - L nbasins; - return meyer_wst<L>(input, nbh, nbasins); - } - -# endif // ! MLN_INCLUDE_ONLY - - } // end of namespace mln::morpho - -} // end of namespace mln - - -#endif // ! MLN_MORPHO_MEYER_WST_HH diff --git a/milena/tests/morpho/Makefile.am b/milena/tests/morpho/Makefile.am index 3d6e264..d9fef8b 100644 --- a/milena/tests/morpho/Makefile.am +++ b/milena/tests/morpho/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development +# Copyright (C) 2007, 2008, 2009, 2010, 2013 EPITA Research and Development # Laboratory (LRDE). # # This file is part of Olena. @@ -44,8 +44,6 @@ check_PROGRAMS = \ lena_line_graph_image_wst2 \ line_graph_image_wst \ line_graph_image_morpho \ - meyer_wst \ - meyer_wst_long \ rank_filter \ Rd \ skeleton_constrained \ @@ -74,8 +72,6 @@ lena_line_graph_image_wst1_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED) lena_line_graph_image_wst2_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED) -meyer_wst_long_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED) - TESTS = $(check_PROGRAMS) @@ -94,7 +90,5 @@ MOSTLYCLEANFILES = \ laplacian-out.pgm \ lena_line_graph_image_wst1-out.ppm \ lena_line_graph_image_wst2-out.ppm \ - meyer_wst-out.pgm \ - meyer_wst_long-out.ppm \ thinning-out.pbm \ thinning-out.pgm diff --git a/milena/tests/morpho/meyer_wst.cc b/milena/tests/morpho/meyer_wst.cc deleted file mode 100644 index bb5de84..0000000 --- a/milena/tests/morpho/meyer_wst.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2008, 2009, 2010 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. - -#include <iostream> - -#include <mln/core/image/image2d.hh> -#include <mln/core/alias/window2d.hh> -#include <mln/core/alias/neighb2d.hh> - -#include <mln/value/int_u8.hh> - -#include <mln/morpho/meyer_wst.hh> - -#include <mln/io/pgm/load.hh> -#include <mln/io/pgm/save.hh> - -#include "tests/data.hh" - - -int main() -{ - using namespace mln; - using value::int_u8; - - image2d<int_u8> input; - io::pgm::load(input, MLN_IMG_DIR "/squares.pgm"); - - typedef int_u8 L; - L nbasins; - image2d<L> output = morpho::meyer_wst(input, c4(), nbasins); - - io::pgm::save(output, "meyer_wst-out.pgm"); -} diff --git a/milena/tests/morpho/meyer_wst_long.cc b/milena/tests/morpho/meyer_wst_long.cc deleted file mode 100644 index 7b9ead9..0000000 --- a/milena/tests/morpho/meyer_wst_long.cc +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2008, 2009, 2010 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. - -#include <iostream> - -#include <mln/core/image/dmorph/image_if.hh> -#include <mln/core/image/image2d.hh> -#include <mln/core/alias/window2d.hh> -#include <mln/core/alias/neighb2d.hh> - -#include <mln/value/int_u8.hh> -#include <mln/value/label_16.hh> - -#include <mln/morpho/gradient.hh> -#include <mln/morpho/closing/area.hh> -#include <mln/morpho/meyer_wst.hh> - -#include <mln/convert/to_window.hh> - -#include <mln/pw/cst.hh> -#include <mln/pw/value.hh> - -#include <mln/io/pgm/load.hh> -#include <mln/io/ppm/save.hh> -#include <mln/labeling/colorize.hh> - -#include "tests/data.hh" - - -int main() -{ - using namespace mln; - using value::int_u8; - - image2d<int_u8> input; - io::pgm::load(input, MLN_IMG_DIR "/lena.pgm"); - - image2d<int_u8> - grad = morpho::gradient(input, c4().win()), - clo = morpho::closing::area(grad, c4(), 200); - - // Perform a Watershed Transform. - typedef value::label_16 L; - L nbasins; - image2d<L> ws = morpho::meyer_wst(clo, c4(), nbasins); - - // Save the image in color. - io::ppm::save(labeling::colorize(value::rgb8(), ws, nbasins), - "meyer_wst_long-out.ppm"); -} diff --git a/milena/tests/unit_test/unit-tests.mk b/milena/tests/unit_test/unit-tests.mk index db1c67b..683a672 100644 --- a/milena/tests/unit_test/unit-tests.mk +++ b/milena/tests/unit_test/unit-tests.mk @@ -962,7 +962,6 @@ mln_morpho_internal_elementary \ mln_morpho_laplacian \ mln_morpho_leveling_filter \ mln_morpho_line_gradient \ -mln_morpho_meyer_wst \ mln_morpho_min \ mln_morpho_minus \ mln_morpho_opening_algebraic \ -- 1.7.2.5