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
- 9625 discussions
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Have beguin/irm compile again.
* beguin/irm.cc: Catch up with the interface of
mln::util::vertex_id.
(my_mln::merge_fg): Remove a useless `typename'.
irm.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: beguin/irm.cc
--- beguin/irm.cc (revision 2073)
+++ beguin/irm.cc (working copy)
@@ -314,7 +314,7 @@
fusion_graph fg;
// Vertices.
- for (util::vertex_id i = 0; i < rag.nvertices(); ++i)
+ for (util::vertex_id i = 0; i < rag.nvertices(); ++i.to_equiv())
{
// The singleton subregion: { I }.
std::set<util::vertex_id> sr;
@@ -350,7 +350,7 @@
// A disjoint set of vertices represented as a forest of rooted
// trees (disjoint set forest).
std::vector<util::vertex_id> parent(input.nvertices());
- for (util::vertex_id i = 0; i < parent.size(); ++i)
+ for (util::vertex_id i = 0; i < parent.size(); ++i.to_equiv())
// � make_set �.
parent[i] = i;
@@ -370,7 +370,7 @@
// Children.
typedef std::multimap<util::vertex_id, util::vertex_id> children_t;
children_t children;
- for (typename util::vertex_id i = 0; i < parent.size(); ++i)
+ for (util::vertex_id i = 0; i < parent.size(); ++i.to_equiv())
{
// � find �.
util::vertex_id r = i;
@@ -507,7 +507,7 @@
// Compute the values (means) for the output image.
std::map<util::vertex_id, int_u8> region_value;
- for (util::vertex_id v = 0; v < fg.nvertices(); ++v)
+ for (util::vertex_id v = 0; v < fg.nvertices(); ++v.to_equiv())
{
// FIXME: Implicit cast. We should rather change the type of
// the accumulator instead.
1
0
cleanup-2008 2072: Add some technical documentation to iterator base classes.
by Thierry Géraud 24 Jun '08
by Thierry Géraud 24 Jun '08
24 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Géraud <thierry.geraud(a)lrde.epita.fr>
Add some technical documentation to iterator base classes.
* mln/core/internal/site_relative_iterator_base.hh: Add some
documentation.
* mln/core/internal/site_iterator_base.hh: Likewise.
site_iterator_base.hh | 7 ++++---
site_relative_iterator_base.hh | 26 +++++++++++++++++---------
2 files changed, 21 insertions(+), 12 deletions(-)
Index: mln/core/internal/site_relative_iterator_base.hh
--- mln/core/internal/site_relative_iterator_base.hh (revision 2071)
+++ mln/core/internal/site_relative_iterator_base.hh (working copy)
@@ -50,8 +50,11 @@
/*! \brief A generic forward iterator on points of windows and of
* neighborhoods.
*
- * The parameter \c S is the type of std::vector enclosing
- * structure.
+ * Parameter \c S is the targeted "site set definition" type. It
+ * can be either a Window, or a Neighborhood.
+ *
+ * IMPORTANT: Sub-classes have to define do_start_, do_next_, and
+ * compute_p_. They shall define NEITHER start_ NOR next_.
*/
template <typename S, typename E>
class site_relative_iterator_base : public site_iterator_base< S, E >
@@ -79,11 +82,11 @@
/// The psite around which this iterator moves.
const mln_psite(S)& center() const;
- /// Overriding that adds a test to prevent getting an invalid
- /// iterator when its center has moved. Some sub-classes
- /// provide an update() method for the client to say that she
- /// really want to read the iterator just after the center has
- /// changed.
+ /// This overriding is very useful: it adds a test to prevent
+ /// getting an invalid iterator when its center has moved. Some
+ /// sub-classes provide an update() method for the client to say
+ /// that she really want to read the iterator just after the
+ /// center has changed.
const mln_psite(S)& unproxy() const;
/// Hook to the current location.
@@ -92,12 +95,17 @@
/// Change the site set targeted by this iterator.
void change_target(const S& s);
- /// FIXME: import doc from home.
+ /// Warning: this method is an advanced tool provided for very
+ /// special occasions; if you are a regular user, you should
+ /// never use it! Calling this method forces this relative
+ /// iterator to synchronize with its center when it has just
+ /// moved and when the relative iterator still makes sense.
E& update();
protected:
- /// A pointer to the center psite.
+ /// A pointer to the center psite around which this iterator
+ /// moves.
const mln_psite(S)* c_;
private:
Index: mln/core/internal/site_iterator_base.hh
--- mln/core/internal/site_iterator_base.hh (revision 2071)
+++ mln/core/internal/site_iterator_base.hh (working copy)
@@ -53,10 +53,11 @@
*
* NEVER DIRECTLY DERIVE FROM THIS CLASS.
*
- * Instead derive from EITHER site_set_iterator_base OR
- * site_relative_iterator_base.
+ * Instead derive EITHER from site_set_iterator_base OR from
+ * site_relative_iterator_base OR from piter_adaptor_.
*
- * Parameter \c S is the targeted site set type.
+ * Parameter \c S is the targeted "site set definition" type. It
+ * can be either a Site_Set, a Window, or a Neighborhood.
*/
template <typename S, typename E>
struct site_iterator_base : Site_Iterator<E>,
1
0
***SPAM*** L3 cleanup-2008 2070: Prefer delegation to impl inheritance for neighborhood.
by Thierry Geraud 24 Jun '08
by Thierry Geraud 24 Jun '08
24 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Prefer delegation to impl inheritance for neighborhood.
* doc/tutorial/examples/window.cc: Test make.
* mln/core/internal/basic_window_impl.hh: Remove; its contents
is now directly handled by...
* mln/core/window.hh: ...this class.
* mln/core/internal/neighborhood_impl_mixin.hh: Remove.
* mln/core/internal/neighborhood_base.hh
(is_centered, is_symmetric, sym): Remove; meaningless.
* mln/core/pset_if_piter.hh: Use using and update.
* mln/core/neighb2d.hh (neighb2d): Rely on neighborhood.
Clean code.
* mln/core/neighborhood.hh: New; use delegation to window.
* mln/metal/math/sqrt.hh (mlc_sqrt_int): New.
(sqrt_int_): Help compiler.
(sqrt): Fix params.
* mln/make/neighb2d.hh: New.
* mln/make/window2d.hh: New overload.
* mln/morpho/dilation_elementary.hh (todo): New.
doc/tutorial/examples/window.cc | 11 +
mln/core/internal/neighborhood_base.hh | 44 -----
mln/core/neighb2d.hh | 31 ++-
mln/core/neighborhood.hh | 274 +++++++++++++++++++++++++++++++++
mln/core/pset_if_piter.hh | 18 +-
mln/core/window.hh | 202 ++++++++++++++++++++++--
mln/make/neighb2d.hh | 67 +++++---
mln/make/window2d.hh | 42 +++--
mln/metal/math/sqrt.hh | 18 +-
mln/morpho/dilation_elementary.hh | 2
10 files changed, 592 insertions(+), 117 deletions(-)
Index: doc/tutorial/examples/window.cc
--- doc/tutorial/examples/window.cc (revision 2069)
+++ doc/tutorial/examples/window.cc (working copy)
@@ -53,6 +53,17 @@
std::cout << win << std::endl;
{
+ bool b[9] = { 1, 1, 0,
+ 1, 0, 0,
+ 0, 0, 0 };
+ bool b2[3][3] = { { 1, 1, 0 },
+ { 1, 0, 0 },
+ { 0, 0, 0 } };
+ mln_assertion(make::window2d(b) == make::window2d(b2));
+ mln_assertion(make::window2d(b) == win);
+ }
+
+ {
mln_fwd_piter_(I) p(ima.domain());
for_all(p)
picture(ima, win, p);
Index: mln/core/window.hh
--- mln/core/window.hh (revision 2069)
+++ mln/core/window.hh (working copy)
@@ -36,25 +36,33 @@
* point_, neighb_, etc.
*
* \todo Code other comparisons (< and <=).
+ *
+ * \todo Add static checks in insert methods.
*/
# include <mln/core/internal/window_base.hh>
-# include <mln/core/internal/basic_window_impl.hh>
# include <mln/metal/is_a.hh>
+# include <mln/util/set.hh>
+# include <mln/fun/i2v/all_to.hh>
+# include <mln/norm/linfty.hh>
namespace mln
{
+ // Fwd decls.
+ template <typename V> class dpsites_fwd_piter;
+ template <typename V> class dpsites_bkd_piter;
+
+
/*! \brief Generic window class.
*
* This type of window is just like a set of delta-points. The
* parameter is \c D, type of delta-point.
*/
template <typename D>
- class window : public internal::window_base< D, window<D> >,
- public internal::basic_window_impl< D, window<D> >
+ class window : public internal::window_base< D, window<D> >
{
public:
@@ -64,11 +72,6 @@
*/
window();
- window(const util::set<D>& s)
- {
- this->dps_ = s;
- }
-
/*! \brief Test if the window is centered.
*
* \return True if the delta-point 0 belongs to the window.
@@ -82,6 +85,65 @@
/*! Apply a central symmetry to the target window.
*/
void sym();
+
+
+ /*! \brief Site_Iterator type to browse the points of a basic window
+ * w.r.t. the ordering of delta-points.
+ */
+ typedef dpsites_fwd_piter< window<D> > fwd_qiter;
+
+ /*! \brief Site_Iterator type to browse the points of a basic window
+ * w.r.t. the reverse ordering of delta-points.
+ */
+ typedef dpsites_bkd_piter< window<D> > bkd_qiter;
+
+ /*! \brief Site_Iterator type to browse the points of a basic window
+ * whatever the ordering of delta-points.
+ */
+ typedef fwd_qiter qiter;
+
+
+ /// Give the window size, i.e., the number of delta-sites.
+ unsigned size() const;
+
+ /*! \brief Test if the window is empty (null size; no delta-point).
+ */
+ bool is_empty() const;
+
+ /*! \brief Give the maximum coordinate gap between the window
+ center and a window point.
+ */
+ unsigned delta() const;
+
+ // Give the \p i-th delta-point.
+ const D& dp(unsigned i) const;
+
+
+
+ /// Insert a delta-point \p dp.
+ window<D>& insert(const D& dp);
+
+ /// \{ Insertion of a delta-point with different numbers of
+ /// arguments (coordinates) w.r.t. the dimension.
+ window<D>& insert(const mln_coord(D)& dind); // For 1D.
+
+ window<D>& insert(const mln_coord(D)& drow,
+ const mln_coord(D)& dcol); // For 2D.
+
+ window<D>& insert(const mln_coord(D)& dsli,
+ const mln_coord(D)& drow,
+ const mln_coord(D)& dcol); // For 3D.
+ /// \}
+
+ /// Give the vector of delta-points.
+ const std::vector<D>& std_vector() const;
+
+ /// Hook to the set of D.
+ const util::set<D>& dps_hook_() const;
+
+ private:
+
+ util::set<D> dps_;
};
@@ -114,7 +176,8 @@
template <typename D>
inline
- bool window<D>::is_symmetric() const
+ bool
+ window<D>::is_symmetric() const
{
window<D> cpy = *this;
return cpy.sym() == *this;
@@ -122,7 +185,8 @@
template <typename D>
inline
- bool window<D>::is_centered() const
+ bool
+ window<D>::is_centered() const
{
static const D origin = all_to(0);
return this->dps_.has(origin); // FIXME: Use literal::origin.
@@ -134,22 +198,127 @@
window<D>::sym()
{
window<D> tmp;
- const unsigned n = this->ndpoints();
+ const unsigned n = size();
for (unsigned i = 0; i < n; ++i)
tmp.insert(- this->dp(i));
*this = tmp;
}
+
+ template <typename D>
+ inline
+ bool
+ window<D>::is_empty() const
+ {
+ return dps_.is_empty();
+ }
+
template <typename D>
- std::ostream& operator<<(std::ostream& ostr, const window<D>& win)
+ inline
+ unsigned
+ window<D>::delta() const
+ {
+ // FIXME: Is-it correct?
+ unsigned d = 0;
+ const unsigned n = size();
+ for (unsigned i = 0; i < n; ++i)
{
- return ostr << win.dps_hook();
+ unsigned dd = norm::linfty(dp(i).to_vec());
+ if (dd > d)
+ d = dd;
+ }
+ return d;
}
template <typename D>
- bool operator==(const window<D>& lhs, const window<D>& rhs)
+ inline
+ unsigned
+ window<D>::size() const
{
- return lhs.dps_hook() == rhs.dps_hook();
+ return dps_.nelements();
+ }
+
+ template <typename D>
+ inline
+ const D&
+ window<D>::dp(unsigned i) const
+ {
+ mln_precondition(i < size());
+ return dps_[i];
+ }
+
+ template <typename D>
+ inline
+ const std::vector<D>&
+ window<D>::std_vector() const
+ {
+ return dps_.vect();
+ }
+
+ template <typename D>
+ inline
+ window<D>&
+ window<D>::insert(const D& dp)
+ {
+ dps_.insert(dp);
+ return *this;
+ }
+
+ template <typename D>
+ inline
+ window<D>&
+ window<D>::insert(const mln_coord(D)& dind)
+ {
+ mlc_bool(D::dim == 1)::check();
+ D dp(dind);
+ return insert(dp);
+ }
+
+ template <typename D>
+ inline
+ window<D>&
+ window<D>::insert(const mln_coord(D)& drow,
+ const mln_coord(D)& dcol)
+ {
+ mlc_bool(D::dim == 2)::check();
+ D dp(drow, dcol);
+ return insert(dp);
+ }
+
+ template <typename D>
+ inline
+ window<D>&
+ window<D>::insert(const mln_coord(D)& dsli,
+ const mln_coord(D)& drow,
+ const mln_coord(D)& dcol)
+ {
+ mlc_bool(D::dim == 3)::check();
+ D dp(dsli, drow, dcol);
+ return insert(dp);
+ }
+
+ template <typename D>
+ inline
+ const util::set<D>&
+ window<D>::dps_hook_() const
+ {
+ return dps_;
+ }
+
+ // Operators.
+
+ template <typename D>
+ std::ostream&
+ operator<<(std::ostream& ostr, const window<D>& win)
+ {
+ return ostr << win.dps_hook_();
+ }
+
+ template <typename D>
+ bool
+ operator==(const window<D>& lhs, const window<D>& rhs)
+ {
+ return lhs.dps_hook_() == rhs.dps_hook_();
}
# endif // ! MLN_INCLUDE_ONLY
@@ -157,4 +326,7 @@
} // end of namespace mln
+# include <mln/core/dpsites_piter.hh>
+
+
#endif // ! MLN_CORE_WINDOW_HH
Index: mln/core/internal/neighborhood_base.hh
--- mln/core/internal/neighborhood_base.hh (revision 2069)
+++ mln/core/internal/neighborhood_base.hh (working copy)
@@ -60,26 +60,6 @@
/// Site associated type.
typedef mln_site(D) site;
-
- /*! \brief Test (as a window) if it is centered so (as a
- * neighborhood) return false.
- *
- * \return Always false.
- */
- bool is_centered() const;
-
- /*! \brief Test (as a window) if it is symmetric so (as a
- * neighborhood) return true.
- *
- * \return Always true.
- */
- bool is_symmetric() const;
-
- /*! Apply (as a window) a central symmetry so (as a
- neighborhood) it is a no-op.
- */
- void sym();
-
protected:
neighborhood_base();
};
@@ -93,30 +73,6 @@
{
}
- template <typename D, typename E>
- inline
- bool
- neighborhood_base<D,E>::is_centered() const
- {
- return false;
- }
-
- template <typename D, typename E>
- inline
- bool
- neighborhood_base<D,E>::is_symmetric() const
- {
- return true;
- }
-
- template <typename D, typename E>
- inline
- void
- neighborhood_base<D,E>::sym()
- {
- // No-op.
- }
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::internal
Index: mln/core/pset_if_piter.hh
--- mln/core/pset_if_piter.hh (revision 2069)
+++ mln/core/pset_if_piter.hh (working copy)
@@ -68,6 +68,14 @@
/// The set site targeted by pi_.
const S& pi_set_from_(const pset_if<S,F>& s) const;
+
+ private:
+ typedef pset_if_piter_<Pi,S,F> self_;
+ typedef internal::piter_adaptor_<Pi, pset_if<S,F>, self_> super_;
+
+ protected:
+ using super_::s_;
+ using super_::pi_;
};
@@ -92,9 +100,9 @@
void
pset_if_piter_<Pi,S,F>::start_()
{
- this->pi_.start();
- while (this->pi_.is_valid() && ! this->s_->pred(this->pi_))
- this->pi_.next();
+ pi_.start();
+ while (pi_.is_valid() && ! s_->pred(pi_))
+ pi_.next();
}
template <typename Pi, typename S, typename F>
@@ -103,8 +111,8 @@
pset_if_piter_<Pi,S,F>::next_()
{
do
- this->pi_.next();
- while (this->pi_.is_valid() && ! this->s_->pred(this->pi_));
+ pi_.next();
+ while (pi_.is_valid() && ! s_->pred(pi_));
}
template <typename Pi, typename S, typename F>
Index: mln/core/neighb2d.hh
--- mln/core/neighb2d.hh (revision 2069)
+++ mln/core/neighb2d.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
@@ -35,7 +35,7 @@
*/
# include <cmath>
-# include <mln/core/neighb.hh>
+# include <mln/core/neighborhood.hh>
# include <mln/core/dpoint2d.hh>
@@ -45,9 +45,17 @@
/*! \brief Type alias for a neighborhood defined on the 2D square
* grid with integer coordinates.
*/
- typedef neighb<dpoint2d> neighb2d;
+ typedef neighborhood<dpoint2d> neighb2d;
+
+}
+
+
+# include <mln/make/neighb2d.hh>
+namespace mln
+{
+
/*! \brief 4-connectivity neighborhood on the 2D grid.
*
* - o -
@@ -104,8 +112,8 @@
static neighb2d it;
if (flower)
{
- it.insert(make::dpoint2d(0, 1));
- it.insert(make::dpoint2d(1, 0));
+ it.insert(0, 1)
+ .insert(1, 0);
flower = false;
}
return it;
@@ -118,10 +126,10 @@
static neighb2d it;
if (flower)
{
- it.insert(make::dpoint2d(0, 1));
- it.insert(make::dpoint2d(1,-1));
- it.insert(make::dpoint2d(1, 0));
- it.insert(make::dpoint2d(1, 1));
+ it.insert(0, 1)
+ .insert(1,-1)
+ .insert(1, 0)
+ .insert(1, 1);
flower = false;
}
return it;
@@ -134,7 +142,7 @@
static neighb2d it;
if (flower)
{
- it.insert(make::dpoint2d(0, 1));
+ it.insert(0, 1);
flower = false;
}
return it;
@@ -147,7 +155,7 @@
static neighb2d it;
if (flower)
{
- it.insert(make::dpoint2d(1, 0));
+ it.insert(1, 0);
flower = false;
}
return it;
@@ -158,4 +166,5 @@
} // end of namespace mln
+
#endif // ! MLN_CORE_NEIGHB2D_HH
Index: mln/core/neighborhood.hh
--- mln/core/neighborhood.hh (revision 0)
+++ mln/core/neighborhood.hh (revision 0)
@@ -0,0 +1,274 @@
+// 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_CORE_NEIGHBORHOOD_HH
+# define MLN_CORE_NEIGHBORHOOD_HH
+
+/*! \file mln/core/neighborhood.hh
+ *
+ * \brief Definition of the generic neighborhood class mln::neighborhood.
+ *
+ * \todo Make naming coherent: we have neighborhood (without '_') but
+ * point_, neighb_, etc.
+ *
+ * \todo Code other comparisons (< and <=).
+ *
+ * \todo Add static checks in insert methods.
+ */
+
+# include <mln/core/internal/neighborhood_base.hh>
+# include <mln/core/window.hh>
+# include <mln/literal/zero.hh>
+
+
+namespace mln
+{
+
+ // Fwd decls.
+ template <typename V> class dpsites_fwd_piter;
+ template <typename V> class dpsites_bkd_piter;
+
+
+ /*! \brief Generic neighborhood class.
+ *
+ * This type of neighborhood is just like a set of delta-points. The
+ * parameter is \c D, type of delta-point.
+ */
+ template <typename D>
+ class neighborhood : public internal::neighborhood_base< D, neighborhood<D> >
+ {
+ public:
+
+ /*! \brief Constructor without argument.
+ *
+ * The constructed neighborhood is empty.
+ */
+ neighborhood();
+
+ /*! \brief Constructor from a window.
+ *
+ * \pre The window has to be symmetrical and not centered.
+ */
+ neighborhood(const mln::window<D>& win);
+
+ /*! \brief Site_Iterator type to browse the points of a basic neighborhood
+ * w.r.t. the ordering of delta-points.
+ */
+ typedef dpsites_fwd_piter< neighborhood<D> > fwd_niter;
+
+ /*! \brief Site_Iterator type to browse the points of a basic neighborhood
+ * w.r.t. the reverse ordering of delta-points.
+ */
+ typedef dpsites_bkd_piter< neighborhood<D> > bkd_niter;
+
+ /*! \brief Site_Iterator type to browse the points of a basic neighborhood
+ * whatever the ordering of delta-points.
+ */
+ typedef fwd_niter niter;
+
+
+ /// Give the neighborhood size, i.e., the number of delta-sites.
+ unsigned size() const;
+
+ /*! \brief Give the maximum coordinate gap between the neighborhood
+ center and a neighborhood point.
+ */
+ unsigned delta() const;
+
+
+ /// Insert a delta-point \p dp.
+ neighborhood<D>& insert(const D& dp);
+
+ /// \{ Insertion of a delta-point with different numbers of
+ /// arguments (coordinates) w.r.t. the dimension.
+ neighborhood<D>& insert(const mln_coord(D)& dind); // For 1D.
+
+ neighborhood<D>& insert(const mln_coord(D)& drow,
+ const mln_coord(D)& dcol); // For 2D.
+
+ neighborhood<D>& insert(const mln_coord(D)& dsli,
+ const mln_coord(D)& drow,
+ const mln_coord(D)& dcol); // For 3D.
+ /// \}
+
+
+
+ typedef window<D> window;
+
+ mln::window<D> to_window() const
+ {
+ mln::window<D> tmp = win_;
+ D zero = literal::zero;
+ tmp.insert(zero);
+ return tmp;
+ }
+
+ /// Give the vector of delta-points.
+ const std::vector<D>& std_vector() const;
+
+ /// Hook to the set of D.
+ const util::set<D>& dps_hook_() const;
+
+ private:
+
+ mln::window<D> win_;
+ };
+
+
+ // FIXME: Doc!
+ template <typename D>
+ std::ostream& operator<<(std::ostream& ostr, const neighborhood<D>& nbh);
+
+
+
+ /*! \brief Equality comparison between neighborhoods \p lhs and \p rhs.
+ *
+ * \relates mln::neighborhood<D>
+ */
+ template <typename D>
+ bool operator==(const neighborhood<D>& lhs, const neighborhood<D>& rhs);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // neighborhood<D>
+
+ template <typename D>
+ inline
+ neighborhood<D>::neighborhood()
+ {
+ // FIXME HERE: Was: mln::metal::is_a<D, Dpoint>::check();
+ // mln::metal::is_a<D, Delta_Point_Site>::check();
+ }
+
+ template <typename D>
+ inline
+ neighborhood<D>::neighborhood(const mln::window<D>& win)
+ {
+ mln_precondition(win.is_symmetric() == true);
+ mln_precondition(win.is_centered() == false);
+ win_ = win;
+ }
+
+ template <typename D>
+ inline
+ unsigned
+ neighborhood<D>::delta() const
+ {
+ mln_precondition(size() != 0);
+ return win_.delta();
+ }
+
+ template <typename D>
+ inline
+ unsigned
+ neighborhood<D>::size() const
+ {
+ return win_.size();
+ }
+
+ template <typename D>
+ inline
+ const std::vector<D>&
+ neighborhood<D>::std_vector() const
+ {
+ return win_.std_vector();
+ }
+
+ template <typename D>
+ inline
+ neighborhood<D>&
+ neighborhood<D>::insert(const D& dp)
+ {
+ win_.insert( dp);
+ win_.insert(-dp);
+ return *this;
+ }
+
+ template <typename D>
+ inline
+ neighborhood<D>&
+ neighborhood<D>::insert(const mln_coord(D)& dind)
+ {
+ mlc_bool(D::dim == 1)::check();
+ D dp(dind);
+ return insert(dp);
+ }
+
+ template <typename D>
+ inline
+ neighborhood<D>&
+ neighborhood<D>::insert(const mln_coord(D)& drow,
+ const mln_coord(D)& dcol)
+ {
+ mlc_bool(D::dim == 2)::check();
+ D dp(drow, dcol);
+ return insert(dp);
+ }
+
+ template <typename D>
+ inline
+ neighborhood<D>&
+ neighborhood<D>::insert(const mln_coord(D)& dsli,
+ const mln_coord(D)& drow,
+ const mln_coord(D)& dcol)
+ {
+ mlc_bool(D::dim == 3)::check();
+ D dp(dsli, drow, dcol);
+ return insert(dp);
+ }
+
+ template <typename D>
+ inline
+ const util::set<D>&
+ neighborhood<D>::dps_hook_() const
+ {
+ return win_.dps_hook_();
+ }
+
+ // Operators.
+
+ template <typename D>
+ std::ostream& operator<<(std::ostream& ostr, const neighborhood<D>& nbh)
+ {
+ return ostr << nbh.dps_hook_();
+ }
+
+ template <typename D>
+ bool operator==(const neighborhood<D>& lhs, const neighborhood<D>& rhs)
+ {
+ return lhs.dps_hook_() == rhs.dps_hook_();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_CORE_NEIGHBORHOOD_HH
Index: mln/metal/math/sqrt.hh
--- mln/metal/math/sqrt.hh (revision 2069)
+++ mln/metal/math/sqrt.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
@@ -37,6 +37,9 @@
# include <mln/metal/int.hh>
+# define mlc_sqrt_int(N) mln::metal::math::sqrt_int<( N )>::value
+
+
namespace mln
{
@@ -54,11 +57,12 @@
template <int n, int lo = 1, int hi = n>
struct sqrt_int_
{
- enum { mid = (lo + hi + 1) / 2 };
-
- enum { value = n < mid * mid
- ? sqrt_int_<n, lo, mid-1>::value
- : sqrt_int_<n, mid, hi>::result };
+ enum {
+ mid = (lo + hi + 1) / 2,
+ val_lo = sqrt_int_<n, lo, mid-1>::value,
+ val_hi = sqrt_int_<n, mid, hi>::value
+ };
+ enum { value = n < mid * mid ? val_lo : val_hi };
};
template<int n, int m>
@@ -92,7 +96,7 @@
// sqrt<N>
- template <typename X, typename N>
+ template <typename N>
struct sqrt;
template <int n>
Index: mln/make/neighb2d.hh
--- mln/make/neighb2d.hh (revision 2069)
+++ mln/make/neighb2d.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
@@ -25,17 +25,15 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_MAKE_WINDOW2D_HH
-# define MLN_MAKE_WINDOW2D_HH
+#ifndef MLN_MAKE_NEIGHB2D_HH
+# define MLN_MAKE_NEIGHB2D_HH
-/*! \file mln/make/window2d.hh
+/*! \file mln/make/neighb2d.hh
*
- * \brief Routine to create an mln::window2d.
+ * \brief Routine to create an mln::neighb2d.
*/
-# include <cmath>
-# include <mln/core/window2d.hh>
-# include <mln/make/dpoint2d.hh>
+# include <mln/make/window2d.hh>
namespace mln
@@ -44,32 +42,53 @@
namespace make
{
- /*! \brief Create an mln::window2d.
+ /*! \brief Create a mln::neighb2d.
*
* \param[in] values Array of Booleans.
*
- * \pre The array size, \c M, has to be a square of an odd integer.
+ * \pre The array size, \c S, has to be a square of an odd integer.
*
- * \return A 2D window.
+ * \return A 2D neighborhood.
*/
- template <unsigned M>
- mln::window2d window2d(bool (&values)[M]);
+ template <unsigned S>
+ mln::neighb2d neighb2d(bool (&values)[S]);
+
+
+ /*! \brief Create a mln::neighb2d.
+ *
+ * \param[in] values Double-array of Booleans.
+ *
+ * \pre \c R and \c C, defining the array size, have to be odd.
+ *
+ * \return A 2D neighborhood.
+ */
+ template <unsigned R, unsigned C>
+ mln::neighb2d neighb2d(bool (&values)[R][C]);
# ifndef MLN_INCLUDE_ONLY
- template <unsigned M>
+ template <unsigned S>
+ inline
+ mln::neighb2d
+ neighb2d(bool (&values)[S])
+ {
+ enum { h = mlc_sqrt_int(S) / 2 };
+ mlc_bool((2 * h + 1) * (2 * h + 1) == S)::check();
+ mln::window2d win = make::window2d(values);
+ neighb2d tmp(win);
+ return tmp;
+ }
+
+ template <unsigned R, unsigned C>
inline
- mln::window2d window2d(bool (&values)[M])
+ mln::neighb2d
+ neighb2d(bool (&values)[R][C])
{
- int h = unsigned(std::sqrt(float(M))) / 2;
- assert((2 * h + 1) * (2 * h + 1) == M);
- mln::window2d tmp;
- unsigned i = 0;
- for (int row = - h; row <= h; ++row)
- for (int col = - h; col <= h; ++col)
- if (values[i++])
- tmp.insert(make::dpoint2d(row, col));
+ mlc_bool(R % 2 == 1)::check();
+ mlc_bool(C % 2 == 1)::check();
+ mln::window2d win = make::window2d(values);
+ neighb2d tmp(win);
return tmp;
}
@@ -80,4 +99,4 @@
} // end of namespace mln
-#endif // ! MLN_MAKE_WINDOW2D_HH
+#endif // ! MLN_MAKE_NEIGHB2D_HH
Index: mln/make/window2d.hh
--- mln/make/window2d.hh (revision 2069)
+++ mln/make/window2d.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
@@ -33,9 +33,8 @@
* \brief Routine to create an mln::window2d.
*/
-# include <cmath>
# include <mln/core/window2d.hh>
-# include <mln/make/dpoint2d.hh>
+# include <mln/metal/math/sqrt.hh>
namespace mln
@@ -48,28 +47,49 @@
*
* \param[in] values Array of Booleans.
*
- * \pre The array size, \c M, has to be a square of an odd integer.
+ * \pre The array size, \c S, has to be a square of an odd integer.
*
* \return A 2D window.
*/
- template <unsigned M>
- mln::window2d window2d(bool (&values)[M]);
+ template <unsigned S>
+ mln::window2d window2d(bool (&values)[S]);
+
+
+ template <unsigned R, unsigned C>
+ mln::window2d window2d(bool (&values)[R][C]);
# ifndef MLN_INCLUDE_ONLY
- template <unsigned M>
+ template <unsigned S>
inline
- mln::window2d window2d(bool (&values)[M])
+ mln::window2d
+ window2d(bool (&values)[S])
{
- int h = unsigned(std::sqrt(float(M))) / 2;
- assert((2 * h + 1) * (2 * h + 1) == M);
+ enum { h = mlc_sqrt_int(S) / 2 };
+ mlc_bool((2 * h + 1) * (2 * h + 1) == S)::check();
mln::window2d tmp;
unsigned i = 0;
for (int row = - h; row <= h; ++row)
for (int col = - h; col <= h; ++col)
if (values[i++])
- tmp.insert(make::dpoint2d(row, col));
+ tmp.insert(row, col);
+ return tmp;
+ }
+
+ template <unsigned R, unsigned C>
+ inline
+ mln::window2d
+ window2d(bool (&values)[R][C])
+ {
+ mlc_bool(R % 2 == 1)::check();
+ mlc_bool(C % 2 == 1)::check();
+ const int drow = int(R) / 2, dcol = int(C) / 2;
+ mln::window2d tmp;
+ for (int row = - drow; row <= drow; ++row)
+ for (int col = - dcol; col <= dcol; ++col)
+ if (values[row + drow][col + dcol])
+ tmp.insert(row, col);
return tmp;
}
Index: mln/morpho/dilation_elementary.hh
--- mln/morpho/dilation_elementary.hh (revision 2069)
+++ mln/morpho/dilation_elementary.hh (working copy)
@@ -30,6 +30,8 @@
/// \file mln/morpho/dilation_elementary.hh
/// \brief Morphological elementary dilation.
+///
+/// \todo Write specific code.
# include <mln/morpho/dilation.hh>
1
0
***SPAM*** L3 cleanup-2008 2069: Factor code for pset_if piters and add bkd iterations.
by Thierry Geraud 24 Jun '08
by Thierry Geraud 24 Jun '08
24 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Factor code for pset_if piters and add bkd iterations.
* mln/core/internal/piter_adaptor.hh (comment): Remove.
* mln/core/pset_if_piter.hh (todo): Remove.
(pset_if_fwd_piter_): Rename as...
(pset_if_piter_): ...this.
(Pi): New parameter.
Update.
(pset_if_bkd_piter_): Remove; obsolete.
* mln/core/pset_if.hh (fwd_piter, bkd_piter): Update.
internal/piter_adaptor.hh | 2 -
pset_if.hh | 8 +++---
pset_if_piter.hh | 54 +++++++++++++++-------------------------------
3 files changed, 23 insertions(+), 41 deletions(-)
Index: mln/core/internal/piter_adaptor.hh
--- mln/core/internal/piter_adaptor.hh (revision 2068)
+++ mln/core/internal/piter_adaptor.hh (working copy)
@@ -84,7 +84,7 @@
protected:
/// The adaptee site iterator.
- Pi pi_; // own copy
+ Pi pi_;
};
Index: mln/core/pset_if_piter.hh
--- mln/core/pset_if_piter.hh (revision 2068)
+++ mln/core/pset_if_piter.hh (working copy)
@@ -31,8 +31,6 @@
/*! \file mln/core/pset_if_piter.hh
*
* \brief Definition of iterators on pset_if<S,F>.
- *
- * \todo pset_if_bkd_piter_.
*/
# include <mln/core/internal/piter_adaptor.hh>
@@ -43,26 +41,24 @@
{
- /*! \brief A generic forward iterator on points of subsets.
+ /*! \brief Iterator on site sets conditionned by a function.
*
- * Parameter \c S is a point set type; parameter F is a function
+ * Parameter \c S is a site set type; parameter F is a function
* from point to Boolean.
*
* \see mln::pset_if
*/
- template <typename S, typename F>
- class pset_if_fwd_piter_
- : public internal::piter_adaptor_< mln_fwd_piter(S), // Adaptee.
+ template <typename Pi, typename S, typename F>
+ struct pset_if_piter_
+ : public internal::piter_adaptor_< Pi, // Adaptee.
pset_if<S,F>, // Site_Set.
- pset_if_fwd_piter_<S,F> > // Exact.
+ pset_if_piter_<Pi,S,F> > // Exact.
{
- public:
-
/// Constructor without argument.
- pset_if_fwd_piter_();
+ pset_if_piter_();
/// Constructor from a site set.
- pset_if_fwd_piter_(const pset_if<S,F>& s);
+ pset_if_piter_(const pset_if<S,F>& s);
/// Start an iteration.
void start_();
@@ -75,64 +71,50 @@
};
- // FIXME:
- template <typename S, typename F>
- class pset_if_bkd_piter_
- :
- public mln::internal::fixme
- {};
-
-
# ifndef MLN_INCLUDE_ONLY
-
- // pset_if_fwd_piter_<S,F>
-
- template <typename S, typename F>
+ template <typename Pi, typename S, typename F>
inline
- pset_if_fwd_piter_<S,F>::pset_if_fwd_piter_()
+ pset_if_piter_<Pi,S,F>::pset_if_piter_()
{
}
- template <typename S, typename F>
+ template <typename Pi, typename S, typename F>
inline
- pset_if_fwd_piter_<S,F>::pset_if_fwd_piter_(const pset_if<S,F>& s)
+ pset_if_piter_<Pi,S,F>::pset_if_piter_(const pset_if<S,F>& s)
{
this->change_target(s);
}
- template <typename S, typename F>
+ template <typename Pi, typename S, typename F>
inline
void
- pset_if_fwd_piter_<S,F>::start_()
+ pset_if_piter_<Pi,S,F>::start_()
{
this->pi_.start();
while (this->pi_.is_valid() && ! this->s_->pred(this->pi_))
this->pi_.next();
}
- template <typename S, typename F>
+ template <typename Pi, typename S, typename F>
inline
void
- pset_if_fwd_piter_<S,F>::next_()
+ pset_if_piter_<Pi,S,F>::next_()
{
do
this->pi_.next();
while (this->pi_.is_valid() && ! this->s_->pred(this->pi_));
}
- template <typename S, typename F>
+ template <typename Pi, typename S, typename F>
inline
const S&
- pset_if_fwd_piter_<S,F>::pi_set_from_(const pset_if<S,F>& s) const
+ pset_if_piter_<Pi,S,F>::pi_set_from_(const pset_if<S,F>& s) const
{
return s.overset();
}
- // FIXME: pset_if_bkd_piter_<S,F>
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: mln/core/pset_if.hh
--- mln/core/pset_if.hh (revision 2068)
+++ mln/core/pset_if.hh (working copy)
@@ -42,8 +42,8 @@
// Fwd decls.
template <typename S, typename F> struct pset_if;
- template <typename S, typename F> struct pset_if_fwd_piter_;
- template <typename S, typename F> struct pset_if_bkd_piter_;
+ template <typename Pi, typename S, typename F> struct pset_if_piter_;
+
namespace trait
{
@@ -88,13 +88,13 @@
/// Forward Site_Iterator associated type.
- typedef pset_if_fwd_piter_<S,F> fwd_piter;
+ typedef pset_if_piter_<mln_fwd_piter(S), S, F> fwd_piter;
/// Site_Iterator associated type.
typedef fwd_piter piter;
/// Backward Site_Iterator associated type.
- typedef mln::internal::fixme bkd_piter;
+ typedef pset_if_piter_<mln_bkd_piter(S), S, F> bkd_piter;
/// Constructor with a point set \p pset and a predicate \p f.
1
0
***SPAM*** L3 cleanup-2008 2068: Update iterator base classes and make image_if fully work.
by Thierry Geraud 24 Jun '08
by Thierry Geraud 24 Jun '08
24 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 iterator base classes and make image_if fully work.
* doc/tutorial/examples/image_if.cc (change_target): Test it.
* doc/tutorial/examples/window.cc: New.
* mln/core/window.hh (window): New ctor from util::set.
* mln/core/internal/basic_window_impl.hh (dps_): Move from
private to protected.
(basic_window_impl): New ctor from util::set.
* mln/core/dpsites_piter.hh (update): Move...
* mln/core/internal/site_relative_iterator_base.hh: ...here so
it is factored.
(p_, p_hook_, change_target): New.
* mln/core/internal/site_iterator_base.hh (todo): Update.
(p): Remove.
(current_p_, p_): Remove as is; those entities are now defined
in sub-classes as respectively p_hook_ and p_ (if needed).
* mln/core/internal/site_set_iterator_base.hh
(site_set_iterator_base): Change from struct to class.
(p_, p_hook_, change_target): New.
* mln/core/internal/piter_adaptor.hh (todo): Update.
(piter_adaptor_): Fix inheritance.
(S): New parameter.
(p_hook_, change_target): New.
(piter_): Rename as...
(pi_): ...this.
* mln/core/concept/neighborhood.hh (window, to_window): New.
* mln/core/neighb.hh: Likewise.
* mln/core/box_piter.hh (super_): Fix type definition.
* mln/core/pset_if_piter.hh (pset_if_piter_): Inherit from
piter_adaptor_.
(is_valid_, invalidate_): Remove; now factored in super class.
(pi_set_from_): New method required for adapters.
(start_, next_): Update.
* mln/core/p_array_piter.hh: Layout.
* mln/morpho/dilation_elementary.hh: New.
doc/tutorial/examples/image_if.cc | 11 +++
doc/tutorial/examples/window.cc | 80 +++++++++++++++++++++
mln/core/box_piter.hh | 40 +++++-----
mln/core/concept/neighborhood.hh | 11 ++-
mln/core/dpsites_piter.hh | 26 -------
mln/core/internal/basic_window_impl.hh | 23 +++++-
mln/core/internal/piter_adaptor.hh | 84 ++++++++++++++++-------
mln/core/internal/site_iterator_base.hh | 41 +----------
mln/core/internal/site_relative_iterator_base.hh | 55 +++++++++++++--
mln/core/internal/site_set_iterator_base.hh | 35 +++++++++
mln/core/neighb.hh | 13 +++
mln/core/p_array_piter.hh | 2
mln/core/pset_if_piter.hh | 62 +++++-----------
mln/core/window.hh | 4 +
mln/morpho/dilation_elementary.hh | 80 +++++++++++++++++++++
15 files changed, 407 insertions(+), 160 deletions(-)
Index: doc/tutorial/examples/image_if.cc
--- doc/tutorial/examples/image_if.cc (revision 2067)
+++ doc/tutorial/examples/image_if.cc (working copy)
@@ -7,6 +7,12 @@
# include <mln/fun/p2b/chess.hh>
+template <typename It, typename S>
+void ch_target(It it, const S& s)
+{
+ it.change_target(s);
+}
+
int main()
{
@@ -20,4 +26,9 @@
debug::println(ima | fun::p2b::chess);
trait::image::print(ima | fun::p2b::chess);
+
+ typedef pset_if<box2d, fun::p2b::chess_t> S;
+
+ ch_target(mln_fwd_piter_(S)(),
+ (ima | fun::p2b::chess).domain());
}
Index: doc/tutorial/examples/window.cc
--- doc/tutorial/examples/window.cc (revision 0)
+++ doc/tutorial/examples/window.cc (revision 0)
@@ -0,0 +1,80 @@
+# include <mln/core/image2d.hh>
+# include <mln/core/window2d.hh>
+# include <mln/core/p_array.hh>
+
+# include <mln/debug/iota.hh>
+# include <mln/debug/println.hh>
+
+# include <mln/core/neighb2d.hh>
+
+
+template <typename I, typename W, typename P>
+void picture(const I& ima, const W& win, const P& p)
+{
+ std::cout << ima(p) << ": ";
+ mln_qiter(W) q(win, p);
+ for_all(q)
+ if (ima.has(q))
+ std::cout << ima(q) << ' ';
+ else
+ std::cout << "- ";
+ std::cout << std::endl;
+}
+
+
+template <typename I, typename W>
+void fill_null(I& ima, const W& win)
+{
+ mln_piter(I) p(ima.domain());
+ mln_qiter(W) q(win, p);
+ for_all(p)
+ for_all(q)
+ if (ima.has(q))
+ ima(q) = 0;
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef image2d<unsigned> I;
+ I ima(2, 3, 0); // no border
+ debug::iota(ima);
+ debug::println(ima);
+ mln_invariant(ima.nsites() == 6);
+
+ window2d win;
+ win
+ .insert(-1, 0)
+ .insert(0, -1)
+ .insert(-1,-1);
+ std::cout << win << std::endl;
+
+ {
+ mln_fwd_piter_(I) p(ima.domain());
+ for_all(p)
+ picture(ima, win, p);
+ }
+
+ {
+ typedef p_array<point2d> A;
+ A arr;
+ arr.insert_all(ima.domain());
+ mln_fwd_piter_(A) p(arr);
+ for_all(p)
+ picture(ima, win, p);
+
+ // FIXME: Move this new test in a separate file.
+ mln_psite_(A) c(arr, 0);
+ window2d it; it.insert(0,0);
+ mln_qiter_(window2d) q(it, c);
+ q.start();
+ q.to_site() == c.to_site();
+ c.inc_index();
+ mln_assertion(q.update().to_site() == c.to_site());
+ }
+
+ fill_null(ima, win);
+}
Index: mln/core/window.hh
--- mln/core/window.hh (revision 2067)
+++ mln/core/window.hh (working copy)
@@ -64,6 +64,10 @@
*/
window();
+ window(const util::set<D>& s)
+ {
+ this->dps_ = s;
+ }
/*! \brief Test if the window is centered.
*
Index: mln/core/internal/basic_window_impl.hh
--- mln/core/internal/basic_window_impl.hh (revision 2067)
+++ mln/core/internal/basic_window_impl.hh (working copy)
@@ -55,8 +55,6 @@
template <typename D, typename E>
class basic_window_impl
{
- util::set<D> dps_;
-
public:
@@ -119,8 +117,14 @@
protected:
+ util::set<D> dps_;
+
+ /// Constructor without argument.
basic_window_impl();
+ /// Constructor from an util::set.
+ basic_window_impl(const util::set<D>& s);
+
void insert_(const D& dp); // The only routine to effectively insert a dp.
// This is a default implementation. This routine can be
// overidden in sub-classes.
@@ -137,6 +141,21 @@
template <typename D, typename E>
inline
+ basic_window_impl<D,E>::basic_window_impl(const util::set<D>& s)
+ {
+ bool is_sym = true;
+ for (unsigned i = 0; s.nelements(); ++i)
+ if (! s.has(-s[i]))
+ {
+ is_sym = false;
+ break;
+ }
+ mln_precondition(is_sym);
+ dps_ = s;
+ }
+
+ template <typename D, typename E>
+ inline
bool basic_window_impl<D,E>::is_empty() const
{
return dps_.is_empty();
Index: mln/core/internal/site_relative_iterator_base.hh
--- mln/core/internal/site_relative_iterator_base.hh (revision 2067)
+++ mln/core/internal/site_relative_iterator_base.hh (working copy)
@@ -86,9 +86,24 @@
/// changed.
const mln_psite(S)& unproxy() const;
+ /// Hook to the current location.
+ const mln_psite(S)& p_hook_() const;
+
+ /// Change the site set targeted by this iterator.
+ void change_target(const S& s);
+
+ /// FIXME: import doc from home.
+ E& update();
+
protected:
+ /// A pointer to the center psite.
const mln_psite(S)* c_;
+
+ private:
+
+ /// The psite designated by this iterator.
+ mln_psite(S) p_;
};
@@ -125,7 +140,7 @@
{
exact(this)->do_start_();
if (this->is_valid())
- this->p_ = exact(this)->compute_p_();
+ p_ = exact(this)->compute_p_();
}
template <typename S, typename E>
@@ -135,7 +150,7 @@
{
exact(this)->do_next_();
if (this->is_valid())
- this->p_ = exact(this)->compute_p_();
+ p_ = exact(this)->compute_p_();
}
template <typename S, typename E>
@@ -153,8 +168,40 @@
site_relative_iterator_base<S,E>::unproxy() const
{
mln_psite(S) p_now = exact(this)->compute_p_();
- mln_assertion(p_now == this->p_);
- return this->p_;
+ mln_assertion(p_now == p_);
+ return p_;
+ }
+
+ template <typename S, typename E>
+ inline
+ const mln_psite(S)&
+ site_relative_iterator_base<S,E>::p_hook_() const
+ {
+ return p_;
+ }
+
+ template <typename S, typename E>
+ inline
+ void
+ site_relative_iterator_base<S,E>::change_target(const S& s)
+ {
+ this->s_ = & s;
+ // p might be also updated since it can hold a pointer towards
+ // the set it designates, so:
+ if_possible::change_target(p_, s);
+ // Last:
+ this->invalidate();
+ }
+
+ template <typename S, typename E>
+ inline
+ E&
+ site_relative_iterator_base<S,E>::update()
+ {
+ mln_precondition(this->s_ && c_);
+ p_ = exact(this)->compute_p_();
+ mln_postcondition(this->is_valid());
+ return exact(*this);
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/core/internal/site_iterator_base.hh
--- mln/core/internal/site_iterator_base.hh (revision 2067)
+++ mln/core/internal/site_iterator_base.hh (working copy)
@@ -32,20 +32,14 @@
*
* \brief Base class to factor code for site iterator classes.
*
- * \todo Make p_ private and add a p() method that can be overridden
- * so that a subclass can use some other info than this attribute.
- * See for instance start_ and next_ in pset_if_piter.hh: we have
- * both pi_ and p_ to designate the current site.
+ * \todo Import tech doc from home.
*/
# include <mln/core/concept/site_iterator.hh>
# include <mln/core/concept/pseudo_site.hh> // Use of if_possible::change_target.
-// site_iterator_base<S> where S is a Site_Set
-// {
-// s_ : const S*
-// }
+// FIXME: See todo.
@@ -100,26 +94,12 @@
/// Give the target address. It might be 0.
const S*& target_();
- /// Change the iterator target.
- void change_target(const S& s);
-
- mln_psite(S)& p() { return exact(this)->current_p_(); }
- const mln_psite(S)& p() const { return exact(this)->current_p_(); }
-
- mln_psite(S)& current_p_() { return p_; }
- const mln_psite(S)& current_p_() const { return p_; }
-
protected:
site_iterator_base();
/// The target.
const S* s_;
-
- private:
-
- /// The psite designated by this iterator.
- mln_psite(S) p_;
};
@@ -146,7 +126,7 @@
site_iterator_base<S, E>::to_site() const
{
mln_precondition(exact(*this).is_valid()); // FIXME: OK?
- return internal::to_site( p() );
+ return internal::to_site( exact(this)->p_hook_() );
}
template <typename S, typename E>
@@ -154,7 +134,7 @@
const mln_psite(S)&
site_iterator_base<S, E>::unproxy() const
{
- return p();
+ return exact(this)->p_hook_();
}
template <typename S, typename E>
@@ -165,19 +145,6 @@
return s_;
}
- template <typename S, typename E>
- inline
- void
- site_iterator_base<S, E>::change_target(const S& s)
- {
- s_ = & s;
- // p might be also updated since it can hold a pointer towards
- // the set it designates, so:
- if_possible::change_target(p(), s);
- // Last:
- this->invalidate();
- }
-
#endif // ! MLN_INCLUDE_ONLY
} // end of namespace internal
Index: mln/core/internal/site_set_iterator_base.hh
--- mln/core/internal/site_set_iterator_base.hh (revision 2067)
+++ mln/core/internal/site_set_iterator_base.hh (working copy)
@@ -48,13 +48,25 @@
* Parameter \c S is the targeted site set type.
*/
template <typename S, typename E>
- struct site_set_iterator_base : site_iterator_base<S, E>
+ class site_set_iterator_base : public site_iterator_base<S, E>
{
+ public:
+
/// Give the site set that this iterator browses.
const S& site_set() const;
+ /// Hook to the current location.
+ const mln_psite(S)& p_hook_() const;
+
+ /// Change the site set targeted by this iterator.
+ void change_target(const S& s);
+
protected:
+ /// The psite designated by this iterator.
+ mln_psite(S) p_;
+
+ /// Constructor without argument.
site_set_iterator_base();
};
@@ -76,6 +88,27 @@
return *this->s_;
}
+ template <typename S, typename E>
+ inline
+ void
+ site_set_iterator_base<S, E>::change_target(const S& s)
+ {
+ this->s_ = & s;
+ // p might be also updated since it can hold a pointer towards
+ // the set it designates, so:
+ if_possible::change_target(p_, s);
+ // Last:
+ this->invalidate();
+ }
+
+ template <typename S, typename E>
+ inline
+ const mln_psite(S)&
+ site_set_iterator_base<S, E>::p_hook_() const
+ {
+ return p_;
+ }
+
#endif // ! MLN_INCLUDE_ONLY
} // end of namespace internal
Index: mln/core/internal/piter_adaptor.hh
--- mln/core/internal/piter_adaptor.hh (revision 2067)
+++ mln/core/internal/piter_adaptor.hh (working copy)
@@ -31,10 +31,14 @@
/*! \file mln/core/internal/piter_adaptor.hh
*
* \brief Definition of iterators on points of boxes.
+ *
+ * \todo Rename as site_iterator_adaptor_base.
+ *
+ * \todo Distinguish between adaptors of site_set_iterator,
+ * site_relative_iterator, etc. (?)
*/
-# include <mln/core/internal/site_set_iterator_base.hh>
-# include <mln/core/concept/box.hh>
+# include <mln/core/internal/site_iterator_base.hh>
namespace mln
@@ -44,14 +48,18 @@
{
/*! \internal A base class for point iterator adaptors.
+ *
* Parameter \c Pi is the type of the point iterator adaptee;
* parameter E is the exact type.
*/
- template <typename Pi, typename E>
- class piter_adaptor_ : public internal::site_set_iterator_base< mln_pset(Pi), E >
+ template <typename Pi, typename S, typename E>
+ class piter_adaptor_ : public internal::site_iterator_base< S, E >
{
public:
+ /// Constructor without argument.
+ piter_adaptor_();
+
/// Constructor from a point iterator \p piter.
piter_adaptor_(const Pi& piter);
@@ -67,54 +75,86 @@
/// Go to the next point.
void next_();
- protected:
+ /// Hook to the current location.
+ const mln_psite(S)& p_hook_() const;
- Pi piter_; // own copy
- };
+ /// Change the site set targeted by this iterator.
+ void change_target(const S& s);
+ protected:
+ /// The adaptee site iterator.
+ Pi pi_; // own copy
+ };
# ifndef MLN_INCLUDE_ONLY
- template <typename Pi, typename E>
+ template <typename Pi, typename S, typename E>
inline
- piter_adaptor_<Pi,E>::piter_adaptor_(const Pi& piter)
- : piter_(piter)
+ piter_adaptor_<Pi,S,E>::piter_adaptor_()
+ {
+ }
+
+ template <typename Pi, typename S, typename E>
+ inline
+ piter_adaptor_<Pi,S,E>::piter_adaptor_(const Pi& pi)
+ : pi_(pi)
{
invalidate_();
}
- template <typename Pi, typename E>
+ template <typename Pi, typename S, typename E>
inline
bool
- piter_adaptor_<Pi,E>::is_valid_() const
+ piter_adaptor_<Pi,S,E>::is_valid_() const
+ {
+ return pi_.is_valid();
+ }
+
+ template <typename Pi, typename S, typename E>
+ inline
+ void
+ piter_adaptor_<Pi,S,E>::invalidate_()
{
- return piter_.is_valid();
+ pi_.invalidate();
}
- template <typename Pi, typename E>
+ template <typename Pi, typename S, typename E>
inline
void
- piter_adaptor_<Pi,E>::invalidate_()
+ piter_adaptor_<Pi,S,E>::start_()
{
- piter_.invalidate();
+ pi_.start();
}
- template <typename Pi, typename E>
+ template <typename Pi, typename S, typename E>
inline
void
- piter_adaptor_<Pi,E>::start_()
+ piter_adaptor_<Pi,S,E>::next_()
+ {
+ pi_.next();
+ }
+
+ template <typename Pi, typename S, typename E>
+ inline
+ const mln_psite(S)&
+ piter_adaptor_<Pi,S,E>::p_hook_() const
{
- piter_.start();
+ return pi_.p_hook_();
}
- template <typename Pi, typename E>
+ template <typename Pi, typename S, typename E>
inline
void
- piter_adaptor_<Pi,E>::next_()
+ piter_adaptor_<Pi,S,E>::change_target(const S& s)
{
- piter_.next();
+ this->s_ = & s;
+ // p might be also updated since it can hold a pointer towards
+ // the set it designates, so:
+ pi_.change_target( exact(this)->pi_set_from_(s) );
+ // Last:
+ this->invalidate();
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/core/neighb.hh
--- mln/core/neighb.hh (revision 2067)
+++ mln/core/neighb.hh (working copy)
@@ -37,6 +37,9 @@
# include <mln/core/internal/basic_window_impl.hh>
# include <mln/core/internal/neighborhood_impl_mixin.hh>
+# include <mln/core/window.hh>
+# include <mln/literal/zero.hh>
+
namespace mln
{
@@ -62,6 +65,16 @@
// Overridden from internal::basic_window_impl so that it also
// inserts \a -dp.
neighb<D>& insert_(const D& dp);
+
+ typedef mln::window<D> window;
+
+ window to_window() const
+ {
+ window tmp(this->dps_);
+ D zero = literal::zero;
+ tmp.insert(zero);
+ return tmp;
+ }
};
Index: mln/core/box_piter.hh
--- mln/core/box_piter.hh (revision 2067)
+++ mln/core/box_piter.hh (working copy)
@@ -51,7 +51,7 @@
box_fwd_piter_<P> >
{
typedef box_fwd_piter_<P> self_;
- typedef internal::site_iterator_base< box<P>, self_ > super_;
+ typedef internal::site_set_iterator_base< box<P>, self_ > super_;
public:
@@ -79,9 +79,8 @@
/// Go to the next point.
void next_();
- using super_::p;
-
protected:
+ using super_::p_;
using super_::s_;
};
@@ -94,11 +93,11 @@
* \see mln::box_
*/
template <typename P>
- class box_bkd_piter_ : public internal::site_iterator_base< box<P>,
+ class box_bkd_piter_ : public internal::site_set_iterator_base< box<P>,
box_bkd_piter_<P> >
{
typedef box_bkd_piter_<P> self_;
- typedef internal::site_iterator_base< box<P>, self_ > super_;
+ typedef internal::site_set_iterator_base< box<P>, self_ > super_;
public:
@@ -126,9 +125,8 @@
/// Go to the next point.
void next_();
- using super_::p;
-
protected:
+ using super_::p_;
using super_::s_;
};
@@ -158,7 +156,7 @@
bool
box_fwd_piter_<P>::is_valid_() const
{
- return p()[0] != s_->pmax()[0] + 1;
+ return p_[0] != s_->pmax()[0] + 1;
}
template <typename P>
@@ -166,7 +164,7 @@
void
box_fwd_piter_<P>::invalidate_()
{
- p()[0] = s_->pmax()[0] + 1;
+ p_[0] = s_->pmax()[0] + 1;
}
template <typename P>
@@ -174,7 +172,7 @@
void
box_fwd_piter_<P>::start_()
{
- p() = s_->pmin();
+ p_ = s_->pmin();
}
template <typename P>
@@ -183,14 +181,14 @@
box_fwd_piter_<P>::next_()
{
for (int i = dim - 1; i >= 0; --i)
- if (p()[i] == s_->pmax()[i])
- p()[i] = s_->pmin()[i];
+ if (p_[i] == s_->pmax()[i])
+ p_[i] = s_->pmin()[i];
else
{
- ++p()[i];
+ ++p_[i];
break;
}
- if (p() == s_->pmin())
+ if (p_ == s_->pmin())
invalidate_();
}
@@ -215,7 +213,7 @@
bool
box_bkd_piter_<P>::is_valid_() const
{
- return p()[0] != s_->pmin()[0] - 1;
+ return p_[0] != s_->pmin()[0] - 1;
}
template <typename P>
@@ -223,7 +221,7 @@
void
box_bkd_piter_<P>::invalidate_()
{
- p()[0] = s_->pmin()[0] - 1;
+ p_[0] = s_->pmin()[0] - 1;
}
template <typename P>
@@ -231,7 +229,7 @@
void
box_bkd_piter_<P>::start_()
{
- p() = s_->pmax();
+ p_ = s_->pmax();
}
template <typename P>
@@ -240,14 +238,14 @@
box_bkd_piter_<P>::next_()
{
for (int i = dim - 1; i >= 0; --i)
- if (p()[i] == s_->pmin()[i])
- p()[i] = s_->pmax()[i];
+ if (p_[i] == s_->pmin()[i])
+ p_[i] = s_->pmax()[i];
else
{
- --p()[i];
+ --p_[i];
break;
}
- if (p() == s_->pmax())
+ if (p_ == s_->pmax())
invalidate_();
}
Index: mln/core/pset_if_piter.hh
--- mln/core/pset_if_piter.hh (revision 2067)
+++ mln/core/pset_if_piter.hh (working copy)
@@ -32,16 +32,17 @@
*
* \brief Definition of iterators on pset_if<S,F>.
*
- * \todo See todo in site_iterator_base.hh
+ * \todo pset_if_bkd_piter_.
*/
-# include <mln/core/internal/site_set_iterator_base.hh>
+# include <mln/core/internal/piter_adaptor.hh>
# include <mln/core/pset_if.hh>
namespace mln
{
+
/*! \brief A generic forward iterator on points of subsets.
*
* Parameter \c S is a point set type; parameter F is a function
@@ -51,8 +52,9 @@
*/
template <typename S, typename F>
class pset_if_fwd_piter_
- : public internal::site_set_iterator_base< pset_if<S,F>,
- pset_if_fwd_piter_<S,F> >
+ : public internal::piter_adaptor_< mln_fwd_piter(S), // Adaptee.
+ pset_if<S,F>, // Site_Set.
+ pset_if_fwd_piter_<S,F> > // Exact.
{
public:
@@ -62,26 +64,14 @@
/// Constructor from a site set.
pset_if_fwd_piter_(const pset_if<S,F>& s);
- /// Test if the iterator is valid.
- bool is_valid_() const;
-
- /// Invalidate the iterator.
- void invalidate_();
-
/// Start an iteration.
void start_();
/// Go to the next point.
void next_();
- mln_fwd_piter(S)& hook_pi_() { return pi_; }
-
- mln_psite(S)& current_p_() { return pi_.p(); }
- const mln_psite(S)& current_p_() const { return pi_.p(); }
-
- private:
-
- mln_fwd_piter(S) pi_;
+ /// The set site targeted by pi_.
+ const S& pi_set_from_(const pset_if<S,F>& s) const;
};
@@ -109,51 +99,37 @@
inline
pset_if_fwd_piter_<S,F>::pset_if_fwd_piter_(const pset_if<S,F>& s)
{
- pi_.change_target(s.overset());
this->change_target(s);
}
template <typename S, typename F>
inline
- bool
- pset_if_fwd_piter_<S,F>::is_valid_() const
- {
- return pi_.is_valid();
- }
-
- template <typename S, typename F>
- inline
void
- pset_if_fwd_piter_<S,F>::invalidate_()
+ pset_if_fwd_piter_<S,F>::start_()
{
- pi_.invalidate();
+ this->pi_.start();
+ while (this->pi_.is_valid() && ! this->s_->pred(this->pi_))
+ this->pi_.next();
}
template <typename S, typename F>
inline
void
- pset_if_fwd_piter_<S,F>::start_()
+ pset_if_fwd_piter_<S,F>::next_()
{
- pi_.start();
- while (pi_.is_valid() && ! this->s_->pred(pi_))
- pi_.next();
-// if (is_valid_())
-// this->p_ = pi_;
+ do
+ this->pi_.next();
+ while (this->pi_.is_valid() && ! this->s_->pred(this->pi_));
}
template <typename S, typename F>
inline
- void
- pset_if_fwd_piter_<S,F>::next_()
+ const S&
+ pset_if_fwd_piter_<S,F>::pi_set_from_(const pset_if<S,F>& s) const
{
- do
- pi_.next();
- while (pi_.is_valid() && ! this->s_->pred(pi_));
-// if (is_valid_())
-// this->p_ = pi_;
+ return s.overset();
}
-
// FIXME: pset_if_bkd_piter_<S,F>
Index: mln/core/p_array_piter.hh
--- mln/core/p_array_piter.hh (revision 2067)
+++ mln/core/p_array_piter.hh (working copy)
@@ -72,7 +72,6 @@
int index() const;
protected:
-
using super::p_;
using super::s_;
};
@@ -117,7 +116,6 @@
int index() const;
protected:
-
using super::p_;
using super::s_;
};
Index: mln/core/dpsites_piter.hh
--- mln/core/dpsites_piter.hh (revision 2067)
+++ mln/core/dpsites_piter.hh (working copy)
@@ -76,8 +76,6 @@
/// Compute the current psite.
mln_psite(V) compute_p_() const;
- dpsites_fwd_piter<V>& update();
-
protected:
unsigned i_;
@@ -119,8 +117,6 @@
/// Compute the current psite.
mln_psite(V) compute_p_() const;
- dpsites_fwd_piter<V>& update();
-
protected:
int i_;
@@ -183,17 +179,6 @@
return *this->c_ + this->s_->std_vector()[i_];
}
- template <typename V>
- inline
- dpsites_fwd_piter<V>&
- dpsites_fwd_piter<V>::update()
- {
- mln_precondition(this->s_ && this->c_);
- this->p_ = compute_p_();
- mln_postcondition(this->is_valid());
- return *this;
- }
-
// Backward.
@@ -247,17 +232,6 @@
return *this->c_ + this->s_->std_vector()[i_];
}
- template <typename V>
- inline
- dpsites_fwd_piter<V>&
- dpsites_bkd_piter<V>::update()
- {
- mln_precondition(this->s_ && this->c_);
- this->p_ = compute_p_();
- mln_postcondition(this->is_valid());
- return *this;
- }
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: mln/core/concept/neighborhood.hh
--- mln/core/concept/neighborhood.hh (revision 2067)
+++ mln/core/concept/neighborhood.hh (working copy)
@@ -32,7 +32,7 @@
* \brief Definition of the concept of mln::Neighborhood.
*/
-# include <mln/core/concept/window.hh>
+# include <mln/core/concept/object.hh>
namespace mln
@@ -55,7 +55,7 @@
* class contents.
*/
template <typename E>
- struct Neighborhood : public Window<E>
+ struct Neighborhood : public Object<E>
{
typedef Neighborhood<void> category;
@@ -63,6 +63,9 @@
typedef niter;
typedef fwd_niter;
typedef bkd_niter;
+
+ typedef window;
+ window to_window() const;
*/
protected:
@@ -79,6 +82,10 @@
typedef mln_niter(E) niter;
typedef mln_fwd_niter(E) fwd_niter;
typedef mln_bkd_niter(E) bkd_niter;
+
+ typedef mln_window(E) window;
+ window (E::*m)() const = & E::to_window;
+ m = 0;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/morpho/dilation_elementary.hh
--- mln/morpho/dilation_elementary.hh (revision 0)
+++ mln/morpho/dilation_elementary.hh (revision 0)
@@ -0,0 +1,80 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_MORPHO_DILATION_ELEMENTARY_HH
+# define MLN_MORPHO_DILATION_ELEMENTARY_HH
+
+/// \file mln/morpho/dilation_elementary.hh
+/// \brief Morphological elementary dilation.
+
+# include <mln/morpho/dilation.hh>
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ /// Morphological elementary dilation.
+ ///
+ /// \param[in] input The image to be dilated.
+ /// \param[in] nbh The neighborhood to consider.
+ ///
+ /// The structuring element is the neighborhood + the center site.
+ ///
+ /// \{
+ template <typename I, typename N>
+ mln_concrete(I)
+ dilation_elementary(const Image<I>& input, const Neighborhood<N>& nbh);
+ /// \}
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename N>
+ mln_concrete(I)
+ dilation_elementary(const Image<I>& input, const Neighborhood<N>& nbh)
+ {
+ trace::entering("morpho::dilation_elementary");
+ mln_precondition(exact(input).has_data());
+ // FIXME: mln_precondition(! exact(nbh).is_empty());
+
+ mln_concrete(I) output = dilation(input, nbh.to_window());
+
+ trace::exiting("morpho::dilation_elementary");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MORPHO_DILATION_ELEMENTARY_HH
1
0
23 Jun '08
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix the linkage of tools from apps/statues/ on GNU/Linux.
* apps/statues/Makefile.am (AM_LDFLAGS): Rename as...
(LDADD): ...this.
Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: apps/statues/Makefile.am
--- apps/statues/Makefile.am (revision 2065)
+++ apps/statues/Makefile.am (working copy)
@@ -4,8 +4,8 @@
AM_CPPFLAGS = -I$(top_srcdir)/milena -I$(top_srcdir)/external/trimesh/include
# Produce fast code.
AM_CXXFLAGS = -O3 -DNDEBUG -ggdb
-# Find trimesh archive.
-AM_LDFLAGS = -L$(top_builddir)/external/trimesh/libsrc -ltrimesh
+# Find the trimesh archive.
+LDADD = -L$(top_builddir)/external/trimesh/libsrc -ltrimesh
bin_PROGRAMS = mesh-segm mesh-skel
mesh_segm_SOURCES = mesh-segm.cc io.hh
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/external/trimesh
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix the linkage of trimesh utilities on GNU/Linux.
* utilsrc/Makefile.am (AM_LDFLAGS): Rename as..
(LDADD): ...this.
Put `-lm' after `-ltrimesh'.
(GLFLAGS): New.
(GLLIBS) [DARWIN]: Move `-framework GLUT -framework OpenGL'...
(GLFLAGS) [DARWIN]: ...here.
(mesh_view_LDFLAGS): s/GLLIBS/GLFLAGS/.
(mesh_view_LDADD): New.
Set to $(LDADD) $(GLLIBS).
Makefile.am | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: utilsrc/Makefile.am
--- utilsrc/Makefile.am (revision 2064)
+++ utilsrc/Makefile.am (working copy)
@@ -1,13 +1,14 @@
## Process this file through Automake to produce Makefile.in -*- Makefile -*-
AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_LDFLAGS = -L$(top_builddir)/libsrc -L$(top_builddir)/gluit -lm -ltrimesh
+LDADD = -L$(top_builddir)/libsrc -L$(top_builddir)/gluit -ltrimesh -lm
# FIXME: Handle other OSes as well (Win32, SunOS, etc.)
if DARWIN
-# LIBS += -lobjc
- GLLIBS = -framework GLUT -framework OpenGL -lgluit
+ GLFLAGS = -framework GLUT -framework OpenGL
+ GLLIBS = -lgluit
else !DARWIN
+ GLFLAGS =
GLLIBS = -lgluit -lGL -lGLU -lX11 -lXmu -lXi
endif !DARWIN
@@ -28,4 +29,5 @@
mesh_shade_SOURCES = mesh_shade.cc
mesh_view_SOURCES = mesh_view.cc
-mesh_view_LDFLAGS = $(AM_LDFLAGS) $(GLLIBS)
+mesh_view_LDFLAGS = $(AM_LDFLAGS) $(GLFLAGS)
+mesh_view_LDADD = $(LDADD) $(GLLIBS)
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Update external/README.
* external/README: Complete the list of files removed from the
initial Trimesh distribution.
README | 11 +++++++++++
1 file changed, 11 insertions(+)
Index: external/README
--- external/README (revision 2063)
+++ external/README (working copy)
@@ -20,6 +20,7 @@
This version of trimesh2 shipped with Olena has been autoconfiscated,
and no longer contains the following files and directories:
+ Makefile
bin.Linux/
mesh_align
mesh_cat
@@ -44,6 +45,7 @@
mesh_make.exe
mesh_shade.exe
mesh_view.exe
+ gluit/Makefile
lib.Linux/
libgluit.a
libtrimesh.a
@@ -53,8 +55,17 @@
lib.Win32/
libgluit.a
libtrimesh.a
+ libsrc/Makefile
+ utilsrc/Makefile
+
+(Old Makefiles have been converted to Automake's Makefile.am's.)
+
Local Variables:
ispell-local-dictionary: "american"
End:
+
+ LocalWords: trimesh Szymon Rusinkiewicz GPL autoconfiscated Makefile exe
+ LocalWords: gluit libgluit libtrimesh libsrc utilsrc Makefiles Automake's
+ LocalWords: ispell american
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
The only tests that do not work on my laptop now are:
- milena/tests/value/graylevel.cc
- milena/tests/value/graylevel_f.cc
because of an ambiguous conversion.
I have no time to try and fix it today, but any help is welcome! :)
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Have most of the test suite compile again.
* mln/algebra/quat.hh: Include missing header for mln/math/abs.hh.
* mln/draw/graph.hh
(graph(Image<I>&, const p_graph<P>&, mln_value(I), mln_value(I))):
s/n1/v1/.
s/n2/v2/.
* tests/draw/graph.cc (test): s/add_node/add_vertex/.
mln/algebra/quat.hh | 1 +
mln/draw/graph.hh | 4 ++--
tests/draw/graph.cc | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
Index: mln/algebra/quat.hh
--- mln/algebra/quat.hh (revision 2060)
+++ mln/algebra/quat.hh (working copy)
@@ -42,6 +42,7 @@
# include <mln/trait/value_.hh>
# include <mln/algebra/vec.hh>
+# include <mln/math/abs.hh>
# include <mln/norm/l2.hh>
//FIXME: pow, exp etc... are def here and in value::...
Index: mln/draw/graph.hh
--- mln/draw/graph.hh (revision 2060)
+++ mln/draw/graph.hh (working copy)
@@ -99,8 +99,8 @@
line (exact(ima),
// FIXME: Too low-level. See similar remarks
// in mln/core/graph_image.hh
- pg.gr_->vertex_data(pg.gr_->edge(l).n1()),
- pg.gr_->vertex_data(pg.gr_->edge(l).n2()),
+ pg.gr_->vertex_data(pg.gr_->edge(l).v1()),
+ pg.gr_->vertex_data(pg.gr_->edge(l).v2()),
edge_v);
// Draw the points (vertices).
for (size_t p = 0; p < pg.npoints(); ++p)
Index: tests/draw/graph.cc
--- tests/draw/graph.cc (revision 2060)
+++ tests/draw/graph.cc (working copy)
@@ -64,7 +64,7 @@
util::graph<mln::point2d> g;
// Populate the graph with nodes.
for (unsigned i = 0; i < points.size(); ++i)
- g.add_node (points[i]);
+ g.add_vertex(points[i]);
// Populate the graph with edges.
for (edges_type::const_iterator i = edges.begin(); i != edges.end(); ++i)
g.add_edge (i->first, i->second);
1
1
***SPAM*** L1 cleanup-2008 2063: Get rid of '_' at end of point_, dpoint_, and box_.
by Thierry Geraud 23 Jun '08
by Thierry Geraud 23 Jun '08
23 Jun '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Get rid of '_' at end of point_, dpoint_, and box_.
* mln/core/point.hh (dpoint): Remove this typedef.
(operator+=, operator-=): Use delta in sig.
(point_): Rename as...
(point): ...this.
* mln/core/dpoint.hh (point): Remove this typedef.
(dpoint_): Rename as...
(dpoint): ...this.
* mln/core/box.hh (box_): Rename as...
(box): ...this.
* mln/trait/image/props.hh,
* mln/core/dpoint2d.hh,
* mln/core/box_piter.hh,
* mln/core/point2d.hh,
* mln/core/box2d.hh,
* mln/geom/bbox.hh: Propagate renaming.
core/box.hh | 56 ++++++++++++-------------
core/box2d.hh | 4 -
core/box_piter.hh | 16 +++----
core/dpoint.hh | 83 ++++++++++++++++++-------------------
core/dpoint2d.hh | 4 -
core/point.hh | 113 ++++++++++++++++++++++++---------------------------
core/point2d.hh | 28 ++++++------
geom/bbox.hh | 12 ++---
trait/image/props.hh | 12 +++--
9 files changed, 162 insertions(+), 166 deletions(-)
Index: mln/trait/image/props.hh
--- mln/trait/image/props.hh (revision 2062)
+++ mln/trait/image/props.hh (working copy)
@@ -31,6 +31,8 @@
/*! \file mln/trait/image/props.hh
*
* \brief Properties of image classes.
+ *
+ * \todo Remove space_from_point and fwd decls at EOF.
*/
# include <string>
@@ -556,11 +558,11 @@
struct cube;
}
- template <typename M, typename C> struct point_;
- typedef point_<grid::tick, int> point1d;
- typedef point_<grid::square, int> point2d;
- typedef point_<grid::hexa, int> point2d_h;
- typedef point_<grid::cube, int> point3d;
+ template <typename M, typename C> struct point;
+ typedef point<grid::tick, int> point1d;
+ typedef point<grid::square, int> point2d;
+ typedef point<grid::hexa, int> point2d_h;
+ typedef point<grid::cube, int> point3d;
namespace trait
{
Index: mln/core/dpoint2d.hh
--- mln/core/dpoint2d.hh (revision 2062)
+++ mln/core/dpoint2d.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
@@ -43,7 +43,7 @@
/*! \brief Type alias for a delta-point defined on the 2D square
* grid with integer coordinates.
*/
- typedef dpoint_<grid::square, int> dpoint2d;
+ typedef dpoint<grid::square, int> dpoint2d;
} // end of namespace mln
Index: mln/core/point.hh
--- mln/core/point.hh (revision 2062)
+++ mln/core/point.hh (working copy)
@@ -49,8 +49,8 @@
{
/// \{ Fwd decls.
- template <typename G, typename C> struct point_;
- template <typename G, typename C> struct dpoint_;
+ template <typename G, typename C> struct point;
+ template <typename G, typename C> struct dpoint;
namespace literal {
struct zero_t;
struct one_t;
@@ -81,8 +81,8 @@
* coordinate type in this space.
*/
template <typename G, typename C>
- struct point_ : public Gpoint< point_<G,C> >,
- public internal::mutable_coord_impl_< G::dim, C, point_<G,C> >
+ struct point : public Gpoint< point<G,C> >,
+ public internal::mutable_coord_impl_< G::dim, C, point<G,C> >
{
/*! \var dim
* \brief Dimension of the space.
@@ -93,14 +93,11 @@
/// Grid associated type.
typedef G grid;
- /// Dpoint associated type.
- typedef dpoint_<G,C> dpoint;
-
/// Delta associated type.
- typedef dpoint_<G,C> delta;
+ typedef dpoint<G,C> delta;
/// DPsite associated type.
- typedef dpoint_<G,C> dpsite;
+ typedef dpoint<G,C> dpsite;
/// Coordinate associated type.
typedef C coord;
@@ -121,44 +118,44 @@
C& operator[](unsigned i);
/// Constructor without argument.
- point_();
+ point();
/// Constructor from an algebra vector.
template <typename C2>
- point_(const algebra::vec<dim,C2>& v);
+ point(const algebra::vec<dim,C2>& v);
/// \{ Constructors with different numbers of arguments
/// (coordinates) w.r.t. the dimension.
- point_(C ind);
- point_(C row, C col);
- point_(C sli, C row, C col);
+ point(C ind);
+ point(C row, C col);
+ point(C sli, C row, C col);
/// \}
/// \{ Constructors/assignments with literals.
- point_(const literal::origin_t&);
- point_<G,C>& operator=(const literal::origin_t&);
+ point(const literal::origin_t&);
+ point<G,C>& operator=(const literal::origin_t&);
// Works only in 1D:
- point_(const literal::zero_t&);
- point_<G,C>& operator=(const literal::zero_t&);
- point_(const literal::one_t&);
- point_<G,C>& operator=(const literal::one_t&);
+ point(const literal::zero_t&);
+ point<G,C>& operator=(const literal::zero_t&);
+ point(const literal::one_t&);
+ point<G,C>& operator=(const literal::one_t&);
/// \}
/// Constructor; coordinates are set by function \p f.
template <typename F>
- point_(const Function_i2v<F>& f);
+ point(const Function_i2v<F>& f);
/// Set all coordinates to the value \p c.
void set_all(C c);
/// Origin point (all coordinates are 0).
- static const point_<G,C> origin;
+ static const point<G,C> origin;
/// Shifting by \p dp.
- point_<G,C>& operator+=(const dpoint& dp);
+ point<G,C>& operator+=(const delta& dp);
/// Shifting by \p the inverse of dp.
- point_<G,C>& operator-=(const dpoint& dp);
+ point<G,C>& operator-=(const delta& dp);
/// Hook to coordinates.
operator typename internal::point_to_<G, C>::metal_vec () const;
@@ -191,8 +188,8 @@
* iterator.
*/
template <typename G, typename Cl, typename Cr>
- struct less_than< point_<G,Cl>,
- point_<G,Cr> >
+ struct less_than< point<G,Cl>,
+ point<G,Cr> >
{
/*! \brief Comparison between a couple of points \a lhs and \a
* rhs.
@@ -200,8 +197,8 @@
* \return True if \p lhs is before \p rhs in the sense of the
* coordinates lexicographic comparison, otherwise false.
*/
- bool operator()(const point_<G,Cl>& lhs,
- const point_<G,Cr>& rhs) const;
+ bool operator()(const point<G,Cl>& lhs,
+ const point<G,Cr>& rhs) const;
};
} // end of namespace mln::util
@@ -211,7 +208,7 @@
template <typename G, typename C>
inline
- C point_<G,C>::operator[](unsigned i) const
+ C point<G,C>::operator[](unsigned i) const
{
assert(i < dim);
return this->coord_[i];
@@ -219,7 +216,7 @@
template <typename G, typename C>
inline
- C& point_<G,C>::operator[](unsigned i)
+ C& point<G,C>::operator[](unsigned i)
{
assert(i < dim);
return this->coord_[i];
@@ -229,21 +226,21 @@
template <typename G, typename C>
inline
- point_<G,C>::point_()
+ point<G,C>::point()
{
}
template <typename G, typename C>
template <typename C2>
inline
- point_<G,C>::point_(const algebra::vec<dim,C2>& v)
+ point<G,C>::point(const algebra::vec<dim,C2>& v)
{
coord_ = v;
}
template <typename G, typename C>
inline
- point_<G,C>::point_(C ind)
+ point<G,C>::point(C ind)
{
metal::bool_<(dim == 1)>::check();
coord_[0] = ind;
@@ -251,7 +248,7 @@
template <typename G, typename C>
inline
- point_<G,C>::point_(C row, C col)
+ point<G,C>::point(C row, C col)
{
metal::bool_<(dim == 2)>::check();
coord_[0] = row;
@@ -260,7 +257,7 @@
template <typename G, typename C>
inline
- point_<G,C>::point_(C sli, C row, C col)
+ point<G,C>::point(C sli, C row, C col)
{
metal::bool_<(dim == 3)>::check();
coord_[0] = sli;
@@ -271,7 +268,7 @@
template <typename G, typename C>
template <typename F>
inline
- point_<G,C>::point_(const Function_i2v<F>& f_)
+ point<G,C>::point(const Function_i2v<F>& f_)
{
mlc_converts_to(mln_result(F), C)::check();
const F& f = exact(f_);
@@ -281,15 +278,15 @@
template <typename G, typename C>
inline
- point_<G,C>::point_(const literal::origin_t&)
+ point<G,C>::point(const literal::origin_t&)
{
coord_.set_all(0);
}
template <typename G, typename C>
inline
- point_<G,C>&
- point_<G,C>::operator=(const literal::origin_t&)
+ point<G,C>&
+ point<G,C>::operator=(const literal::origin_t&)
{
coord_.set_all(0);
return *this;
@@ -297,7 +294,7 @@
template <typename G, typename C>
inline
- point_<G,C>::point_(const literal::zero_t&)
+ point<G,C>::point(const literal::zero_t&)
{
metal::bool_<(dim == 1)>::check();
coord_[0] = 1;
@@ -305,8 +302,8 @@
template <typename G, typename C>
inline
- point_<G,C>&
- point_<G,C>::operator=(const literal::zero_t&)
+ point<G,C>&
+ point<G,C>::operator=(const literal::zero_t&)
{
metal::bool_<(dim == 1)>::check();
coord_[0] = 1;
@@ -315,7 +312,7 @@
template <typename G, typename C>
inline
- point_<G,C>::point_(const literal::one_t&)
+ point<G,C>::point(const literal::one_t&)
{
metal::bool_<(dim == 1)>::check();
coord_[0] = 1;
@@ -323,8 +320,8 @@
template <typename G, typename C>
inline
- point_<G,C>&
- point_<G,C>::operator=(const literal::one_t&)
+ point<G,C>&
+ point<G,C>::operator=(const literal::one_t&)
{
metal::bool_<(dim == 1)>::check();
coord_[0] = 1;
@@ -333,18 +330,18 @@
template <typename G, typename C>
inline
- void point_<G,C>::set_all(C c)
+ void point<G,C>::set_all(C c)
{
coord_.set_all(c);
}
template <typename G, typename C>
- const point_<G,C> point_<G,C>::origin = all_to(0);
+ const point<G,C> point<G,C>::origin = all_to(0);
template <typename G, typename C>
inline
- point_<G,C>&
- point_<G,C>::operator+=(const dpoint& dp)
+ point<G,C>&
+ point<G,C>::operator+=(const delta& dp)
{
for (unsigned i = 0; i < dim; ++i)
coord_[i] += dp[i];
@@ -353,8 +350,8 @@
template <typename G, typename C>
inline
- point_<G,C>&
- point_<G,C>::operator-=(const dpoint& dp)
+ point<G,C>&
+ point<G,C>::operator-=(const delta& dp)
{
for (unsigned i = 0; i < dim; ++i)
coord_[i] -= dp[i];
@@ -363,14 +360,14 @@
template <typename G, typename C>
inline
- point_<G,C>::operator typename internal::point_to_<G, C>::metal_vec () const
+ point<G,C>::operator typename internal::point_to_<G, C>::metal_vec () const
{
return coord_; // FIXGE: Is-it OK?
}
template <typename G, typename C>
inline
- point_<G,C>::operator algebra::vec<G::dim, float> () const
+ point<G,C>::operator algebra::vec<G::dim, float> () const
{
algebra::vec<dim, float> tmp;
for (unsigned i = 0; i < dim; ++i)
@@ -381,14 +378,14 @@
template <typename G, typename C>
inline
const algebra::vec<G::dim, C>&
- point_<G,C>::to_vec() const
+ point<G,C>::to_vec() const
{
return coord_;
}
template <typename G, typename C>
inline
- h_vec<G::dim, C> point_<G,C>::to_h_vec() const
+ h_vec<G::dim, C> point<G,C>::to_h_vec() const
{
h_vec<G::dim, C> tmp;
for (unsigned i = 0; i < dim; ++i)
@@ -403,9 +400,9 @@
template <typename G, typename Cl, typename Cr>
bool
- less_than< point_<G,Cl>,
- point_<G,Cr> >::operator()(const point_<G,Cl>& lhs,
- const point_<G,Cr>& rhs) const
+ less_than< point<G,Cl>,
+ point<G,Cr> >::operator()(const point<G,Cl>& lhs,
+ const point<G,Cr>& rhs) const
{
enum { n = G::dim };
typedef less_than< algebra::vec<n,Cl>, algebra::vec<n,Cr> > less_t;
Index: mln/core/box_piter.hh
--- mln/core/box_piter.hh (revision 2062)
+++ mln/core/box_piter.hh (working copy)
@@ -47,11 +47,11 @@
* \see mln::box_
*/
template <typename P>
- class box_fwd_piter_ : public internal::site_set_iterator_base< box_<P>,
+ class box_fwd_piter_ : public internal::site_set_iterator_base< box<P>,
box_fwd_piter_<P> >
{
typedef box_fwd_piter_<P> self_;
- typedef internal::site_iterator_base< box_<P>, self_ > super_;
+ typedef internal::site_iterator_base< box<P>, self_ > super_;
public:
@@ -65,7 +65,7 @@
*
* \param[in] b A box.
*/
- box_fwd_piter_(const box_<P>& b);
+ box_fwd_piter_(const box<P>& b);
/// Test the iterator validity.
bool is_valid_() const;
@@ -94,11 +94,11 @@
* \see mln::box_
*/
template <typename P>
- class box_bkd_piter_ : public internal::site_iterator_base< box_<P>,
+ class box_bkd_piter_ : public internal::site_iterator_base< box<P>,
box_bkd_piter_<P> >
{
typedef box_bkd_piter_<P> self_;
- typedef internal::site_iterator_base< box_<P>, self_ > super_;
+ typedef internal::site_iterator_base< box<P>, self_ > super_;
public:
@@ -112,7 +112,7 @@
*
* \param[in] b A box.
*/
- box_bkd_piter_(const box_<P>& b);
+ box_bkd_piter_(const box<P>& b);
/// Test the iterator validity.
bool is_valid_() const;
@@ -148,7 +148,7 @@
template <typename P>
inline
- box_fwd_piter_<P>::box_fwd_piter_(const box_<P>& b)
+ box_fwd_piter_<P>::box_fwd_piter_(const box<P>& b)
{
this->change_target(b);
}
@@ -205,7 +205,7 @@
template <typename P>
inline
- box_bkd_piter_<P>::box_bkd_piter_(const box_<P>& b)
+ box_bkd_piter_<P>::box_bkd_piter_(const box<P>& b)
{
this->change_target(b);
}
Index: mln/core/dpoint.hh
--- mln/core/dpoint.hh (revision 2062)
+++ mln/core/dpoint.hh (working copy)
@@ -30,7 +30,7 @@
/*! \file mln/core/dpoint.hh
*
- * \brief Definition of the generic delta-point class mln::dpoint_.
+ * \brief Definition of the generic delta-point class mln::dpoint.
*/
# include <mln/core/concept/gdpoint.hh>
@@ -43,7 +43,7 @@
{
/// \{ Fwd decls.
- template <typename G, typename C> struct point_;
+ template <typename G, typename C> struct point;
namespace literal {
struct zero_t;
struct one_t;
@@ -57,8 +57,8 @@
* coordinate type in this space.
*/
template <typename G, typename C>
- struct dpoint_ : public Gdpoint< dpoint_<G,C> >,
- public internal::mutable_coord_impl_< G::dim, C, dpoint_<G,C> >
+ struct dpoint : public Gdpoint< dpoint<G,C> >,
+ public internal::mutable_coord_impl_< G::dim, C, dpoint<G,C> >
{
/*! \var dim
* \brief Dimension of the space.
@@ -69,14 +69,11 @@
/// Grid associated type.
typedef G grid;
- /// Point associated type.
- typedef point_<G,C> point;
-
/// Psite associated type.
- typedef point_<G,C> psite;
+ typedef point<G,C> psite;
/// Site associated type.
- typedef point_<G,C> site;
+ typedef point<G,C> site;
/// Coordinate associated type.
typedef C coord;
@@ -97,30 +94,30 @@
C& operator[](unsigned i);
/// Constructor without argument.
- dpoint_();
+ dpoint();
/// Constructor from an algebra vector.
template <typename C2>
- dpoint_(const algebra::vec<dim,C2>& v);
+ dpoint(const algebra::vec<dim,C2>& v);
/// \{ Constructors with different numbers of arguments
/// (coordinates) w.r.t. the dimension.
- dpoint_(C ind);
- dpoint_(C row, C col);
- dpoint_(C sli, C row, C col);
+ dpoint(C ind);
+ dpoint(C row, C col);
+ dpoint(C sli, C row, C col);
/// \}
/// \{ Constructors/assignments with literals.
- dpoint_(const literal::zero_t&);
- dpoint_<G,C>& operator=(const literal::zero_t&);
+ dpoint(const literal::zero_t&);
+ dpoint<G,C>& operator=(const literal::zero_t&);
// Works only in 1D:
- dpoint_(const literal::one_t&);
- dpoint_<G,C>& operator=(const literal::one_t&);
+ dpoint(const literal::one_t&);
+ dpoint<G,C>& operator=(const literal::one_t&);
/// \}
/// Constructor; coordinates are set by function \p f.
template <typename F>
- dpoint_(const Function_i2v<F>& f);
+ dpoint(const Function_i2v<F>& f);
/// Set all coordinates to the value \p c.
void set_all(C c);
@@ -149,8 +146,8 @@
* Both delta-points have to be defined on the same topology.
*/
template <typename G, typename Cl, typename Cr>
- struct less_than< dpoint_<G,Cl>,
- dpoint_<G,Cr> >
+ struct less_than< dpoint<G,Cl>,
+ dpoint<G,Cr> >
{
/*! \brief Comparison between a couple of delta-points \a lhs
* and \a rhs.
@@ -158,8 +155,8 @@
* \return True if \p lhs is before \p rhs in the sense of the
* coordinates lexicographic comparison, otherwise false.
*/
- bool operator()(const dpoint_<G,Cl>& lhs,
- const dpoint_<G,Cr>& rhs) const;
+ bool operator()(const dpoint<G,Cl>& lhs,
+ const dpoint<G,Cr>& rhs) const;
};
} // end of namespace mln::util
@@ -169,7 +166,7 @@
template <typename G, typename C>
inline
- C dpoint_<G,C>::operator[](unsigned i) const
+ C dpoint<G,C>::operator[](unsigned i) const
{
assert(i < dim);
return coord_[i];
@@ -177,7 +174,7 @@
template <typename G, typename C>
inline
- C& dpoint_<G,C>::operator[](unsigned i)
+ C& dpoint<G,C>::operator[](unsigned i)
{
assert(i < dim);
return coord_[i];
@@ -185,21 +182,21 @@
template <typename G, typename C>
inline
- dpoint_<G,C>::dpoint_()
+ dpoint<G,C>::dpoint()
{
}
template <typename G, typename C>
template <typename C2>
inline
- dpoint_<G,C>::dpoint_(const algebra::vec<dim,C2>& v)
+ dpoint<G,C>::dpoint(const algebra::vec<dim,C2>& v)
{
coord_ = v;
}
template <typename G, typename C>
inline
- dpoint_<G,C>::dpoint_(C ind)
+ dpoint<G,C>::dpoint(C ind)
{
metal::bool_<(dim == 1)>::check();
coord_[0] = ind;
@@ -207,7 +204,7 @@
template <typename G, typename C>
inline
- dpoint_<G,C>::dpoint_(C row, C col)
+ dpoint<G,C>::dpoint(C row, C col)
{
metal::bool_<(dim == 2)>::check();
coord_[0] = row;
@@ -216,7 +213,7 @@
template <typename G, typename C>
inline
- dpoint_<G,C>::dpoint_(C sli, C row, C col)
+ dpoint<G,C>::dpoint(C sli, C row, C col)
{
metal::bool_<(dim == 3)>::check();
coord_[0] = sli;
@@ -226,15 +223,15 @@
template <typename G, typename C>
inline
- dpoint_<G,C>::dpoint_(const literal::zero_t&)
+ dpoint<G,C>::dpoint(const literal::zero_t&)
{
coord_.set_all(0);
}
template <typename G, typename C>
inline
- dpoint_<G,C>&
- dpoint_<G,C>::operator=(const literal::zero_t&)
+ dpoint<G,C>&
+ dpoint<G,C>::operator=(const literal::zero_t&)
{
coord_.set_all(0);
return *this;
@@ -242,7 +239,7 @@
template <typename G, typename C>
inline
- dpoint_<G,C>::dpoint_(const literal::one_t&)
+ dpoint<G,C>::dpoint(const literal::one_t&)
{
metal::bool_<(dim == 1)>::check();
coord_[0] = 1;
@@ -250,8 +247,8 @@
template <typename G, typename C>
inline
- dpoint_<G,C>&
- dpoint_<G,C>::operator=(const literal::one_t&)
+ dpoint<G,C>&
+ dpoint<G,C>::operator=(const literal::one_t&)
{
metal::bool_<(dim == 1)>::check();
coord_[0] = 1;
@@ -261,7 +258,7 @@
template <typename G, typename C>
template <typename F>
inline
- dpoint_<G,C>::dpoint_(const Function_i2v<F>& f_)
+ dpoint<G,C>::dpoint(const Function_i2v<F>& f_)
{
mlc_converts_to(mln_result(F), C)::check();
const F& f = exact(f_);
@@ -271,7 +268,7 @@
template <typename G, typename C>
inline
- void dpoint_<G,C>::set_all(C c)
+ void dpoint<G,C>::set_all(C c)
{
for (unsigned i = 0; i < dim; ++i)
coord_[i] = c;
@@ -280,7 +277,7 @@
template <typename G, typename C>
template <typename Q>
inline
- dpoint_<G,C>::operator algebra::vec<G::dim, Q> () const
+ dpoint<G,C>::operator algebra::vec<G::dim, Q> () const
{
return coord_;
}
@@ -288,7 +285,7 @@
template <typename G, typename C>
inline
const algebra::vec<G::dim, C>&
- dpoint_<G,C>::to_vec() const
+ dpoint<G,C>::to_vec() const
{
return coord_;
}
@@ -298,9 +295,9 @@
template <typename G, typename Cl, typename Cr>
bool
- less_than< dpoint_<G,Cl>,
- dpoint_<G,Cr> >::operator()(const dpoint_<G,Cl>& lhs,
- const dpoint_<G,Cr>& rhs) const
+ less_than< dpoint<G,Cl>,
+ dpoint<G,Cr> >::operator()(const dpoint<G,Cl>& lhs,
+ const dpoint<G,Cr>& rhs) const
{
enum { n = G::dim };
typedef less_than< algebra::vec<n,Cl>, algebra::vec<n,Cr> > less_t;
Index: mln/core/box.hh
--- mln/core/box.hh (revision 2062)
+++ mln/core/box.hh (working copy)
@@ -44,7 +44,7 @@
{
// Fwd decls.
- template <typename P> struct box_;
+ template <typename P> struct box;
template <typename P> struct box_fwd_piter_;
template <typename P> struct box_bkd_piter_;
@@ -53,7 +53,7 @@
{
template <typename P>
- struct site_set_< box_<P> >
+ struct site_set_< box<P> >
{
typedef trait::site_set::nsites::known nsites;
typedef trait::site_set::bbox::straight bbox;
@@ -70,8 +70,8 @@
* Parameter \c P is the corresponding type of point.
*/
template <typename P>
- struct box_ : public Box< box_<P> >,
- public internal::box_impl_< P::dim, mln_coord(P), box_<P> >
+ struct box : public Box< box<P> >,
+ public internal::box_impl_< P::dim, mln_coord(P), box<P> >
{
/// Dimension.
enum { dim = P::dim };
@@ -104,16 +104,16 @@
P& pmax();
/// Constructor without argument.
- box_();
+ box();
/// Constructor of a box going from \p pmin to \p pmax.
- box_(const site& pmin, const site& pmax);
+ box(const site& pmin, const site& pmax);
/// \{ Constructors with different numbers of arguments
/// (sizes) w.r.t. the dimension.
- explicit box_(mln_coord(P) ninds);
- box_(mln_coord(P) nrows, mln_coord(P) ncols);
- box_(mln_coord(P) nslis, mln_coord(P) nrows, mln_coord(P) ncols);
+ explicit box(mln_coord(P) ninds);
+ box(mln_coord(P) nrows, mln_coord(P) ncols);
+ box(mln_coord(P) nslis, mln_coord(P) nrows, mln_coord(P) ncols);
/// \}
/*! \brief Test if \p p belongs to the box.
@@ -126,7 +126,7 @@
void enlarge(unsigned b);
/// Give a larger box.
- box_<P> to_larger(unsigned b) const;
+ box<P> to_larger(unsigned b) const;
/// Test that the box owns valid data, i.e., pmin is 'less-than'
/// pmax.
@@ -145,10 +145,10 @@
*
* \return The modified output stream \p ostr.
*
- * \relates mln::box_
+ * \relates mln::box<P>
*/
template <typename P>
- std::ostream& operator<<(std::ostream& ostr, const box_<P>& b);
+ std::ostream& operator<<(std::ostream& ostr, const box<P>& b);
# ifndef MLN_INCLUDE_ONLY
@@ -156,7 +156,7 @@
template <typename P>
inline
bool
- box_<P>::is_valid() const
+ box<P>::is_valid() const
{
typedef util::less<P> less_t;
static const less_t op = less_t();
@@ -166,7 +166,7 @@
template <typename P>
inline
P
- box_<P>::pmin() const
+ box<P>::pmin() const
{
mln_precondition(is_valid());
return pmin_;
@@ -175,7 +175,7 @@
template <typename P>
inline
P&
- box_<P>::pmin()
+ box<P>::pmin()
{
return pmin_;
}
@@ -183,7 +183,7 @@
template <typename P>
inline
P
- box_<P>::pmax() const
+ box<P>::pmax() const
{
mln_precondition(is_valid());
return pmax_;
@@ -192,20 +192,20 @@
template <typename P>
inline
P&
- box_<P>::pmax()
+ box<P>::pmax()
{
return pmax_;
}
template <typename P>
inline
- box_<P>::box_()
+ box<P>::box()
{
}
template <typename P>
inline
- box_<P>::box_(const site& pmin, const site& pmax)
+ box<P>::box(const site& pmin, const site& pmax)
: pmin_(pmin),
pmax_(pmax)
{
@@ -214,7 +214,7 @@
template <typename P>
inline
- box_<P>::box_(mln_coord(P) ninds)
+ box<P>::box(mln_coord(P) ninds)
{
metal::bool_<(dim == 1)>::check();
pmin_ = literal::origin;
@@ -223,7 +223,7 @@
template <typename P>
inline
- box_<P>::box_(mln_coord(P) nrows, mln_coord(P) ncols)
+ box<P>::box(mln_coord(P) nrows, mln_coord(P) ncols)
{
metal::bool_<(dim == 2)>::check();
pmin_ = literal::origin;
@@ -233,7 +233,7 @@
template <typename P>
inline
- box_<P>::box_(mln_coord(P) nslis, mln_coord(P) nrows, mln_coord(P) ncols)
+ box<P>::box(mln_coord(P) nslis, mln_coord(P) nrows, mln_coord(P) ncols)
{
metal::bool_<(dim == 3)>::check();
pmin_ = literal::origin;
@@ -244,7 +244,7 @@
template <typename P>
inline
bool
- box_<P>::has(const P& p) const
+ box<P>::has(const P& p) const
{
mln_precondition(is_valid());
for (unsigned i = 0; i < P::dim; ++i)
@@ -256,7 +256,7 @@
template <typename P>
inline
void
- box_<P>::enlarge(unsigned b)
+ box<P>::enlarge(unsigned b)
{
mln_precondition(is_valid());
for (unsigned i = 0; i < P::dim; ++i)
@@ -270,11 +270,11 @@
template <typename P>
inline
- box_<P>
- box_<P>::to_larger(unsigned b) const
+ box<P>
+ box<P>::to_larger(unsigned b) const
{
mln_precondition(is_valid());
- box_<P> tmp(*this);
+ box<P> tmp(*this);
for (unsigned i = 0; i < P::dim; ++i)
{
@@ -287,7 +287,7 @@
template <typename P>
inline
- std::ostream& operator<<(std::ostream& ostr, const box_<P>& b)
+ std::ostream& operator<<(std::ostream& ostr, const box<P>& b)
{
mln_precondition(b.is_valid());
return ostr << "[" << b.pmin() << ".." << b.pmax() << ']';
Index: mln/core/point2d.hh
--- mln/core/point2d.hh (revision 2062)
+++ mln/core/point2d.hh (working copy)
@@ -45,7 +45,7 @@
/*! \brief Type alias for a point defined on the 2D square grid with
* integer coordinates.
*/
- typedef point_<grid::square, int> point2d;
+ typedef point<grid::square, int> point2d;
namespace internal
@@ -54,7 +54,7 @@
// Specialization.
template <typename C, typename E>
- struct site_const_impl< point_<grid::square, C>, E >
+ struct site_const_impl< point<grid::square, C>, E >
{
C row() const;
C col() const;
@@ -64,17 +64,17 @@
};
- // Specialization for point_<M,C>.
+ // Specialization for point<M,C>.
template <typename C, typename E>
- struct site_mutable_impl< point_<grid::square, C>, E > :
- site_const_impl < point_<grid::square, C>, E >
+ struct site_mutable_impl< point<grid::square, C>, E > :
+ site_const_impl < point<grid::square, C>, E >
{
C& row();
C& col();
C& operator[](unsigned i);
private:
- typedef site_const_impl< point_<grid::square, C>, E > super;
+ typedef site_const_impl< point<grid::square, C>, E > super;
E& exact_();
};
@@ -90,21 +90,21 @@
template <typename C, typename E>
C
- site_const_impl< point_<grid::square, C>, E >::row() const
+ site_const_impl< point<grid::square, C>, E >::row() const
{
return exact_().to_site().row();
}
template <typename C, typename E>
C
- site_const_impl< point_<grid::square, C>, E >::col() const
+ site_const_impl< point<grid::square, C>, E >::col() const
{
return exact_().to_site().col();
}
template <typename C, typename E>
C
- site_const_impl< point_<grid::square, C>, E >::operator[](unsigned i) const
+ site_const_impl< point<grid::square, C>, E >::operator[](unsigned i) const
{
mln_precondition(i < 2);
return exact_().to_site()[i];
@@ -112,7 +112,7 @@
template <typename C, typename E>
const E&
- site_const_impl< point_<grid::square, C>, E >::exact_() const
+ site_const_impl< point<grid::square, C>, E >::exact_() const
{
return internal::force_exact<const E>(*this);
}
@@ -121,21 +121,21 @@
template <typename C, typename E>
C&
- site_mutable_impl< point_<grid::square, C>, E >::row()
+ site_mutable_impl< point<grid::square, C>, E >::row()
{
return exact_().to_site().row();
}
template <typename C, typename E>
C&
- site_mutable_impl< point_<grid::square, C>, E >::col()
+ site_mutable_impl< point<grid::square, C>, E >::col()
{
return exact_().to_site().col();
}
template <typename C, typename E>
C&
- site_mutable_impl< point_<grid::square, C>, E >::operator[](unsigned i)
+ site_mutable_impl< point<grid::square, C>, E >::operator[](unsigned i)
{
mln_precondition(i < 2);
return exact_().to_site()[i];
@@ -143,7 +143,7 @@
template <typename C, typename E>
E&
- site_mutable_impl< point_<grid::square, C>, E >::exact_()
+ site_mutable_impl< point<grid::square, C>, E >::exact_()
{
return internal::force_exact<E>(*this);
}
Index: mln/core/box2d.hh
--- mln/core/box2d.hh (revision 2062)
+++ mln/core/box2d.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
@@ -46,7 +46,7 @@
*
* \see mln::win::rectangle2d.
*/
- typedef box_<point2d> box2d;
+ typedef box<point2d> box2d;
} // end of namespace mln
Index: mln/geom/bbox.hh
--- mln/geom/bbox.hh (revision 2062)
+++ mln/geom/bbox.hh (working copy)
@@ -50,7 +50,7 @@
/// Compute the precise bounding box of a point set \p pset.
template <typename S>
- box_<mln_site(S)> bbox(const Site_Set<S>& pset);
+ box<mln_site(S)> bbox(const Site_Set<S>& pset);
# ifndef MLN_INCLUDE_ONLY
@@ -59,14 +59,14 @@
{
template <typename S>
- box_<mln_site(S)> bbox_(trait::site_set::bbox::known,
+ box<mln_site(S)> bbox_(trait::site_set::bbox::known,
const S& pset)
{
return pset.bbox();
}
template <typename S>
- box_<mln_site(S)> bbox_(trait::site_set::bbox::unknown,
+ box<mln_site(S)> bbox_(trait::site_set::bbox::unknown,
const S& pset)
{
typedef mln_site(S) P;
@@ -87,7 +87,7 @@
if (p[i] > pmax[i])
pmax[i] = p[i];
- box_<P> bb(pmin, pmax);
+ box<P> bb(pmin, pmax);
return bb;
}
@@ -98,12 +98,12 @@
template <typename S>
inline
- box_<mln_site(S)> bbox(const Site_Set<S>& pset)
+ box<mln_site(S)> bbox(const Site_Set<S>& pset)
{
trace::entering("geom::bbox");
// mln_precondition(set::is_empty(pset) != 0);
- box_<mln_site(S)> b = impl::bbox_(mln_trait_site_set_bbox(S)(),
+ box<mln_site(S)> b = impl::bbox_(mln_trait_site_set_bbox(S)(),
exact(pset));
trace::exiting("geom::bbox");
1
0