Commit 7b62e266 authored by Roland Levillain's avatar Roland Levillain
Browse files

Add the first two morphers: identity and neighborhood addition.

	* oln/core/typedefs.hh (morpher_type, neighborhood_type): New
	typedef declarations.
	(neighb_type, image_neighbness_type, image_constness_type)
	(image_dimension_type, image_typeness_type)
	(image_valuedness_type, image_rawness_type): Remove typedef
	declarations.
	* oln/core/image_entry.hh
	(single_vtype<image_entry<E>, typedef_::morpher_type>): New
	virtual type.
	* oln/core/abstract/image.hh: Check it.

	* oln/core/abstract/image_hierarchies.hh
	(image_dimension_hierarchy, image_type_hierarchy): Rename as...
	(image_hierarchy_wrt_dimension, image_hierarchy_wrt_type):
	...this.
	(image_neighborhood_hierarchy): Make it the third image hierarchy.
	Rename as...
	(image_hierarchy_wrt_neighborhood).
	(image_value_hierarchy, image_rawness_hierarchy): Adjust and
	rename as...
	(image_hierarchy_wrt_value, image_hierarchy_wrt_data_retrieval):
	...this.	
	(oln/core/abstract/image_having_neighborhood.hh): Include it.
	* oln/core/abstract/image_dimension.hh:
	s/image_dimension_hierarchy/image_hierarchy_wrt_dimension/.
	(oln::abstract::image1d, oln::abstract::image2d)
	(oln::abstract::image3d): Inherit from automatic::impl.
	* oln/core/abstract/image_type.hh,
	* oln/core/abstract/image_type_integre.hh:
	s/image_type_hierarchy/image_hierarchy_wrt_type/.
	* oln/core/abstract/image_having_neighborhood.hh: New
	abstraction.
	* oln/automatic/image_having_neighborhood.hh: New automatic
	implementation.

	* oln/morpher/internal/image_extension.hh: New abstract
	class.
	* oln/morpher/identity.hh,
	* oln/morpher/add_neighborhood.hh: New morphers.
	* tests/morphers.cc, tests/identity_morpher.cc: New tests.

	* oln/Makefile.am (nobase_oln_HEADERS): Catch up with renamings
	from the previous patches.
	Add automatic/image_having_neighborhood.hh,
	core/abstract/image_having_neighborhood.hh,
	morpher/internal/image_extension.hh,
	morpher/add_neighborhood.hh and
	morpher/identity.hh.
	* tests/Makefile.am (check_PROGRAMS): Add identity_morpher and
	morphers.
	(identity_morpher_SOURCES, morphers_SOURCES): New.
	* oln/core/abstract/topology_hierarchies.hh: Aesthetic changes.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@552 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent bb7bfc23
