
* mln/core/image/complex_lower_neighborhood.hh, * mln/core/image/complex_higher_neighborhood.hh: New. --- milena/ChangeLog | 8 ++ .../mln/core/image/complex_higher_neighborhood.hh | 117 ++++++++++++++++++++ .../mln/core/image/complex_lower_neighborhood.hh | 117 ++++++++++++++++++++ 3 files changed, 242 insertions(+), 0 deletions(-) create mode 100644 milena/mln/core/image/complex_higher_neighborhood.hh create mode 100644 milena/mln/core/image/complex_lower_neighborhood.hh diff --git a/milena/ChangeLog b/milena/ChangeLog index e44301f..be5fc43 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,13 @@ 2008-10-01 Roland Levillain <roland@lrde.epita.fr> + Add neighborhoods of lower- and higher-dimension adjacent faces. + + * mln/core/image/complex_lower_neighborhood.hh, + * mln/core/image/complex_higher_neighborhood.hh: + New. + +2008-10-01 Roland Levillain <roland@lrde.epita.fr> + * tests/core/image/complex_image.cc: Alias mln::point2d to P. 2008-10-01 Roland Levillain <roland@lrde.epita.fr> diff --git a/milena/mln/core/image/complex_higher_neighborhood.hh b/milena/mln/core/image/complex_higher_neighborhood.hh new file mode 100644 index 0000000..2b52c5b --- /dev/null +++ b/milena/mln/core/image/complex_higher_neighborhood.hh @@ -0,0 +1,117 @@ +// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library 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 this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library 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_CORE_COMPLEX_HIGHER_NEIGHBORHOOD_HH +# define MLN_CORE_COMPLEX_HIGHER_NEIGHBORHOOD_HH + +/// \file mln/core/complex_higher_neighborhood.hh +/// \brief A neighborhood centered on a n-face of complex returning its +/// adjacent (n+1)-faces. + +# include <mln/core/concept/neighborhood.hh> + +# include <mln/core/site_set/complex_psite.hh> + +# include <mln/topo/adj_higher_face_iter.hh> + +// FIXME: Factor with complex_lower_neighborhood. + + +namespace mln +{ + // Fwd decls. + template <typename I, typename P, typename N> + class complex_neighborhood_fwd_piter; + template <typename I, typename P, typename N> + class complex_neighborhood_bkd_piter; + + + /// \brief Neighborhood centered on a n-face of complex returning its + /// adjacent (n-1)-faces. + template <unsigned D, typename P> + class complex_higher_neighborhood + : public Neighborhood< complex_higher_neighborhood<D, P> > + { + typedef complex_higher_neighborhood<D, P> self_; + + // FIXME: The associated complex iterators. + public: + typedef topo::adj_higher_face_fwd_iter<D> complex_fwd_iter; + typedef topo::adj_higher_face_bkd_iter<D> complex_bkd_iter; + + public: + /// Associated types. + /// \{ + /// The type of psite corresponding to the neighborhood. + typedef complex_psite<D, P> psite; + /// The type of site corresponding to the neighborhood. + typedef mln_site(psite) site; + + /// \brief Point_Iterator type to browse the psites of the neighborhood + /// w.r.t. the ordering of vertices. + typedef + complex_neighborhood_fwd_piter<complex_fwd_iter, P, self_> fwd_niter; + + /// \brief Point_Iterator type to browse the psites of the neighborhood + /// w.r.t. the reverse ordering of vertices. + typedef + complex_neighborhood_bkd_piter<complex_bkd_iter, P, self_> bkd_niter; + + /// The default niter type. + typedef fwd_niter niter; + /// \} + + /// Conversions. + /// \{ + /// The window type corresponding to this neighborhood. + // FIXME: Dummy. + typedef self_ window; + /// Create a window corresponding to this neighborhood. + const window& win() const; + /// \} + }; + + + +# ifndef MLN_INCLUDE_ONLY + + // FIXME: Dummy. + template <unsigned D, typename P> + inline + // FIXME: Change (dummy) type. + const typename complex_higher_neighborhood<D, P>::window& + complex_higher_neighborhood<D, P>::win() const + { + // FIXME: Dummy. + return *this; + } + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + +#endif // ! MLN_CORE_COMPLEX_HIGHER_NEIGHBORHOOD_HH diff --git a/milena/mln/core/image/complex_lower_neighborhood.hh b/milena/mln/core/image/complex_lower_neighborhood.hh new file mode 100644 index 0000000..7eb8fc4 --- /dev/null +++ b/milena/mln/core/image/complex_lower_neighborhood.hh @@ -0,0 +1,117 @@ +// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library 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 this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library 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_CORE_COMPLEX_LOWER_NEIGHBORHOOD_HH +# define MLN_CORE_COMPLEX_LOWER_NEIGHBORHOOD_HH + +/// \file mln/core/complex_lower_neighborhood.hh +/// \brief A neighborhood centered on a n-face of complex returning its +/// adjacent (n-1)-faces. + +# include <mln/core/concept/neighborhood.hh> + +# include <mln/core/site_set/complex_psite.hh> + +# include <mln/topo/adj_lower_face_iter.hh> + +// FIXME: Factor with complex_higher_neighborhood. + + +namespace mln +{ + // Fwd decls. + template <typename I, typename P, typename N> + class complex_neighborhood_fwd_piter; + template <typename I, typename P, typename N> + class complex_neighborhood_bkd_piter; + + + /// \brief Neighborhood centered on a n-face of complex returning its + /// adjacent (n-1)-faces. + template <unsigned D, typename P> + class complex_lower_neighborhood + : public Neighborhood< complex_lower_neighborhood<D, P> > + { + typedef complex_lower_neighborhood<D, P> self_; + + // FIXME: The associated complex iterators. + public: + typedef topo::adj_lower_face_fwd_iter<D> complex_fwd_iter; + typedef topo::adj_lower_face_bkd_iter<D> complex_bkd_iter; + + public: + /// Associated types. + /// \{ + /// The type of psite corresponding to the neighborhood. + typedef complex_psite<D, P> psite; + /// The type of site corresponding to the neighborhood. + typedef mln_site(psite) site; + + /// \brief Point_Iterator type to browse the psites of the neighborhood + /// w.r.t. the ordering of vertices. + typedef + complex_neighborhood_fwd_piter<complex_fwd_iter, P, self_> fwd_niter; + + /// \brief Point_Iterator type to browse the psites of the neighborhood + /// w.r.t. the reverse ordering of vertices. + typedef + complex_neighborhood_bkd_piter<complex_bkd_iter, P, self_> bkd_niter; + + /// The default niter type. + typedef fwd_niter niter; + /// \} + + /// Conversions. + /// \{ + /// The window type corresponding to this neighborhood. + // FIXME: Dummy. + typedef self_ window; + /// Create a window corresponding to this neighborhood. + const window& win() const; + /// \} + }; + + + +# ifndef MLN_INCLUDE_ONLY + + // FIXME: Dummy. + template <unsigned D, typename P> + inline + // FIXME: Change (dummy) type. + const typename complex_lower_neighborhood<D, P>::window& + complex_lower_neighborhood<D, P>::win() const + { + // FIXME: Dummy. + return *this; + } + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + +#endif // ! MLN_CORE_COMPLEX_LOWER_NEIGHBORHOOD_HH -- 1.6.0.1