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

Introduce a no-constraint functor to replace fun::p2b::tautology.

	* mln/fun/p2b/antilogy.hh,
	* mln/fun/p2b/tautology.hh:
	Do not include mln/core/alias/point2d.hh.
	* mln/topo/no_constraint.hh: New file.
	* mln/topo/skeleton/breadth_first_thinning.hh,
	* mln/topo/skeleton/priority_driven_thinning.hh:
	Use mln::topo::no_constraint instead of mln::fun::p2b::tautology.
	Do not include the standard header `algorithm'.
	* headers.mk, tests/unit_test/unit-tests.mk: Regen.
parent 91582ecb
2011-06-13 Roland Levillain <roland@lrde.epita.fr>
Introduce a no-constraint functor to replace fun::p2b::tautology.
* mln/fun/p2b/antilogy.hh,
* mln/fun/p2b/tautology.hh:
Do not include mln/core/alias/point2d.hh.
* mln/topo/no_constraint.hh: New file.
* mln/topo/skeleton/breadth_first_thinning.hh,
* mln/topo/skeleton/priority_driven_thinning.hh:
Use mln::topo::no_constraint instead of mln::fun::p2b::tautology.
Do not include the standard header `algorithm'.
* headers.mk, tests/unit_test/unit-tests.mk: Regen.
2011-07-13 Roland Levillain <roland@lrde.epita.fr>
 
Factor code of 2D skeletonizations in apps/generic-skel/.
......@@ -1081,6 +1081,7 @@ mln/topo/is_simple_point3d.hh \
mln/topo/n_face.hh \
mln/topo/n_face_iter.hh \
mln/topo/n_faces_set.hh \
mln/topo/no_constraint.hh \
mln/topo/skeleton/breadth_first_thinning.hh \
mln/topo/skeleton/crest.hh \
mln/topo/skeleton/is_simple_point.hh \
......
......@@ -30,7 +30,6 @@
/// \brief Definition of a p2b function always returning \c false.
# include <mln/core/concept/function.hh>
# include <mln/core/alias/point2d.hh>
namespace mln
......
......@@ -30,7 +30,6 @@
/// \brief Definition of a p2b function always returning \c true.
# include <mln/core/concept/function.hh>
# include <mln/core/alias/point2d.hh>
namespace mln
......
// 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.
#ifndef MLN_TOPO_NO_CONSTRAINT_HH
# define MLN_TOPO_NO_CONSTRAINT_HH
/// \file
/// \brief Definition of a functor expressing a lack of constraint.
# include <mln/core/concept/function.hh>
# include <mln/core/concept/image.hh>
namespace mln
{
namespace topo
{
/// \brief A constraint functor always returning \c true.
///
/// \see mln::fun::p2b::tautology
struct no_constraint : public Function_v2b<no_constraint>
{
typedef bool result;
/// Dummy setter (does nothing).
template <typename I>
void set_image(const Image<I>& ima) const;
template <typename P>
bool operator()(const P& p) const;
};
# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
void
no_constraint::set_image(const Image<I>& /* ima */) const
{
}
template <typename P>
inline
bool
no_constraint::operator()(const P& /* p */) const
{
return true;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::topo
} // end of namespace mln
#endif // ! MLN_TOPO_NO_CONSTRAINT_HH
......@@ -30,8 +30,14 @@
/// \file
/// \brief Computing a skeleton by using breadth-first thinning on a
/// binary image.
# include <algorithm>
///
/// Careful: The meaning of the `constraint' is inversed with respect
/// to the definitions used in
///
/// Gilles Bertrand and Michel Couprie: Transformations topologiques
/// discrtes. In David Coeurjolly, Annick Montanvert and Jean-Marc
/// Chassery, eds.: Gomtrie discrte et images numriques. Hermes
/// Sciences Publications (2007), pages 187--209.
# include <mln/core/routine/duplicate.hh>
......@@ -40,7 +46,7 @@
# include <mln/core/site_set/p_queue_fast.hh>
# include <mln/fun/p2b/tautology.hh>
# include <mln/topo/no_constraint.hh>
# include <mln/data/fill.hh>
......@@ -181,8 +187,11 @@ namespace mln
Function_v2b<F>& is_simple,
G& detach)
{
// mln::topo::no_constraint is a dummy functor always
// returning `true'.
no_constraint constraint;
return breadth_first_thinning(input, nbh, is_simple, detach,
fun::p2b::tautology());
constraint);
}
# endif // MLN_INCLUDE_ONLY
......
......@@ -30,8 +30,14 @@
/// \file
/// \brief Computing a skeleton by using priority-driven thinning on a
/// binary image.
# include <algorithm>
///
/// Careful: The meaning of the `constraint' is inversed with respect
/// to the definitions used in
///
/// Gilles Bertrand and Michel Couprie: Transformations topologiques
/// discrtes. In David Coeurjolly, Annick Montanvert and Jean-Marc
/// Chassery, eds.: Gomtrie discrte et images numriques. Hermes
/// Sciences Publications (2007), pages 187--209.
# include <mln/core/routine/duplicate.hh>
......@@ -41,7 +47,7 @@
# include <mln/core/site_set/p_queue_fast.hh>
# include <mln/core/site_set/p_priority.hh>
# include <mln/fun/p2b/tautology.hh>
# include <mln/topo/no_constraint.hh>
# include <mln/data/fill.hh>
......@@ -192,8 +198,11 @@ namespace mln
G& detach,
const Image<J>& priority)
{
// mln::topo::no_constraint is a dummy functor always
// returning `true'.
no_constraint constraint;
return priority_driven_thinning(input, nbh, is_simple, detach,
priority, fun::p2b::tautology());
priority, constraint);
}
# endif // MLN_INCLUDE_ONLY
......
......@@ -1131,6 +1131,7 @@ mln_topo_is_simple_point3d \
mln_topo_n_face \
mln_topo_n_face_iter \
mln_topo_n_faces_set \
mln_topo_no_constraint \
mln_topo_skeleton_breadth_first_thinning \
mln_topo_skeleton_crest \
mln_topo_skeleton_is_simple_point \
......
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