2006-09-18 Roland Levillain <roland@lrde.epita.fr>
Add the first two morphers: identity and neighborhood addition.
* oln/core/typedefs.hh (morpher_type, neighborhood_type): New
typedef declarations.
(neighb_type, image_neighbness_type, image_constness_type)
(image_dimension_type, image_typeness_type)
(image_valuedness_type, image_rawness_type): Remove typedef
declarations.
* oln/core/image_entry.hh
(single_vtype<image_entry<E>, typedef_::morpher_type>): New
virtual type.
* oln/core/abstract/image.hh: Check it.
* oln/core/abstract/image_hierarchies.hh
(image_dimension_hierarchy, image_type_hierarchy): Rename as...
(image_hierarchy_wrt_dimension, image_hierarchy_wrt_type):
...this.
(image_neighborhood_hierarchy): Make it the third image hierarchy.
Rename as...
(image_hierarchy_wrt_neighborhood).
(image_value_hierarchy, image_rawness_hierarchy): Adjust and
rename as...
(image_hierarchy_wrt_value, image_hierarchy_wrt_data_retrieval):
...this.
(oln/core/abstract/image_having_neighborhood.hh): Include it.
* oln/core/abstract/image_dimension.hh:
s/image_dimension_hierarchy/image_hierarchy_wrt_dimension/.
(oln::abstract::image1d, oln::abstract::image2d)
(oln::abstract::image3d): Inherit from automatic::impl.
* oln/core/abstract/image_type.hh,
* oln/core/abstract/image_type_integre.hh:
s/image_type_hierarchy/image_hierarchy_wrt_type/.
* oln/core/abstract/image_having_neighborhood.hh: New
abstraction.
* oln/automatic/image_having_neighborhood.hh: New automatic
implementation.
* oln/morpher/internal/image_extension.hh: New abstract
class.
* oln/morpher/identity.hh,
* oln/morpher/add_neighborhood.hh: New morphers.
* tests/morphers.cc, tests/identity_morpher.cc: New tests.
* oln/Makefile.am (nobase_oln_HEADERS): Catch up with renamings
from the previous patches.
Add automatic/image_having_neighborhood.hh,
core/abstract/image_having_neighborhood.hh,
morpher/internal/image_extension.hh,
morpher/add_neighborhood.hh and
morpher/identity.hh.
* tests/Makefile.am (check_PROGRAMS): Add identity_morpher and
morphers.
(identity_morpher_SOURCES, morphers_SOURCES): New.
* oln/core/abstract/topology_hierarchies.hh: Aesthetic changes.
2006-09-18 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Rename bbox point iterators.
......@@ -231,7 +288,7 @@
* oln/core/abstract/image.hh: ...here.
* oln/core/case.hh: New file.
* oln/core/abstract/image_abstractions.hh,
* olena/oln/core/abstract/entry.hh,
* oln/core/abstract/entry.hh,
* oln/core/traits.hh: Use it.
* oln/Makefile.am (nobase_oln_HEADERS): Add core/case.hh.
......
......@@ -3,6 +3,8 @@
olndir = $(includedir)/oln
nobase_oln_HEADERS = \
automatic/image_having_neighborhood.hh \
\
core/1d/grid1d.hh \
\
core/2d/grid2d.hh \
......@@ -19,42 +21,49 @@ nobase_oln_HEADERS = \
core/abstract/any.hh \
core/abstract/bbox.hh \
core/abstract/dpoint.hh \
core/abstract/dpoint_nd.hh \
core/abstract/entry.hh \
core/abstract/grid.hh \
core/abstract/image_dimension.hh \
core/abstract/image.hh \
core/abstract/image_dimension.hh \
core/abstract/image_having_neighborhood.hh \
core/abstract/image_hierarchies.hh \
core/abstract/image_type.hh \
core/abstract/image_type_integre.hh \
core/abstract/iter.hh \
core/abstract/piter.hh \
core/abstract/iterator.hh \
core/abstract/iterator_on_points.hh \
core/abstract/point.hh \
core/abstract/point_nd.hh \
core/abstract/pset_bboxed.hh \
core/abstract/pset_cnx.hh \
core/abstract/pset_fixed.hh \
core/abstract/pset.hh \
core/abstract/pset_hierarchies.hh \
core/abstract/pset_ra.hh \
core/abstract/point_set.hh \
core/abstract/point_set_being_connected.hh \
core/abstract/point_set_being_random_accessible.hh \
core/abstract/point_set_having_bbox.hh \
core/abstract/point_set_having_known_size.hh \
core/abstract/point_set_hierarchies.hh \
core/abstract/topology.hh \
core/abstract/topology_hierarchies.hh \
core/abstract/topology_being_random_accessible.hh \
core/abstract/topology_having_bbox.hh \
core/abstract/topology_hierarchies.hh \
\
core/gen/bbox.hh \
core/gen/bbox_bkd_piter.hh \
core/gen/bbox_fwd_piter.hh \
core/gen/topo_bbox.hh \
core/gen/bkd_piter.hh \
core/gen/fwd_piter.hh \
\
core/internal/dpoint_nd.hh \
core/internal/point_nd.hh \
\
core/case.hh \
core/image_entry.hh \
core/macros.hh \
core/pset_entry.hh \
core/point_set_entry.hh \
core/traits.hh \
core/traits_id.hh \
core/topology_entry.hh \
core/typedefs.hh \
core/type.hh \
\
morpher/internal/image_extension.hh \
\
morpher/add_neighborhood.hh \
morpher/identity.hh \
\
basics2d.hh
// Copyright (C) 2006 EPITA Research and Development Laboratory
//
// 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 OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
# define OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
# include <oln/core/typedefs.hh>
# include <oln/morphers/identity.hh>
# include <oln/core/abstract/image_dimension.hh>
namespace oln
{
namespace automatic
{
/// Implementation corresponding to the interface
/// oln::abstract::image1d for an identity morpher.
template <abstract::image_having_neighborhood, morpher::tag::identity,
typename E>
class impl
{
private:
typedef oln_type_of(E, neighborhood) neighborhood_t;
public:
/// Accessor delegation.
neighborhood_t impl_neighborhood()
{
return delegate().impl_neighborhood()
}
};
} // end of namespace automatic
} // end of namespace oln
#endif // ! OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
......@@ -77,6 +77,8 @@ namespace oln
stc_virtual_typedef(concrete);
stc_virtual_typedef(morpher);
decl() {
// FIXME: ...
}
......
......@@ -51,7 +51,7 @@
o
|
/switch_<image_dimension_hierarchy, I>::ret/
/switch_<image_hierarchy_wrt_dimension, I>::ret/
(image dimension selector)
^
|
......@@ -81,7 +81,9 @@ namespace oln
/// Class of 1-D images.
template <typename E>
struct image1d : public virtual image<E>
struct image1d :
public virtual image<E>,
public automatic::impl< image1d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
......@@ -90,7 +92,9 @@ namespace oln
/// Class of 2-D images.
template <typename E>
struct image2d : public virtual image<E>
struct image2d :
public virtual image<E>,
public automatic::impl< image2d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
......@@ -99,7 +103,9 @@ namespace oln
/// Class of 3-D images.
template <typename E>
struct image3d : public virtual image<E>
struct image3d :
public virtual image<E>,
public automatic::impl< image3d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
......@@ -125,7 +131,7 @@ namespace oln
/// 1-D case.
template <typename E>
struct case_< image_dimension_hierarchy, E, 1 > :
struct case_< image_hierarchy_wrt_dimension, E, 1 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid1d > >
{
typedef abstract::image1d<E> ret;
......@@ -133,7 +139,7 @@ namespace oln
/// 2-D case.
template <typename E>
struct case_< image_dimension_hierarchy, E, 2 > :
struct case_< image_hierarchy_wrt_dimension, E, 2 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid2d > >
{
typedef abstract::image2d<E> ret;
......@@ -141,7 +147,7 @@ namespace oln
/// 3-D case.
template <typename E>
struct case_< image_dimension_hierarchy, E, 3 > :
struct case_< image_hierarchy_wrt_dimension, E, 3 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid3d > >
{
typedef abstract::image3d<E> ret;
......
// Copyright (C) 2006 EPITA Research and Development Laboratory
//
// 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 OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
# define OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
# include <oln/core/abstract/image.hh>
/* Image having neighborhood hierarchy (summary).
FIXME: TODO!
Default case: If the neighborhood type returned by
`oln_type_of(I, neighborhood)', the entry is directly plugged to
abstract::image<I>. */
namespace oln
{
/*-------------------------.
| Dimension abstractions. |
`-------------------------*/
namespace abstract
{
/// Class of 1-D images.
template <typename E>
struct image_having_neighborhood :
public virtual image<E>,
public automatic::impl< image_having_neighborhood,
oln_type_of(E, morpher),
E >
{
protected:
/// Constructor (protected, empty).
image_having_neighborhood() {}
};
} // end of namespace oln::abstract
/*-------------------.
| Dimension switch. |
`-------------------*/
/// With neig
template <typename E>
struct case_< image_hierarchy_wrt_neighborhood, E, 1 > :
where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::none > >
{
typedef abstract::image_having_neighborhood<E> ret;
};
/*-----------------.
| External vtype. |
`-----------------*/
// Forward declaration.
template <typename E> struct image_entry;
/// Neighborhood type, as extended virtual type.
template <typename E>
struct ext_vtype < image_entry<E>, typedef_::neighborhood_type >
{
typedef mlc::none ret;
};
} // end of namespace oln
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
......@@ -34,24 +34,29 @@
namespace oln
{
typedef hierarchy<abstract::image, 1> image_dimension_hierarchy;
typedef hierarchy<abstract::image, 2> image_type_hierarchy;
typedef hierarchy<abstract::image, 1> image_hierarchy_wrt_dimension;
typedef hierarchy<abstract::image, 2> image_hierarchy_wrt_type;
typedef hierarchy<abstract::image, 3> image_hierarchy_wrt_neighborhood;
// FIXME: To be continued.
#if 0
typedef hierarchy<abstract::image, 3> image_value_hierarchy;
// FIXME: Rename (``rawness'' means ``crudit'' in French...).
typedef hierarchy<abstract::image, 4> image_rawness_hierarchy;
typedef hierarchy<abstract::image, 5> image_neighborhood_hierarchy;
typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_value;
typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_data_retrieval;
// ...
#endif
} // end of namespace oln
// Hierarchy 1: topology w.r.t. dimension.
# include <oln/core/abstract/image_dimension.hh>
// Hierarchy 2: topology w.r.t. type of data.
# include <oln/core/abstract/image_type.hh>
// Hierarchy 3: topology w.r.t. neighborhood.
# include <oln/core/abstract/image_having_neighborhood.hh>
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HIERARCHIES_HH
......@@ -232,7 +232,7 @@ namespace oln
/// Binary case.
template <typename E>
struct case_< image_type_hierarchy, E, 1 > :
struct case_< image_hierarchy_wrt_type, E, 1 > :
where_< mlc::eq_< oln_type_of(E, value), bool > >
{
// Definition of the super class corresponding to this case.
......@@ -241,7 +241,7 @@ namespace oln
/// Grey-level case.
template <typename E>
struct case_< image_type_hierarchy, E, 2 > :
struct case_< image_hierarchy_wrt_type, E, 2 > :
where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), char>,
mlc::eq_<oln_type_of(E, value), signed char>,
mlc::eq_<oln_type_of(E, value), unsigned char> > >
......@@ -259,7 +259,7 @@ namespace oln
/// Default case: image of ``data''.
template <typename E>
struct default_case_< image_type_hierarchy, E >
struct default_case_< image_hierarchy_wrt_type, E >
{
// Definition of the super class corresponding to this case
// (abstract::data_image_ is the conjunction of
......
......@@ -96,7 +96,7 @@ namespace oln {
/// Binary case.
template <typename E>
struct case_< image_type_hierarchy, E, 3 > :
struct case_< image_hierarchy_wrt_type, E, 3 > :
where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), ntg::bin>,
ntg::eq_<ntg::int_u, 1, oln_type_of(E, value)>,
ntg::eq_<ntg::int_s, 1, oln_type_of(E, value)> > >
......@@ -107,7 +107,7 @@ namespace oln {
/// Grey-level case.
template <typename E>
struct case_< image_type_hierarchy, E, 4 > :
struct case_< image_hierarchy_wrt_type, E, 4 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::real_value ) >
{
// Definition of the super class corresponding to this case
......@@ -118,7 +118,7 @@ namespace oln {
/// Label case.
template <typename E>
struct case_< image_type_hierarchy, E, 5 > :
struct case_< image_hierarchy_wrt_type, E, 5 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::enum_value ) >
{
// Definition of the super class corresponding to this case
......@@ -129,7 +129,7 @@ namespace oln {
/// Color case.
template <typename E>
struct case_< image_type_hierarchy, E, 6 > :
struct case_< image_hierarchy_wrt_type, E, 6 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::color_value ) >
{
// Definition of the super class corresponding to this case
......
......@@ -40,10 +40,10 @@ namespace oln
} // end of namespace oln
// hierarchy 1: topology wrt accessibility
// Hierarchy 1: topology w.r.t. accessibility.
# include <oln/core/abstract/topology_being_random_accessible.hh>
// hierarchy 2: topology wrt bbox
// Hierarchy 2: topology w.r.t. bbox.
# include <oln/core/abstract/topology_having_bbox.hh>
......
......@@ -56,17 +56,19 @@ namespace oln
typedef mlc::undefined topo_type;
typedef mlc::undefined grid_type;
// psite_type: see below
// psite_type: see below.
typedef mlc::undefined point_type;
// piter_type: see below
// piter_type: see below.
typedef mlc::undefined fwd_piter_type;
typedef mlc::undefined bkd_piter_type;
typedef mlc::undefined value_type;
// rvalue_type: see below
// rvalue_type: see below.
typedef mlc::undefined concrete_type;
// morpher_type: see below.
};
......@@ -90,6 +92,15 @@ namespace oln
typedef oln_type_of(E, value) ret;
};
/// \brief Morpher type.
///
/// Optionally contains a tag indicating a kind of morpher.
template <typename E>
struct single_vtype< image_entry<E>, typedef_::morpher_type >
{
typedef mlc::none ret;
};
} // end of namespace oln
......
......@@ -65,6 +65,7 @@ namespace oln
`-------*/
mlc_decl_typedef(exact_type);
mlc_decl_typedef(morpher_type);
/*----------.
......@@ -119,16 +120,19 @@ namespace oln
// --------------------------------------------------------------------
mlc_decl_typedef(value_type);
mlc_decl_typedef(rvalue_type);
// --------------------------------------------------------------------
// FIXME: To be enabled later.
// --------------------------------------------------------------------
// mlc_decl_typedef(neighb_type);
// mlc_decl_typedef(value_storage_type);
// mlc_decl_typedef(storage_type);
// --------------------------------------------------------------------
mlc_decl_typedef(psite_type);
mlc_decl_typedef(point_type);
mlc_decl_typedef(dpoint_type);
mlc_decl_typedef(neighborhood_type);
// --------------------------------------------------------------------
// FIXME: To be enabled later.
// --------------------------------------------------------------------
......@@ -144,17 +148,6 @@ namespace oln
// FIXME: To be enabled later.
// --------------------------------------------------------------------
// mlc_decl_typedef(window_type);
// mlc_decl_typedef(image_neighbness_type);
// mlc_decl_typedef(image_constness_type);
// --------------------------------------------------------------------
mlc_decl_typedef(image_dimension_type);
mlc_decl_typedef(image_typeness_type);
// --------------------------------------------------------------------
// FIXME: To be enabled later.
// --------------------------------------------------------------------
// mlc_decl_typedef(image_valuedness_type);
// mlc_decl_typedef(image_rawness_type);
// --------------------------------------------------------------------
// ------------------------------ //
......
// Copyright (C) 2006 EPITA Research and Development Laboratory
//
// 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 OLENA_MORPHER_ADD_NEIGHBORHOOD
# define OLENA_MORPHER_ADD_NEIGHBORHOOD
# include <oln/morpher/internal/image_extension.hh>
namespace oln
{
namespace morpher
{
// Forward declaration.
template <typename Image>
struct add_neighborhood;