Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
June 2008
- 9 participants
- 135 discussions
11 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update image2d with new image properties.
* doc/tutorial/examples/image2d.cc: New.
* mln/trait/image/props.hh (localization): Fix missing types.
(space_from_point): Update.
* mln/trait/image/print.hh: Fix missing brackets.
* mln/trait/images.hh: Update macros.
(mln_trait_image_io_from_): Update.
(mln_trait_image_data_from_): Remove; obsolete.
* mln/core/macros.hh (mln_dpsite, mln_dpsite_): New.
* mln/core/internal/image_base.hh
(dpoint, coord, bbox): Remove cause not general.
(owns_): Remove; it is obsolete/replaced by 'has'.
* mln/core/internal/check/image_fastest.hh
(offset_at): Return std::size_t; now accept more types for
the p argument.
(image_fastest_): Update ctor.
* mln/core/concept/image.hh: Layout doc.
(mln_point, point): Rename as...
(mln_site, site): ...these.
(coord, dpoint): Remove; obsolete.
* mln/core/image2d.hh: Likewise.
(image_): Update traits.
(owns_): Rename as...
(has): ...this.
doc/tutorial/examples/image2d.cc | 10 ++++
mln/core/concept/image.hh | 66 +++++++++++++------------------
mln/core/image2d.hh | 45 +++++++++++++--------
mln/core/internal/check/image_fastest.hh | 24 +++++------
mln/core/internal/image_base.hh | 24 -----------
mln/core/macros.hh | 6 ++
mln/trait/image/print.hh | 30 +++++++-------
mln/trait/image/props.hh | 13 ++++--
mln/trait/images.hh | 53 +++++++-----------------
9 files changed, 128 insertions(+), 143 deletions(-)
Index: doc/tutorial/examples/image2d.cc
--- doc/tutorial/examples/image2d.cc (revision 0)
+++ doc/tutorial/examples/image2d.cc (revision 0)
@@ -0,0 +1,10 @@
+# include <mln/core/image2d.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<char> ima(2, 3);
+ mln_invariant(ima.nsites() == 6);
+}
Index: mln/trait/image/props.hh
--- mln/trait/image/props.hh (revision 2010)
+++ mln/trait/image/props.hh (working copy)
@@ -379,8 +379,15 @@
struct none : any { std::string name() const { return "localization::none"; } };
struct space : any { std::string name() const { return "localization::space"; } };
struct grid : space { protected: grid() {} };
+ struct isotropic_grid
+ : grid { std::string name() const { return "localization::isotropic_grid"; } };
+ struct basic_grid
+ : isotropic_grid { std::string name() const { return "localization::basic_grid"; } };
+ struct anisotropic_grid
+ : grid { std::string name() const { return "localization::anisotropic_grid"; } };
};
+
// dimension: /any/
// |
// + -- none
@@ -566,15 +573,15 @@
template <>
struct space_from_point<point1d>
- { typedef trait::image::space::one_d ret; };
+ { typedef trait::image::dimension::one_d ret; };
template <>
struct space_from_point<point2d>
- { typedef trait::image::space::two_d ret; };
+ { typedef trait::image::dimension::two_d ret; };
template <>
struct space_from_point<point3d>
- { typedef trait::image::space::three_d ret; };
+ { typedef trait::image::dimension::three_d ret; };
/// \}
} // end of namespace mln::trait::image
Index: mln/trait/image/print.hh
--- mln/trait/image/print.hh (revision 2010)
+++ mln/trait/image/print.hh (working copy)
@@ -68,21 +68,21 @@
mlc_is_a(I, Image)::check();
typedef mln::trait::image_<I> the;
ostr << "{ "
- << typename the::category.name() << ", "
- << typename the::speed.name() << ", "
- << typename the::size.name() << ", "
- << typename the::value_access.name() << ", "
- << typename the::value_storage.name() << ", "
- << typename the::value_browsing.name() << ", "
- << typename the::value_io.name() << ", "
- << typename the::localization.name() << ", "
- << typename the::dimension.name() << ", "
- << typename the::ext_domain.name() << ", "
- << typename the::ext_value.name() << ", "
- << typename the::ext_io.name() << ", "
- << typename the::kind.name() << ", "
- << typename the::nature.name() << ", "
- << typename the::quant.name() << " }" << std::endl;
+ << typename the::category().name() << ", "
+ << typename the::speed().name() << ", "
+ << typename the::size().name() << ", "
+ << typename the::value_access().name() << ", "
+ << typename the::value_storage().name() << ", "
+ << typename the::value_browsing().name() << ", "
+ << typename the::value_io().name() << ", "
+ << typename the::localization().name() << ", "
+ << typename the::dimension().name() << ", "
+ << typename the::ext_domain().name() << ", "
+ << typename the::ext_value().name() << ", "
+ << typename the::ext_io().name() << ", "
+ << typename the::kind().name() << ", "
+ << typename the::nature().name() << ", "
+ << typename the::quant().name() << " }" << std::endl;
}
template <typename I>
Index: mln/trait/images.hh
--- mln/trait/images.hh (revision 2010)
+++ mln/trait/images.hh (working copy)
@@ -47,52 +47,33 @@
# include <mln/metal/if.hh>
# include <mln/metal/is_const.hh>
-// category
-// speed
-// size
-// value_access
-// value_storage
-// value_browsing
-// value_io
-// localization
-// dimension
-// ext_domain
-// ext_value
-// ext_io
-// kind
-// nature
-// quant
+
# define mln_trait_image_category(I) typename mln::trait::image_< I >::category
+# define mln_trait_image_speed(I) typename mln::trait::image_< I >::speed
+# define mln_trait_image_size(I) typename mln::trait::image_< I >::size
+
+# define mln_trait_image_value_access(I) typename mln::trait::image_< I >::value_access
+# define mln_trait_image_value_storage(I) typename mln::trait::image_< I >::value_storage
+# define mln_trait_image_value_browsing(I) typename mln::trait::image_< I >::value_browsing
+# define mln_trait_image_value_io(I) typename mln::trait::image_< I >::value_io
+
+# define mln_trait_image_localization(I) typename mln::trait::image_< I >::localization
+# define mln_trait_image_dimension(I) typename mln::trait::image_< I >::dimension
+
+# define mln_trait_image_ext_domain(I) typename mln::trait::image_< I >::ext_domain
+# define mln_trait_image_ext_value(I) typename mln::trait::image_< I >::ext_value
+# define mln_trait_image_ext_io(I) typename mln::trait::image_< I >::ext_io
# define mln_trait_image_kind(I) typename mln::trait::image_< I >::kind
+# define mln_trait_image_nature(I) typename mln::trait::image_< I >::nature
# define mln_trait_image_quant(I) typename mln::trait::image_< I >::quant
-# define mln_trait_image_value(I) typename mln::trait::image_< I >::value
-
-# define mln_trait_image_access(I) typename mln::trait::image_< I >::access
-# define mln_trait_image_space(I) typename mln::trait::image_< I >::space
-# define mln_trait_image_size(I) typename mln::trait::image_< I >::size
-# define mln_trait_image_support(I) typename mln::trait::image_< I >::support
-
-# define mln_trait_image_border(I) typename mln::trait::image_< I >::border
-# define mln_trait_image_neighb(I) typename mln::trait::image_< I >::neighb
-# define mln_trait_image_data(I) typename mln::trait::image_< I >::data
-# define mln_trait_image_io(I) typename mln::trait::image_< I >::io
-# define mln_trait_image_speed(I) typename mln::trait::image_< I >::speed
// for io: I const => read_only, otherwise like I
# define mln_trait_image_io_from_(I) \
-mlc_if( mlc_is_const(I), mln::trait::image::io::read_only, mln_trait_image_io(I) )
+mlc_if( mlc_is_const(I), mln::trait::image::value_io::read_only, mln_trait_image_value_io(I) )
-// for data: if raw or linear => stored, otherwise like I (i.e., either stored or computed)
-#define mln_trait_image_data_from_(I) typename \
-mln::metal::if_< mln::metal::or_< mlc_equal( mln_trait_image_data(I), \
- mln::trait::image::data::raw), \
- mlc_equal( mln_trait_image_data(I), \
- mln::trait::image::data::linear) >, \
- mln::trait::image::data::stored, \
- mln_trait_image_data(I) >::ret
namespace mln
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 2010)
+++ mln/core/macros.hh (working copy)
@@ -94,6 +94,12 @@
# define mln_dpoint_(T) T::dpoint
/// \}
+/// Shortcuts to access the dpsite type associated to T.
+/// \{
+# define mln_dpsite(T) typename T::dpsite
+# define mln_dpsite_(T) T::dpsite
+/// \}
+
// e
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 2010)
+++ mln/core/internal/image_base.hh (working copy)
@@ -106,13 +106,6 @@
/// Point associated type.
typedef mln_site(S) site;
- /// Dpoint associated type.
- typedef mln_dpoint(site) dpoint;
-
- /// Coordinate associated type.
- typedef mln_coord(site) coord;
-
-
/// Forward Site_Iterator associated type.
typedef mln_fwd_piter(S) fwd_piter;
@@ -123,12 +116,6 @@
/// Test if \p p belongs to the image domain.
bool has(const psite& p) const;
- // FIXME: Keep this default (owns_ is based on has)?
- bool owns_(const psite& p) const;
-
- /// Give a bounding box of the image domain.
- const box_<site>& bbox() const;
-
/// Give the number of sites of the image domain.
std::size_t nsites() const;
@@ -208,18 +195,11 @@
template <typename S, typename E>
inline
- bool
- image_base_<S,E>::owns_(const psite& p) const
- {
- mln_precondition(exact(this)->has_data());
- return exact(this)->has(p);
- }
-
- template <typename S, typename E>
- inline
std::size_t
image_base_<S,E>::nsites() const
{
+ mlc_equal(mln_trait_site_set_nsites(S),
+ mln::trait::site_set::nsites::known)::check();
mln_precondition(exact(this)->has_data());
return exact(this)->domain().nsites();
}
Index: mln/core/internal/check/image_fastest.hh
--- mln/core/internal/check/image_fastest.hh (revision 2010)
+++ mln/core/internal/check/image_fastest.hh (working copy)
@@ -32,6 +32,8 @@
*
* \brief Class that statically checks the interface of fastest
* images.
+ *
+ * \todo Check and convert p in offset_at towards E::psite.
*/
# include <mln/core/internal/force_exact.hh>
@@ -52,9 +54,9 @@
struct image_fastest_
{
- /*! \brief Give the offset of the point \p p.
+ /*! \brief Give the offset of the site \p p.
*
- * \param[in] p A generalized point.
+ * \param[in] p A site.
*
* \warning This method is final.
*
@@ -62,8 +64,8 @@
* \post p == point_at_offset(result)
*/
template <typename P>
- unsigned
- offset_at(const Point_Site<P>& p) const;
+ std::size_t
+ offset_at(const P& p) const;
protected:
image_fastest_();
@@ -84,15 +86,15 @@
inline
image_fastest_<E,B>::image_fastest_()
{
- typedef mln_point(E) point;
- typedef mln_dpoint(E) dpoint;
+ typedef mln_site(E) site;
+ typedef mln_dpsite(E) dpsite;
typedef mln_fwd_pixter(E) fwd_pixter;
typedef mln_bkd_pixter(E) bkd_pixter;
- int (E::*m1)(const dpoint&) const = & E::offset;
+ int (E::*m1)(const dpsite&) const = & E::offset;
m1 = 0;
- point (E::*m2)(unsigned) const = & E::point_at_offset;
+ site (E::*m2)(unsigned) const = & E::point_at_offset;
m2 = 0;
unsigned (E::*m3)() const = & E::border;
m3 = 0;
@@ -121,12 +123,10 @@
template <typename E, typename B>
template <typename P>
inline
- unsigned // FIXME: std::size_t?
- image_fastest_<E,B>::offset_at(const Point_Site<P>& p_) const
+ std::size_t
+ image_fastest_<E,B>::offset_at(const P& p) const
{
- // FIXME: check that P is mln_point(E)
const E* this_ = & internal::force_exact<E>(*this);
- const P& p = exact(p_);
mln_precondition(this_->has_data());
mln_precondition(this_->owns_(p));
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 2010)
+++ mln/core/concept/image.hh (working copy)
@@ -73,42 +73,35 @@
typedef Image<void> category;
/*
- // to be provided in concrete image classes:
-
- typedef mesh;
-
- typedef value;
- typedef rvalue;
- typedef lvalue;
- typedef vset;
-
- const vset& values() const;
-
- bool owns_(const psite& p) const;
- const pset& domain() const;
-
- rvalue operator()(const psite& p) const;
- lvalue operator()(const psite& p);
-
- typedef skeleton;
-
-
// provided by internal::image_base_:
typedef pset;
- typedef point;
+ typedef site;
typedef psite;
- typedef coord;
- typedef dpoint;
-
typedef fwd_piter;
typedef bkd_piter;
bool has(const psite& p) const;
- std::size_t nsites() const;
+ std::size_t nsites() const; // If relevant.
bool has_data() const;
+
+ // to be provided in concrete image classes:
+
+ typedef value;
+
+ typedef vset;
+ const vset& values() const;
+
+ typedef rvalue;
+ typedef lvalue;
+ rvalue operator()(const psite& p) const;
+ lvalue operator()(const psite& p);
+
+ const pset& domain() const;
+
+ typedef skeleton;
*/
protected:
@@ -125,17 +118,18 @@
// provided by internal::image_base_:
typedef mln_pset(E) pset;
- typedef mln_point(E) point;
+ typedef mln_site(E) site;
typedef mln_psite(E) psite;
- typedef mln_coord(E) coord;
- typedef mln_dpoint(E) dpoint;
-
typedef mln_fwd_piter(E) fwd_piter;
typedef mln_bkd_piter(E) bkd_piter;
bool (E::*m1)(const psite& p) const = & E::has;
m1 = 0;
+ std::size_t (E::*m2)() const = & E::nsites;
+ m2 = 0;
+ bool (E::*m3)() const = & E::has_data;
+ m3 = 0;
// to be provided in concrete image classes:
@@ -143,13 +137,8 @@
typedef mln_rvalue(E) rvalue;
typedef mln_lvalue(E) lvalue;
- typedef typename E::skeleton skeleton;
-
- bool (E::*m3)() const = & E::has_data;
- m3 = 0;
- bool (E::*m4)(const psite& p) const = & E::owns_;
- m4 = 0;
- const pset& (E::*m5)() const = & E::domain;
+ typedef mln_vset(E) vset;
+ const vset& (E::*m5)() const = & E::values;
m5 = 0;
rvalue (E::*m6)(const psite& p) const = & E::operator();
@@ -157,9 +146,10 @@
lvalue (E::*m7)(const psite& p) = & E::operator();
m7 = 0;
- typedef mln_vset(E) vset;
- const vset& (E::*m8)() const = & E::values;
+ const pset& (E::*m8)() const = & E::domain;
m8 = 0;
+
+ typedef typename E::skeleton skeleton;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/core/image2d.hh
--- mln/core/image2d.hh (revision 2010)
+++ mln/core/image2d.hh (working copy)
@@ -88,17 +88,25 @@
template <typename T>
struct image_< image2d<T> > : default_image_< T, image2d<T> >
{
+ // misc
typedef trait::image::category::primary category;
-
- typedef trait::image::access::random access;
- typedef trait::image::space::two_d space;
+ typedef trait::image::speed::fastest speed;
typedef trait::image::size::regular size;
- typedef trait::image::support::aligned support;
- typedef trait::image::border::stored border;
- typedef trait::image::data::raw data;
- typedef trait::image::io::read_write io;
- typedef trait::image::speed::fastest speed;
+ // value
+ typedef trait::image::value_access::direct value_access;
+ typedef trait::image::value_storage::one_block value_storage;
+ typedef trait::image::value_browsing::site_wise_only value_browsing;
+ typedef trait::image::value_io::read_write value_io;
+
+ // site / domain
+ typedef trait::image::localization::basic_grid localization;
+ typedef trait::image::dimension::two_d dimension;
+
+ // extended domain
+ typedef trait::image::ext_domain::extendable ext_domain;
+ typedef trait::image::ext_value::multiple ext_value;
+ typedef trait::image::ext_io::read_write ext_io;
};
} // end of namespace mln::trait
@@ -116,12 +124,15 @@
{
// Warning: just to make effective types appear in Doxygen:
typedef box2d pset;
+
typedef point2d psite;
- typedef point2d point;
- typedef dpoint2d dpoint;
+ typedef point2d site;
+ typedef dpoint2d dpsite;
+
typedef mln_fwd_piter(box2d) fwd_piter;
typedef mln_bkd_piter(box2d) bkd_piter;
- typedef line_piter_<point> line_piter;
+
+ typedef line_piter_<point2d> line_piter;
// End of warning.
@@ -160,7 +171,7 @@
/// Test if \p p is valid.
- bool owns_(const point2d& p) const;
+ bool has(const point2d& p) const;
/// Give the set of values of the image.
const vset& values() const;
@@ -422,7 +433,7 @@
template <typename T>
inline
bool
- image2d<T>::owns_(const point2d& p) const
+ image2d<T>::has(const point2d& p) const
{
mln_precondition(this->has_data());
return this->data_->vb_.has(p);
@@ -433,7 +444,7 @@
const T&
image2d<T>::operator()(const point2d& p) const
{
- mln_precondition(this->owns_(p));
+ mln_precondition(this->has(p));
return this->data_->array_[p.row()][p.col()];
}
@@ -442,7 +453,7 @@
T&
image2d<T>::operator()(const point2d& p)
{
- mln_precondition(this->owns_(p));
+ mln_precondition(this->has(p));
return this->data_->array_[p.row()][p.col()];
}
@@ -469,7 +480,7 @@
const T&
image2d<T>::at(int row, int col) const
{
- mln_precondition(this->owns_(make::point2d(row, col)));
+ mln_precondition(this->has(make::point2d(row, col)));
return this->data_->array_[row][col];
}
@@ -478,7 +489,7 @@
T&
image2d<T>::at(int row, int col)
{
- mln_precondition(this->owns_(make::point2d(row, col)));
+ mln_precondition(this->has(make::point2d(row, col)));
return this->data_->array_[row][col];
}
1
0
10 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Introduce the new set of image properties.
* mln/trait/image/props.hh: New set of image properties.
* mln/trait/image/print.hh: Update.
* mln/trait/images.hh: Update.
image/print.hh | 27 +-
image/props.hh | 556 +++++++++++++++++++++++++++++++++++++++++++++------------
images.hh | 98 ++++++----
3 files changed, 514 insertions(+), 167 deletions(-)
Index: mln/trait/image/props.hh
--- mln/trait/image/props.hh (revision 2009)
+++ mln/trait/image/props.hh (working copy)
@@ -38,6 +38,177 @@
# include <mln/trait/value/kind.hh>
+
+// Properties of images.
+// =====================
+
+// * misc
+
+// category: /any/
+// |
+// + -- primary
+// |
+// + -- /morpher/
+// |
+// + -- domain_morpher
+// |
+// + -- value_morpher
+// |
+// + -- identity_morpher
+
+// speed: /any/
+// |
+// + -- slow
+// |
+// + -- fast
+// |
+// + -- fastest
+
+// size: /any/
+// |
+// + -- regular
+// |
+// + -- huge
+
+// * value
+
+// value_access: /any/
+// |
+// + -- direct
+// |
+// + -- computed
+
+// value_storage:/any/
+// |
+// + -- /organized/
+// | |
+// | + -- singleton
+// | |
+// | + -- one_block
+// | |
+// | + -- piecewise
+// |
+// + -- disrupted
+
+// value_browsing:/any/
+// |
+// + -- site_wise_only
+// |
+// + ------- cell_wise
+// | \
+// + -- value_wise \
+// \ \
+// ---- + -- cell_and_value_wise
+
+// value_io: /any/
+// |
+// + -- read_only
+// |
+// + -- read_write
+
+// * site localization
+
+// localization: /any/
+// |
+// + -- none
+// |
+// + -- space
+// |
+// + -- /grid/
+// |
+// + -- isotropic_grid
+// | |
+// | + -- basic_grid
+// |
+// + -- anisotropic_grid
+
+// dimension: /any/
+// |
+// + -- none
+// |
+// + -- /some/
+// |
+// + -- one_d
+// |
+// + -- two_d
+// |
+// + -- three_d
+
+// * extended domain
+
+// ext_domain: /any/
+// |
+// + -- none
+// |
+// + -- /some/
+// |
+// + -- fixed
+// | |
+// | + -- infinite
+// |
+// + -- extendable
+
+// ext_value: /any/
+// |
+// + -- irrelevant
+// |
+// + -- single
+// |
+// + -- multiple
+
+// ext_io: /any/
+// |
+// + -- irrelevant
+// |
+// + -- read_only
+// |
+// + -- read_write
+
+// * data (related to I::value)
+
+// kind: /any/
+// |
+// + -- color
+// |
+// + -- gray
+// |
+// + ----------- label
+// | |
+// | +-- named
+// + -- /logic/ |
+// | | |
+// | + -- /mvlogic/
+// | | |
+// | | + -- binary
+// | | |
+// | | + -- ternary
+// | |
+// | + -- fuzzy
+// |
+// + -- data
+// |
+// |
+// + -- /map/
+// |
+// + -- distance
+
+// nature: /any/
+// |
+// + -- scalar
+// |
+// + -- vectorial
+// |
+// + -- structed
+// |
+// + -- pointer
+
+// quant: /any/
+// |
+// + -- low
+// |
+// + -- high
+
+
namespace mln
{
@@ -47,43 +218,23 @@
namespace image
{
- // FIXME: For the record:
-
- // template <typename I>
- // struct undefined_image_
- // {
- // typedef undef category; // primary, domain_morpher, value_morpher,
- // // or identity_morpher < morpher
-
- // // related to I::value
- // typedef undef kind; // color, gray, binary < logic < label, data
- // typedef undef quant; // low or high
- // typedef undef value; // scalar, vectorial, structed, pointer
- // // FIXME: Make the difference between homogeneous and heterogeneous vectors...
-
- // // related to I::pset
- // typedef undef access; // random, browsing
- // typedef undef space; // one_d, two_d, three_d
- // typedef undef size; // huge or regular
- // typedef undef support; // irregular, aligned < regular
-
- // // global
- // typedef undef border; // none, { stored, computed } < some
- // typedef undef neighb; // none, some
- // typedef undef data; // raw < linear < stored, computed
- // typedef undef io; // read_only < read, write_only < write, read_write < both read'n write
- // typedef undef speed; // slow, fast, or fastest
- // };
-
- // FIXME: Add nice pictures of those hierarchies.
-
-
+// category: /any/
+// |
+// + -- primary
+// |
+// + -- /morpher/
+// |
+// + -- domain_morpher
+// |
+// + -- value_morpher
+// |
+// + -- identity_morpher
struct category
{
- struct any {};
+ struct any { protected: any() {} };
struct primary : any { std::string name() const { return "category::primary"; } };
- struct morpher : any {};
+ struct morpher : any { protected: morpher() {} };
struct domain_morpher
: morpher { std::string name() const { return "category::domain_morpher"; } };
struct value_morpher
@@ -93,113 +244,286 @@
};
- typedef mln::trait::value::kind kind; // Fetch the 'kind' structure from value traits.
-
-
- struct data
- {
- struct any {};
- struct computed : any { std::string name() const { return "data::computed"; } };
- struct stored : any { std::string name() const { return "data::stored"; } };
- struct linear
- : stored { std::string name() const { return "data::linear"; } };
- struct raw
- : linear { std::string name() const { return "data::raw"; } };
- };
-
- struct quant
- {
- struct any {};
- struct low : any { std::string name() const { return "quant::low"; } };
- struct high : any { std::string name() const { return "quant::high"; } };
- };
-
- struct value
- {
- struct any {};
- struct scalar : any { std::string name() const { return "value::scalar"; } };
- struct vectorial : any { std::string name() const { return "value::vectorial"; } };
- struct structed : any { std::string name() const { return "value::structed"; } };
- struct pointer : any { std::string name() const { return "value::pointer"; } };
-
- struct fixme // So FIXME!
- : any { std::string name() const { return "space::fixme"; } };
- };
-
+// speed: /any/
+// |
+// + -- slow
+// |
+// + -- fast
+// |
+// + -- fastest
- struct access
+ struct speed
{
- struct any {};
- struct random : any { std::string name() const { return "access::random"; } };
- struct browsing : any { std::string name() const { return "access::browsing"; } };
+ struct any { protected: any() {} };
+ struct slow : any { std::string name() const { return "speed::slow"; } };
+ struct fast : any { std::string name() const { return "speed::fast"; } };
+ struct fastest
+ : fast { std::string name() const { return "speed::fastest"; } };
};
- struct space
- {
- struct any {};
- struct one_d : any { std::string name() const { return "space::one_d"; } };
- struct two_d : any { std::string name() const { return "space::two_d"; } };
- struct three_d : any { std::string name() const { return "space::three_d"; } };
- struct fixme_ // So FIXME!
- : any { std::string name() const { return "space::fixme_"; } };
- };
+// size: /any/
+// |
+// + -- regular
+// |
+// + -- huge
struct size
{
- struct any {};
+ struct any { protected: any() {} };
struct huge : any { std::string name() const { return "size::huge"; } };
struct regular : any { std::string name() const { return "size::regular"; } };
};
- struct support
- {
- struct any {};
- struct irregular : any { std::string name() const { return "support::irregular"; } };
- struct regular : any { std::string name() const { return "support::regular"; } };
- struct aligned
- : regular { std::string name() const { return "support::aligned"; } };
- struct fixme_ // So FIXME!
- : any { std::string name() const { return "support::fixme_"; } };
- };
+// value_access: /any/
+// |
+// + -- direct
+// |
+// + -- computed
+
+ struct value_access
+ {
+ struct any { protected: any() {} };
+ struct direct : any { std::string name() const { return "value_access::direct"; } };
+ struct computed : any { std::string name() const { return "value_access::computed"; } };
+ };
+
+
+// value_storage:/any/
+// |
+// + -- /organized/
+// | |
+// | + -- singleton
+// | |
+// | + -- one_block
+// | |
+// | + -- piecewise
+// |
+// + -- disrupted
+
+ struct value_storage
+ {
+ struct any { protected: any() {} };
+ struct organized
+ : any { protected: organized() {} };
+ struct singleton
+ : organized { std::string name() const { return "value_storage::singleton"; } };
+ struct one_block
+ : organized { std::string name() const { return "value_storage::one_block"; } };
+ struct piecewise
+ : organized { std::string name() const { return "value_storage::piecewise"; } };
+ struct disrupted : any { std::string name() const { return "value_storage::disrupted"; } };
+ };
+
+
+// value_browsing:/any/
+// |
+// + -- site_wise_only
+// |
+// + ------- cell_wise
+// | \
+// + -- value_wise \
+// \ \
+// ---- + -- cell_and_value_wise
+
+ struct value_browsing
+ {
+ struct any { protected: any() {} };
+ struct site_wise_only
+ : any { std::string name() const { return "value_browsing::site_wise_only"; } };
+ struct cell_wise
+ : virtual any { std::string name() const { return "value_browsing::cell_wise"; } };
+ struct value_wise
+ : virtual any { std::string name() const { return "value_browsing::value_wise"; } };
+ struct cell_and_value_wise
+ : cell_wise,
+ value_wise
+ { std::string name() const { return "value_browsing::cell_and_value_wise"; } };
+ };
+
+
+// value_io: /any/
+// |
+// + -- read_only
+// |
+// + -- read_write
- struct border
+ struct value_io
{
- struct any {};
- struct none : any { std::string name() const { return "border::none"; } };
- struct some : any { std::string name() const { return "border::some"; } };
- struct stored : some { std::string name() const { return "border::stored"; } };
- struct computed : some { std::string name() const { return "border::computed"; } };
+ struct any { protected: any() {} };
+ struct read_only
+ : any { std::string name() const { return "value_io::read_only"; } };
+ struct read_write
+ : any { std::string name() const { return "value_io::read_write"; } };
};
- struct neighb
- {
- struct any {};
- struct none : any { std::string name() const { return "neighb::none"; } };
- struct some : any { std::string name() const { return "neighb::some"; } };
- };
- struct io
+// localization: /any/
+// |
+// + -- none
+// |
+// + -- space
+// |
+// + -- /grid/
+// |
+// + -- isotropic_grid
+// | |
+// | + -- basic_grid
+// |
+// + -- anisotropic_grid
+
+ struct localization
+ {
+ struct any { protected: any() {} };
+ struct none : any { std::string name() const { return "localization::none"; } };
+ struct space : any { std::string name() const { return "localization::space"; } };
+ struct grid : space { protected: grid() {} };
+ };
+
+// dimension: /any/
+// |
+// + -- none
+// |
+// + -- /some/
+// |
+// + -- one_d
+// |
+// + -- two_d
+// |
+// + -- three_d
+
+ struct dimension
+ {
+ struct any { protected: any() {} };
+ struct none : any { std::string name() const { return "dimension::none"; } };
+ struct some
+ : any { protected: some() {} };
+ struct one_d : some { std::string name() const { return "dimension::one_d"; } };
+ struct two_d : some { std::string name() const { return "dimension::two_d"; } };
+ struct three_d : some { std::string name() const { return "dimension::three_d"; } };
+ };
+
+
+// ext_domain: /any/
+// |
+// + -- none
+// |
+// + -- /some/
+// |
+// + -- fixed
+// | |
+// | + -- infinite
+// |
+// + -- extendable
+
+ struct ext_domain
+ {
+ struct any { protected: any() {} };
+ struct none : any { std::string name() const { return "ext_domain::none"; } };
+ struct some
+ : any { protected: some() {} };
+ struct extendable : some { std::string name() const { return "ext_domain::extendable"; } };
+ struct fixed : some { std::string name() const { return "ext_domain::fixed"; } };
+ struct infinite : fixed { std::string name() const { return "ext_domain::infinite"; } };
+ };
+
+
+// ext_value: /any/
+// |
+// + -- irrelevant
+// |
+// + -- single
+// |
+// + -- multiple
+
+ struct ext_value
+ {
+ struct any { protected: any() {} };
+ struct irrelevant : any { std::string name() const { return "ext_value::irrelevant"; } };
+ struct single : any { std::string name() const { return "ext_value::single"; } };
+ struct multiple : any { std::string name() const { return "ext_value::multiple"; } };
+ };
+
+
+// ext_io: /any/
+// |
+// + -- irrelevant
+// |
+// + -- read_only
+// |
+// + -- read_write
+
+ struct ext_io
{
- struct any {};
- struct read : virtual any {};
- struct write : virtual any {};
+ struct any { protected: any() {} };
struct read_only
- : read { std::string name() const { return "io::read_only"; } };
- struct write_only
- : write { std::string name() const { return "io::write_only"; } };
+ : any { std::string name() const { return "ext_io::read_only"; } };
struct read_write
- : read, write { std::string name() const { return "io::read_write"; } };
+ : any { std::string name() const { return "ext_io::read_write"; } };
};
- struct speed
+
+// kind: /any/
+// |
+// + -- color
+// |
+// + -- gray
+// |
+// + ----------- label
+// | |
+// | +-- named
+// + -- /logic/ |
+// | | |
+// | + -- /mvlogic/
+// | | |
+// | | + -- binary
+// | | |
+// | | + -- ternary
+// | |
+// | + -- fuzzy
+// |
+// + -- data
+// |
+// |
+// + -- /map/
+// |
+// + -- distance
+
+ typedef mln::trait::value::kind kind; // Fetch the 'kind' structure from value traits.
+
+
+// nature: /any/
+// |
+// + -- scalar
+// |
+// + -- vectorial
+// |
+// + -- structed
+// |
+// + -- pointer
+
+ struct nature
+ {
+ struct any { protected: any() {} };
+ struct scalar : any { std::string name() const { return "nature::scalar"; } };
+ struct vectorial : any { std::string name() const { return "nature::vectorial"; } };
+ struct structed : any { std::string name() const { return "nature::structed"; } };
+ struct pointer : any { std::string name() const { return "nature::pointer"; } };
+ };
+
+
+// quant: /any/
+// |
+// + -- low
+// |
+// + -- high
+
+ struct quant
{
- struct any {};
- struct slow : any { std::string name() const { return "speed::slow"; } };
- struct fast : any { std::string name() const { return "speed::fast"; } };
- struct fastest
- : fast { std::string name() const { return "speed::fastest"; } };
+ struct any { protected: any() {} };
+ struct low : any { std::string name() const { return "quant::low"; } };
+ struct high : any { std::string name() const { return "quant::high"; } };
};
Index: mln/trait/image/print.hh
--- mln/trait/image/print.hh (revision 2009)
+++ mln/trait/image/print.hh (working copy)
@@ -68,18 +68,21 @@
mlc_is_a(I, Image)::check();
typedef mln::trait::image_<I> the;
ostr << "{ "
- << typename the::category().name() << ", "
- << typename the::data() .name() << ", "
- << typename the::kind() .name() << ", "
- << typename the::quant() .name() << ", "
- << typename the::value() .name() << ", "
- << typename the::access() .name() << ", "
- << typename the::space() .name() << ", "
- << typename the::size() .name() << ", "
- << typename the::support() .name() << ", "
- << typename the::border() .name() << ", "
- << typename the::io() .name() << ", "
- << typename the::speed() .name() << " }" << std::endl;
+ << typename the::category.name() << ", "
+ << typename the::speed.name() << ", "
+ << typename the::size.name() << ", "
+ << typename the::value_access.name() << ", "
+ << typename the::value_storage.name() << ", "
+ << typename the::value_browsing.name() << ", "
+ << typename the::value_io.name() << ", "
+ << typename the::localization.name() << ", "
+ << typename the::dimension.name() << ", "
+ << typename the::ext_domain.name() << ", "
+ << typename the::ext_value.name() << ", "
+ << typename the::ext_io.name() << ", "
+ << typename the::kind.name() << ", "
+ << typename the::nature.name() << ", "
+ << typename the::quant.name() << " }" << std::endl;
}
template <typename I>
Index: mln/trait/images.hh
--- mln/trait/images.hh (revision 2009)
+++ mln/trait/images.hh (working copy)
@@ -47,6 +47,21 @@
# include <mln/metal/if.hh>
# include <mln/metal/is_const.hh>
+// category
+// speed
+// size
+// value_access
+// value_storage
+// value_browsing
+// value_io
+// localization
+// dimension
+// ext_domain
+// ext_value
+// ext_io
+// kind
+// nature
+// quant
# define mln_trait_image_category(I) typename mln::trait::image_< I >::category
@@ -107,28 +122,30 @@
template <typename I>
struct undefined_image_
{
- typedef undef category; // primary, domain_morpher, value_morpher,
- // or identity_morpher < morpher
-
- // related to I::value
- typedef undef kind; // color, gray, binary < logic < label, data
- typedef undef quant; // low or high
- typedef undef value; // scalar, vectorial, structed, pointer
- // FIXME: Make the difference between homogeneous and heterogeneous vectors...
-
- // related to I::pset
- typedef undef access; // random, browsing
- // FIXME: Wouldn't it be nicer to use metal::int_<DIM>?
- typedef undef space; // one_d, two_d, three_d
- typedef undef size; // huge or regular
- typedef undef support; // irregular, aligned < regular
-
- // global
- typedef undef border; // none, { stored, computed } < some
- typedef undef neighb; // none, some
- typedef undef data; // raw < linear < stored, computed
- typedef undef io; // read_only < read, write_only < write, read_write < both read'n write
- typedef undef speed; // slow, fast, or fastest
+ // misc
+ typedef undef category;
+ typedef undef speed;
+ typedef undef size;
+
+ // value
+ typedef undef value_access;
+ typedef undef value_storage;
+ typedef undef value_browsing;
+ typedef undef value_io;
+
+ // site
+ typedef undef localization;
+ typedef undef dimension;
+
+ // extended domain
+ typedef undef ext_domain;
+ typedef undef ext_value;
+ typedef undef ext_io;
+
+ // data (I::value)
+ typedef undef kind;
+ typedef undef nature;
+ typedef undef quant;
};
@@ -160,31 +177,34 @@
// speed is fast by default (neither "fastest" nor "slow")
typedef trait::image::speed::fast speed;
-
- // neighb is absent by default.
- typedef trait::image::neighb::none neighb;
};
template <typename D, typename T, typename I>
struct default_image_morpher_ : default_image_<T, I>
{
- // value-related => delegation
+ // misc => NO delegation
+ // for category, speed, and size
+
+ // value => delegation
+ typedef typename image_<D>::value_access value_access;
+ typedef typename image_<D>::value_storage value_storage;
+ typedef typename image_<D>::value_browsing value_browsing;
+ typedef typename image_<D>::value_io value_io;
+
+ // site => delegation
+ typedef typename image_<D>::localization localization;
+ typedef typename image_<D>::dimension dimension;
+
+ // extended domain => delegation
+ typedef typename image_<D>::ext_domain ext_domain;
+ typedef typename image_<D>::ext_value ext_value;
+ typedef typename image_<D>::ext_io ext_io;
+
+ // data (I::value) => delegation
+ typedef typename image_<D>::nature nature;
typedef typename image_<D>::kind kind;
typedef typename image_<D>::quant quant;
- typedef typename image_<D>::value value;
-
- // domain-related => delegation
- typedef typename image_<D>::access access;
- typedef typename image_<D>::space space;
- typedef typename image_<D>::size size;
- typedef typename image_<D>::support support;
-
- // mostly global-related => delegation
- typedef typename image_<D>::border border;
- typedef typename image_<D>::neighb neighb;
- typedef typename image_<D>::data data;
- typedef typename image_<D>::io io;
};
1
0
cleanup-2008 2009: New files to keep track of site set and image types status.
by Thierry Geraud 10 Jun '08
by Thierry Geraud 10 Jun '08
10 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
New files to keep track of site set and image types status.
* mln/trait/site_set/status.txt: New.
* mln/trait/image/status.txt: New.
* mln/core/internal/site_iterator_base.hh: Remove dead comment.
* mln/core/concept/site_set.hh: Fix (c).
Add a todo.
core/concept/site_set.hh | 6 ++++--
core/internal/site_iterator_base.hh | 2 +-
trait/image/status.txt | 27 +++++++++++++++++++++++++++
trait/site_set/status.txt | 17 +++++++++++++++++
4 files changed, 49 insertions(+), 3 deletions(-)
Index: mln/trait/site_set/status.txt
--- mln/trait/site_set/status.txt (revision 0)
+++ mln/trait/site_set/status.txt (revision 0)
@@ -0,0 +1,17 @@
+ok box_
+KO line2d
+ok p_array
+KO p_array_bb
+KO p_bgraph
+KO p_graph
+KO p_image2d
+KO p_line_graph
+KO p_priority_queue
+KO p_priority_queue_fast
+KO p_priority_queue_fast_with_array
+KO p_queue
+KO p_queue_fast
+KO p_run
+KO p_runs
+KO p_set
+KO pset_if
Index: mln/trait/image/status.txt
--- mln/trait/image/status.txt (revision 0)
+++ mln/trait/image/status.txt (revision 0)
@@ -0,0 +1,27 @@
+KO bgraph_image
+KO cast_image
+KO decorated_image
+KO fi_adaptor
+KO graph_image
+KO hexa
+KO image1d
+KO image2d
+KO image3d
+KO image_if
+KO image_if_interval
+KO image_if_value
+KO interpolated
+KO line_graph_image
+KO mono_obased_rle_image
+KO mono_rle_image
+KO obased_rle_image
+KO plain
+KO pw::image
+KO rle_image
+KO safe
+KO sparse_image
+KO sub_image
+KO t_image
+KO tr_image
+KO translate_image
+KO value_enc_image
Index: mln/core/internal/site_iterator_base.hh
--- mln/core/internal/site_iterator_base.hh (revision 2008)
+++ mln/core/internal/site_iterator_base.hh (working copy)
@@ -52,7 +52,7 @@
proxy_impl< mln_psite(S), E>,
site_impl< false, // Constant access to site / subject.
- mln_site(S), // HOT: typename site_from< >::ret,
+ mln_site(S),
E >
{
Index: mln/core/concept/site_set.hh
--- mln/core/concept/site_set.hh (revision 2008)
+++ mln/core/concept/site_set.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -32,7 +32,9 @@
*
* \brief Definition of the concept of mln::Site_Set.
*
- * \todo Move out the ops.
+ * \todo Rewrite and move out the ops.
+ *
+ * \todo Check optional methods s.a. nsites and bbox.
*/
# include <mln/core/concept/point_site.hh>
1
0
10 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add some documentation about site set properties.
* mln/trait/site_set/props.hh: Add some doc.
* mln/trait/site_sets.hh: Likewise.
site_set/props.hh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++----
site_sets.hh | 21 ++++++++++++
2 files changed, 103 insertions(+), 6 deletions(-)
Index: mln/trait/site_set/props.hh
--- mln/trait/site_set/props.hh (revision 2007)
+++ mln/trait/site_set/props.hh (working copy)
@@ -37,6 +37,43 @@
# include <mln/trait/undef.hh>
+
+// Properties of site sets.
+// ========================
+
+// nsites: /any/
+// |
+// + -- unknown
+// |
+// + -- known
+
+// bbox: /any/
+// |
+// + -- unknown
+// |
+// + -- /known/
+// |
+// + -- lazy
+// |
+// + -- straight
+
+// contents: /any/
+// |
+// + -- fixed
+// |
+// + -- /dynamic/
+// |
+// + -- growing
+// |
+// + -- free
+
+// arity: /any/
+// |
+// + -- unique
+// |
+// + -- multiple
+
+
namespace mln
{
@@ -46,34 +83,73 @@
namespace site_set
{
+
+ /// Site set property about the 'nsites' method presence.
struct nsites
{
- struct any {};
+ /// Base class for the site set 'nsites' property.
+ struct any { protected: any() {} };
+
+ /// Property that states that the number of sites cannot be
+ /// retrieved from a site set in O(1) complexity so the site
+ /// set does not feature the 'nsites' methods.
struct unknown : any { std::string name() const { return "nsites::unknown"; } };
+
+ /// Property that states that a site set features the method
+ /// 'nsites' because the number of sites is known so its
+ /// retrieval has O(1) complexity.
struct known : any { std::string name() const { return "nsites::known"; } };
};
+
+ /// Site set property about the 'bbox' method presence.
struct bbox
{
- struct any {};
+ /// Base class for the site set 'bbox' property.
+ struct any { protected: any() {} };
+
+ /// Property that states that the bounding box of a site set
+ /// is not featured as a method. This is either because the
+ /// notion of bounding box is meaningless for the site set
+ /// type, or because the bounding box cannot be retrieved in
+ /// O(1) complexity.
struct unknown : any { std::string name() const { return "bbox::unknown"; } };
- struct known : any {};
+
+ /// Property that states that the bounding box of a site set
+ /// is featured by the 'bbox' method. It means that the
+ /// notion of bounding box makes sense and that such a piece
+ /// of information can be retrieved in O(1) complexity.
+ /// Warning: this property is pseudo-abstract. The more
+ /// precise properties are 'lazy' and 'straight'.
+ struct known : any { protected: known() {} };
+
+ /// Property that states that the bounding box of a site set
+ /// is computed by the site set in a lazy way.
struct lazy : known { std::string name() const { return "bbox::lazy"; } };
+
+ /// Property that states that the bounding box of a site set
+ /// is always kept up to date by the site set.
struct straight : known { std::string name() const { return "bbox::straight"; } };
};
+
+ /// Site set property about how the contents can evolve.
struct contents
{
- struct any {};
+ /// Base class for the site set 'contents' property.
+ struct any { protected: any() {} };
struct fixed : any { std::string name() const { return "contents::fixed"; } };
- struct dynamic : any {};
+ struct dynamic : any { protected: dynamic() {} };
struct growing : dynamic { std::string name() const { return "contents::growing"; } };
struct free : dynamic { std::string name() const { return "contents::dynamic"; } };
};
+ /// Site set property about the unicity or multiplicity of its
+ /// elements.
struct arity
{
- struct any {};
+ /// Base class for the site set 'arity' property.
+ struct any { protected: any() {} };
struct unique : any { std::string name() const { return "arity::unique"; } };
struct multiple : any { std::string name() const { return "arity::multiple"; } };
};
Index: mln/trait/site_sets.hh
--- mln/trait/site_sets.hh (revision 2007)
+++ mln/trait/site_sets.hh (working copy)
@@ -37,9 +37,20 @@
# include <mln/trait/site_set/props.hh>
+/// Shortcut to the site set property about the 'nsites' method
+/// presence.
# define mln_trait_site_set_nsites(S) typename mln::trait::site_set_< S >::nsites
+
+/// Shortcut to the site set property about the 'bbox' method
+/// presence.
# define mln_trait_site_set_bbox(S) typename mln::trait::site_set_< S >::bbox
+
+/// Shortcut to the site set property about how the contents can
+/// evolve.
# define mln_trait_site_set_contents(S) typename mln::trait::site_set_< S >::contents
+
+/// Shortcut to the site set property about the unicity or
+/// multiplicity of its elements.
# define mln_trait_site_set_arity(S) typename mln::trait::site_set_< S >::arity
@@ -50,6 +61,7 @@
namespace trait
{
+ /// Pack of 'undefined' type values for properties of site sets.
template <typename I>
struct undefined_site_set_
{
@@ -59,6 +71,15 @@
typedef undef arity; // Unique or multiple.
};
+
+ /*! \brief The trait pack structure for properties of site sets.
+ *
+ * This structure is specialized for every concrete class of site
+ * set so that properties are properly defined.
+ *
+ * \see mln::doc::Site_Set for the documentation of the "site set"
+ * concept.
+ */
template <typename I>
struct site_set_ : undefined_site_set_<I>
{
1
0
Roland Levillain wrote:
> https://svn.lrde.epita.fr/svn/oln/trunk/milena
>
>
> Index: ChangeLog
> from Roland Levillain <roland(a)lrde.epita.fr>
>
> Fix tests/util/graph.
>
> * tests/util/graph.cc: Catch up with the new interface of
> mln::util::graph<V, E>.
> s/add_node/add_vertex/.
>
> graph.cc | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> Index: tests/util/graph.cc
> --- tests/util/graph.cc (revision 1999)
> +++ tests/util/graph.cc (working copy)
> @@ -37,12 +37,12 @@
>
> util::graph<void> g;
>
> - g.add_node (); // 0
> - g.add_node (); // 1
> - g.add_node (); // 2
> - g.add_node (); // 3
> - g.add_node (); // 4
> - g.add_node (); // 5
> + g.add_vertex (); // 0
> + g.add_vertex (); // 1
> + g.add_vertex (); // 2
> + g.add_vertex (); // 3
> + g.add_vertex (); // 4
> + g.add_vertex (); // 5
> g.add_edge (0, 1);
> g.add_edge (0, 2);
> g.add_edge (3, 4);
Faire un pauvre patch de renommage juste pour avoir le 2000 ème patch
c'est petit ...
--
Vivien Delmon
- ZiXiS -
CSI 2009
2
1
10 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add some tutorial-like files about cubical complex.
* sandbox/geraud/cs2d/tuto.cc: New.
* sandbox/geraud/cs2d/tuto_bis.cc: New.
tuto.cc | 145 +++++++++++++++++++++++++++++++
tuto_bis.cc | 277 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 422 insertions(+)
Index: sandbox/geraud/cs2d/tuto.cc
--- sandbox/geraud/cs2d/tuto.cc (revision 0)
+++ sandbox/geraud/cs2d/tuto.cc (revision 0)
@@ -0,0 +1,145 @@
+# include <mln/core/image2d.hh>
+# include <mln/core/image_if.hh>
+
+# include <mln/core/neighb2d.hh>
+# include <mln/core/window2d.hh>
+# include <mln/convert/to_window.hh>
+
+# include <mln/debug/println.hh>
+# include <mln/fun/p2v/iota.hh>
+# include <mln/level/paste.hh>
+# include <mln/level/fill.hh>
+# include <mln/morpho/dilation.hh>
+
+
+
+ struct is_cell_t : mln::Function_p2b<is_cell_t>
+ {
+ typedef bool result;
+ bool operator()(const mln::point2d& p) const
+ {
+ return p.row() % 2 == 0 && p.col() % 2 == 0;
+ }
+ }
+ is_cell;
+
+ struct is_edge_t : mln::Function_p2b<is_edge_t>
+ {
+ typedef bool result;
+ bool operator()(const mln::point2d& p) const
+ {
+ return p.row() % 2 + p.col() % 2 == 1;
+ }
+ }
+ is_edge;
+
+ struct is_point_t : mln::Function_p2b<is_point_t>
+ {
+ typedef bool result;
+ bool operator()(const mln::point2d& p) const
+ {
+ return p.row() % 2 && p.col() % 2;
+ }
+ }
+ is_point;
+
+
+
+int main()
+{
+ using namespace mln;
+
+ window2d c4 = convert::to_window(mln::c4());
+
+ {
+ image2d<char> ima(3, 5);
+
+ level::fill(ima, 'o');
+
+ debug::println(ima);
+ // o o o o o
+ // o o o o o
+ // o o o o o
+
+ debug::println(ima | is_cell);
+ // o o o
+ //
+ // o o o
+
+ level::fill(inplace(ima | is_cell), 'c');
+ level::fill(inplace(ima | is_edge), 'e');
+ level::fill(inplace(ima | is_point), 'p');
+
+ debug::println(ima);
+ // c e c e c
+ // e p e p e
+ // c e c e c
+ }
+
+ {
+ image2d<int> ima(3, 5);
+
+ level::fill(ima, 0);
+ debug::println(ima);
+ // 0 0 0 0 0
+ // 0 0 0 0 0
+ // 0 0 0 0 0
+
+ level::fill(inplace(ima | is_cell), fun::p2v::iota);
+ debug::println(ima | is_cell);
+ // 1 2 3
+ //
+ // 4 5 6
+
+ // --- for the record:
+ // debug::println(morpho::dilation(ima, win::square(3)));
+
+ debug::println(ima);
+ // 1 0 2 0 3
+ // 0 0 0 0 0
+ // 4 0 5 0 6
+
+ debug::println(ima | is_edge);
+ // 0 0
+ // 0 0 0
+ // 0 0
+
+ debug::println(morpho::dilation(ima | is_edge, c4));
+ // 2 3
+ // 4 5 6
+ // 5 6
+
+ // Attention : les traitements ne travaillent généralement pas en
+ // place ; l'entrée n'est pas modifiée, une nouvelle image est
+ // retournée. Dans le code ci-dessus, l'image dilatée est envoyée
+ // à la routine d'affichage puis, n'étant plus utilisée, elle est
+ // automatiquement désallouée.
+
+ // On peut vérifier que 'ima' n'a pas été modifié :
+
+ debug::println(ima);
+ // 1 0 2 0 3
+ // 0 0 0 0 0
+ // 4 0 5 0 6
+
+ // En revanche, rien n'empêche de "coller" le résultat d'un
+ // traitement dans l'image d'entrée :
+
+ level::paste(morpho::dilation(ima | is_edge, c4), ima);
+
+ // Maintenant, le dilaté de "ima restreint à edge" est collé dans
+ // 'ima' :
+
+ debug::println(ima);
+ // 1 2 2 3 3
+ // 4 0 5 0 6
+ // 4 5 5 6 6
+
+ level::paste(morpho::dilation(ima | is_point, c4), ima);
+ debug::println(ima);
+ // 1 2 2 3 3
+ // 4 5 5 6 6
+ // 4 5 5 6 6
+ }
+
+}
Index: sandbox/geraud/cs2d/tuto_bis.cc
--- sandbox/geraud/cs2d/tuto_bis.cc (revision 0)
+++ sandbox/geraud/cs2d/tuto_bis.cc (revision 0)
@@ -0,0 +1,277 @@
+# include <vector>
+
+# include <mln/core/image2d.hh>
+# include <mln/core/sub_image.hh>
+# include <mln/core/image_if.hh>
+# include <mln/core/image_if_value.hh>
+
+# include <mln/core/neighb2d.hh>
+# include <mln/core/window2d.hh>
+# include <mln/convert/to_window.hh>
+
+# include <mln/debug/println.hh>
+# include <mln/fun/p2v/iota.hh>
+# include <mln/level/paste.hh>
+# include <mln/level/fill.hh>
+
+# include <mln/morpho/dilation.hh>
+# include <mln/morpho/gradient.hh>
+# include <mln/morpho/meyer_wst.hh>
+
+# include <mln/level/transform.hh>
+# include <mln/accu/mean.hh>
+
+# include "dbl_neighb.hh"
+
+
+namespace mln
+{
+
+
+ namespace level
+ {
+
+ template<typename I, typename R>
+ mln_ch_value(I, R)
+ transform(const Image<I>& input_, const std::vector<R>& v)
+ {
+ trace::entering("level::transform");
+ const I& input = exact(input_);
+
+ mln_ch_value(I, R) output;
+ initialize(output, input);
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ output(p) = v[input(p)];
+
+ trace::exiting("level::transform");
+ return output;
+ }
+
+ } // mln::level
+
+ namespace accu
+ {
+
+ template <typename A_, typename I, typename L, typename R>
+ inline
+ void
+ compute(const Image<I>& input_,
+ const Image<L>& label_,
+ std::vector<R>& v)
+ {
+ mlc_is_a(A_, Meta_Accumulator)::check();
+
+ trace::entering("accu::compute");
+
+ const I& input = exact(input_);
+ const L& label = exact(label_);
+
+ typedef mln_accu_with(A_, mln_value(I)) A;
+ const unsigned n = v.size();
+ std::vector<A> a(n);
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ a[label(p)].take(input(p));
+
+ for (unsigned l = 1; l < n; ++l)
+ v[l] = a[l].to_result();
+
+ trace::exiting("accu::compute");
+ }
+
+ } // mln::accu
+
+} // mln
+
+
+ struct is_cell_t : mln::Function_p2b<is_cell_t>
+ {
+ typedef bool result;
+ bool operator()(const mln::point2d& p) const
+ {
+ return p.row() % 2 == 0 && p.col() % 2 == 0;
+ }
+ }
+ is_cell;
+
+ struct is_edge_t : mln::Function_p2b<is_edge_t>
+ {
+ typedef bool result;
+ bool operator()(const mln::point2d& p) const
+ {
+ return p.row() % 2 + p.col() % 2 == 1;
+ }
+ }
+ is_edge;
+
+ struct is_point_t : mln::Function_p2b<is_point_t>
+ {
+ typedef bool result;
+ bool operator()(const mln::point2d& p) const
+ {
+ return p.row() % 2 && p.col() % 2;
+ }
+ }
+ is_point;
+
+
+ struct is_row_odd_t
+ {
+ bool operator()(const mln::point2d& p) const
+ {
+ return p.row() % 2;
+ }
+ } is_row_odd;
+
+
+
+#define mln_alias(Var, Expr) \
+typeof(Expr) Var = Expr;
+
+
+
+int main()
+{
+ using namespace mln;
+
+ window2d c4 = convert::to_window(mln::c4());
+
+
+ dbl_neighb_<dpoint2d, is_row_odd_t> nbh_e2c, win_p_e2c, nbh_e2e;
+ {
+ bool e2c_h[] = { 0, 1, 0,
+ 0, 0, 0,
+ 0, 1, 0 };
+
+ bool e2c_v[] = { 0, 0, 0,
+ 1, 0, 1,
+ 0, 0, 0 };
+ nbh_e2c
+ .when_true (make::neighb2d(e2c_h))
+ .when_false(make::neighb2d(e2c_v));
+
+ win_p_e2c = nbh_e2c;
+ win_p_e2c
+ .insert_true(make::dpoint2d(0,0))
+ .insert_false(make::dpoint2d(0,0));
+
+ bool e2e_h[] = { 0, 0, 1, 0, 0,
+ 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0,
+ 0, 1, 0, 1, 0,
+ 0, 0, 1, 0, 0 };
+
+ bool e2e_v[] = { 0, 0, 0, 0, 0,
+ 0, 1, 0, 1, 0,
+ 1, 0, 0, 0, 1,
+ 0, 1, 0, 1, 0,
+ 0, 0, 0, 0, 0 };
+ nbh_e2e
+ .when_true (make::neighb2d(e2e_h))
+ .when_false(make::neighb2d(e2e_v));
+ }
+
+
+ image2d<int> ima(3, 5);
+
+ mln_alias(cell, ima | is_cell);
+ level::fill(cell, fun::p2v::iota);
+ debug::println(cell);
+ // 1 2 3
+ //
+ // 4 5 6
+
+ mln_alias(edge, ima | is_edge);
+ level::paste(morpho::gradient(edge, nbh_e2c), edge);
+ // ^^^^^^^
+ // edge -> neighbooring cells
+ debug::println(edge);
+ // 1 1
+ // 3 3 3
+ // 1 1
+
+ unsigned nbasins;
+ mln_alias(wst, morpho::meyer_wst(edge, nbh_e2e, nbasins));
+ // ^^^^^^^
+ // edge -> neighbooring edges
+ debug::println(wst);
+ // 2 2
+ // 0 0 0
+ // 1 1
+
+ std::cout << nbasins << " bassins" << std::endl;
+ // 2 bassins
+
+
+ // '0' IS THE TAG VALUE FOR THE WATERSHED LINE
+ // THE OTHER VALUES ARE THE REGION LABELS
+
+
+ std::cout << "the watershed line = " << (wst | 0).domain() << std::endl;
+ // the watershed line = {(1,0)(1,2)(1,4)}
+ // ^^^^^
+ // meaning (row = 1, col = 0)
+
+ // Actually wst is:
+ //
+ // 0 1 2 3 4 <- col
+ // +-----------+
+ // 0 | 2 2 |
+ // 1 | 0 0 0 |
+ // 2 | 1 1 |
+ // +-----------+
+ // ^
+ // |
+ // row
+
+
+ // YET THOSE VALUES ARE ON EDGES, NOT ON CELLS...
+
+
+ mln_alias(label, wst.full());
+ debug::println(label);
+ // 0 2 0 2 0
+ // 0 0 0 0 0
+ // 0 1 0 1 0
+
+ level::paste(morpho::dilation(label | is_cell, c4), label);
+
+ debug::println(label);
+ // 2 2 2 2 2
+ // 0 0 0 0 0
+ // 1 1 1 1 1
+ debug::println(label | is_cell);
+ // 2 2 2
+ //
+ // 1 1 1
+
+
+ // ABOVE, WE HAVE THE LABEL IMAGE (POINTS-ONLY).
+ // BELOW, THE ORIGINAL IMAGE (POINTS-ONLY).
+
+
+ debug::println(cell);
+ // 1 2 3
+ //
+ // 4 5 6
+
+
+ // NOW WE WANT TO MODIFY THE INPUT IMAGE TO FLATTEN REGIONS...
+
+
+ std::vector<int> m(nbasins + 1);
+ accu::compute<accu::mean>(cell, label, m);
+ for (unsigned i = 1; i <= nbasins; ++i)
+ std::cout << "mean value of basin " << i << " is " << m[i] << std::endl;
+
+ level::fill(cell, level::transform(label, m));
+ debug::println(cell);
+ // 2 2 2
+ //
+ // 5 5 5
+
+ // DONE!
+}
1
0
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Deactivate site set inclusion tests.
Operators that test inclusion relationships between a couple of
site sets are not always correct as is. Yet they are widely used
thru the library. They are temporarily deactivated thanks to
their return value.
* mln/util/yes.hh: New utility class that always responds yes,
i.e., converts to 'true'.
* tests/util/yes.cc: New.
* mln/core/concept/site_set.hh (operator==): Deactivate body and
return yes.
(operator <=): Likewise.
(operator <): Likewise.
* doc/tutorial/examples/p_array.cc: Add a test of inclusion.
doc/tutorial/examples/p_array.cc | 1
mln/core/concept/site_set.hh | 74 +++++++++--------
mln/util/yes.hh | 161 +++++++++++++++++++++++++++++++++++++++
tests/util/yes.cc | 54 +++++++++++++
4 files changed, 255 insertions(+), 35 deletions(-)
Index: tests/util/yes.cc
--- tests/util/yes.cc (revision 0)
+++ tests/util/yes.cc (revision 0)
@@ -0,0 +1,54 @@
+// Copyright (C) 2008 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.
+
+/*!
+ * \file tests/util/yes.cc
+ *
+ * \brief test of mln::util::yes
+ *
+ */
+
+#include <mln/util/yes.hh>
+
+
+int main ()
+{
+ using namespace mln;
+
+ util::yes b;
+
+ mln_invariant(b == true);
+ mln_invariant((!b) == true);
+ mln_invariant(b != true);
+
+ mln_invariant(b == false);
+ mln_invariant((!b) == false);
+ mln_invariant(b != false);
+
+ mln_invariant(b);
+ mln_invariant(! b);
+}
Index: doc/tutorial/examples/p_array.cc
--- doc/tutorial/examples/p_array.cc (revision 2004)
+++ doc/tutorial/examples/p_array.cc (working copy)
@@ -60,6 +60,7 @@
<< index_of_in(p, arr1) << " in arr1" << std::endl;
}
+ mln_invariant(arr2 < arr1);
}
}
Index: mln/core/concept/site_set.hh
--- mln/core/concept/site_set.hh (revision 2004)
+++ mln/core/concept/site_set.hh (working copy)
@@ -41,6 +41,8 @@
# include <mln/metal/not_equal.hh>
# include <mln/metal/is_a.hh>
+# include <mln/util/yes.hh> // Temporary include.
+
namespace mln
{
@@ -90,7 +92,7 @@
* \relates mln::Site_Set
*/
template <typename Sl, typename Sr>
- bool operator==(const Site_Set<Sl>& lhs, const Site_Set<Sr>& rhs);
+ util::yes operator==(const Site_Set<Sl>& lhs, const Site_Set<Sr>& rhs);
@@ -102,7 +104,7 @@
* \relates mln::Site_Set
*/
template <typename Sl, typename Sr>
- bool operator<=(const Site_Set<Sl>& lhs, const Site_Set<Sr>& rhs);
+ util::yes operator<=(const Site_Set<Sl>& lhs, const Site_Set<Sr>& rhs);
@@ -115,7 +117,7 @@
* \relates mln::Site_Set
*/
template <typename Sl, typename Sr>
- bool operator<(const Site_Set<Sl>& lhs, const Site_Set<Sr>& rhs);
+ util::yes operator<(const Site_Set<Sl>& lhs, const Site_Set<Sr>& rhs);
@@ -168,40 +170,41 @@
template <typename Sl, typename Sr>
inline
- bool operator==(const Site_Set<Sl>& lhs_, const Site_Set<Sr>& rhs_)
+ util::yes operator==(const Site_Set<Sl>& lhs_, const Site_Set<Sr>& rhs_)
{
- // FIXME: Same grid!
- const Sl& lhs = exact(lhs_);
- const Sr& rhs = exact(rhs_);
-
- // exhaustive test:
- mln_fwd_piter(Sl) pl(lhs);
- mln_fwd_piter(Sr) pr(rhs);
- for (pl.start(), pr.start();
- pl.is_valid() && pr.is_valid();
- pl.next(), pr.next())
- if (pl != pr)
- return false; // difference found
-
- // both sets are equal only if both browsings are completed
- // at the same time:
- return ! pl.is_valid() && ! pr.is_valid();
+// // FIXME: Same grid!
+// const Sl& lhs = exact(lhs_);
+// const Sr& rhs = exact(rhs_);
+
+// // exhaustive test:
+// mln_fwd_piter(Sl) pl(lhs);
+// mln_fwd_piter(Sr) pr(rhs);
+// for (pl.start(), pr.start();
+// pl.is_valid() && pr.is_valid();
+// pl.next(), pr.next())
+// if (pl != pr)
+// return false; // difference found
+
+// // both sets are equal only if both browsings are completed
+// // at the same time:
+// return ! pl.is_valid() && ! pr.is_valid();
+ return true;
}
template <typename Sl, typename Sr>
inline
- bool operator<=(const Site_Set<Sl>& lhs_, const Site_Set<Sr>& rhs_)
+ util::yes operator<=(const Site_Set<Sl>& lhs_, const Site_Set<Sr>& rhs_)
{
- // FIXME: Same grid!
- const Sl& lhs = exact(lhs_);
- const Sr& rhs = exact(rhs_);
-
- // exhaustive test:
- mln_piter(Sl) pl(lhs);
- for_all(pl)
- if (! rhs.has(pl))
- return false;
+// // FIXME: Same grid!
+// const Sl& lhs = exact(lhs_);
+// const Sr& rhs = exact(rhs_);
+
+// // exhaustive test:
+// mln_piter(Sl) pl(lhs);
+// for_all(pl)
+// if (! rhs.has(pl))
+// return false;
return true;
}
@@ -209,12 +212,13 @@
template <typename Sl, typename Sr>
inline
- bool operator<(const Site_Set<Sl>& lhs_, const Site_Set<Sr>& rhs_)
+ util::yes operator<(const Site_Set<Sl>& lhs_, const Site_Set<Sr>& rhs_)
{
- // FIXME: Same grid!
- const Sl& lhs = exact(lhs_);
- const Sr& rhs = exact(rhs_);
- return lhs <= rhs && lhs != rhs;
+// // FIXME: Same grid!
+// const Sl& lhs = exact(lhs_);
+// const Sr& rhs = exact(rhs_);
+// return lhs <= rhs && lhs != rhs;
+ return true;
}
Index: mln/util/yes.hh
--- mln/util/yes.hh (revision 0)
+++ mln/util/yes.hh (revision 0)
@@ -0,0 +1,161 @@
+// Copyright (C) 2008 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_UTIL_YES_HH
+# define MLN_UTIL_YES_HH
+
+/*! \file mln/util/yes.hh
+ *
+ * \brief Definition of an object that always says "yes".
+ */
+
+# include <mln/core/concept/object.hh>
+# include <mln/core/ops.hh>
+
+
+namespace mln
+{
+
+ // Fwd decl.
+ namespace util { struct yes; }
+
+
+ namespace trait
+ {
+
+ template <>
+ struct set_precise_unary_< op::not_, util::yes >
+ {
+ typedef util::yes ret;
+ };
+
+ template <template<class, class> class Op>
+ struct set_precise_binary_< Op, util::yes, bool >
+ {
+ typedef util::yes ret;
+ };
+
+ } // end of namespace mln::trait
+
+
+ namespace util
+ {
+
+ /*! \brief Yes structure.
+ *
+ */
+ struct yes : public Object< yes >
+ {
+ yes();
+ yes(bool);
+ operator bool() const;
+ };
+
+ } // end of namespace mln::util
+
+
+ // Negate.
+ util::yes operator ! (const util::yes& y);
+
+ // Equal.
+ util::yes operator == (const util::yes&, bool);
+
+ // Not equal.
+ util::yes operator != (const util::yes&, bool);
+
+ // And.
+ util::yes operator && (const util::yes&, bool);
+
+ // Or.
+ util::yes operator || (const util::yes&, bool);
+
+
+ // FIXME: Is-it suffisiant?
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace util
+ {
+
+ // yes
+
+ inline
+ yes::yes()
+ {
+ }
+
+ inline
+ yes::yes(bool)
+ {
+ }
+
+ inline
+ yes::operator bool() const
+ {
+ return true;
+ }
+
+ } // end of namespace mln::util
+
+ inline
+ util::yes
+ operator ! (const util::yes& y)
+ {
+ return y;
+ }
+
+ inline
+ util::yes operator == (const util::yes&, bool)
+ {
+ return true;
+ }
+
+ inline
+ util::yes operator != (const util::yes&, bool)
+ {
+ return true;
+ }
+
+ inline
+ util::yes operator && (const util::yes&, bool)
+ {
+ return true;
+ }
+
+ inline
+ util::yes operator || (const util::yes&, bool)
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_UTIL_YES_HH
1
0
08 Jun '08
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <jardonnet(a)lrde.epita.fr>
Sandbox: ICP: Points escaping during multi-scale registration.
* jardonnet/test/test.rb: Fix: Change parameters e and q.
* jardonnet/test/icp.cc: Fix: Make use of update_qk[1].
* jardonnet/registration/icp_ref.hh: Fix: Remove useless Xk array.
* jardonnet/registration/icp.hh: Update: Escape points during
registration steps.
registration/icp.hh | 16 +++++++++++++++-
registration/icp_ref.hh | 2 +-
test/icp.cc | 4 +++-
test/test.rb | 4 ++--
4 files changed, 21 insertions(+), 5 deletions(-)
Index: jardonnet/test/test.rb
--- jardonnet/test/test.rb (revision 2003)
+++ jardonnet/test/test.rb (working copy)
@@ -3,8 +3,8 @@
print "# icp_ref \t icp\n"
print "-------------------------\n"
-q = 1
-e = 1
+q = 4
+e = 5
for i in 0..9 do
Index: jardonnet/test/icp.cc
--- jardonnet/test/icp.cc (revision 2003)
+++ jardonnet/test/icp.cc (working copy)
@@ -79,8 +79,9 @@
for (size_t i = 0; i < c.npoints(); i++)
length[i] = norm::l2(algebra::vec<3,int> (c[i] - map(c[i])));
+
// final transform
- quat7<3> fqk = registration::final_qk2(c, map, 2*stddev);
+ quat7<3> fqk = registration::final_qk(c, map, 2*stddev);
fqk.apply_on(c, c, c.npoints());
//print x
@@ -92,6 +93,7 @@
output(px) = literal::green;
}
+
//to 2d : projection (FIXME:if 3d)
for (size_t i = 0; i < c.npoints(); i++)
{
Index: jardonnet/registration/icp_ref.hh
--- jardonnet/registration/icp_ref.hh (revision 2003)
+++ jardonnet/registration/icp_ref.hh (working copy)
@@ -102,7 +102,7 @@
buffer<4,quat7<P::dim> > buf_qk;
- p_array<P> Ck(C), Xk(C);
+ p_array<P> Ck(C);
float d_k = 1000, d_k_1 = 1000, e_k = 1000;
algebra::vec<P::dim,float> mu_C = center(C, c_length), mu_Xk;
Index: jardonnet/registration/icp.hh
--- jardonnet/registration/icp.hh (revision 2003)
+++ jardonnet/registration/icp.hh (working copy)
@@ -151,7 +151,7 @@
pts += c_length;
#endif
k++;
- } while (/*k < 3 ||*/ (qk - buf_qk[1]).sqr_norm() /
qk.sqr_norm() > epsilon);
+ } while ((qk - buf_qk[1]).sqr_norm() / qk.sqr_norm() > epsilon);
trace::exiting("registration::impl::icp_");
}
@@ -203,6 +203,20 @@
l = (l<1) ? 1 : l;
impl::icp_(cloud, map, qk, l, 1e-3);
+ //remove points
+ p_array<P> tmp;
+ tmp.reserve(cloud.npoints());
+ qk.apply_on(cloud,tmp, cloud.npoints());
+ float stddev, mean;
+ mean_stddev(tmp, map, mean, stddev);
+ for (unsigned i = 0; i < cloud.npoints(); i++)
+ {
+ algebra::vec<3,float> qci = tmp[i];
+ algebra::vec<3,float> xi = x[i];
+ if (norm::l2(qci - xi) < 2 * stddev)
+ cloud.hook_()[i] = cloud[(i+1) % cloud.npoints()];
+ }
+
#ifndef NDEBUG
{
value::rgb8 c;
1
0
#135: Name Confilts between util::node and util::node.
-----------------------+----------------------------------------------------
Reporter: garrigues | Owner: Olena Team
Type: defect | Status: new
Priority: major | Milestone: Olena 1.0ß
Component: Milena | Version: 1.0
Keywords: |
-----------------------+----------------------------------------------------
We have two util::node : one for the graph implementation and also one for
the tree.
see source:/trunk/milena/mln/util/tree.hh and
source:/trunk/milena/mln/util/internal/graph_base.hh
--
Ticket URL: <https://trac.lrde.org/olena/ticket/135>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
1
4
2003: Have mln::util::vertex_id and mln::util::edge_id be distinct types.
by Roland Levillain 08 Jun '08
by Roland Levillain 08 Jun '08
08 Jun '08
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Closes https://trac.lrde.org/olena/ticket/135.
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Have mln::util::vertex_id and mln::util::edge_id be distinct types.
* mln/util/internal/graph_base.hh
(mln::util::gen_id<Tag, Typename>): New class.
(mln::util::vertex_tag, mln::util::edge_tag): New tags
(mln::util::vertex_id, mln::util::edge_id): Define these typedefs
as specializations of mln::util::gen_id instead of unsigned.
(mln::util::graph_base<V, E>::add_edge_): Adjust.
(operator==(const edge<E>&, const edge<E>&))
(operator< (const edge<E>&, const edge<E>&)):
Add missing an inline qualifier.
(mln::util::graph_base<V, E>::vertex(vertex_id)): Have the
declarations and definitions of thee methods have the exact same
signature.
* mln/core/line_graph_psite.hh
(line_graph_psite(const p_line_graph<P>&, util::edge_id))
(mln::util::line_graph_psite<P>::id):
Likewise.
* mln/core/graph_psite.hh
(graph_psite(const p_graph<P>&, util::vertex_id)):
Likewise.
* mln/core/p_line_graph_piter.hh
(p_line_graph_fwd_piter_<P>::next_):
(p_line_graph_bkd_piter_<P>::next_):
Adjust.
* tests/morpho/lena_line_graph_image_wst1.cc: Adjust.
mln/core/graph_psite.hh | 2
mln/core/line_graph_psite.hh | 4
mln/core/p_line_graph_piter.hh | 4
mln/util/internal/graph_base.hh | 160 ++++++++++++++++++++++++++---
tests/morpho/lena_line_graph_image_wst1.cc | 2
5 files changed, 153 insertions(+), 19 deletions(-)
Index: tests/morpho/lena_line_graph_image_wst1.cc
--- tests/morpho/lena_line_graph_image_wst1.cc (revision 2002)
+++ tests/morpho/lena_line_graph_image_wst1.cc (working copy)
@@ -126,7 +126,7 @@
is bad. util:graph<N,E>::add_vertex should return this
id. */
points[p] = id;
- ++id;
+ ++id.to_equiv();
}
// Edges.
Index: mln/core/line_graph_psite.hh
--- mln/core/line_graph_psite.hh (revision 2002)
+++ mln/core/line_graph_psite.hh (working copy)
@@ -61,7 +61,7 @@
/// Construction and assignment.
/// \{
line_graph_psite();
- line_graph_psite(const p_line_graph<P>& plg, unsigned id);
+ line_graph_psite(const p_line_graph<P>& plg, util::edge_id id);
line_graph_psite(const self_& rhs);
self_& operator= (const self_& rhs);
/// \}
@@ -224,7 +224,7 @@
template<typename P>
inline
- util::vertex_id
+ util::edge_id
line_graph_psite<P>::id() const
{
return id_;
Index: mln/core/p_line_graph_piter.hh
--- mln/core/p_line_graph_piter.hh (revision 2002)
+++ mln/core/p_line_graph_piter.hh (working copy)
@@ -281,7 +281,7 @@
void
p_line_graph_fwd_piter_<P>::next_()
{
- ++id_;
+ ++id_.to_equiv();
if (is_valid())
update_();
}
@@ -422,7 +422,7 @@
void
p_line_graph_bkd_piter_<P>::next_()
{
- --id_;
+ --id_.to_equiv();
if (is_valid())
update_();
}
Index: mln/core/graph_psite.hh
--- mln/core/graph_psite.hh (revision 2002)
+++ mln/core/graph_psite.hh (working copy)
@@ -58,7 +58,7 @@
/// Construction and assignment.
/// \{
graph_psite();
- graph_psite(const p_graph<P>& pg_, unsigned id);
+ graph_psite(const p_graph<P>& pg_, util::vertex_id id);
graph_psite(const self_& rhs);
self_& operator= (const self_& rhs);
/// \}
Index: mln/util/internal/graph_base.hh
--- mln/util/internal/graph_base.hh (revision 2002)
+++ mln/util/internal/graph_base.hh (working copy)
@@ -40,35 +40,79 @@
# include <ostream>
# include <mln/core/concept/object.hh>
+
# include <mln/util/ordpair.hh>
+# include <mln/value/builtin/integers.hh>
namespace mln
{
namespace util
{
- /* FIXME: We should create actual types for vertex_id and edge_id,
- (not just typedefs), at least to prevent the user from using a
- vertex_id where an edge_id is expected (and vice versa).
- Conversion to and from unsigned would still be useful, but it
- might be safer to turn them into explicit ones.
+ /*--------------.
+ | Identifiers. |
+ `--------------*/
- See what the Vaucanson team did for the handles of
- vertices/states in their graphs/automata implemenations here:
+ /// \brief Generic identifier/handler.
+ ///
+ /// Inspired by Vaucansons's handlers for automata.
+ ///
+ /// https://svn.lrde.epita.fr/svn/vaucanson/trunk/include/vaucanson/automata/co…
+ /// https://svn.lrde.epita.fr/svn/vaucanson/trunk/include/vaucanson/automata/co…
+ //
+ // \todo We /might/ want to integrate this into Milena's value system.
+
+ template <typename Tag, typename Equiv>
+ class gen_id
+ {
+ typedef gen_id<Tag, Equiv> self_t;
- https://trac.lrde.org/vaucanson/browser/trunk/include/vaucanson/automata/co…
+ public:
+ typedef Equiv equiv;
+
+ gen_id();
+ gen_id(const Equiv& e);
+ self_t& operator=(const Equiv& e);
+
+ const equiv& to_equiv() const;
+ equiv& to_equiv();
+ operator const equiv() const;
+ operator equiv();
+
+ private:
+ equiv e_;
+ };
+
+ /// Compare two identifiers.
+ /// \{
+ template <typename Tag, typename Equiv>
+ bool
+ operator==(const gen_id<Tag, Equiv>& i, const gen_id<Tag, Equiv>& j);
+
+ template <typename Tag, typename Equiv>
+ bool
+ operator==(const Equiv& i, const gen_id<Tag, Equiv>& j);
+
+ template <typename Tag, typename Equiv>
+ bool
+ operator==(const gen_id<Tag, Equiv>& i, const Equiv j);
+ /// \}
- We /might/ want to integrate this into Milena's value system. */
+ /// Tags.
+ /// \{
+ struct vertex_tag;
+ struct edge_tag;
+ /// \}
/// \brief The type used to identify vertices.
///
/// Used internally as a key to manipulate vertices.
- typedef unsigned vertex_id;
+ typedef gen_id<vertex_tag, unsigned> vertex_id;
/// \brief The type used to identify edges.
///
/// Used internally as a key to manipulate edges.
- typedef unsigned edge_id;
+ typedef gen_id<edge_tag, unsigned> edge_id;
/*---------.
@@ -180,7 +224,7 @@
/// Return the vertex whose id is \a v.
/// \{
util::vertex<V>& vertex(vertex_id v);
- const util::vertex<V>& vertex(edge_id v) const;
+ const util::vertex<V>& vertex(vertex_id v) const;
/// \}
/// Return the edge whose id is \a e.
@@ -242,7 +286,93 @@
# ifndef MLN_INCLUDE_ONLY
+ /*--------------.
+ | Identifiers. |
+ `--------------*/
+
+ template <typename Tag, typename Equiv>
+ inline
+ gen_id<Tag, Equiv>::gen_id()
+ {
+ }
+
+ template <typename Tag, typename Equiv>
+ inline
+ gen_id<Tag, Equiv>::gen_id(const Equiv& e)
+ : e_ (e)
+ {
+ }
+
+ template <typename Tag, typename Equiv>
+ inline
+ gen_id<Tag, Equiv>&
+ gen_id<Tag, Equiv>::operator=(const Equiv& e)
+ {
+ e_ = e;
+ return *this;
+ }
+
+ template <typename Tag, typename Equiv>
+ inline
+ const Equiv&
+ gen_id<Tag, Equiv>::to_equiv() const
+ {
+ return e_;
+ }
+
+ template <typename Tag, typename Equiv>
+ inline
+ Equiv&
+ gen_id<Tag, Equiv>::to_equiv()
+ {
+ return e_;
+ }
+
+ template <typename Tag, typename Equiv>
+ inline
+ gen_id<Tag, Equiv>::operator const Equiv() const
+ {
+ return to_equiv();
+ }
+
+ template <typename Tag, typename Equiv>
+ inline
+ gen_id<Tag, Equiv>::operator Equiv()
+ {
+ return to_equiv();
+ }
+
+
+ template <typename Tag, typename Equiv>
+ inline
+ bool
+ operator==(const gen_id<Tag, Equiv>& i, const gen_id<Tag, Equiv>& j)
+ {
+ return i.to_equiv() == j.to_equiv();
+ }
+
+ template <typename Tag, typename Equiv>
+ inline
+ bool
+ operator==(const Equiv& i, const gen_id<Tag, Equiv>& j)
+ {
+ return i == j.to_equiv();
+ }
+
+ template <typename Tag, typename Equiv>
+ inline
+ bool
+ operator==(const gen_id<Tag, Equiv>& i, const Equiv j)
+ {
+ return i.to_equiv() == j;
+ }
+
+ /*---------------------.
+ | Operators on edges. |
+ `---------------------*/
+
template <typename E>
+ inline
bool
operator==(const edge<E>& lhs, const edge<E>& rhs)
{
@@ -250,6 +380,7 @@
}
template <typename E>
+ inline
bool
operator< (const edge<E>& lhs, const edge<E>& rhs)
{
@@ -447,7 +578,10 @@
delete edge;
edge = 0;
// Return the erroneous value.
- return mln_max(edge_id);
+ /* FIXME: We have to explicitly extract the numerical
+ equivalent type here, because mln::util::gen_id<T, E>
+ is not compatible with Milena's value system (yet). */
+ return mln_max(edge_id::equiv);
}
else
{
1
0