Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* olena/oln/core/bkd_iter1d.hh: Correct comments.
* olena/oln/core/bkd_iter2d.hh: Likewise.
* olena/oln/core/bkd_iter3d.hh: Likewise.
* olena/oln/core/fwd_iter1d.hh: Likewise.
* olena/oln/core/fwd_iter2d.hh: Likewise.
* olena/oln/core/fwd_iter3d.hh: Likewise.
* olena/oln/core/abstract/iter1d.hh: Likewise.
* olena/oln/core/abstract/iter2d.hh: Likewise.
* olena/oln/core/abstract/iter3d.hh: Likewise.
* olena/oln/core/abstract/iter.hh: Likewise.
* olena/oln/core/neighborhood1d.hh: Likewise.
* olena/oln/core/neighborhood2d.hh: Likewise.
* olena/oln/core/neighborhood3d.hh: Likewise.
* olena/oln/core/abstract/neighborhood.hh: Likewise.
* olena/oln/core/abstract/struct_elt.hh: Likewise.
* olena/oln/core/window1d.hh: Likewise.
* olena/oln/core/window2d.hh: Likewise.
* olena/oln/core/window3d.hh: Likewise.
* olena/oln/core/abstract/window.hh: Likewise.
* olena/oln/core/w_window1d.hh: Likewise.
* olena/oln/core/w_window2d.hh: Likewise.
* olena/oln/core/w_window3d.hh: Likewise.
* olena/oln/core/abstract/w_window.hh: Likewise.
* olena/oln/core/abstract/image.hh: Likewise.
* olena/oln/core/abstract/window_base.hh: Likewise.
* olena/oln/core/abstract/windownd.hh: Likewise.
* olena/oln/core/abstract/w_windownd.hh: Likewise.
* olena/oln/core/abstract/neighborhoodnd.hh: Likewise.
Index: olena/oln/core/bkd_iter1d.hh
--- olena/oln/core/bkd_iter1d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/d/38_bkd_iter1d 1.16 640)
+++ olena/oln/core/bkd_iter1d.hh Fri, 12 Mar 2004 13:10:43 +0100 odou_s
(oln/d/38_bkd_iter1d 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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,8 +33,11 @@
namespace oln {
template<class Exact = mlc::final>
- class bkd_iter1d; // fwd_decl
+ class bkd_iter1d; // forward declaration
+ /*!
+ ** \brief Traits for bkd_iter1d.
+ */
template<class Exact>
struct iter_traits<bkd_iter1d<Exact> >: public
iter_traits<abstract::iter1d<typename
@@ -44,29 +47,51 @@
typedef dpoint1d dpoint_type;
};
-
+ /*!
+ ** \brief Backward Iterator of 1 dimension.
+ **
+ ** Allow iterable object (like image, window, ...) of 1 dimension backward
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class bkd_iter1d : public abstract::iter1d<typename
mlc::exact_vt<bkd_iter1d<Exact>, Exact>::ret>
{
public:
typedef typename mlc::exact_vt<bkd_iter1d<Exact>, Exact>::ret
exact_type;
+ ///< The exact type.
- typedef abstract::iter1d<exact_type> super_type;
+ typedef abstract::iter1d<exact_type> super_type; ///< The super type.
typedef abstract::iter<exact_type> super_iter_type;
+ ///< The super iterator type.
- enum { dim = iter_traits<exact_type>::dim };
+ enum { dim = iter_traits<exact_type>::dim }; ///< Dimension.
+ /*!
+ ** \brief The associate image's type of point.
+ ** \warning Prefer the macros oln_point_type(Pointable) and
+ ** oln_point_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename iter_traits<exact_type>::point_type point_type;
friend class abstract::iter<exact_type>;
friend class abstract::iter1d<exact_type>;
+ /*!
+ ** \brief Construct a backward iterator (1 dimension).
+ ** \arg ima The image to iterate.
+ */
template<class Image>
bkd_iter1d(const Image& ima) :
super_type(ima.size())
{}
+ /*!
+ ** \brief Set current iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
template<class U>
U
operator=(U u)
@@ -74,6 +99,12 @@
return super_iter_type::operator=(u);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -82,24 +113,41 @@
protected:
+ /*!
+ ** \brief Set current point to the first iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
void
goto_begin_()
{
this->p_.col() = this->ncols_ - 1;
}
+ /*!
+ ** \brief Set current point to the last iterator's point.
+ **
+ ** Set current point of iterator to the last iterator's point.
+ */
void
goto_end_()
{
this->p_.col() = -1;
}
+ /*!
+ ** \brief Test if iterator's current point is the last one.
+ ** \return True if current point is the last one.
+ */
bool
is_at_end_() const
{
return this->p_.col() == -1;
}
+ /*!
+ ** \brief Go to the next iterator's point.
+ */
void
goto_next_()
{
Index: olena/oln/core/bkd_iter2d.hh
--- olena/oln/core/bkd_iter2d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/d/37_bkd_iter2d 1.16 640)
+++ olena/oln/core/bkd_iter2d.hh Thu, 11 Mar 2004 21:36:13 +0100 odou_s
(oln/d/37_bkd_iter2d 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -30,12 +30,14 @@
# include <oln/core/abstract/iter2d.hh>
-
namespace oln {
template<class Exact = mlc::final>
- class bkd_iter2d; // fwd_decl
+ class bkd_iter2d; // forward declaration
+ /*!
+ ** Traits for bkd_iter2d
+ */
template<class Exact>
struct iter_traits<bkd_iter2d<Exact> >: public
iter_traits<abstract::iter2d<typename
@@ -45,28 +47,50 @@
typedef dpoint2d dpoint_type;
};
-
+ /*!
+ ** Backward Iterator on image 2 dimension
+ **
+ ** Allow iterable object (like image, window, ...) of 2 dimensions backward
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class bkd_iter2d : public abstract::iter2d<typename
mlc::exact_vt<bkd_iter2d<Exact>, Exact>::ret>
{
public:
typedef typename mlc::exact_vt<bkd_iter2d<Exact>, Exact>::ret
exact_type;
+ ///< The exact type.
- typedef abstract::iter2d<exact_type> super_type;
+ typedef abstract::iter2d<exact_type> super_type; ///< The super type.
typedef abstract::iter<exact_type> super_iter_type;
+ ///< The super iterator type.
+
+ enum { dim = iter_traits<exact_type>::dim }; ///< Dimension.
- enum { dim = iter_traits<exact_type>::dim };
+ /*!
+ ** \brief The associate image's type of point.
+ ** \warning Prefer the macros oln_point_type(Pointable) and
+ ** oln_point_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename iter_traits<exact_type>::point_type point_type;
friend class abstract::iter<exact_type>;
friend class abstract::iter2d<exact_type>;
+ /*!
+ ** \brief Construct a backward iterator (2 dimension).
+ ** \arg ima The image to iterate.
+ */
template<class Image>
bkd_iter2d(const Image& ima) :
super_type(ima.size())
{}
+ /*!
+ ** \brief Set current iterator's point.
+ ** \arg u New current point.
+ */
template<class U>
U
operator=(U u)
@@ -74,6 +98,12 @@
return super_iter_type::operator=(u);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -82,6 +112,11 @@
protected:
+ /*!
+ ** \brief Set current point to the first iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
void
goto_begin_()
{
@@ -89,18 +124,30 @@
this->p_.col() = this->ncols_ - 1;
}
+ /*!
+ ** \brief Set current point to the last iterator's point.
+ **
+ ** Set current point of iterator to the last iterator's point.
+ */
void
goto_end_()
{
this->p_.row() = -1;
}
+ /*!
+ ** \brief Test if iterator's current point is the last one
+ ** \return True if current point is the last one.
+ */
bool
is_at_end_() const
{
return this->p_.row() == -1;
}
+ /*!
+ ** \brief Go to the next iterator's point.
+ */
void
goto_next_()
{
Index: olena/oln/core/bkd_iter3d.hh
--- olena/oln/core/bkd_iter3d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/d/36_bkd_iter3d 1.16 640)
+++ olena/oln/core/bkd_iter3d.hh Thu, 11 Mar 2004 21:36:15 +0100 odou_s
(oln/d/36_bkd_iter3d 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -30,11 +30,10 @@
# include <oln/core/abstract/iter3d.hh>
-
namespace oln {
template<class Exact = mlc::final>
- class bkd_iter3d; // fwd_decl
+ class bkd_iter3d; // forward declaration
template<class Exact>
struct iter_traits<bkd_iter3d<Exact> >: public
@@ -45,28 +44,50 @@
typedef dpoint3d dpoint_type;
};
+ /*!
+ ** Backward Iterator on image 3 dimension.
+ **
+ ** Allow iterable object (like image, window, ...) 3 dimensions backward
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class bkd_iter3d : public abstract::iter3d<typename
mlc::exact_vt<bkd_iter3d<Exact>, Exact>::ret>
{
public:
typedef typename mlc::exact_vt<bkd_iter3d<Exact>, Exact>::ret
exact_type;
+ ///< The exact type.
- typedef abstract::iter3d<exact_type> super_type;
+ typedef abstract::iter3d<exact_type> super_type; ///< The super type.
typedef abstract::iter<exact_type> super_iter_type;
+ ///< The super iterator type.
+ enum { dim = iter_traits<exact_type>::dim }; ///< Dimension.
- enum { dim = iter_traits<exact_type>::dim };
+ /*!
+ ** \brief The associate image's type of point.
+ ** \warning Prefer the macros oln_point_type(Pointable) and
+ ** oln_point_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename iter_traits<exact_type>::point_type point_type;
friend class abstract::iter<exact_type>;
friend class abstract::iter3d<exact_type>;
+ /*!
+ ** \brief Construct a backward iterator (3 dimension).
+ ** \arg ima The image to iterate.
+ */
template<class Image>
bkd_iter3d(const Image& ima) :
super_type(ima.size())
{}
+ /*!
+ ** \brief Set current iterator's point.
+ ** \arg u New current point.
+ */
template<class U>
U
operator=(U u)
@@ -74,6 +95,12 @@
return super_iter_type::operator=(u);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string name()
{
return std::string("bkd_iter3d<") + Exact::name() + ">";
@@ -81,6 +108,11 @@
protected:
+ /*!
+ ** \brief Set current point to the first iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
void
goto_begin_()
{
@@ -89,18 +121,30 @@
this->p_.col() = this->ncols_ - 1;
}
+ /*!
+ ** \brief Set current point to the last iterator's point.
+ **
+ ** Set current point of iterator to the last iterator's point.
+ */
void
goto_end_()
{
this->p_.slice() = -1;
}
+ /*!
+ ** \brief Test if iterator's current point is the last one
+ ** \return True if current point is the last one.
+ */
bool
is_at_end_() const
{
return this->p_.slice() == -1;
}
+ /*!
+ ** \brief Go to the next iterator's point.
+ */
void
goto_next_()
{
Index: olena/oln/core/fwd_iter1d.hh
--- olena/oln/core/fwd_iter1d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/d/21_fwd_iter1d 1.13 640)
+++ olena/oln/core/fwd_iter1d.hh Thu, 11 Mar 2004 21:35:15 +0100 odou_s
(oln/d/21_fwd_iter1d 1.13 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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,7 +33,7 @@
namespace oln {
template<class Exact = mlc::final>
- class fwd_iter1d; // fwd_decl
+ class fwd_iter1d; // forward declaration
template<class Exact>
struct iter_traits<fwd_iter1d<Exact> >: public
@@ -44,6 +44,13 @@
typedef dpoint1d dpoint_type;
};
+ /*!
+ ** \brief Forward Iterator on image 1 dimension
+ **
+ ** Allow iterable object (like image, window, ...) of 1 dimension forward
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class fwd_iter1d : public abstract::iter1d<typename
mlc::exact_vt<fwd_iter1d<Exact>, Exact>::ret>
{
@@ -51,21 +58,38 @@
public:
typedef typename mlc::exact_vt<fwd_iter1d<Exact>, Exact>::ret
exact_type;
+ ///< The exact type.
- typedef abstract::iter1d<exact_type> super_type;
+ typedef abstract::iter1d<exact_type> super_type; ///< The super type.
typedef abstract::iter<exact_type> super_iter_type;
+ ///< The super iterator type.
- enum { dim = iter_traits<exact_type>::dim };
+ enum { dim = iter_traits<exact_type>::dim }; ///< Dimension.
+
+ /*!
+ ** \brief The associate image's type of point.
+ ** \warning Prefer the macros oln_point_type(Pointable) and
+ ** oln_point_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename iter_traits<exact_type>::point_type point_type;
friend class abstract::iter<exact_type>;
friend class abstract::iter1d<exact_type>;
+ /*!
+ ** \brief Construct a forward iterator (1 dimension).
+ ** \arg ima The image to iterate.
+ */
template<class Image>
fwd_iter1d(const Image& ima) :
super_type(ima.size())
{}
+ /*!
+ ** \brief Set current iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
template<class U>
U
operator=(U u)
@@ -73,6 +97,12 @@
return super_iter_type::operator=(u);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -81,24 +111,41 @@
protected:
+ /*!
+ ** \brief Set current point to the first iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
void
goto_begin_()
{
this->p_.col() = 0;
}
+ /*!
+ ** \brief Set current point to the last iterator's point.
+ **
+ ** Set current point of iterator to the last iterator's point.
+ */
void
goto_end_()
{
this->p_.col() = this->ncols_;
}
+ /*!
+ ** \brief Test if iterator's current point is the last one
+ ** \return True if current point is the last one.
+ */
bool
is_at_end_() const
{
return this->p_.col() == this->ncols_;
}
+ /*!
+ ** \brief Go to the next iterator's point.
+ */
void
goto_next_()
{
Index: olena/oln/core/fwd_iter2d.hh
--- olena/oln/core/fwd_iter2d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/d/20_fwd_iter2d 1.13 640)
+++ olena/oln/core/fwd_iter2d.hh Thu, 11 Mar 2004 21:36:01 +0100 odou_s
(oln/d/20_fwd_iter2d 1.13 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -30,12 +30,14 @@
# include <oln/core/abstract/iter2d.hh>
-
namespace oln {
template<class Exact = mlc::final>
class fwd_iter2d; // fwd_decl
+ /*!
+ ** Traits for fwd_iter2d
+ */
template<class Exact>
struct iter_traits<fwd_iter2d<Exact> >: public
iter_traits<abstract::iter2d<typename
@@ -45,6 +47,13 @@
typedef dpoint2d dpoint_type;
};
+ /*!
+ ** \brief Backward Iterator on image 2 dimension
+ **
+ ** Allow iterable object (like image, window, ...) of 2 dimensions forward
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class fwd_iter2d : public abstract::iter2d<typename
mlc::exact_vt<fwd_iter2d<Exact>, Exact>::ret>
{
@@ -52,21 +61,37 @@
public:
typedef typename mlc::exact_vt<fwd_iter2d<Exact>, Exact>::ret
exact_type;
+ ///< The exact type.
- typedef abstract::iter2d<exact_type> super_type;
+ typedef abstract::iter2d<exact_type> super_type; ///< The super type.
typedef abstract::iter<exact_type> super_iter_type;
+ ///< The super iterator type.
+
+ enum { dim = iter_traits<exact_type>::dim }; ///< Dimension.
- enum { dim = iter_traits<exact_type>::dim };
+ /*!
+ ** \brief The associate image's type of point.
+ ** \warning Prefer the macros oln_point_type(Pointable) and
+ ** oln_point_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename iter_traits<exact_type>::point_type point_type;
friend class abstract::iter<exact_type>;
friend class abstract::iter2d<exact_type>;
+ /*!
+ ** \brief Construct a forward iterator (2 dimension).
+ ** \arg ima The image to iterate.
+ */
template<class Image>
fwd_iter2d(const Image& ima) :
super_type(ima.size())
{}
+ /*!
+ ** \brief Set current iterator's point.
+ ** \arg u New current point.
+ */
template<class U>
U
operator=(U u)
@@ -74,6 +99,12 @@
return super_iter_type::operator=(u);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -82,24 +113,41 @@
protected:
+ /*!
+ ** \brief Set current point to the first iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
void
goto_begin_()
{
this->p_.row() = this->p_.col() = 0;
}
+ /*!
+ ** \brief Set current point to the last iterator's point.
+ **
+ ** Set current point of iterator to the last iterator's point.
+ */
void
goto_end_()
{
this->p_.row() = this->nrows_;
}
+ /*!
+ ** \brief Test if iterator's current point is the last one
+ ** \return True if current point is the last one.
+ */
bool
is_at_end_() const
{
return this->p_.row() == this->nrows_;
}
+ /*!
+ ** \brief Go to the next iterator's point.
+ */
void
goto_next_()
{
Index: olena/oln/core/fwd_iter3d.hh
--- olena/oln/core/fwd_iter3d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/d/19_fwd_iter3d 1.13 640)
+++ olena/oln/core/fwd_iter3d.hh Thu, 11 Mar 2004 21:35:55 +0100 odou_s
(oln/d/19_fwd_iter3d 1.13 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -30,11 +30,10 @@
# include <oln/core/abstract/iter3d.hh>
-
namespace oln {
template<class Exact = mlc::final>
- class fwd_iter3d; // fwd_decl
+ class fwd_iter3d; // forward declaration
template<class Exact>
struct iter_traits<fwd_iter3d<Exact> >: public
@@ -45,6 +44,13 @@
typedef dpoint3d dpoint_type;
};
+ /*!
+ ** \brief Backward Iterator on image 3 dimension
+ **
+ ** Allow iterable object (like image, window, ...) of 3 dimensions forward
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class fwd_iter3d : public abstract::iter3d<typename
mlc::exact_vt<fwd_iter3d<Exact>, Exact>::ret>
{
@@ -52,21 +58,37 @@
public:
typedef typename mlc::exact_vt<fwd_iter3d<Exact>, Exact>::ret
exact_type;
+ ///< The exact type.
- typedef abstract::iter3d<exact_type> super_type;
+ typedef abstract::iter3d<exact_type> super_type; ///< The super type.
typedef abstract::iter<exact_type> super_iter_type;
+ ///< The super iterator type.
+
+ enum { dim = iter_traits<exact_type>::dim }; ///< Dimension.
- enum { dim = iter_traits<exact_type>::dim };
+ /*!
+ ** \brief The associate image's type of point.
+ ** \warning Prefer the macros oln_point_type(Pointable) and
+ ** oln_point_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename iter_traits<exact_type>::point_type point_type;
friend class abstract::iter<exact_type>;
friend class abstract::iter3d<exact_type>;
+ /*!
+ ** \brief Construct a forward iterator (3 dimension).
+ ** \arg ima The image to iterate.
+ */
template<class Image>
fwd_iter3d(const Image& ima) :
super_type(ima.size())
{}
+ /*!
+ ** \brief Set current iterator's point.
+ ** \arg u New current point.
+ */
template<class U>
U
operator=(U u)
@@ -74,6 +96,12 @@
return super_iter_type::operator=(u);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -82,24 +110,41 @@
protected:
+ /*!
+ ** \brief Set current point to the first iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
void
goto_begin_()
{
this->p_.slice() = this->p_.row() = this->p_.col() = 0;
}
+ /*!
+ ** \brief Set current point to the last iterator's point.
+ **
+ ** Set current point of iterator to the last iterator's point.
+ */
void
goto_end_()
{
this->p_.slice() = this->nslices_;
}
+ /*!
+ ** \brief Test if iterator's current point is the last one
+ ** \return True if current point is the last one.
+ */
bool
is_at_end_() const
{
return this->p_.slice() == this->nslices_;
}
+ /*!
+ ** \brief Go to the next iterator's point.
+ */
void
goto_next_()
{
Index: olena/oln/core/abstract/iter1d.hh
--- olena/oln/core/abstract/iter1d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/d/10_iter1d.hh 1.16 640)
+++ olena/oln/core/abstract/iter1d.hh Fri, 12 Mar 2004 13:36:06 +0100 odou_s
(oln/d/10_iter1d.hh 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -42,34 +42,58 @@
namespace abstract {
template<class Exact>
- class iter1d; // fwd_decl
+ class iter1d; // forward declaration
} // end of abstract
+ /*!
+ ** \brief Traits for iter::iter1d.
+ */
template<class Exact>
struct iter_traits<abstract::iter1d<Exact> >: public
iter_traits<abstract::iter<Exact> >
{
- enum { dim = 1 };
- typedef point1d point_type;
- typedef dpoint1d dpoint_type;
+ enum { dim = 1 }; ///< The dimension of the image traversed.
+ typedef point1d point_type; ///< The type of point of the image.
+ typedef dpoint1d dpoint_type; ///< The type of dpoint of the image.
};
namespace abstract {
+ /*!
+ ** \brief Iterator on image of 1 dimension.
+ **
+ ** Allow iterable object (like image, window, ...) of 1 dimension
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class iter1d : public iter< Exact >
{
public:
- typedef iter<Exact> super_type;
+ typedef iter<Exact> super_type; ///< The exact type of the object.
+
friend class iter<Exact>;
+ /*!
+ ** \brief Get the coordinates of iterator's current point.
+ **
+ ** On this kind of image, all point are on the same line. So
+ ** you are able to get the column number by this way (and never the
+ ** line number).
+ */
coord
col() const
{
return this->p_.col();
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string name()
{
return std::string("_iter1d<") + Exact::name() + ">";
@@ -77,8 +101,13 @@
protected:
- const coord ncols_;
+ const coord ncols_; ///< The number of column of the image you are iterating
+ /*!
+ ** \brief Get the current point viewed by the iterator.
+ ** \return The point (1 dimension) viewed by the iterator.
+ ** \pre Instance != end.
+ */
point1d
to_point() const
{
@@ -88,9 +117,13 @@
return this->p_;
}
- iter1d() : super_type(), ncols_(0)
- {}
-
+ /*!
+ ** \brief Constructor
+ ** \arg size The size of the image to iterate.
+ ** \pre size.ncols() > 0.
+ **
+ ** Construct an iterator (1d) on an image (1d).
+ */
iter1d(const image1d_size& size) :
super_type(), ncols_(size.ncols())
{
Index: olena/oln/core/abstract/iter2d.hh
--- olena/oln/core/abstract/iter2d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/d/9_iter2d.hh 1.16 640)
+++ olena/oln/core/abstract/iter2d.hh Fri, 12 Mar 2004 13:36:06 +0100 odou_s
(oln/d/9_iter2d.hh 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -45,39 +45,68 @@
class iter2d; // fwd_decl
} // end of abstract
+ /*!
+ ** \brief Traits for abstract::iter2d.
+ */
template<class Exact>
struct iter_traits<abstract::iter2d<Exact> >: public
iter_traits<abstract::iter<Exact> >
{
- enum { dim = 2 };
- typedef point2d point_type;
- typedef dpoint2d dpoint_type;
+ enum { dim = 2 }; ///< The dimension of the image traversed.
+ typedef point2d point_type; ///< The type of point of the image.
+ typedef dpoint2d dpoint_type; ///< The type of dpoint of the image.
};
-
namespace abstract {
-
+ /*!
+ ** \brief Iterator on image of 2 dimensions.
+ **
+ ** Allow iterable object (like image, window, ...) of 2 dimensions
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class iter2d : public iter< Exact >
{
public:
- typedef iter<Exact> super_type;
+ typedef iter<Exact> super_type; ///< The exact type of the object.
+
friend class iter<Exact>;
+ /*!
+ ** \brief Get the coordinates (rows) of iterator's current point.
+ ** \return The row number.
+ **
+ ** On this kind of image (i.e. 2 dimensions), you are able to get
+ ** the column number and the row number.
+ */
coord
row() const
{
return this->p_.row();
}
+ /*!
+ ** \brief Get the coordinates (columns) of iterator's current point.
+ ** \return The column number.
+ **
+ ** On this kind of image (i.e. 2 dimensions), you are able to get
+ ** the column number and the row number.
+ */
coord
col() const
{
return this->p_.col();
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string name()
{
return std::string("_iter2d<") + Exact::name() + ">";
@@ -85,9 +114,14 @@
protected:
- const coord nrows_;
- const coord ncols_;
+ const coord nrows_; ///< The number of rows of the image you are iterating.
+ const coord ncols_; ///< The number of column of the image you are iterating.
+ /*!
+ ** \brief Get the current point viewed by the iterator.
+ ** \return The point (2 dimensions) viewed by the iterator.
+ ** \pre Instance != end.
+ */
point2d
to_point() const
{
@@ -99,9 +133,12 @@
return this->p_;
}
- iter2d() : super_type(), nrows_(0), ncols_(0)
- {}
-
+ /*!
+ ** \brief Construct an iterator (2d) on an inamge (2d).
+ ** \arg size The size of the image to iterate.
+ ** \pre size.ncols() > 0.
+ ** \pre size.nrows() > 0.
+ */
iter2d(const image2d_size& size) :
super_type(),
nrows_(size.nrows()),
Index: olena/oln/core/abstract/iter3d.hh
--- olena/oln/core/abstract/iter3d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/d/8_iter3d.hh 1.16 640)
+++ olena/oln/core/abstract/iter3d.hh Fri, 12 Mar 2004 13:36:05 +0100 odou_s
(oln/d/8_iter3d.hh 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -38,52 +38,88 @@
# include <mlc/type.hh>
# include <mlc/objs.hh>
-
namespace oln {
namespace abstract {
template<class Exact>
- class iter3d; // fwd_decl
+ class iter3d; // forward declaration
} // end of abstract
+ /*!
+ ** \brief Traits for abstract::iter3d
+ */
template<class Exact>
struct iter_traits<abstract::iter3d<Exact> >: public
iter_traits<abstract::iter<Exact> >
{
- enum { dim = 3 };
- typedef point3d point_type;
- typedef dpoint3d dpoint_type;
+ enum { dim = 3 }; ///< The dimension of the image traversed.
+ typedef point3d point_type; ///< The type of point of the image.
+ typedef dpoint3d dpoint_type; ///< The type of dpoint of the image.
};
namespace abstract {
-
+ /*!
+ ** Iterator on image of 3 dimensions.
+ **
+ ** Allow iterable object (like image, window, ...) of 3 dimensions
+ ** traversing.
+ ** \see iter
+ */
template<class Exact>
class iter3d : public iter< Exact >
{
public:
- typedef iter<Exact> super_type;
+ typedef iter<Exact> super_type; ///< The exact type of the object.
+
friend class iter<Exact>;
+ /*!
+ ** \brief Get the coordinates (slice) of iterator's current point.
+ ** \return The slice number.
+ **
+ ** On this kind of image (i.e. 3 dimensions), you are able to get
+ ** the column number, the row number and the slice number.
+ */
coord
slice() const
{
return this->p_.slice();
}
+ /*!
+ ** \brief Get the coordinates (row) of iterator's current point.
+ ** \return The row number.
+ **
+ ** On this kind of image (i.e. 3 dimensions), you are able to get
+ ** the column number, the row number and the slice number.
+ */
coord
row() const
{
return this->p_.row();
}
+ /*!
+ ** \brief Get the coordinates (col) of iterator's current point.
+ ** \return The col number.
+ **
+ ** On this kind of image (i.e. 3 dimensions), you are able to get
+ ** the column number, the row number and the slice number.
+ */
coord
col() const
{
return this->p_.col();
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string name()
{
return std::string("_iter3d<") + Exact::name() + ">";
@@ -91,10 +127,15 @@
protected:
- const coord nslices_;
- const coord nrows_;
- const coord ncols_;
-
+ const coord nslices_; ///< The number of slice of the image you are iterating.
+ const coord nrows_; ///< The number of rows of the image you are iterating.
+ const coord ncols_; ///< The number of column of the image you are iterating.
+
+ /*!
+ ** \brief Get the current point viewed by the iterator.
+ ** \return The point (3 dimensions) viewed by the iterator.
+ ** \pre Instance != end.
+ */
point3d
to_point() const
{
@@ -108,9 +149,13 @@
return this->p_;
}
- iter3d() : super_type(), nslices_(0), nrows_(0), ncols_(0)
- {}
-
+ /*!
+ ** \brief Construct an iterator (3d) on an image (3d).
+ ** \arg size The size of the image to iterate.
+ ** \pre size.ncols() > 0.
+ ** \pre size.nrows() > 0.
+ ** \pre size.nslices() > 0.
+ */
iter3d(const image3d_size& size) :
super_type(),
nslices_(size.nslices()),
@@ -124,7 +169,6 @@
}
};
-
} // end of abstract
} // end of oln
Index: olena/oln/core/abstract/iter.hh
--- olena/oln/core/abstract/iter.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n
(oln/c/40_iter.hh 1.17 640)
+++ olena/oln/core/abstract/iter.hh Fri, 12 Mar 2004 13:43:49 +0100 odou_s
(oln/c/40_iter.hh 1.17 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -34,17 +34,23 @@
# include <mlc/objs.hh>
# include <oln/core/macros.hh>
-namespace oln
-{
- namespace abstract
- {
+namespace oln {
+
+ /*!
+ ** \namespace oln::abstract
+ ** \brief oln::abstract namespace.
+ */
+ namespace abstract {
template<class Exact>
- struct iter; // fwd_decl
+ struct iter; // forward declaration
} // end of abstract
template<class Exact>
struct iter_traits;
+ /*!
+ ** \brief Traits for abstract::iter.
+ */
template<class Exact>
struct iter_traits<abstract::iter<Exact> >
{
@@ -57,34 +63,182 @@
namespace abstract
{
- // iter
-
+ /*!
+ ** \brief Iterator.
+ **
+ ** Allow iterable object (like image, window, ...) traversing.
+ ** \warning To know the type of iterator you need for an iterable object,
+ ** use the macro oln_iter_type(Iterable) or oln_iter_type_(Iterable) (same
+ ** without 'typename' keyword) rather than Iterable::iter_type.
+ **
+ ** Simple use of iterators:
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** #include <iostream>
+ ** #include <assert.h>
+ ** using namespace oln;
+ ** using namespace ntg;
+ ** int main(int argc, char **argv)
+ ** {
+ ** image2d<bin> image1 = load(IMG_IN "se.pbm");
+ ** assert(image1.has_impl());
+ ** oln_iter_type_(image2d<bin>) i(image1);
+ ** for_all(i)
+ ** {
+ ** std::cout << image1[i] << std::endl;
+ ** }
+ ** }
+ ** \endcode
+ **
+ ** This code is equivalent to the previous one but DEPRECATED (prefer to
+ ** use the for_all macro):
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** #include <iostream>
+ ** #include <assert.h>
+ ** using namespace oln;
+ ** using namespace ntg;
+ ** int main(int argc, char **argv)
+ ** {
+ ** image2d<bin> image1 = load(IMG_IN "se.pbm");
+ ** assert(image1.has_impl());
+ ** for (int row = 0; row < image1.nrows(); ++row)
+ ** for (int col = 0; col < image1.ncols(); ++col)
+ ** std::cout << image1(row, col) << std::endl;
+ ** }
+ ** \endcode
+ **
+ **
+ ** You can use the same iterator on several image if they have the same size.
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** #include <iostream>
+ ** #include <assert.h>
+ ** using namespace oln;
+ ** using namespace ntg;
+ ** int main(int argc, char **argv)
+ ** {
+ ** image2d<bin> image1 = load(IMG_IN "se.pbm");
+ ** image2d<bin> image2 = load(IMG_IN "se.pbm");
+ ** assert(image1.has_impl());
+ ** assert(image2.has_impl());
+ ** oln_iter_type_(image2d<bin>) i(image1);
+ ** for_all(i)
+ ** {
+ ** std::cout << "image1:" << image1[i] << std::endl;
+ ** std::cout << "image2:" << image2[i] << std::endl;
+ ** }
+ ** return 0;
+ ** }
+ ** \endcode
+ **
+ ** You can iterate not only image but windows. This example make a binary
+ ** dilatation to show you how use them:
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** #include <iostream>
+ ** #include <assert.h>
+ ** using namespace oln;
+ ** using namespace ntg;
+ ** int main(int argc, char **argv)
+ ** {
+ ** image2d<bin> image1 = load(IMG_IN "object.pbm");
+ ** assert(image1.has_impl());
+ ** image2d<bin> image1_out(image1.size());
+ ** oln_iter_type_(image2d<bin>) i(image1);
+ ** for_all(i)
+ ** {
+ ** image1_out[i] = image1[i];
+ ** if (!image1[i])
+ ** {
+ ** window2d win = win_c8_only();
+ ** oln_iter_type_(window2d) j(win);
+ ** bool change_color = false;
+ ** for_all(j)
+ ** {
+ ** if (image1[i + j])
+ ** change_color = true;
+ ** }
+ ** image1_out[i] = change_color;
+ ** }
+ ** }
+ ** save(image1_out, IMG_OUT "oln_abstract_iter.pbm");
+ ** return 0;
+ ** }
+ ** \endcode
+ ** \image html object.png
+ ** \image latex object.png
+ ** =>
+ ** \image html oln_abstract_iter.png
+ ** \image latex oln_abstract_iter.png
+ **
+ */
template<class Exact>
struct iter : public mlc_hierarchy::any<Exact>
{
-
+ /*!
+ ** \brief The associate image's type of point.
+ ** \warning Prefer the macros oln_point_type(Pointable) and
+ ** oln_point_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename iter_traits<Exact>::point_type point_type;
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename iter_traits<Exact>::dpoint_type dpoint_type;
-
+ /*!
+ ** \brief Accessor to current iterator's point.
+ **
+ ** Just return the current point of the iterator which
+ ** is traversing an image.
+ */
const point_type&
point_ref() const
{
return p_;
}
+ /*!
+ ** \brief Compare with the current iterator's point.
+ ** \arg p The iterator's point to be compared to the current point.
+ **
+ ** Compare the current iterator's point with p (his argument). If
+ ** successful, return true.
+ */
bool
operator==(const abstract::point<point_type>& p) const
{
return p_ == p.exact();
}
+ /*!
+ ** \brief Compare with the current iterator's point.
+ ** \arg p The iterator's point to be compared to the current point.
+ **
+ ** Compare the current iterator's point with p (his argument). If
+ ** they are different, return true.
+ */
bool
operator!=(const abstract::point<point_type>& p) const
{
return p_ != p.exact();
}
+ /*!
+ ** \brief Sum a move point to the current point.
+ ** \arg p The move point.
+ ** \return The sum.
+ ** \pre Instance != end.
+ **
+ ** Sum the current iterator's point and the move coordinates.
+ */
point_type
operator+(const abstract::dpoint<dpoint_type>& dp) const
{
@@ -92,6 +246,14 @@
return p_ + dp.exact();
}
+ /*!
+ ** \brief Minor a move to the current point.
+ ** \arg p The move.
+ ** \return The minoration.
+ ** \pre Instance != end.
+ **
+ ** Minor the current point and the move coordinates.
+ */
point_type
operator-(const abstract::dpoint<dpoint_type>& dp) const
{
@@ -99,13 +261,23 @@
return p_ - dp.exact();
}
+ /*!
+ ** \brief Cast to exact point type.
+ ** \return The exact point type.
+ **
+ ** Return the exact point type by calling sub-classes methods.
+ */
operator point_type() const
{
return this->exact().to_point();
}
- // it's convenient to type `it.cur()' instead of `(point)it' when
- // necessary.
+ /*!
+ ** \brief Syntax improvement
+ **
+ ** It's convenient to type `it.cur()' instead of `(point)it' when
+ ** necessary.
+ */
point_type
cur() const
{
@@ -119,6 +291,11 @@
// bool _is_at_end() const;
// void _goto_next();
+ /*!
+ ** \brief Set current point to the first iterator's point.
+ **
+ ** Set current point of iterator to the first iterator's point.
+ */
mlc::begin_type
operator=(mlc::begin_type b)
{
@@ -126,6 +303,11 @@
return b;
}
+ /*!
+ ** \brief Set current point to the last iterator's point.
+ **
+ ** Set current point of iterator to the last iterator's point.
+ */
mlc::end_type
operator=(mlc::end_type e)
{
@@ -133,12 +315,22 @@
return e;
}
+ /*!
+ ** \brief Compare current point and last point.
+ ** \return True if they are the same.
+ **
+ ** Compare current point with last iterator's point.
+ */
bool
operator==(mlc::end_type) const
{
return this->exact().is_at_end_();
}
+ /*!
+ ** \brief Go to the next iterator's point.
+ ** \pre Instance != end.
+ */
void
operator++()
{
@@ -156,13 +348,24 @@
// deduced methods:
+ /*!
+ ** \brief Compare current point and last point.
+ ** \return True if they are different.
+ **
+ ** Compare current point with last iterator's point.
+ */
bool
operator!=(mlc::end_type e) const
{
return ! this->operator==(e);
}
-
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -171,8 +374,13 @@
}
protected:
- point_type p_;
+ point_type p_; ///< The iterator's current point.
+ /*!
+ ** \brief Constructor
+ **
+ ** Do nothing, used only by sub-classes
+ */
iter()
{}
};
Index: olena/oln/core/neighborhood1d.hh
--- olena/oln/core/neighborhood1d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/37_neighborho 1.15 640)
+++ olena/oln/core/neighborhood1d.hh Fri, 12 Mar 2004 16:28:25 +0100 odou_s
(oln/c/37_neighborho 1.15 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -36,35 +36,64 @@
namespace oln {
- class neighborhood1d; // fwd_decl
+ class neighborhood1d; // forward declaration
+ /*!
+ ** \brief Traits for neighborhood1d.
+ */
template<>
struct struct_elt_traits<neighborhood1d>: public
struct_elt_traits<abstract::neighborhoodnd<neighborhood1d> >
{
- enum { dim = 1 };
- typedef point1d point_type;
- typedef dpoint1d dpoint_type;
- typedef winiter< neighborhood1d > iter_type;
- typedef winneighb< neighborhood1d > neighb_type;
- typedef window1d win_type;
+ enum { dim = 1 }; ///< Dimension.
+ typedef point1d point_type; ///< Type of point.
+ typedef dpoint1d dpoint_type; ///< Type of dpoint (move).
+ typedef winiter< neighborhood1d > iter_type; ///< Type of iterator.
+ typedef winneighb< neighborhood1d > neighb_type; ///< Type of neighbor.
+ typedef window1d win_type; ///< Type of window.
};
+ /*!
+ ** \brief Neighborhood 1 dimension.
+ **
+ ** It looks like structuring elements but here, when
+ ** you add an element, you add his opposite.
+ ** Points have 1 dimensions.
+ **
+ */
class neighborhood1d :
public abstract::neighborhoodnd< neighborhood1d >
{
public:
typedef abstract::neighborhoodnd< neighborhood1d > super_type;
- typedef neighborhood1d self_type;
+ ///< Super type.
+ typedef neighborhood1d self_type; ///< Self type.
+ /*!
+ ** \brief The associate image's type of iterator (move point).
+ ** \warning Prefer the macros oln_iter_type(Pointable) and
+ ** oln_iter_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::iter_type iter_type;
- typedef struct_elt_traits< self_type >::neighb_type
- neighb_type;
+ typedef struct_elt_traits< self_type >::neighb_type neighb_type;
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::dpoint_type dpoint_type;
friend class abstract::window_base<abstract::neighborhood<neighborhood1d>,
neighborhood1d>;
+ /*!
+ ** \brief Add a dpoint (move point) to the neighborhood.
+ ** \arg dp The new point.
+ **
+ ** Add a new member to the neighborhood. This point must be of 1
+ ** dimension.
+ */
neighborhood1d&
add(const dpoint_type& dp)
{
@@ -72,24 +101,50 @@
return this->exact().add_(-dp);
}
+ /*!
+ ** \brief Add a point by coordinates to the neighborhood.
+ ** \arg col The coordinate of the new point (1 dimension).
+ **
+ ** Add a new member by its coordinates to the neighborhood.
+ ** The coordinates are only the column number because the neighborhood has
+ ** 1 dimension.
+ */
neighborhood1d&
add(coord col)
{
return this->add(dpoint_type(col));
}
+ /*!
+ ** \brief Construct a neighborhood of 1 dimension.
+ */
neighborhood1d() : super_type()
{}
+ /*!
+ ** \brief Construct a neighborhood of 1 dimension.
+ ** \arg size Reserve 'size' elements for the neighborhood.
+ */
neighborhood1d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Construct a neighborhood of 1 dimension.
+ ** \arg n Add 'n' elements to the neighborhood.
+ ** \arg crd Coordinates of the 'n' elements.
+ */
neighborhood1d(unsigned n, const coord crd[]) : super_type()
{
for (unsigned i = 0; i < n; ++i)
add(dpoint_type(crd[i]));
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -98,6 +153,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a move point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the neighborhood,
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -108,8 +171,12 @@
};
- // std neighb
+ // standard neighborhood
+ /*!
+ ** \brief Create a neighborhood (1 dimension) with 1 element : 1.
+ ** \return The new neighborhood.
+ */
inline const neighborhood1d&
neighb_c2()
{
@@ -118,6 +185,15 @@
return neighb;
}
+ /*!
+ ** \brief Create a neighborhood (1 dimension).
+ ** \arg width The width.
+ ** \return The new neighborhood.
+ ** \pre width >= 3.
+ ** \pre width % 2 == 1.
+ **
+ ** Add elements of coordinates 1, ..., width / 2.
+ */
inline neighborhood1d
mk_neighb_segment(unsigned width)
{
@@ -129,6 +205,11 @@
return neighb;
}
+ /*!
+ ** \brief Convert a window (1 dimension) to a neighborhood (1 dimension).
+ ** \arg n The neighborhood to convert.
+ ** \return The new window.
+ */
inline window1d
mk_win_from_neighb(const neighborhood1d& n)
{
Index: olena/oln/core/neighborhood2d.hh
--- olena/oln/core/neighborhood2d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/36_neighborho 1.16 640)
+++ olena/oln/core/neighborhood2d.hh Fri, 12 Mar 2004 16:39:01 +0100 odou_s
(oln/c/36_neighborho 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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,36 +37,65 @@
namespace oln {
- class neighborhood2d; // fwd_decl
+ class neighborhood2d; // forward declaration
+ /*!
+ ** \brief Traits for neighborhood2d.
+ */
template<>
struct struct_elt_traits<neighborhood2d>: public
struct_elt_traits<abstract::neighborhoodnd<neighborhood2d> >
{
- enum { dim = 2 };
- typedef point2d point_type;
- typedef dpoint2d dpoint_type;
- typedef winiter< neighborhood2d > iter_type;
- typedef winneighb< neighborhood2d > neighb_type;
- typedef window2d win_type;
+ enum { dim = 2 }; ///< Dimension.
+ typedef point2d point_type; ///< Type of point.
+ typedef dpoint2d dpoint_type; ///< Type of dpoint (move).
+ typedef winiter< neighborhood2d > iter_type; ///< Type of iterator.
+ typedef winneighb< neighborhood2d > neighb_type; ///< Type of neighbor.
+ typedef window2d win_type; ///< Type of window.
};
-
+ /*!
+ ** \brief Neighborhood 2 dimensions.
+ **
+ ** It looks like structuring elements but here, when
+ ** you add an element, you add his opposite.
+ ** Points have 2 dimensions.
+ **
+ */
class neighborhood2d :
public abstract::neighborhoodnd< neighborhood2d >
{
public:
typedef abstract::neighborhoodnd< neighborhood2d > super_type;
- typedef neighborhood2d self_type;
+ ///< Super type.
+ typedef neighborhood2d self_type; ///< Self type.
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::iter_type iter_type;
- typedef struct_elt_traits< self_type >::neighb_type
- neighb_type;
+
+ typedef struct_elt_traits< self_type >::neighb_type neighb_type;
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::dpoint_type dpoint_type;
friend class abstract::window_base<abstract::neighborhood<neighborhood2d>,
neighborhood2d>;
+ /*!
+ ** \brief Add a dpoint (move point) to the neighborhood.
+ ** \arg dp The new point.
+ **
+ ** Add a new member to the neighborhood. This point must be of 2
+ ** dimensions.
+ */
neighborhood2d&
add(const dpoint_type& dp)
{
@@ -74,18 +103,38 @@
return this->exact().add_(-dp);
}
+ /*!
+ ** \brief Add a point by coordinates to the neighborhood.
+ ** \arg row The coordinates of the new point.
+ ** \arg col The coordinates of the new point.
+ **
+ ** Add a new member by its coordinates to the neighborhood.
+ ** The coordinates have 2 dimensions.
+ */
neighborhood2d&
add(coord row, coord col)
{
return this->add(dpoint_type(row, col));
}
+ /*!
+ ** \brief Construct a neighborhood of 2 dimensions.
+ */
neighborhood2d() : super_type()
{}
+ /*!
+ ** \brief Construct a neighborhood of 2 dimensions.
+ ** \arg size Reserve 'size' elements for the neighborhood.
+ */
neighborhood2d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Construct a neighborhood of 2 dimensions.
+ ** \arg n Add 'n' elements to the neighborhood.
+ ** \arg crd Coordinates of the 'n' elements.
+ */
neighborhood2d(unsigned n, const coord crd[]) : super_type(n)
{
for (unsigned i = 0; i < 2 * n; i += 2)
@@ -93,17 +142,29 @@
}
// io
+ /*!
+ ** \todo FIXME: it doesn't seem useful. We may remove it
+ */
neighborhood2d(const io::internal::anything& r) : super_type()
{
r.assign(*this);
}
+ /*!
+ ** \todo FIXME: it doesn't seem useful. We may remove it
+ */
neighborhood2d&
operator=(const io::internal::anything& r)
{
return r.assign(*this);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -112,6 +173,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a deplacement point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the neighborhood,
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -124,6 +193,10 @@
// std neighbs
+ /*!
+ ** \brief Create a neighborhood (2 dimension) with 0,1, 1,0.
+ ** \return The new neighborhood.
+ */
inline const neighborhood2d&
neighb_c4()
{
@@ -132,6 +205,12 @@
return neighb;
}
+
+ /*!
+ ** \brief Create a neighborhood (2 dimension) with 4 coordinates:
+ ** 0,1, 1,1, 1,0, 1,-1.
+ ** \return The new neighborhood.
+ */
inline const neighborhood2d&
neighb_c8()
{
@@ -142,6 +221,16 @@
// mk_neighb's
+ /*!
+ ** \brief Create a rectangular neighborhood (2 dimensions).
+ ** \arg nrows Number of row.
+ ** \arg ncols Number of column.
+ ** \return The new neighborhood (2d).
+ ** \pre nrows >= 3.
+ ** \pre nrows % 2 == 1.
+ ** \pre ncols >= 3.
+ ** \pre ncols % 2 == 1.
+ */
inline neighborhood2d
mk_neighb_rectangle(unsigned nrows, unsigned ncols)
{
@@ -155,12 +244,22 @@
return neighb;
}
+ /*!
+ ** \brief Create a square neighborhood (2 dimensions).
+ ** \arg width Number of colunm and row.
+ ** \return The new neighborhood (2d).
+ */
inline neighborhood2d
mk_neighb_square(unsigned width)
{
return mk_neighb_rectangle(width, width);
}
+ /*!
+ ** \brief Convert a window (2 dimensions) to a neighborhood (2 dimensions).
+ ** \arg n The neighborhood to convert.
+ ** \return The new window.
+ */
inline window2d
mk_win_from_neighb(const neighborhood2d& n)
{
Index: olena/oln/core/neighborhood3d.hh
--- olena/oln/core/neighborhood3d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/35_neighborho 1.15 640)
+++ olena/oln/core/neighborhood3d.hh Fri, 12 Mar 2004 13:10:20 +0100 odou_s
(oln/c/35_neighborho 1.15 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -36,36 +36,64 @@
namespace oln {
- class neighborhood3d; // fwd_decl
+ class neighborhood3d; // forward declaration
+ /*!
+ ** \brief Traits for neighborhood3d.
+ */
template<>
struct struct_elt_traits<neighborhood3d>: public
struct_elt_traits<abstract::neighborhoodnd<neighborhood3d> >
{
- enum { dim = 3 };
- typedef point3d point_type;
- typedef dpoint3d dpoint_type;
- typedef winiter< neighborhood3d > iter_type;
- typedef winneighb< neighborhood3d > neighb_type;
- typedef window3d win_type;
+ enum { dim = 3 }; ///< Dimension.
+ typedef point3d point_type; ///< Type of point.
+ typedef dpoint3d dpoint_type; ///< Type of dpoint (move).
+ typedef winiter< neighborhood3d > iter_type; ///< Type of iterator.
+ typedef winneighb< neighborhood3d > neighb_type; ///< Type of neighbor.
+ typedef window3d win_type; ///< Type of window.
};
-
+ /*!
+ ** \brief Neighborhood 3 dimensions.
+ **
+ ** It looks like structuring elements but here, when
+ ** you add an element, you add his opposite.
+ ** Points have 3 dimensions.
+ **
+ */
class neighborhood3d :
public abstract::neighborhoodnd< neighborhood3d >
{
public:
typedef abstract::neighborhoodnd< neighborhood3d > super_type;
- typedef neighborhood3d self_type;
+ ///< Super type.
+ typedef neighborhood3d self_type; ///< Self type.
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::iter_type iter_type;
- typedef struct_elt_traits< self_type >::neighb_type
- neighb_type;
+ typedef struct_elt_traits< self_type >::neighb_type neighb_type;
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::dpoint_type dpoint_type;
friend class abstract::window_base<abstract::neighborhood<neighborhood3d>,
neighborhood3d>;
+ /*!
+ ** \brief Add a dpoint (move point) to the neighborhood.
+ ** \arg dp The new point.
+ **
+ ** Add a new member to the neighborhood. This point must be of 3
+ ** dimensions.
+ */
neighborhood3d&
add(const dpoint_type& dp)
{
@@ -73,24 +101,51 @@
return this->exact().add_(-dp);
}
+ /*!
+ ** \brief Add a point by coordinates to the neighborhood.
+ ** \arg slice The coordinates of the new point.
+ ** \arg row The coordinates of the new point.
+ ** \arg col The coordinates of the new point.
+ **
+ ** Add a new member by its coordinates to the neighborhood.
+ ** The coordinates have 3 dimensions.
+ */
neighborhood3d&
add(coord slice, coord row, coord col)
{
return this->add(dpoint3d(slice, row, col));
}
+ /*!
+ ** \brief Construct a neighborhood of 3 dimensions.
+ */
neighborhood3d() : super_type()
{}
+ /*!
+ ** \brief Construct a neighborhood of 3 dimensions.
+ ** \arg size Reserve 'size' elements for the neighborhood.
+ */
neighborhood3d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Construct a neighborhood of 3 dimension.
+ ** \arg n Add 'n' elements to the neighborhood.
+ ** \arg crd Coordinates of the 'n' elements.
+ */
neighborhood3d(unsigned n, const coord crd[]) : super_type()
{
for (unsigned i = 0; i < 3 * n; i += 3)
add(dpoint_type(crd[i], crd[i+1], crd[i+2]));
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -99,6 +154,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a deplacement point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the neighborhood,
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -112,6 +175,10 @@
// std neighb
+ /*!
+ ** \brief Create a neighborhood (3 dimension) with 3 coordinates.
+ ** \return The new neighborhood.
+ */
inline const neighborhood3d&
neighb_c6()
{
@@ -122,6 +189,10 @@
return neighb;
}
+ /*!
+ ** \brief Create a neighborhood (3 dimension) with 9 coordinates.
+ ** \return The new neighborhood.
+ */
inline const neighborhood3d&
neighb_c18()
{
@@ -138,6 +209,10 @@
return neighb;
}
+ /*!
+ ** \brief Create a neighborhood (3 dimension) with 13 coordinates.
+ ** \return The new neighborhood.
+ */
inline const neighborhood3d&
neighb_c26()
{
@@ -160,6 +235,19 @@
// mk_neighb's
+ /*!
+ ** \brief Create a block neighborhood (3 dimension).
+ ** \arg nslices Number of slice.
+ ** \arg nrows Number of row.
+ ** \arg ncols Number of column.
+ ** \return The new neighborhood (3d).
+ ** \pre nslices >= 3.
+ ** \pre nslices % 2 == 1.
+ ** \pre nrows >= 3.
+ ** \pre nrows % 2 == 1.
+ ** \pre ncols >= 3.
+ ** \pre ncols % 2 == 1.
+ */
inline neighborhood3d
mk_neighb_block(unsigned nslices, unsigned nrows, unsigned ncols)
{
@@ -177,12 +265,22 @@
return neighb;
}
+ /*!
+ ** \brief Create a cube neighborhood (3 dimension).
+ ** \arg width Number of slice, colunm and row.
+ ** \return The new neighborhood (3d).
+ */
inline neighborhood3d
mk_neighb_cube(unsigned width)
{
return mk_neighb_block(width, width, width);
}
+ /*!
+ ** \brief Convert a window (3 dimensions) to a neighborhood (3 dimensions).
+ ** \arg n The neighborhood to convert.
+ ** \return The new window.
+ */
inline window3d
mk_win_from_neighb(const neighborhood3d& n)
{
Index: olena/oln/core/abstract/neighborhood.hh
--- olena/oln/core/abstract/neighborhood.hh Wed, 11 Feb 2004 11:51:35 +0100 van-vl_n
(oln/c/38_neighborho 1.19 640)
+++ olena/oln/core/abstract/neighborhood.hh Fri, 12 Mar 2004 13:36:04 +0100 odou_s
(oln/c/38_neighborho 1.19 640)
@@ -32,15 +32,16 @@
# include <oln/core/abstract/dpoint.hh>
# include <oln/core/abstract/struct_elt.hh>
-namespace oln
-{
+namespace oln {
- namespace abstract
- {
+ namespace abstract {
template<class Exact>
- struct neighborhood; // fwd_decl
+ struct neighborhood; // forward declaration
} // end of abstract
+ /*!
+ ** \brief Traits for abstract::neighborhood.
+ */
template<class Exact>
struct struct_elt_traits<abstract::neighborhood<Exact> >
{
@@ -50,94 +51,186 @@
namespace abstract
{
+ /*!
+ **
+ ** \brief Neighborhood.
+ **
+ ** It looks like structuring elements but here, when
+ ** you add an element, you add his opposite (cf mathematical
+ ** definition to know more about).
+ ** This abstract class defines several virtual methods for his
+ ** subclasses. His aim is to deal with a set of deplacement points.
+ **
+ */
template<class Exact>
struct neighborhood : public mlc_hierarchy::any<Exact>
{
- typedef Exact exact_type;
- typedef neighborhood<Exact> self_type;
+ typedef Exact exact_type; ///< Set the exact type.
+ typedef neighborhood<Exact> self_type; ///< Set his type.
+
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::iter_type iter_type;
+
typedef typename struct_elt_traits<Exact>::neighb_type neighb_type;
+ ///< Set the neighborhood type.
typedef typename struct_elt_traits<Exact>::win_type win_type;
+ ///< Set the window type.
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::dpoint_type dpoint_type;
+
typedef typename struct_elt_traits<Exact>::abstract_type abstract_type;
+ ///< Set the abstract type.
+
enum { dim = struct_elt_traits<Exact>::dim };
+ ///< Set the dim of the points of the neighborhood.
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
return std::string("neighborhood<") + Exact::name() + ">";
}
+ /*!
+ ** \brief Test if the set of points contains this one.
+ ** \arg dp a dpoint (deplacement point).
+ ** \return True if the set of points contains this dpoint.
+ */
bool
has(const abstract::dpoint<dpoint_type>& dp) const
{
return this->exact().has_(dp.exact());
}
+ /*!
+ ** \brief Get the number of point we get.
+ ** \return The number of point.
+ */
unsigned
card() const
{
return this->exact().card_();
}
+ /*!
+ ** \brief Test if the neighborhood is centered.
+ ** \return True if it's centered.
+ **
+ ** Neighborhood are centered when they contains at least one
+ ** element.
+ */
bool
is_centered() const
{
return this->exact().is_centered_();
}
+ /*!
+ ** \brief Get the nth element of the neighborhood.
+ ** \arg i The nth.
+ ** \return The nth dpoint.
+ */
const dpoint_type
dp(unsigned i) const
{
return this->exact()[i];
}
+ /*!
+ ** \brief Compare two sets of structuring elements.
+ ** \arg win The structuring elements to compare.
+ ** \return True if they are the same.
+ */
bool
operator==(const self_type& win) const
{
return this->exact().is_equal(win.exact());
}
+ /*!
+ ** \brief Get the delta of the neighborhood.
+ ** \return Delta.
+ **
+ ** Delta is the biggest element of the neighborhood.
+ */
coord
delta() const
{
return this->exact().get_delta();
}
+ /*!
+ ** \brief Get the nth element of the neighborhood.
+ ** \arg i The nth.
+ ** \return The nth dpoint.
+ */
const dpoint_type
operator[](unsigned i) const
{
return this->exact().at(i);
}
+ /*!
+ ** \brief Add a point to the neighborhood.
+ ** \arg dp The new point.
+ **
+ ** Add a new member to the neighborhood.
+ */
exact_type&
add(const abstract::dpoint<dpoint_type>& dp)
{
this->exact().add_(dp.exact());
return this->exact().add_(-dp.exact());
}
+
+
// obsolete
- exact_type
- operator-() const
- {
- return this->exact();
- }
+// exact_type
+// operator-() const
+// {
+// return this->exact();
+// }
protected:
+ /*!
+ ** \brief Set neighborhood to opposite.
+ **
+ ** Each point of neighborhood is assigned to his opposite.
+ **
+ */
void
sym()
{
this->exact().sym_();
}
+ /*!
+ ** \brief Do nothing, used only by sub-classes
+ */
neighborhood()
{}
};
} // end of abstract
+ /*!
+ ** \brief Compute intersection between two neighborhood
+ */
template<class E>
inline E
inter(const abstract::neighborhood<E> &lhs,
@@ -150,6 +243,9 @@
return neighb;
}
+ /*!
+ ** \brief Compute union between two neighborhood
+ */
template<class E>
inline E
uni(const abstract::neighborhood<E> &lhs,
@@ -165,6 +261,9 @@
return neighb;
}
+ /*!
+ ** \brief Construct a window from a neighborhood.
+ */
template<class E>
inline typename struct_elt_traits<E>::win_type
mk_win_from_neighb(const abstract::neighborhood<E>& n)
Index: olena/oln/core/abstract/struct_elt.hh
--- olena/oln/core/abstract/struct_elt.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/25_structelt. 1.20 640)
+++ olena/oln/core/abstract/struct_elt.hh Fri, 12 Mar 2004 13:36:02 +0100 odou_s
(oln/c/25_structelt. 1.20 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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,31 +35,49 @@
namespace oln {
namespace abstract {
-
template<class Exact>
- struct struct_elt; // fwd_decl
+ struct struct_elt; // forwarding declaration
} // end of abstract
template<class Exact>
struct struct_elt_traits;
+ /*!
+ ** \brief Traits for abstract::struct_elt.
+ */
template<class Exact>
struct struct_elt_traits<abstract::struct_elt<Exact> >
{
typedef abstract::struct_elt<Exact> abstract_type;
+ ///< Defines the abstract type of the structuring element.
};
namespace abstract {
+ /*!
+ ** Structuring elements (set of points).
+ **
+ ** This abstract class defines several virtual methods for his
+ ** subclasses. His aim is to deal with a set of deplacement points.
+ */
template<class Exact>
struct struct_elt : public mlc_hierarchy::any< Exact >
{
enum { dim = struct_elt_traits<Exact>::dim };
+ ///< Set the dim of the image from which points com.
typedef struct_elt<Exact> self_type;
+ ///< Set the exact self type of the class.
typedef typename struct_elt_traits<Exact>::abstract_type abstract_type;
+ ///< Set the abstract type of hisself.
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -67,59 +85,108 @@
}
typedef typename struct_elt_traits<Exact>::point_type point_type;
+ ///< Set the point type of the image from which points come.
typedef typename struct_elt_traits<Exact>::dpoint_type dpoint_type;
+ ///< Set the dpoint type.
typedef Exact exact_type;
+ /*!
+ ** \brief Test if the set of points contains this one.
+ ** \arg dp a dpoint (deplacement point).
+ ** \return True if the set of points contains this dpoint.
+ */
bool
has(const abstract::dpoint<dpoint_type>& dp) const
{
return this->exact().has_(dp.exact());
}
+ /*!
+ ** \brief Get the number of point we get.
+ ** \return The number of point.
+ */
unsigned
card() const
{
return this->exact().card_();
}
+ /*!
+ ** \brief Test if the structuring elements is centered.
+ ** \return True if it's centered.
+ **
+ ** Structuring elements are centered when they contains 0.
+ */
bool
is_centered() const
{
return this->exact().is_centered_();
}
- // FIXME: here for convenience (see morpho algorithms),
- // work with w_windows (associate a default weight set to 1)
+ /*!
+ ** \brief Add a point to the structuring elements.
+ **
+ ** Add a new member to the structuring elements.
+ **
+ ** \warning Here for convenience (see morpho algorithms).
+ ** Work with w_windows (associate a default weight set to 1).
+ */
exact_type&
add(const abstract::dpoint<dpoint_type>& dp)
{
return this->exact().add_dp(dp);
}
+ /*!
+ ** \brief Get the nth structuring element.
+ ** \arg i The nth.
+ ** \return The nth dpoint.
+ */
dpoint_type
dp(unsigned i) const
{
return this->exact().at(i);
}
+ /*!
+ ** \brief Compare two sets of structuring elements.
+ ** \arg win The structuring elements to compare.
+ ** \return True if they are the same.
+ */
bool
operator==(const self_type& win) const
{
return this->exact().is_equal(win.exact());
}
+ /*!
+ ** \brief Get the delta of the structuring elements.
+ ** \return Delta.
+ **
+ ** Delta is the biggest element of the structuring elements.
+ */
coord
delta() const
{
return this->exact().get_delta();
}
+ /*!
+ ** \brief Get the nth structuring element.
+ ** \arg i The nth.
+ ** \return The nth dpoint.
+ */
const dpoint_type
operator[](unsigned i) const
{
return this->exact().at(i);
}
+ /*!
+ ** \brief Set structuring elements to opposite.
+ **
+ ** Each point of structuring elements is assigned to his opposite.
+ */
exact_type
operator-() const
{
@@ -130,12 +197,20 @@
protected:
+ /*!
+ ** \brief Set structuring elements to opposite.
+ **
+ ** Each point of structuring elements is assigned to his opposite.
+ */
void
sym()
{
return this->exact().sym_();
}
+ /*!
+ ** \brief Do nothing, used only by sub-classes
+ */
struct_elt()
{}
Index: olena/oln/core/window1d.hh
--- olena/oln/core/window1d.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/15_window1d.h
1.15 640)
+++ olena/oln/core/window1d.hh Fri, 12 Mar 2004 16:24:30 +0100 odou_s (oln/c/15_window1d.h
1.15 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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,57 +37,114 @@
namespace oln {
- class window1d; // fwd_decl
+ class window1d; // forward declaration
+ /*!
+ ** \brief Traits for window1d.
+ */
template<>
struct struct_elt_traits<window1d>: public
struct_elt_traits<abstract::windownd<window1d> >
{
- enum { dim = 1 };
- typedef point1d point_type;
- typedef dpoint1d dpoint_type;
- typedef winiter< window1d > iter_type;
- typedef winneighb< window1d > neighb_type;
+ enum { dim = 1 }; ///< Dimension.
+ typedef point1d point_type; ///< Type of point.
+ typedef dpoint1d dpoint_type; ///< Type of dpoint.
+ typedef winiter< window1d > iter_type; ///< Type of iterator.
+ typedef winneighb< window1d > neighb_type; ///< Type of neighbor.
};
+
+ /*!
+ ** \brief Window 1 dimension.
+ **
+ ** A window is a set of points. This class
+ ** defines how to deal with. These points have 1 dimension.
+ */
class window1d : public abstract::windownd< window1d >
{
public:
typedef abstract::windownd< window1d > super_type;
- typedef window1d self_type;
+ ///< The super type.
+ typedef window1d self_type; ///< The self type.
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::iter_type iter_type;
+
typedef struct_elt_traits< self_type >::neighb_type neighb_type;
+ ///< Type of neighbor.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::dpoint_type dpoint_type;
friend class abstract::window_base<abstract::window<window1d>,
window1d>;
+ /*!
+ ** \brief Add a dpoint (move point) to the window.
+ ** \arg dp The new point.
+ **
+ ** Add a new member to the neighborhood. This point must be of 1
+ ** dimension.
+ */
window1d&
add(const dpoint_type& dp)
{
return this->exact().add_(dp);
}
+ /*!
+ ** \brief Add a point by coordinates to the window.
+ ** \arg col The coordinate of the new point (1 dimension).
+ **
+ ** Add a new member by its coordinates to the window.
+ ** The coordinates are only the column number because the window is
+ ** of 1 dimension.
+ */
window1d&
add(coord col)
{
return this->add(dpoint_type(col));
}
+ /*!
+ ** \brief Construct a window of 1 dimension.
+ */
window1d() : super_type()
{}
+ /*!
+ ** \brief Construct a window of 1 dimension.
+ ** \arg size The number of element.
+ */
window1d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Construct a window of 1 dimension from several points.
+ ** \arg n The number of element.
+ ** \arg crd The coordinates of the elements
+ */
window1d(unsigned n, const coord crd[]) : super_type(n)
{
for (unsigned i = 0; i < n; ++i)
add(dpoint_type(crd[i]));
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -96,6 +153,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a move point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the window.
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -107,6 +172,10 @@
// std win
+ /*!
+ ** \brief Create a window (1 dimension) of 2 elements (-1, 1).
+ ** \return The new neighborhood.
+ */
inline const window1d&
win_c2_only()
{
@@ -115,6 +184,10 @@
return win;
}
+ /*!
+ ** \brief Create a window (1 dimension) of 3 elements (-1, 0, 1).
+ ** \return The new neighborhood.
+ */
inline const window1d&
win_c2p()
{
@@ -123,6 +196,14 @@
return win;
}
+ /*!
+ ** \brief Create a window (1 dimension) with width elements :
+ ** -width / 2, ..., 1, 2, ..., width / 2
+ ** \arg width The width.
+ ** \return The new neighborhood.
+ ** \pre width >= 3.
+ ** \pre width % 2 == 1.
+ */
inline window1d
mk_win_segment(unsigned width)
{
Index: olena/oln/core/window2d.hh
--- olena/oln/core/window2d.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/14_window2d.h
1.17 640)
+++ olena/oln/core/window2d.hh Fri, 12 Mar 2004 17:10:20 +0100 odou_s (oln/c/14_window2d.h
1.17 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -38,41 +38,79 @@
namespace oln {
- class window2d; // fwd_decl
+ class window2d; // forward declaration
+ /*!
+ ** \brief Traits for window2d.
+ */
template<>
struct struct_elt_traits<window2d>: public
struct_elt_traits<abstract::windownd<window2d> >
{
- enum { dim = 2 };
- typedef point2d point_type;
- typedef dpoint2d dpoint_type;
- typedef winiter< window2d > iter_type;
- typedef winneighb< window2d > neighb_type;
+ enum { dim = 2 }; ///< Dimension.
+ typedef point2d point_type; ///< Type of point.
+ typedef dpoint2d dpoint_type; ///< Type of dpoint.
+ typedef winiter< window2d > iter_type; ///< Type of iterator.
+ typedef winneighb< window2d > neighb_type; ///< Type of neighbor.
};
+ /*!
+ ** \brief Window 2 dimensions.
+ **
+ ** A window is a set of points. This class
+ ** defines how to deal with. These points have 2 dimension.
+ */
class window2d : public abstract::windownd< window2d >
{
public:
typedef abstract::windownd<window2d > super_type;
- typedef window2d self_type;
+ ///< The super type.
+ typedef window2d self_type; ///< The self type.
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::iter_type iter_type;
- typedef struct_elt_traits< self_type >::neighb_type
- neighb_type;
- typedef struct_elt_traits< self_type >::dpoint_type
- dpoint_type;
+
+ typedef struct_elt_traits< self_type >::neighb_type neighb_type;
+ typedef struct_elt_traits< self_type >::neighb_type neighb_type;
+ ///< Type of neighbor.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
+ typedef struct_elt_traits< self_type >::dpoint_type dpoint_type;
friend class abstract::window_base<abstract::window<window2d>,
window2d>;
+ /*!
+ ** \brief Add a dpoint (move point) to the window.
+ ** \arg dp The new point.
+ **
+ ** Add a new member to the window. This point must be of 2
+ ** dimensions.
+ */
window2d&
add(const dpoint_type& dp)
{
return this->exact().add_(dp);
}
+ /*!
+ ** \brief Add a point by coordinates to the window.
+ ** \arg row The coordinate (row) of the new point.
+ ** \arg col The coordinate (col) of the new point.
+ **
+ ** Add a new member by its coordinates to the window.
+ ** The coordinates are the row number and the column number because the
+ ** window has 2 dimensions.
+ */
window2d&
add(coord row, coord col)
{
@@ -80,12 +118,24 @@
return add(dp);
}
+ /*!
+ ** \brief Construct a window of 2 dimensions.
+ */
window2d() : super_type()
{}
+ /*!
+ ** \brief Construct a window of 2 dimensions.
+ ** \arg size The number of element.
+ */
window2d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Construct a window of 2 dimensions from several points.
+ ** \arg n The number of element.
+ ** \arg crd The coordinates of the elements
+ */
window2d(unsigned n, const coord crd[]) : super_type(n)
{
for (unsigned i = 0; i < 2 * n; i += 2)
@@ -93,17 +143,29 @@
}
// io
+ /*!
+ ** \todo FIXME: it doesn't seem useful. We may remove it
+ */
window2d(const io::internal::anything& r) : super_type()
{
r.assign(*this);
}
+ /*!
+ ** \todo FIXME: it doesn't seem useful. We may remove it
+ */
window2d&
operator=(const io::internal::anything& r)
{
return r.assign(*this);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -112,6 +174,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a move point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the window.
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -125,6 +195,10 @@
// std win
+ /*!
+ ** \brief Create a window (2 dimensions) of 4 elements.
+ ** \return The new window.
+ */
inline const window2d&
win_c4_only()
{
@@ -133,6 +207,12 @@
return win;
}
+ /*!
+ ** \brief Create a window (2 dimensions) of 5 elements.
+ ** \return The new window.
+ **
+ ** It's the same than win_c4_only() plus the 0,0 point.
+ */
inline const window2d&
win_c4p()
{
@@ -141,6 +221,10 @@
return win;
}
+ /*!
+ ** \brief Create a window (2 dimensions) of 8 elements.
+ ** \return The new window.
+ */
inline const window2d&
win_c8_only()
{
@@ -149,6 +233,12 @@
return win;
}
+ /*!
+ ** \brief Create a window (2 dimensions) of 9 elements.
+ ** \return The new window.
+ **
+ ** It's the same than win_c8_only more the 0,0 point.
+ */
inline const window2d&
win_c8p()
{
@@ -159,6 +249,16 @@
// mk_win's
+ /*!
+ ** \brief Create a rectangular window (2 dimensions).
+ ** \arg nrows Number of row.
+ ** \arg ncols Number of column.
+ ** \return The new window (2d).
+ ** \pre nrows >= 3.
+ ** \pre nrows % 2 == 1.
+ ** \pre ncols >= 3.
+ ** \pre ncols % 2 == 1.
+ */
inline window2d
mk_win_rectangle(unsigned nrows, unsigned ncols)
{
@@ -172,6 +272,13 @@
return win;
}
+ /*!
+ ** \brief Create an ellipse window (2 dimensions).
+ ** \return The new window.
+ **
+ ** The ellipse formula is :
+ ** \f$$\frac{x^2}{xradius^2} + \frac{y^2}{yradius^2} = 1$\f$
+ */
inline window2d
mk_win_ellipse(float yradius, float xradius)
{
@@ -198,12 +305,22 @@
return win;
}
+ /*!
+ ** \brief Create a square window (2 dimensions).
+ ** \arg width Number of column and row.
+ ** \return The new window (2d).
+ */
inline window2d
mk_win_square(unsigned width)
{
return mk_win_rectangle(width, width);
}
+ /*!
+ ** \brief Create a disc window (2 dimensions).
+ ** \arg radius Radius of the disc.
+ ** \return The new window (2d).
+ */
inline window2d
mk_win_disc(float radius)
{
Index: olena/oln/core/window3d.hh
--- olena/oln/core/window3d.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/13_window3d.h
1.16 640)
+++ olena/oln/core/window3d.hh Fri, 12 Mar 2004 17:01:51 +0100 odou_s (oln/c/13_window3d.h
1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -38,56 +38,113 @@
namespace oln {
- class window3d; // fwd_decl
+ class window3d; // forward declaration
+ /*!
+ ** \brief Traits for window3d.
+ */
template<>
struct struct_elt_traits<window3d>: public
struct_elt_traits<abstract::windownd<window3d> >
{
- enum { dim = 3 };
- typedef point3d point_type;
- typedef dpoint3d dpoint_type;
- typedef winiter< window3d > iter_type;
- typedef winneighb< window3d > neighb_type;
+ enum { dim = 3 }; ///< Dimension.
+ typedef point3d point_type; ///< Type of point.
+ typedef dpoint3d dpoint_type; ///< Type of dpoint.
+ typedef winiter< window3d > iter_type; ///< Type of iterator.
+ typedef winneighb< window3d > neighb_type; ///< Type of neighbor.
};
+ /*!
+ ** \brief Window 3 dimensions.
+ **
+ ** A window is a set of points. This class
+ ** defines how to deal with. These points have 3 dimensions.
+ */
class window3d : public abstract::windownd< window3d >
{
public:
typedef abstract::windownd< window3d > super_type;
- typedef window3d self_type;
+ ///< The super type.
+ typedef window3d self_type; ///< The self type.
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::iter_type iter_type;
- typedef struct_elt_traits< self_type >::neighb_type
- neighb_type;
+
+ typedef struct_elt_traits< self_type >::neighb_type neighb_type;
+ ///< Type of neighbor.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef struct_elt_traits< self_type >::dpoint_type dpoint_type;
friend class abstract::window_base<abstract::window<window3d>,
window3d>;
+ /*!
+ ** \brief Add a dpoint (move point) to the window.
+ ** \arg dp The new point.
+ **
+ ** Add a new member to the window. This point must be of 3
+ ** dimensions.
+ */
window3d& add(const dpoint_type& dp)
{
return this->exact().add_(dp);
}
+ /*!
+ ** \brief Add a point by coordinates to the window.
+ ** \arg slice The coordinate (slice) of the new point.
+ ** \arg row The coordinate (row) of the new point.
+ ** \arg col The coordinate (col) of the new point.
+ **
+ ** Add a new member by its coordinates to the window.
+ ** The coordinates are only the column number, row number and column
+ ** number because the window has 3 dimensions.
+ */
window3d& add(coord slice, coord row, coord col)
{
return this->add(dpoint_type(slice, row, col));
}
+ /*!
+ ** \brief Construct a window of 3 dimensions.
+ */
window3d() : super_type()
{}
+ /*!
+ ** \brief Construct a window of 3 dimensions.
+ ** \arg size The number of element.
+ */
window3d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Construct a window of 3 dimensions from several points.
+ ** \arg n The number of element.
+ ** \arg crd The coordinates of the elements
+ */
window3d(unsigned n, const coord crd[]) : super_type(n)
{
for (unsigned i = 0; i < 3 * n; i += 3)
add(dpoint_type(crd[i], crd[i+1], crd[i+2]));
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -96,6 +153,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a move point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the window.
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -109,6 +174,10 @@
// std win
+ /*!
+ ** \brief Create a window (3 dimensions) of 6 elements.
+ ** \return The new window.
+ */
inline const window3d&
win_c6_only()
{
@@ -122,6 +191,12 @@
return win;
}
+ /*!
+ ** \brief Create a window (3 dimensions) of 7 elements.
+ ** \return The new window.
+ **
+ ** It's the same than win_c6_only() plus the 0,0,0 point.
+ */
inline const window3d&
win_c6p()
{
@@ -136,6 +211,10 @@
return win;
}
+ /*!
+ ** \brief Create a window (3 dimensions) of 18 elements.
+ ** \return The new window.
+ */
inline const window3d&
win_c18_only()
{
@@ -161,6 +240,12 @@
return win;
}
+ /*!
+ ** \brief Create a window (3 dimensions) of 19 elements.
+ ** \return The new window.
+ **
+ ** It's the same than win_c18_only() plus the 0,0,0 point.
+ */
inline const window3d&
win_c18p()
{
@@ -187,6 +272,10 @@
return win;
}
+ /*!
+ ** \brief Create a window (3 dimensions) of 26 elements.
+ ** \return The new window.
+ */
inline const window3d&
win_c26_only()
{
@@ -220,6 +309,12 @@
return win;
}
+ /*!
+ ** \brief Create a window (3 dimensions) of 27 elements.
+ ** \return The new window.
+ **
+ ** It's the same than win_c26_only() plus the 0,0,0 point.
+ */
inline const window3d&
win_c26p()
{
@@ -256,6 +351,19 @@
// mk_win's
+ /*!
+ ** \brief Create a block window (3 dimension).
+ ** \arg nslices Number of slice.
+ ** \arg nrows Number of row.
+ ** \arg ncols Number of column.
+ ** \return The new window (3d).
+ ** \pre nslices >= 3.
+ ** \pre nslices % 2 == 1.
+ ** \pre nrows >= 3.
+ ** \pre nrows % 2 == 1.
+ ** \pre ncols >= 3.
+ ** \pre ncols % 2 == 1.
+ */
inline window3d
mk_win_block(unsigned nslices, unsigned nrows, unsigned ncols)
{
@@ -273,6 +381,18 @@
return win;
}
+ /*!
+ ** \brief Create an ellipsoid window (3 dimension).
+ ** \arg zradius radius Z.
+ ** \arg yradius radius Y.
+ ** \arg xradius radius X.
+ ** \pre zradius > 0
+ ** \pre yradius > 0
+ ** \pre xradius > 0
+ **
+ ** The ellipsoid formula is :
+ ** \f$$\frac{x^2}{xradius^2} + \frac{y^2}{yradius^2} + \frac{z^2}{zradius^2} = 1$\f$
+ */
inline window3d
mk_win_ellipsoid(float zradius, float yradius, float xradius)
{
@@ -308,12 +428,22 @@
return win;
}
+ /*!
+ ** \brief Create a cube neighborhood (3 dimension).
+ ** \arg width Number of slice, colunm and row.
+ ** \return The new neighborhood (3d).
+ */
inline window3d
mk_win_cube(unsigned width)
{
return mk_win_block(width, width, width);
}
+ /*!
+ ** \brief Create a ball neighborhood (3 dimension).
+ ** \arg radius The radius.
+ ** \return The new neighborhood (3d).
+ */
inline window3d
mk_win_ball(float radius)
{
Index: olena/oln/core/abstract/window.hh
--- olena/oln/core/abstract/window.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/16_window.hh 1.17 640)
+++ olena/oln/core/abstract/window.hh Fri, 12 Mar 2004 13:44:26 +0100 odou_s
(oln/c/16_window.hh 1.17 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -32,15 +32,16 @@
# include <oln/core/winneighb.hh>
# include <oln/core/abstract/dpoint.hh>
-namespace oln
-{
+namespace oln {
- namespace abstract
- {
+ namespace abstract {
template<class Exact>
- struct window; // fwd_decl
+ struct window; // forward declaration
} // end of abstract
+ /*!
+ ** Traits for abstract::neighborhood
+ */
template<class Exact>
struct struct_elt_traits<abstract::window<Exact> > : public
struct_elt_traits<abstract::struct_elt<Exact> >
@@ -51,14 +52,33 @@
namespace abstract
{
+ /*!
+ ** \brief Window.
+ **
+ ** A window is a set of points and this class defines how to deal
+ ** with.
+ */
template<class Exact>
struct window : public struct_elt<Exact>
{
- typedef struct_elt<Exact> super_type;
- typedef Exact exact_type;
+ typedef struct_elt<Exact> super_type; ///< Set super type.
+ typedef Exact exact_type; ///< Set exact type.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::dpoint_type dpoint_type;
+
friend class struct_elt<exact_type>;
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -67,12 +87,20 @@
protected:
+ /*!
+ ** \brief Add a point to the window.
+ **
+ ** Add a new member to the window.
+ */
exact_type&
add_dp(const abstract::dpoint<dpoint_type>& dp)
{
return this->exact().add_(dp.exact());
}
+ /*!
+ ** \brief Do nothing, used only by sub-classes
+ */
window() : super_type()
{}
@@ -80,6 +108,9 @@
} // end of abstract
+ /*!
+ ** \brief Compute intersection between two windows
+ */
template<class E>
inline E
inter(const abstract::window<E>& lhs, const abstract::window<E>&
rhs)
@@ -94,6 +125,9 @@
return win;
}
+ /*!
+ ** \brief Compute union between two windows
+ */
template<class E>
inline E
uni(const abstract::window<E>& lhs, const abstract::window<E>&
rhs)
Index: olena/oln/core/w_window1d.hh
--- olena/oln/core/w_window1d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/19_w_window1d 1.16 640)
+++ olena/oln/core/w_window1d.hh Fri, 12 Mar 2004 15:23:18 +0100 odou_s
(oln/c/19_w_window1d 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -40,68 +40,135 @@
namespace oln {
template<class T>
- class w_window1d; // fwd_decl
-
+ class w_window1d; // forward declaration
+ /*!
+ ** \brief Traits for w_windownd1d.
+ */
template<class T>
struct struct_elt_traits<w_window1d<T> >: public
struct_elt_traits<abstract::w_windownd<w_window1d<T> > >
{
- enum { dim = 1 };
- typedef T weight_type;
- typedef point1d point_type;
- typedef dpoint1d dpoint_type;
- typedef winiter< w_window1d<T> > iter_type;
- typedef winneighb< w_window1d<T> > neighb_type;
+ enum { dim = 1 }; ///< Dimension.
+ typedef T weight_type; ///< Type of weight.
+ typedef point1d point_type; ///< Type of point.
+ typedef dpoint1d dpoint_type; ///< Type of dpoint.
+ typedef winiter< w_window1d<T> > iter_type; ///< Type of iterator.
+ typedef winneighb< w_window1d<T> > neighb_type; ///< Type of
neighbor.
};
+ /*!
+ ** \brief Window 1 dimension with weight.
+ **
+ ** A window is a set of points. This class
+ ** defines how to deal with. These points have 1 dimension.
+ */
template<class T>
class w_window1d : public abstract::w_windownd<w_window1d<T> >
{
typedef abstract::w_windownd< w_window1d<T> > super_type;
+ ///< The super type.
public:
- typedef w_window1d<T> self_type;
+ typedef w_window1d<T> self_type; ///< The self type.
+
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits< self_type >::iter_type iter_type;
- typedef typename struct_elt_traits< self_type >::neighb_type
- neighb_type;
+
+ typedef typename struct_elt_traits< self_type >::neighb_type neighb_type;
+ ///< Type of neighbor.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits< self_type >::dpoint_type dpoint_type;
+
typedef typename struct_elt_traits< self_type >::weight_type weight_type;
+ ///< Type of weight.
friend class abstract::window_base<abstract::w_window<w_window1d>,
w_window1d>;
+ /*!
+ ** \brief Construct a w_window of 1 dimension.
+ */
w_window1d(): super_type()
{}
+ /*!
+ ** \brief Construct a w_window of 1 dimension.
+ ** \arg size The number of element.
+ */
w_window1d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Add a dpoint (move point) to the w_window.
+ ** \arg dp The new point.
+ ** \arg w The weight of the new point.
+ **
+ ** Add a new member to the w_window. This point must be of 1
+ ** dimension.
+ */
w_window1d<T>&
add(const dpoint_type& dp, const weight_type& w)
{
return this->exact().add_(dp, w);
}
+ /*!
+ ** \brief Add a point by coordinates to the w_window.
+ ** \arg col The coordinate of the new point (1 dimension).
+ ** \arg weight The weight of the new point.
+ **
+ ** Add a new member by its coordinates to the w_window.
+ ** The coordinates are only the column number because the w_window is
+ ** of 1 dimension.
+ */
w_window1d<T>&
add(coord col, const weight_type& weight)
{
return add(dpoint_type(col), weight);
}
+ /*!
+ ** \brief Set the weight of a point.
+ ** \arg dp The point to set the weight.
+ ** \arg weight The weight of the point.
+ */
const weight_type&
set(const dpoint_type& dp, const weight_type& weight)
{
return this->exact().set_(dp, weight);
}
+ /*!
+ ** \brief Set the weight of a point by coordinates.
+ ** \arg col The coordinates of the point.
+ ** \arg weight The weight of the point.
+ **
+ ** The coordinates are only the column number because the w_window is
+ ** of 1 dimension.
+ */
const weight_type&
set(coord col, const weight_type& weight)
{
return set(dpoint_type(col), weight);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -110,6 +177,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a move point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the w_window,
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -119,7 +194,12 @@
};
-
+ /*!
+ ** \brief Convert a window (1 dimension) to a w_window (1 dimension).
+ ** \arg weight The weight to set for each element of the window.
+ ** \arg win The window to convert.
+ ** \return The new w_window.
+ */
template<class T>
w_window1d<T>
mk_w_win_from_win(T weight, const window1d& win)
Index: olena/oln/core/w_window2d.hh
--- olena/oln/core/w_window2d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/18_w_window2d 1.6.1.11 640)
+++ olena/oln/core/w_window2d.hh Fri, 12 Mar 2004 15:23:29 +0100 odou_s
(oln/c/18_w_window2d 1.6.1.11 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -41,44 +41,81 @@
namespace oln {
template<class T>
- class w_window2d; // fwd_decl
-
+ class w_window2d; // forward declaration
+ /*!
+ ** \brief Traits for w_windownd2d.
+ */
template<class T>
struct struct_elt_traits<w_window2d<T> >: public
struct_elt_traits<abstract::w_windownd<w_window2d<T> > >
{
- enum { dim = 2 };
- typedef T weight_type;
- typedef point2d point_type;
- typedef dpoint2d dpoint_type;
- typedef winiter< w_window2d<T> > iter_type;
- typedef winneighb< w_window2d<T> > neighb_type;
+ enum { dim = 2 }; ///< Dimension.
+ typedef T weight_type; ///< Type of weight.
+ typedef point2d point_type; ///< Type of point.
+ typedef dpoint2d dpoint_type; ///< Type of dpoint.
+ typedef winiter< w_window2d<T> > iter_type; ///< Type of iterator.
+ typedef winneighb< w_window2d<T> > neighb_type; ///< Type of
neighbor.
};
+ /*!
+ ** \brief Window 2 dimensions with weight.
+ **
+ ** A window is a set of points. This class
+ ** defines how to deal with. These points have 2 dimensions.
+ */
template<class T>
class w_window2d : public abstract::w_windownd<w_window2d<T> >
{
typedef abstract::w_windownd< w_window2d<T> > super_type;
+ ///< The super type.
public:
- typedef w_window2d<T> self_type;
+ typedef w_window2d<T> self_type; ///< The self type.
+
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits< self_type >::iter_type iter_type;
- typedef typename struct_elt_traits< self_type >::neighb_type
- neighb_type;
+
+ typedef typename struct_elt_traits< self_type >::neighb_type neighb_type;
+ ///< Type of neighbor.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits< self_type >::dpoint_type dpoint_type;
+
typedef typename struct_elt_traits< self_type >::weight_type weight_type;
+ ///< Type of weight.
friend class abstract::window_base<abstract::w_window<w_window2d>,
w_window2d>;
+ /*!
+ ** \brief Construct a w_window of 2 dimensions.
+ */
w_window2d(): super_type()
{}
+ /*!
+ ** \brief Construct a w_window of 2 dimensions.
+ ** \arg size The number of element.
+ */
w_window2d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Construct a w_window of 2 dimensions from an array of elements.
+ ** \arg arr The array of elements.
+ ** \todo FIXME: this constructor is not in w_window1d.hh nor w_window3d.hh.
+ ** Is it really useful ?
+ */
template<class I, class T2>
w_window2d(const mlc::array2d<I, T2 >& arr) :
super_type(I::card)
@@ -89,30 +126,68 @@
add(row, col, arr[i++]);
}
+ /*!
+ ** \brief Add a point by coordinates to the w_window.
+ ** \arg row The coordinate (row) of the new point (2 dimensions).
+ ** \arg col The coordinate (col) of the new point (2 dimensions).
+ ** \arg weight The weight of the new point.
+ **
+ ** Add a new member by its coordinates to the w_window.
+ ** The coordinates are only the column number because the w_window is
+ ** of 2 dimensions.
+ */
w_window2d<T>&
add(coord row, coord col, const weight_type& weight)
{
return add(dpoint_type(row, col), weight);
}
+ /*!
+ ** \brief Add a dpoint (move point) to the w_window.
+ ** \arg dp The new point.
+ ** \arg w The weight of the new point.
+ **
+ ** Add a new member to the w_window. This point must be of 2
+ ** dimensions.
+ */
w_window2d<T>&
add(const dpoint_type& dp, const weight_type& w)
{
return this->exact().add_(dp, w);
}
+ /*!
+ ** \brief Set the weight of a point.
+ ** \arg dp The point to set the weight.
+ ** \arg weight The weight of the point.
+ */
const weight_type&
set(const dpoint_type& dp, const weight_type& weight)
{
return this->exact().set_(dp, weight);
}
+ /*!
+ ** \brief Set the weight of a point by coordinates.
+ ** \arg row The coordinates (row) of the point.
+ ** \arg col The coordinates (col) of the point.
+ ** \arg weight The weight of the point.
+ **
+ ** The coordinates are only the column number because the w_window is
+ ** of 2 dimensions.
+ */
const weight_type&
set(coord row, coord col, const weight_type& weight)
{
return set(dpoint_type(row, col), weight);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -121,6 +196,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a move point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the w_window,
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -131,7 +214,12 @@
};
-
+ /*!
+ ** \brief Convert a window (2 dimension) to a w_window (2 dimension).
+ ** \arg weight The weight to set for each element of the window.
+ ** \arg win The window to convert.
+ ** \return The new w_window.
+ */
template<class T>
w_window2d<T>
mk_w_win_from_win(T weight, const window2d& win)
Index: olena/oln/core/w_window3d.hh
--- olena/oln/core/w_window3d.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/17_w_window3d 1.16 640)
+++ olena/oln/core/w_window3d.hh Fri, 12 Mar 2004 15:23:40 +0100 odou_s
(oln/c/17_w_window3d 1.16 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -40,67 +40,141 @@
namespace oln {
template<class T>
- class w_window3d; // fwd_decl
+ class w_window3d; // forward declaration
+ /*!
+ ** \brief Traits for w_windownd3d.
+ */
template<class T>
struct struct_elt_traits<w_window3d<T> >: public
struct_elt_traits<abstract::w_windownd<w_window3d<T> > >
{
- enum { dim = 3 };
- typedef T weight_type;
- typedef point3d point_type;
- typedef dpoint3d dpoint_type;
- typedef winiter< w_window3d<T> > iter_type;
- typedef winneighb< w_window3d<T> > neighb_type;
+ enum { dim = 3 }; ///< Dimension.
+ typedef T weight_type; ///< Type of weight.
+ typedef point3d point_type; ///< Type of point.
+ typedef dpoint3d dpoint_type; ///< Type of dpoint.
+ typedef winiter< w_window3d<T> > iter_type; ///< Type of iterator.
+ typedef winneighb< w_window3d<T> > neighb_type; ///< Type of
neighbor.
};
+ /*!
+ ** \brief Window 3 dimensions with weight.
+ **
+ ** A window is a set of points. This class
+ ** defines how to deal with. These points have 3 dimensions.
+ */
template<class T>
class w_window3d : public abstract::w_windownd<w_window3d<T> >
{
typedef abstract::w_windownd< w_window3d<T> > super_type;
+ ///< The super type.
public:
- typedef w_window3d<T> self_type;
+ typedef w_window3d<T> self_type; ///< The self type.
+
+ /*!
+ ** \brief The associate image's type of iterator.
+ ** \warning Prefer the macros oln_iter_type(Iterable) and
+ ** oln_iter_type_(Iterable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits< self_type >::iter_type iter_type;
+
+
typedef typename struct_elt_traits< self_type >::neighb_type neighb_type;
+ ///< Type of neighbor.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits< self_type >::dpoint_type dpoint_type;
+
typedef typename struct_elt_traits< self_type >::weight_type weight_type;
+ ///< Type of weight.
friend class abstract::window_base<abstract::w_window<w_window3d>,
w_window3d>;
+ /*!
+ ** \brief Construct a w_window of 3 dimensions.
+ */
w_window3d(): super_type()
{}
+ /*!
+ ** \brief Construct a w_window of 3 dimensions.
+ ** \arg size The number of element.
+ */
w_window3d(unsigned size) : super_type(size)
{}
+ /*!
+ ** \brief Add a dpoint (move point) to the w_window.
+ ** \arg dp The new point.
+ ** \arg w The weight of the new point.
+ **
+ ** Add a new member to the w_window. This point must be of 3
+ ** dimensions.
+ */
w_window3d<T>&
add(const dpoint_type& dp, const weight_type& w)
{
return this->exact().add_(dp, w);
}
+ /*!
+ ** \brief Add a point by coordinates to the w_window.
+ ** \arg slice The coordinate (slice) of the new point (3 dimensions).
+ ** \arg row The coordinate (row) of the new point (3 dimensions).
+ ** \arg col The coordinate (col) of the new point (3 dimensions).
+ ** \arg weight The weight of the new point.
+ **
+ ** Add a new member by its coordinates to the w_window.
+ ** The coordinates are only the column number because the w_window is
+ ** of 3 dimensions.
+ */
w_window3d<T>&
add(coord slice, coord row, coord col, const weight_type& weight)
{
return add(dpoint_type(slice, row, col), weight);
}
+ /*!
+ ** \brief Set the weight of a point.
+ ** \arg dp The point to set the weight.
+ ** \arg weight The weight of the point.
+ */
const weight_type&
set(const dpoint_type& dp, const weight_type& weight)
{
return this->exact().set_(dp, weight);
}
+ /*!
+ ** \brief Set the weight of a point by coordinates.
+ ** \arg slice The coordinates (slice) of the point.
+ ** \arg row The coordinates (row) of the point.
+ ** \arg col The coordinates (col) of the point.
+ ** \arg weight The weight of the point.
+ **
+ ** The coordinates are only the column number because the w_window is
+ ** of 3 dimensions.
+ */
const weight_type&
set(coord slice, coord row, coord col, const weight_type& weight)
{
return set(dpoint_type(slice, row, col), weight);
}
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -109,6 +183,14 @@
protected:
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a move point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the w_window,
+ ** then this point is assigned to delta.
+ */
coord
delta_update_(const dpoint_type& dp)
{
@@ -120,7 +202,12 @@
};
-
+ /*!
+ ** \brief Convert a window (3 dimension) to a w_window (3 dimension).
+ ** \arg weight The weight to set for each element of the window.
+ ** \arg win The window to convert.
+ ** \return The new w_window.
+ */
template<class T>
w_window3d<T>
mk_w_win_from_win(T weight, const window3d& win)
Index: olena/oln/core/abstract/w_window.hh
--- olena/oln/core/abstract/w_window.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/20_w_window.h 1.14 640)
+++ olena/oln/core/abstract/w_window.hh Fri, 12 Mar 2004 13:44:58 +0100 odou_s
(oln/c/20_w_window.h 1.14 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -31,17 +31,17 @@
# include <oln/core/abstract/struct_elt.hh>
# include <oln/core/abstract/dpoint.hh>
-namespace oln
-{
-
- namespace abstract
- {
+namespace oln {
+ namespace abstract {
template<class Exact>
- struct w_window; // fwd_decl
+ struct w_window; // forwarding declaration
} // end of abstract
+ /*!
+ ** \brief Traits for abstract::w_window.
+ */
template<class Exact>
struct struct_elt_traits<abstract::w_window<Exact> > : public
struct_elt_traits<abstract::struct_elt<Exact> >
@@ -52,36 +52,73 @@
namespace abstract
{
+ /*!
+ ** \brief Weight Window.
+ **
+ ** A w_window is a set of points associated with a weight. This class
+ ** defines how to deal with.
+ */
template<class Exact>
struct w_window : public struct_elt< Exact >
{
- typedef Exact exact_type;
- typedef struct_elt<Exact> super_type;
+ typedef Exact exact_type; ///< Set the exact type.
+ typedef struct_elt<Exact> super_type; ///< Set the super type.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::dpoint_type dpoint_type;
+
typedef typename struct_elt_traits<Exact>::weight_type weight_type;
+ ///< Set the type of weight.
friend class struct_elt<exact_type>;
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
return std::string("w_window<") + Exact::name() + ">";
}
- // FIXME:
- // add dpoint with default weight
- // (multiplication neutral element)
+ /*!
+ ** \brief Add a point (with weight) to the w_window.
+ **
+ ** Add a new member to the w_window.
+ **
+ ** \todo FIXME: Add dpoint with default weight
+ ** (multiplication neutral element).
+ */
exact_type&
add(const abstract::dpoint<dpoint_type>& dp, const weight_type& w =
1)
{
return this->exact().add_(dp.exact(), w);
}
+ /*!
+ ** \brief Get the weight of a point.
+ ** \arg i The nth point.
+ ** \return The weight of the point.
+ */
weight_type
w(unsigned i) const
{
return this->exact().get_weight(i);
}
+ /*!
+ ** \brief Set the weight of a point if it exists. Otherwise
+ ** create a new entry.
+ ** \arg dp The point.
+ ** \arg weight The weight of the point.
+ ** \return The weight of the point.
+ */
const weight_type&
set(const abstract::dpoint<dpoint_type>& dp,
const weight_type& weight)
@@ -91,9 +128,13 @@
protected:
- // FIXME:
- // add dpoint with default weight
- // (multiplication neutral element)
+ /*!
+ ** \brief Add a new point with a weight of 1.
+ ** \arg dp The point.
+ **
+ ** \todo FIXME: Add dpoint with default weight
+ ** (multiplication neutral element).
+ */
exact_type&
add_dp(const abstract::dpoint<dpoint_type>& dp)
{
@@ -102,6 +143,9 @@
protected:
+ /*!
+ ** \brief Do nothing, used only by sub-classes
+ */
w_window() : super_type()
{}
@@ -109,6 +153,10 @@
} // end of abstract
+
+ /*!
+ ** \brief Compute intersection between two w_windows
+ */
template<class E>
inline E
inter(const abstract::w_window<E>& lhs, const
abstract::w_window<E>& rhs)
@@ -123,6 +171,9 @@
return win;
}
+ /*!
+ ** \brief Compute union between two w_windows
+ */
template<class E>
inline E
uni(const abstract::w_window<E>& lhs, const abstract::w_window<E>&
rhs)
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh Thu, 11 Mar 2004 20:19:51 +0100 thivol_d
(oln/t/25_image.hh 1.23 640)
+++ olena/oln/core/abstract/image.hh Fri, 12 Mar 2004 13:27:12 +0100 odou_s
(oln/t/25_image.hh 1.23 640)
@@ -351,8 +351,8 @@
# define oln_dpoint_type(DPointable) \
mlc_exact_type(DPointable)::dpoint_type
-# define oln_dpoint_type_(Pointable) \
-mlc_exact_type_(Pointable)::dpoint_type
+# define oln_dpoint_type_(DPointable) \
+mlc_exact_type_(DPointable)::dpoint_type
} // end of namespace oln
Index: olena/oln/core/abstract/window_base.hh
--- olena/oln/core/abstract/window_base.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/u/3_window_bas 1.9 640)
+++ olena/oln/core/abstract/window_base.hh Fri, 12 Mar 2004 13:41:06 +0100 odou_s
(oln/u/3_window_bas 1.9 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -39,38 +39,49 @@
# include <vector>
# include <utility>
-namespace oln
-{
- namespace abstract
- {
- template<class Sup, class Exact>
- struct window_base; // fwd_decl
+namespace oln {
+ namespace abstract {
+ template<class Sup, class Exact>
+ struct window_base; // forwarding declaration
} // end of abstract
-
+ /*!
+ ** \brief Traits for abstract::window_base.
+ */
template<class Sup, class Exact>
struct struct_elt_traits<abstract::window_base<Sup, Exact> >: public
struct_elt_traits<Sup>
{
};
-
+ /*!
+ ** Used for conditionnal friend in window_base class.
+ */
template<class Sup>
struct window_base_friend_traits;
+ /*!
+ ** If window_base inherits from neighborhood, then mother is neighborhood.
+ */
template< class Exact>
struct window_base_friend_traits<abstract::neighborhood<Exact> >
{
typedef abstract::neighborhood<Exact> ret;
};
+ /*!
+ ** If window_base inherits from window, then mother is struct_elt.
+ */
template< class Exact>
struct window_base_friend_traits<abstract::window<Exact> >
{
typedef abstract::struct_elt<Exact> ret;
};
+ /*!
+ ** If window_base inherits from w_window, then mother is struct_elt.
+ */
template< class Exact>
struct window_base_friend_traits<abstract::w_window<Exact> >
{
@@ -79,22 +90,56 @@
namespace abstract
{
+
+ /*!
+ ** \brief Window Base.
+ **
+ ** A window is a set of points and this class defines how to deal
+ ** with. This class regroups common things for window, w_window (weight
+ ** window) and neighborhood.
+ ** Here, a set of point is a window or a weigh window or a neighborhood.
+ */
template<class Sup, class Exact>
struct window_base: public Sup
{
enum { dim = struct_elt_traits<Exact >::dim };
+ ///< Set the dimension of the window (depends of point dimension).
typedef window_base<Sup, Exact> self_type;
+ ///< Set self type.
+
+ /*!
+ ** \brief The associate image's type of point.
+ ** \warning Prefer the macros oln_point_type(Pointable) and
+ ** oln_point_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::point_type point_type;
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::dpoint_type dpoint_type;
+
typedef Exact exact_type;
+ ///< Set exact type.
typedef Sup super_type;
+ ///< Set type of class inherited.
- // FIXME: this has been commented out to satisfy icc and
- // comeau. I don't know who is right between them and gcc.
+ /*!
+ ** \todo FIXME: this has been commented out to satisfy icc and
+ ** comeau. I don't know who is right between them and gcc.
+ */
friend class struct_elt<Exact>;
friend class neighborhood<Exact>;
// friend class window_base_friend_traits<Sup>::ret;
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -103,24 +148,46 @@
protected:
+ /*!
+ ** \brief Test if the set of points contains this one.
+ ** \arg dp a dpoint (deplacement point).
+ ** \return True if the set of points contains this dpoint.
+ */
bool
has_(const dpoint_type& dp) const
{
return std::find(dp_.begin(), dp_.end(), dp) != dp_.end();
}
+ /*!
+ ** \brief Get the number of point we get.
+ ** \return The number of point.
+ */
unsigned
card_() const
{
return dp_.size();
}
+ /*!
+ ** \brief Test if the set of points is centered.
+ ** \return True if it's centered.
+ **
+ ** Centered means :
+ ** - at least one element for neighborhood;
+ ** - list of point contains 0 for window.
+ */
bool
is_centered_() const
{
return centered_;
}
+ /*!
+ ** \brief Compare two sets of points.
+ ** \arg win The set of point to compare.
+ ** \return True if they are the same.
+ */
bool
is_equal(const exact_type& win) const
{
@@ -130,18 +197,37 @@
return true;
}
+ /*!
+ ** \brief Get the delta of the set of points.
+ ** \return Delta.
+ **
+ ** Delta is the bigger element of the set of points.
+ */
coord
get_delta() const
{
return delta_;
}
+ /*!
+ ** \brief Update delta.
+ ** \arg dp a deplacement point.
+ ** \return Delta.
+ **
+ ** If the point is the biggest element of the set of points,
+ ** then this point is assigned to delta.
+ */
coord
delta_update(const dpoint_type& dp)
{
return this->exact().delta_update_(dp);
}
+ /*!
+ ** \brief Set a set of point to opposite.
+ **
+ ** Each point of the set of point is assigned to his opposite.
+ */
void
sym_()
{
@@ -149,6 +235,12 @@
dp_[i] = - dp_[i];
}
+ /*!
+ ** \brief Get the nth structuring element.
+ ** \arg i The nth.
+ ** \return The nth dpoint.
+ ** \pre i < card().
+ */
const dpoint_type
at(unsigned i) const
{
@@ -156,30 +248,47 @@
return dp_[i];
}
+ /*!
+ ** \brief CTor
+ **
+ ** Used only by sub-classes
+ */
window_base() : super_type(), dp_(), delta_(0)
{
centered_ = false;
}
+ /*!
+ ** \brief Used only by sub-classes
+ ** \arg size The number of point.
+ **
+ ** Set the number of point this object will get.
+ ** Used only by sub-classes
+ */
window_base(unsigned size) : super_type(), dp_(), delta_(0)
{
dp_.reserve(size);
centered_ = false;
}
- std::vector<dpoint_type> dp_;
- max_accumulator<coord> delta_;
- bool centered_;
+ std::vector<dpoint_type> dp_; ///< The list of point.
+ max_accumulator<coord> delta_; ///< Delta : the maximale point of the
list.
+ bool centered_; ///< Is the set of point centered ?
};
-
-
} // end of abstract
} // end of oln
-
+/*!
+** \brief Write the coordinates of point on an ostream.
+** \arg o The stream.
+** \arg w The window_base to write
+** \return The ostream
+**
+** Useful for debugging
+*/
template<class Sup, class Exact>
std::ostream&
operator<<(std::ostream& o, const oln::abstract::window_base<Sup,
Exact>& w)
Index: olena/oln/core/abstract/windownd.hh
--- olena/oln/core/abstract/windownd.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/u/4_windownd.h 1.7 640)
+++ olena/oln/core/abstract/windownd.hh Fri, 12 Mar 2004 16:39:02 +0100 odou_s
(oln/u/4_windownd.h 1.7 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -30,14 +30,16 @@
# include <oln/core/abstract/window_base.hh>
-namespace oln
-{
- namespace abstract
- {
+namespace oln {
+
+ namespace abstract {
template<class Exact>
- struct windownd; //fwd_decl
+ struct windownd; // forward declaration
} // end of abstract
+ /*!
+ ** \brief Traits for abstract::windownd.
+ */
template<class Exact>
struct struct_elt_traits<abstract::windownd<Exact> >: public
struct_elt_traits<abstract::window_base<abstract::window<Exact>, Exact>
>
@@ -45,18 +47,37 @@
};
- namespace abstract
- {
+ namespace abstract {
+
+ /*!
+ ** \brief Window N dimensions.
+ **
+ ** A window is a set of points. This class
+ ** defines how to deal with. These points have N dimensions.
+ */
template<class Exact>
struct windownd: public window_base<window<Exact>, Exact>
{
typedef window_base<window<Exact>, Exact> super_type;
- typedef windownd<Exact> self_type;
+ ///< Set the super type.
+ typedef windownd<Exact> self_type; ///< Set the self type.
+ typedef Exact exact_type; ///< Set the exact type.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::dpoint_type dpoint_type;
- typedef Exact exact_type;
friend class window<exact_type>;
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -65,6 +86,12 @@
protected:
+ /*!
+ ** \brief Add a point to the window.
+ ** \arg dp The new point.
+ **
+ ** Add a new member to the window.
+ */
exact_type&
add_(const dpoint_type& dp)
{
@@ -76,9 +103,16 @@
return this->exact();
}
+ /*!
+ ** \brief Construct a window.
+ */
windownd() : super_type()
{ }
+ /*!
+ ** \brief Construct a w_window of 'size' elements.
+ ** \arg size The number of element to reserve for the window.
+ */
windownd(unsigned size) : super_type(size)
{}
Index: olena/oln/core/abstract/w_windownd.hh
--- olena/oln/core/abstract/w_windownd.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/u/5_w_windownd 1.6 640)
+++ olena/oln/core/abstract/w_windownd.hh Fri, 12 Mar 2004 14:44:34 +0100 odou_s
(oln/u/5_w_windownd 1.6 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -30,14 +30,16 @@
# include <oln/core/abstract/window_base.hh>
-namespace oln
-{
- namespace abstract
- {
+namespace oln {
+
+ namespace abstract {
template<class Exact>
- struct w_windownd; //fwd_decl
+ struct w_windownd; // forward declaration
} // end of abstract
+ /*!
+ ** \brief Traits for abstract::w_windownd.
+ */
template<class Exact>
struct struct_elt_traits<abstract::w_windownd<Exact> >: public
struct_elt_traits<abstract::window_base<abstract::w_window<Exact>,
Exact> >
@@ -45,19 +47,39 @@
};
- namespace abstract
- {
+ namespace abstract {
+
+ /*!
+ ** \brief Weight Window N dimensions
+ **
+ ** A w_window is a set of points associated with a weight. This class
+ ** defines how to deal with. These points have N dimensions.
+ */
template<class Exact>
struct w_windownd: public window_base<w_window<Exact>, Exact>
{
typedef window_base<abstract::w_window<Exact>, Exact> super_type;
- typedef w_windownd<Exact> self_type;
- typedef Exact exact_type;
+ ///< Set the super type.
+ typedef w_windownd<Exact> self_type; ///< Set the self type.
+ typedef Exact exact_type; ///< Set the exact type.
typedef typename struct_elt_traits<Exact>::weight_type weight_type;
+ ///< Set the type of weight.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::dpoint_type dpoint_type;
friend class w_window<exact_type>;
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -66,6 +88,12 @@
protected:
+ /*!
+ ** \brief Get the weight of the nth point of the window.
+ ** \arg i The nth point.
+ ** \return The weight of this point.
+ ** \pre i < card().
+ */
weight_type
get_weight(unsigned i) const
{
@@ -73,6 +101,14 @@
return w_[i];
}
+ /*!
+ ** \brief Add a point (with weight) to the window.
+ ** \arg dp The new point.
+ ** \arg w The weight of this new point.
+ ** \pre !has(dp).
+ **
+ ** Add a new member to the window (ignored if ist weight is 0).
+ */
exact_type&
add_(const dpoint_type& dp, const weight_type& w)
{
@@ -87,6 +123,13 @@
return this->exact();
}
+ /*!
+ ** \brief Set the weight of a point if it exists. Otherwise
+ ** create a new entry.
+ ** \arg dp The point.
+ ** \arg weight The weight of the point.
+ ** \return The weight of the point.
+ */
const weight_type&
set_(const dpoint_type& dp, const weight_type& w)
{
@@ -103,20 +146,36 @@
return w_.back();
}
+ /*!
+ ** \brief Construct a w_window.
+ */
w_windownd() : super_type()
{}
+ /*!
+ ** \brief Construct a w_window of 'size' elements.
+ ** \arg size The number of element to reserve for the window.
+ */
w_windownd(unsigned size) : super_type(size)
{
w_.reserve(size);
}
- std::vector< weight_type > w_;
+ std::vector< weight_type > w_; ///< List of point's weight.
};
} // end of abstract
} // end of oln
+/*!
+** \brief Write coordinates and weight of each window's point
+** on an ostream.
+** \arg o The stream.
+** \arg w The window_base to write
+** \return The ostream
+**
+** Useful for debugging
+*/
template<class Exact>
std::ostream&
operator<<(std::ostream& o, const oln::abstract::w_windownd<Exact>&
w)
Index: olena/oln/core/abstract/neighborhoodnd.hh
--- olena/oln/core/abstract/neighborhoodnd.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/u/6_neighborho 1.6 640)
+++ olena/oln/core/abstract/neighborhoodnd.hh Fri, 12 Mar 2004 13:36:03 +0100 odou_s
(oln/u/6_neighborho 1.6 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -30,14 +30,16 @@
# include <oln/core/abstract/window_base.hh>
-namespace oln
-{
- namespace abstract
- {
+namespace oln {
+
+ namespace abstract {
template<class Exact>
- struct neighborhoodnd; //fwd_decl
+ struct neighborhoodnd; // forward declaration
} // end of abstract
+ /*!
+ ** \brief Traits for abstract::neighborhoodnd.
+ */
template<class Exact>
struct struct_elt_traits<abstract::neighborhoodnd<Exact> >: public
struct_elt_traits<abstract::window_base<abstract::neighborhood<Exact>,
Exact> >
@@ -45,18 +47,39 @@
};
- namespace abstract
- {
+ namespace abstract {
+
+ /*!
+ ** \brief Neighborhoodnd.
+ **
+ ** It looks like structuring elements but here, when
+ ** you add an element, you add his opposite.
+ ** Points have N dimensions.
+ **
+ */
template<class Exact>
struct neighborhoodnd: public window_base<neighborhood<Exact>, Exact>
{
typedef window_base<neighborhood<Exact>, Exact> super_type;
- typedef neighborhoodnd<Exact> self_type;
- typedef Exact exact_type;
+ ///< Super type.
+ typedef neighborhoodnd<Exact> self_type; ///< Self type.
+ typedef Exact exact_type; ///< Exact type.
+
+ /*!
+ ** \brief The associate image's type of dpoint (move point).
+ ** \warning Prefer the macros oln_dpoint_type(Pointable) and
+ ** oln_dpoint_type_(Pointable) (the same without the 'typename' keyword)
+ */
typedef typename struct_elt_traits<Exact>::dpoint_type dpoint_type;
friend class neighborhood<exact_type>;
+ /*!
+ ** \brief Return his type in a string.
+ ** \return The type in a string.
+ **
+ ** Very useful to debug.
+ */
static std::string
name()
{
@@ -65,6 +88,13 @@
protected:
+ /*!
+ ** \brief Add a point to the neighborhood.
+ ** \arg dp The new point.
+ ** \pre !dp.is_centered().
+ **
+ ** Add a new member to the neighborhood.
+ */
exact_type&
add_(const dpoint_type& dp)
{
@@ -76,9 +106,16 @@
return this->exact();
}
+ /*!
+ ** \brief Construct a neighborhoodnd.
+ */
neighborhoodnd() : super_type()
{}
+ /*!
+ ** \brief Construct a neighborhood of 'size' elements.
+ ** \arg size The number of element to reserve for the neighborhood.
+ */
neighborhoodnd(unsigned size) : super_type(size)
{}
--
Simon Odou
simon(a)lrde.epita.fr