Commit 2e845d6c authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Fix more tests.

	* mln/accu/count_adjacent_vertices.hh: make it work with the
new graph images.

	* mln/accu/median_alt.hh: fix compilation issue.

	* mln/util/multi_site.hh,
	* mln/util/vertex.hh,
	* mln/util/internal/graph_nbh_iter.hh,
	* mln/core/internal/pixel_impl.hh,
	* mln/core/internal/set_of.hh,
	* mln/core/site_set/box_piter.hh,
	* mln/core/site_set/p_centered.hh,
	* mln/fun/p2b/has.hh,
	* mln/fun/x2p/closest_point.hh,
	* mln/geom/seeds2tiling_roundness.hh,
	* mln/io/txt/save.hh,
	* mln/metal/vec.hh,
	* mln/morpho/internal/elementary.hh,
	* mln/morpho/tree/data.hh,
	* mln/registration/get_rot.hh,
	* mln/registration/get_rtransf.hh,
	* mln/registration/multiscale.hh,
	* mln/topo/face.hh,
	* mln/topo/face_iter.hh,
	* mln/topo/n_face.hh,
	* mln/trait/op/ord.hh,
	* mln/util/edge.hh,
	* mln/core/dpoints_pixter.hh,
	* mln/core/internal/check/image_all.hh,
	* mln/core/internal/check/image_fastest.hh,
	* mln/core/internal/graph_neighborhood_base.hh,
	* mln/core/internal/graph_window_base.hh,
	* mln/core/concept/graph.hh,
	* mln/canvas/browsing/snake_generic.hh,
	* mln/accu/rank_high_quant.hh: fix includes.

	* mln/border/resize.hh: avoid a warning.

	* mln/core/internal/image_if_base.hh: removed since it is unused and
	not updated.

	* mln/util/internal/graph_edge_impl.hh: rename as...
	* mln/util/internal/edge_impl.hh: ... this.

	* mln/util/internal/graph_vertex_impl.hh: rename as...
	* mln/util/internal/vertex_impl.hh: ... this.

	* tests/morpho/Makefile.am: disable more tests.

	* tests/unit_test/build_unit_test.sh: do not include mln/core/doc
	headers.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@2973 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 6350d633
2008-11-28 Guillaume Lazzara <z@lrde.epita.fr>
Fix more tests.
* mln/accu/count_adjacent_vertices.hh: make it work with the
new graph images.
* mln/accu/median_alt.hh: fix compilation issue.
* mln/util/multi_site.hh,
* mln/util/vertex.hh,
* mln/util/internal/graph_nbh_iter.hh,
* mln/core/internal/pixel_impl.hh,
* mln/core/internal/set_of.hh,
* mln/core/site_set/box_piter.hh,
* mln/core/site_set/p_centered.hh,
* mln/fun/p2b/has.hh,
* mln/fun/x2p/closest_point.hh,
* mln/geom/seeds2tiling_roundness.hh,
* mln/io/txt/save.hh,
* mln/metal/vec.hh,
* mln/morpho/internal/elementary.hh,
* mln/morpho/tree/data.hh,
* mln/registration/get_rot.hh,
* mln/registration/get_rtransf.hh,
* mln/registration/multiscale.hh,
* mln/topo/face.hh,
* mln/topo/face_iter.hh,
* mln/topo/n_face.hh,
* mln/trait/op/ord.hh,
* mln/util/edge.hh,
* mln/core/dpoints_pixter.hh,
* mln/core/internal/check/image_all.hh,
* mln/core/internal/check/image_fastest.hh,
* mln/core/internal/graph_neighborhood_base.hh,
* mln/core/internal/graph_window_base.hh,
* mln/core/concept/graph.hh,
* mln/canvas/browsing/snake_generic.hh,
* mln/accu/rank_high_quant.hh: fix includes.
* mln/border/resize.hh: avoid a warning.
* mln/core/internal/image_if_base.hh: removed since it is unused and
not updated.
* mln/util/internal/graph_edge_impl.hh: rename as...
* mln/util/internal/edge_impl.hh: ... this.
* mln/util/internal/graph_vertex_impl.hh: rename as...
* mln/util/internal/vertex_impl.hh: ... this.
* tests/morpho/Makefile.am: disable more tests.
* tests/unit_test/build_unit_test.sh: do not include mln/core/doc
headers.
2008-11-28 Thierry Geraud <thierry.geraud@lrde.epita.fr>
 
Make morpho erosion rely on a general code.
......
......@@ -31,11 +31,11 @@
/// \file mln/accu/count_adjacent_vertices.hh
/// Define an accumulator that counts the vertices adjacent to a
/// set of line graph psite.
/// set of p_edges psites.
# include <mln/accu/internal/base.hh>
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/core/image/line_graph_image.hh>
# include <mln/pw/image.hh>
# include <mln/util/pix.hh>
namespace mln
......@@ -45,20 +45,20 @@ namespace mln
{
/// Accumulator class counting the number of vertices
/// adjacent to a set of mln::line_graph_psite (i.e., a set of
/// adjacent to a set of mln::p_edges_psite (i.e., a set of
/// edges).
///
/// The type to be count is mln::util::pix< mln::line_graph_image<P, V> >
/// where \p P and \p V are the parameters of this class.
/// The type to be count is mln::util::pix< pw::image<F, S> >
/// where \p F and \p S are the parameters of this class.
///
/// This accumulator is used by mln::closing_area_on_vertices and
/// mln::opening_area_on_vertices.
template <typename P, typename V>
template <typename F, typename S>
struct count_adjacent_vertices
: public mln::accu::internal::base< unsigned,
count_adjacent_vertices<P, V> >
count_adjacent_vertices<F,S> >
{
typedef mln::util::pix< mln::line_graph_image<P, V> > argument;
typedef mln::util::pix< pw::image<F,S> > argument;
count_adjacent_vertices();
......@@ -66,7 +66,7 @@ namespace mln
/// \{
void init();
void take(const argument& arg);
void take(const count_adjacent_vertices<P, V>& other);
void take(const count_adjacent_vertices<F,S>& other);
/// Force the value of the counter to \a c.
void set_value(unsigned c);
......@@ -83,7 +83,7 @@ namespace mln
/// The value of the counter.
unsigned count__;
/// The set of adjacent vertices.
std::set<util::vertex_id> vertices_;
std::set<unsigned> vertices_;
};
......@@ -94,10 +94,10 @@ namespace mln
struct count_adjacent_vertices
: public Meta_Accumulator< count_adjacent_vertices >
{
template <typename P, typename V>
template <typename F, typename S>
struct with
{
typedef accu::count_adjacent_vertices<P, V> ret;
typedef accu::count_adjacent_vertices<F,S> ret;
};
};
......@@ -106,63 +106,63 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
template <typename P, typename V>
template <typename F, typename S>
inline
count_adjacent_vertices<P, V>::count_adjacent_vertices()
count_adjacent_vertices<F,S>::count_adjacent_vertices()
{
init();
}
template <typename P, typename V>
template <typename F, typename S>
inline
void
count_adjacent_vertices<P, V>::init()
count_adjacent_vertices<F,S>::init()
{
vertices_.clear();
update_();
}
template <typename P, typename V>
template <typename F, typename S>
inline
void
count_adjacent_vertices<P, V>::take(const argument& arg)
count_adjacent_vertices<F,S>::take(const argument& arg)
{
vertices_.insert(arg.p().first_id());
vertices_.insert(arg.p().second_id());
vertices_.insert(arg.p().v1());
vertices_.insert(arg.p().v2());
update_();
}
template <typename P, typename V>
template <typename F, typename S>
inline
void
count_adjacent_vertices<P, V>::take(const count_adjacent_vertices<P, V>& other)
count_adjacent_vertices<F,S>::take(const count_adjacent_vertices<F,S>& other)
{
vertices_.insert (other.vertices_.begin(), other.vertices_.end());
update_();
}
template <typename P, typename V>
template <typename F, typename S>
inline
unsigned
count_adjacent_vertices<P, V>::to_result() const
count_adjacent_vertices<F,S>::to_result() const
{
return count__;
}
template <typename P, typename V>
template <typename F, typename S>
inline
void
count_adjacent_vertices<P, V>::set_value(unsigned c)
count_adjacent_vertices<F,S>::set_value(unsigned c)
{
count__ = c;
/// Reset the other member.
vertices_.clear();
}
template <typename P, typename V>
template <typename F, typename S>
inline
void
count_adjacent_vertices<P, V>::update_()
count_adjacent_vertices<F,S>::update_()
{
count__ = vertices_.size();
}
......
......@@ -99,24 +99,24 @@ namespace mln
/// Meta accumulator for median_alt.
struct median_alt : public Meta_Accumulator< median_alt >
template <typename T>
struct median_alt : public Meta_Accumulator< median_alt<T> >
{
median_alt(const Value_Set<S>& s_) : s(s_) {}
median_alt(const Value_Set<T>& s_) : s(s_) {}
template <typename V>
struct with
{
typedef accu::median_alt<V> ret;
typedef accu::median_alt<T> ret;
};
Value_Set<S> s;
Value_Set<T> s;
};
} // end of namespace mln::accu::meta
template <typename T>
median_alt<T> unmeta(const meta::median_alt& m, T)
median_alt<T> unmeta(const meta::median_alt<T>& m, T)
{
median_alt<T> a(m.s);
return a;
......
......@@ -204,6 +204,6 @@ namespace mln
} // end of namespace mln
#include <mln/accu/rankbool.hh>
#include <mln/accu/rank_bool.hh>
#endif // ! MLN_ACCU_RANK_HH
......@@ -98,6 +98,8 @@ namespace mln
const Image<I>& ima, unsigned thickness)
{
// No-op.
(void) ima;
(void) thickness;
}
template <typename I>
......
......@@ -33,6 +33,7 @@
///
/// Browsing in a snake-way, forward.
# include <vector>
# include <mln/core/concept/browsing.hh>
......
......@@ -32,6 +32,8 @@
///
/// Definition of the concept of mln::Graph.
# include <mln/core/concept/object.hh>
namespace mln
{
......
......@@ -37,6 +37,7 @@
# include <cassert>
# include <vector>
# include <mln/core/concept/proxy.hh>
# include <mln/core/concept/pixel_iterator.hh>
# include <mln/core/internal/pixel_impl.hh>
# include <mln/metal/converts_to.hh>
......
// Copyright (C) 2007, 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
......@@ -28,12 +29,11 @@
#ifndef MLN_CORE_INTERNAL_CHECK_IMAGE_ALL_HH
# define MLN_CORE_INTERNAL_CHECK_IMAGE_ALL_HH
/*! \file mln/core/internal/check/image_all.hh
*
* \brief File that includes all image-related internal checks.
*/
/// \file mln/core/internal/check/image_all.hh
///
/// File that includes all image-related internal checks.
# include <mln/trait/images.hh>
# include <mln/core/internal/check/image_fastest.hh>
// ...
......
// Copyright (C) 2007, 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
......@@ -28,14 +29,18 @@
#ifndef MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
# define MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
/*! \file mln/core/internal/check/image_fastest.hh
*
* \brief Class that statically checks the interface of fastest
* images.
*
* \todo Check and convert p in index_of_point towards E::psite.
*/
/// \file mln/core/internal/check/image_fastest.hh
///
/// Class that statically checks the interface of fastest
/// images.
///
/// \todo Check and convert p in index_of_point towards E::psite.
# include <mln/metal/bool.hh>
# include <mln/core/macros.hh>
# include <mln/core/trait/pixter.hh>
# include <mln/core/trait/qlf_value.hh>
# include <mln/core/internal/force_exact.hh>
namespace mln
......@@ -47,21 +52,20 @@ namespace mln
namespace check
{
/*! FIXME
*/
/// FIXME
template < typename E, typename B = metal::true_ >
struct image_fastest_
{
/*! \brief Give the offset of the site \p p.
*
* \param[in] p A site.
*
* \warning This method is final.
*
* \pre The image has to be initialized and to own the point \p p.
* \post p == point_at_index(result)
*/
/// \brief Give the offset of the site \p p.
///
/// \param[in] p A site.
///
/// \warning This method is final.
///
/// \pre The image has to be initialized and to own the point \p p.
/// \post p == point_at_index(result)
///
template <typename P>
unsigned
index_of_point(const P& p) const;
......@@ -71,7 +75,6 @@ namespace mln
};
///
template <typename E>
struct image_fastest_< E, metal::false_ >
{
......@@ -86,8 +89,8 @@ namespace mln
image_fastest_<E,B>::image_fastest_()
{
typedef mln_site(E) site;
typedef mln_psite(E) psite;
typedef mln_delta(psite) dpsite;
typedef mln_psite(E) psite;
typedef mln_delta(psite) dpsite;
typedef mln_fwd_pixter(E) fwd_pixter;
......
......@@ -32,6 +32,9 @@
///
/// FIXME: doc
# include <set>
# include <mln/core/concept/neighborhood.hh>
namespace mln
{
......
......@@ -29,6 +29,7 @@
# define MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
# include <set>
# include <mln/core/concept/window.hh>
/// \file mln/internal/graph_window_base.hh
///
......
// Copyright (C) 2007 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 MLN_CORE_INTERNAL_IMAGE_IF_BASE_HH
# define MLN_CORE_INTERNAL_IMAGE_IF_BASE_HH
/*! \file mln/core/internal/image_if_base.hh
*
* \brief Definition of a image_if_base image.
*/
# include <mln/core/internal/image_domain_morpher.hh>
# include <mln/core/site_set/p_if.hh>
# include <mln/pw/all.hh>
# include <mln/value/interval.hh>
namespace mln
{
namespace internal
{
// Fwd decl.
template <typename I, typename F, typename E> struct image_if_base_;
// data_.
template <typename I, typename F, typename E>
struct data< image_if_base_<I,F,E> >
{
data(I& ima, const F& f);
I ima_;
p_if<mln_pset(I), F> pset_;
};
} // end of namespace mln::internal
namespace trait
{
template <typename I, typename F, typename E>
struct image_< mln::internal::image_if_base_<I,F,E> > : default_image_morpher< I, mln_value(I), E >
{
private:
typedef mln_trait_image_data(I) I_data_;
typedef mlc_equal(I_data_, trait::image::data::linear) I_data_are_linear_;
public:
typedef trait::image::category::domain_morpher category;
typedef mlc_if( mlc_is_const(I),
trait::image::io::read_only, // I const => read_only
mln_trait_image_io(I) ) io; // otherwise like I
typedef mlc_if( I_data_are_linear_,
trait::image::data::stored, // if linear then just stored
I_data_ ) data; // otherwise like I
typedef mln_trait_image_border(I) border;
};
} // end of namespace mln::trait
namespace internal
{
/*! An base image class for image_if_'something.
*
*/
template <typename I, typename F, typename E>
struct image_if_base_ : public internal::image_domain_morpher< I, p_if<mln_pset(I),F>, E >
{
/// Give the definition domain.
const p_if<mln_pset(I), F>& domain() const;
void init_(I& ima, const F& f);
/// Test if the image owns the point site \p p.
/// The result is the same than over the underlying image.
bool has(const mln_psite(I)& p) const;
protected:
/// Constructor from an image \p ima and a predicate \p f.
image_if_base_(I& ima, const F& f);
/// Constructor without argument.
image_if_base_();
};
# ifndef MLN_INCLUDE_ONLY
// // init_
// template <typename I, typename F, typename E>
// void init_(tag::function_t, F& f, const image_if_base_<I,F,E>& model)
// {
// f = model.domain().predicate();
// }
// template <typename I, typename F, typename E, typename J>
// void init_(tag::image_t, image_if_base_<I,F,E>& target, const J& model)
// {
// I ima;
// init_(tag::image, ima, exact(model));
// F f;
// init_(tag::function, f, exact(model));
// target.init_(ima, f);
// }
// internal::data< image_if_base_<I,S> >
template <typename I, typename F, typename E>
inline
data< image_if_base_<I,F,E> >::data(I& ima, const F& f)
: ima_(ima),
pset_(ima.domain() | f)
{
}
// image_if_base_<I,F,E>
template <typename I, typename F, typename E>
inline
image_if_base_<I,F,E>::image_if_base_()
{
}
template <typename I, typename F, typename E>
inline
image_if_base_<I,F,E>::image_if_base_(I& ima, const F& f)
{
init_(ima, f);
}
template <typename I, typename F, typename E>
inline
bool
image_if_base_<I,F,E>::has(const mln_psite(I)& p) const
{
mln_precondition(this->has_data());
return this->data_->ima_.has(p);
}
template <typename I, typename F, typename E>
inline
void
image_if_base_<I,F,E>::init_(I& ima, const F& f)
{
mln_precondition(! this->has_data());
this->data_ = new internal::data<E>(ima, f);
}
template <typename I, typename F, typename E>
inline
const p_if<mln_pset(I), F>&
image_if_base_<I,F,E>::domain() const
{
return this->data_->pset_;
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::internal
} // end of namespace mln
#endif // ! MLN_CORE_INTERNAL_IMAGE_IF_BASE_HH