Olena
Threads by month
- ----- 2025 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
March 2004
- 15 participants
- 44 discussions
Please, try to correct apply.hh and traverse.hh.
There is many problems with \param and with \ref.
There is mamy English problems too, such as the wrong
usage of "we".
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/convert/nrgbxyz.hh: Correct comments.
* olena/oln/convert/stretch.hh: Likewise.
* olena/oln/level/cc.hh: Likewise.
* olena/oln/morpho/gradient.inc: Likewise.
* olena/oln/morpho/attribute_closing_opening.hh: Likewise.
* olena/oln/morpho/attribute_union_find.hh: Likewise.
* olena/oln/topo/inter-pixel/inter-pixel.hh: Likewise.
* olena/oln/topo/inter-pixel/node.hh: Likewise.
* olena/oln/core/abstract/image_with_dim.hh: Likewise.
* olena/oln/core/impl/image_impl.hh: Likewise.
* olena/oln/morpho/attributes.hh: Likewise.
* olena/oln/utils/special_points.hh: Likewise.
Index: olena/oln/convert/nrgbxyz.hh
--- olena/oln/convert/nrgbxyz.hh Sat, 13 Mar 2004 17:45:05 +0100
van-vl_n (oln/16_nrgbxyz.hh 1.13 640)
+++ olena/oln/convert/nrgbxyz.hh Sun, 14 Mar 2004 18:40:08 +0100
van-vl_n (oln/16_nrgbxyz.hh 1.13 640)
@@ -52,7 +52,7 @@
/*! Functor for conversion from N-RGB to XYZ color space.
**
- ** \obsolete A composition should be performed with nrgb->rgb and
rgb->xyz. It has
+ ** \deprecated A composition should be performed with nrgb->rgb and
rgb->xyz. It has
** not been replaced within the function because a double
conversion 'reduces'
** the color space. See the following example:
** \code
@@ -112,7 +112,7 @@
/*! Conversion from N-RGB to XYZ color space.
**
- ** \obsolete A composition should be performed with nrgb->rgb and
rgb->xyz.
+ ** \deprecated A composition should be performed with nrgb->rgb and
rgb->xyz.
**
** \see f_nrgb_to_xyz for more information.
*/
@@ -127,7 +127,7 @@
/*! Functor for conversion from XYZ to N-RGB color space.
**
- ** \obsolete A composition should be performed with xyz->rgb and
rgb->nrgb.
+ ** \deprecated A composition should be performed with xyz->rgb and
rgb->nrgb.
**
** \see f_nrgb_to_xyz for more information.
*/
@@ -162,7 +162,7 @@
/*! Conversion from XYZ to N-RGB color space.
**
- ** \obsolete a composition should be performed with xyz->rgb and
rgb->nrgb.
+ ** \deprecated a composition should be performed with xyz->rgb and
rgb->nrgb.
**
** \see f_nrgb_to_xyz for more information.
*/
Index: olena/oln/convert/stretch.hh
--- olena/oln/convert/stretch.hh Sun, 14 Mar 2004 18:21:09 +0100 palma_g
(oln/f/51_stretch.hh 1.16 640)
+++ olena/oln/convert/stretch.hh Sun, 14 Mar 2004 18:46:17 +0100
van-vl_n (oln/f/51_stretch.hh 1.16 640)
@@ -92,7 +92,7 @@
/*! Stretch the value of an image.
**
** This function stretches values between \a min_in and \a max_in
- ** of an image \in, to a range that goes from \a min_out to \a max_out.
+ ** of an image \a in, to a range that goes from \a min_out to \a
max_out.
** \arg in Input image, must be have scalar values
** \arg min_in Lower bound of the range in the input. All values
smaller
** than min_in are converted to \a min_out.
Index: olena/oln/level/cc.hh
--- olena/oln/level/cc.hh Sun, 14 Mar 2004 18:21:09 +0100 palma_g
(oln/e/20_cc.hh 1.11.1.11 640)
+++ olena/oln/level/cc.hh Sun, 14 Mar 2004 18:47:51 +0100 van-vl_n
(oln/e/20_cc.hh 1.11.1.11 640)
@@ -61,7 +61,7 @@
** the connected components.
**
** It removes the small (in area) connected components of the upper
- ** level sets of \var{input} using \var{se} as structural element.
+ ** level sets of \a input using \a se as structural element.
**
** \ref The implementation uses front propagation.
**
Index: olena/oln/morpho/gradient.inc
--- olena/oln/morpho/gradient.inc Sun, 14 Mar 2004 18:21:09 +0100
palma_g (oln/43_gradient.i 1.15 640)
+++ olena/oln/morpho/gradient.inc Sun, 14 Mar 2004 18:51:26 +0100
van-vl_n (oln/43_gradient.i 1.15 640)
@@ -201,7 +201,7 @@
** IMG_OUT "oln_morpho_external_gradient.pbm");
** return 0;
** }
-** \encode
+** \endcode
**
** \image html lena256_pgm.png
** \image latex lena256_pgm.png
Index: olena/oln/morpho/attribute_closing_opening.hh
--- olena/oln/morpho/attribute_closing_opening.hh Sun, 14 Mar 2004
18:21:09 +0100 palma_g (oln/q/49_attribute_ 1.20 640)
+++ olena/oln/morpho/attribute_closing_opening.hh Sun, 14 Mar 2004
18:52:18 +0100 van-vl_n (oln/q/49_attribute_ 1.20 640)
@@ -30,9 +30,7 @@
#include <oln/morpho/attribute_union_find.hh>
-/*! \namespace oln
-** \brief oln namespace
-*/
+
namespace oln {
/*! \namespace oln::morpho
** \brief oln::morpho namespace
Index: olena/oln/morpho/attribute_union_find.hh
--- olena/oln/morpho/attribute_union_find.hh Sun, 14 Mar 2004 18:15:46
+0100 van-vl_n (oln/q/50_attribute_ 1.16 640)
+++ olena/oln/morpho/attribute_union_find.hh Sun, 14 Mar 2004 18:42:36
+0100 van-vl_n (oln/q/50_attribute_ 1.16 640)
@@ -49,7 +49,7 @@
** \param ATTRIBUTE Exact type of attribute to use.
** \param Env Type of environment to use.
**
- ** \Note FIXME: a similar class is defined in oln/topo/tarjan/union.hh
+ ** \note FIXME: a similar class is defined in oln/topo/tarjan/union.hh
** (oln::topo::tarjan::tarjan_set).
*/
template<class T, class ATTRIBUTE, class Env = attr_env_type(ATTRIBUTE)>
Index: olena/oln/topo/inter-pixel/inter-pixel.hh
--- olena/oln/topo/inter-pixel/inter-pixel.hh Sun, 14 Mar 2004 18:15:46
+0100 van-vl_n (oln/r/34_inter-pixe 1.13 640)
+++ olena/oln/topo/inter-pixel/inter-pixel.hh Sun, 14 Mar 2004 18:27:59
+0100 van-vl_n (oln/r/34_inter-pixe 1.13 640)
@@ -68,6 +68,7 @@
** // (10,11): north west south
** // (11,14): north west south
** }
+ ** \endcode
** \todo FIXME: Test the output values in the tests.
*/
template <class I>
Index: olena/oln/topo/inter-pixel/node.hh
--- olena/oln/topo/inter-pixel/node.hh Sun, 14 Mar 2004 18:15:46 +0100
van-vl_n (oln/r/46_node.hh 1.5 640)
+++ olena/oln/topo/inter-pixel/node.hh Sun, 14 Mar 2004 18:43:28 +0100
van-vl_n (oln/r/46_node.hh 1.5 640)
@@ -67,7 +67,7 @@
data_[i] = true;
}
- /// Return true if the direction \i joins the node.
+ /// Return true if the direction \a i joins the node.
bool
get(dir_type i) const
{
Index: olena/oln/core/abstract/image_with_dim.hh
--- olena/oln/core/abstract/image_with_dim.hh Thu, 11 Mar 2004 20:19:51
+0100 thivol_d (oln/t/26_image_with 1.20 600)
+++ olena/oln/core/abstract/image_with_dim.hh Sun, 14 Mar 2004 18:30:27
+0100 van-vl_n (oln/t/26_image_with 1.20 600)
@@ -151,11 +151,7 @@
namespace abstract {
- /*! \class image_with_dim<1, Exact>: virtual public image<Exact>
- **
- ** The specialized version for image1d.
- */
-
+ /// The specialized version for image1d.
template <class Exact>
class image_with_dim<1, Exact>: virtual public image<Exact>
{
@@ -280,12 +276,7 @@
- /*! \class image_with_dim<2, Exact>: virtual public image<Exact>
- **
- ** The specialized version for image2d.
- */
-
-
+ /// The specialized version for image2d.
template <class Exact>
class image_with_dim<2, Exact>: virtual public image<Exact>
{
@@ -423,10 +414,7 @@
}; // end of bi-dimensional specialization
- /*! \class image_with_dim<3, Exact>: virtual public image<Exact>
- **
- ** The specialized version for image3d.
- */
+ /// The specialized version for image3d.
template <class Exact>
class image_with_dim<3, Exact>: virtual public image<Exact>
Index: olena/oln/core/impl/image_impl.hh
--- olena/oln/core/impl/image_impl.hh Fri, 12 Mar 2004 20:17:58 +0100
thivol_d (oln/t/29_image_impl 1.17 640)
+++ olena/oln/core/impl/image_impl.hh Sun, 14 Mar 2004 18:41:06 +0100
van-vl_n (oln/t/29_image_impl 1.17 640)
@@ -111,7 +111,7 @@
return this->exact().at_(p);
}
- /// Return a reference to the value stored at \p.
+ /// Return a reference to the value stored at \a p.
value_type&
at(const point_type& p)
Index: olena/oln/morpho/attributes.hh
--- olena/oln/morpho/attributes.hh Fri, 12 Mar 2004 13:29:59 +0100
palma_g (oln/j/45_attributes 1.7 644)
+++ olena/oln/morpho/attributes.hh Sun, 14 Mar 2004 18:26:35 +0100
van-vl_n (oln/j/45_attributes 1.7 644)
@@ -183,9 +183,9 @@
};
/*!
- ** \brief < operator
+ ** \brief "<" operator
**
- ** This is a static dispatcher for the < operator.
+ ** This is a static dispatcher for the "<" operator.
** This method is abstract.
*/
bool operator<(const lambda_type &lambda) const
@@ -282,9 +282,9 @@
};
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
- ** This is an implementation of the < operator. Override this
+ ** This is an implementation of the "<" operator. Override this
** method to provide a new implementation of this operator.
** \warning This method SHOULDN'T be called.
*/
@@ -443,7 +443,7 @@
};
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
** This is an implementation of the += operator. Override this
** method to provide a new implementation of this operator.
@@ -693,7 +693,7 @@
};
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
** This is an implementation of the += operator. Override this
** method to provide a new implementation of this operator.
@@ -811,7 +811,7 @@
};
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
** This is an implementation of the += operator. Override this
** method to provide a new implementation of this operator.
@@ -927,7 +927,7 @@
};
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
** This is an implementation of the += operator. Override this
** method to provide a new implementation of this operator.
@@ -1088,7 +1088,7 @@
};
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
** This is an implementation of the += operator. Override this
** method to provide a new implementation of this operator.
@@ -1239,7 +1239,7 @@
};
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
** This is an implementation of the += operator. Override this
** method to provide a new implementation of this operator.
@@ -1408,7 +1408,7 @@
}
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
** This is an implementation of the += operator. Override this
** method to provide a new implementation of this operator.
@@ -1567,7 +1567,7 @@
}
/*!
- ** \brief < operator implementation.
+ ** \brief "<" operator implementation.
**
** This is an implementation of the += operator. Override this
** method to provide a new implementation of this operator.
Index: olena/oln/utils/special_points.hh
--- olena/oln/utils/special_points.hh Sat, 13 Mar 2004 21:28:08 +0100
van-vl_n (oln/j/50_special_po 1.2 644)
+++ olena/oln/utils/special_points.hh Sun, 14 Mar 2004 18:28:50 +0100
van-vl_n (oln/j/50_special_po 1.2 644)
@@ -33,7 +33,7 @@
namespace oln {
namespace utils {
- /// oln::utils::internal
+
namespace internal {
/*! Creates a point that is used as a state.
*
2
2
The following message is a courtesy copy of an article
that has been posted to epita.cours.compile as well.
2004-03-16 Akim Demaille <akim(a)epita.fr>
* assignments.texi (Documentation Style): Document
flyspell-prog-mode, Doxygen limitations (capitalization of
sentences), and namespace documentation location.
--- /home/akim/www/compil/assignments.txt 2004-03-16 09:13:35.000000000 +0100
+++ assignments.txt 2004-03-16 10:16:23.000000000 +0100
@@ -1565,6 +1565,26 @@
2.3.7 Documentation Style
-------------------------
+ -- Rule: Write correct English
+ Nowadays most editors provide interactive spell checking including for
+ programs (strings and comments). For instance, see `flyspell-mode' in
+ Emacs, and in particular the `flyspell-prog-mode'. To trigger it
+ automatically, install the following in your `~/.emacs.el':
+
+ (add-hook 'c-mode-hook 'flyspell-prog-mode 1)
+ (add-hook 'c++-mode-hook 'flyspell-prog-mode 1)
+ (add-hook 'cperl-mode-hook 'flyspell-prog-mode 1)
+ (add-hook 'sh-mode-hook 'flyspell-prog-mode 1)
+ (add-hook 'makefile-mode-hook 'flyspell-prog-mode 1)
+
+ and so forth.
+
+ End comments with a period.
+
+ For documentation as for any other kind of writing, the shorter, the
+ better: hunt useless words. *Note The Elements of Style::, for an
+ excellent set of writing guidelines.
+
-- Rule: Use the Imperative
Use the imperative when documenting, as if you were giving order to the
function or entity you are describing. When describing a function,
@@ -1581,7 +1601,7 @@
/// Swap the two references and return the first.
ref& swap (ref& other);
- The same rules apply to writing ChangeLogs.
+ The same rules apply to ChangeLogs.
-- Rule: Use `rebox.el' to markup paragraphs
Often one wants to leave a clear markup to separate different matters.
@@ -1599,13 +1619,28 @@
| Comments end with a period. |
`-----------------------------*/
- -- Rule: Prefer Doxygen Documentation to plain comments
- We use Doxygen (*note Doxygen::) to maintain the developer
- documentation of the Tiger Compiler.
-
-- Rule: Write Documentation in Doxygen
- Documentation is a genuine part of programming, just as testing. The
- quality of this documentation can change the grade.
+ Documentation is a genuine part of programming, just as testing. We
+ use Doxygen (*note Doxygen::) to maintain the developer documentation
+ of the Tiger Compiler. The quality of this documentation can change
+ the grade.
+
+ Beware that Doxygen puts the first letter of the documentation in upper
+ case. As a result,
+
+ /// \file ast/arrayexp.hh
+ /// \brief ast::ArrayExp declaration.
+
+ will not work properly, since `ast::ArrayExp' will be transformed into
+ `Ast::ArrayExp' by Doxygen, which will not be recognized as an entity
+ name. As a workaround, write the slightly longer:
+
+ /// \file ast/arrayexp.hh
+ /// \brief Declaration of ast::ArrayExp.
+
+ -- Rule: Document namespaces in `lib*.hh' files
+ -- Rule: Document classes in their `*.hh' file
+ There must be a single location, that's our standard.
-- Rule: Use `\directive'
Prefer backslash (`\') to the commercial at (`@') to specify
1
0
Index: doc/ChangeLog
from Giovanni Palma <giovanni(a)lrde.epita.fr>
* ref/doxygen.config.in: Change some flags.
* ref/Makefile.am: Correct pdf generation.
Index: doc/ref/Makefile.am
--- doc/ref/Makefile.am Sun, 14 Mar 2004 18:21:09 +0100 palma_g (oln/d/51_Makefile.a 1.27.1.13 600)
+++ doc/ref/Makefile.am Mon, 15 Mar 2004 16:42:54 +0100 palma_g (oln/d/51_Makefile.a 1.27.1.13 640)
@@ -24,7 +24,8 @@
$(TAR) -czf $@ html
oln-ref.pdf: doxy
- cd latex && make && cp refman.pdf ../$@
+ make -C ./latex || echo "Discarding problems..." # FIXME: Find a better way to use large graph with pdflatex.
+ cp latex/refman.pdf ./$@
dist_noinst_DATA = oln-ref.pdf html.tar.gz $(srcdir)/exdoc.pl $(srcdir)/img_conv.pl
Index: doc/ref/doxygen.config.in
--- doc/ref/doxygen.config.in Tue, 24 Feb 2004 16:33:38 +0100 palma_g (oln/v/29_doxygen.co 1.2 600)
+++ doc/ref/doxygen.config.in Mon, 15 Mar 2004 16:33:16 +0100 palma_g (oln/v/29_doxygen.co 1.2 644)
@@ -122,7 +122,7 @@
LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
-LATEX_BATCHMODE = NO
+LATEX_BATCHMODE = YES
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
@@ -184,7 +184,7 @@
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
+HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
@@ -211,4 +211,3 @@
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
-EXT_DOC_PATHS =
--
Giovanni Palma
EPITA - promo 2005 - membre d'EpX - LRDE
Mob. : +33 (0)6 60 97 31 74
1
0
Il existe un newsgroup lrde.olena.patches, et c'est là que devraient
être postés les patches.
1
0
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/arith/internal/opdecls.hh
* olena/oln/arith/logic.hh
* olena/oln/arith/ops.hh
* olena/oln/math/macros.hh
* olena/oln/config/pconf-hh.in
+2004-03-13 Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/convert/basics.hh: Add comments.
* olena/oln/convert/bound.hh: Likewise.
* olena/oln/convert/abstract/colorconv.hh: Likewise.
Index: olena/oln/arith/internal/opdecls.hh
--- olena/oln/arith/internal/opdecls.hh Fri, 07 Nov 2003 17:26:19 +0100
burrus_n (oln/b/22_opdecls.hh 1.15 640)
+++ olena/oln/arith/internal/opdecls.hh Sat, 13 Mar 2004 17:49:35 +0100
van-vl_n (oln/b/22_opdecls.hh 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
@@ -28,27 +28,31 @@
#ifndef OLENA_ARITH_INTERNAL_OPDECLS_HH
# define OLENA_ARITH_INTERNAL_OPDECLS_HH
-/*
- These macros should be rewritten / split into real code to make
- things clearer.
-
- Operations are defined between two images and between one image and
- one constant value (with the cst suffix).
-
- The two main components are:
-
- 1) Define functors for each operations, taking two values and
- returning the result.
-
- 2) Define front-end functions applying a functor on the whole image.
- 3 versions are defined, leaving the possibility to specify the
- return type automatically, manually or using a conversion (from
- convert).
+/*! \file opdecls.hh
+**
+** Operations are defined between two images and between one image and
+** one constant value (with the cst suffix).
+** The two main components are:
+** \n
+** 1) Define functors for each operations, taking two values and
+** returning the result.
+**\n
+** 2) Define front-end functions applying a functor on the whole image.
+** 3 versions are defined, leaving the possibility to specify the
+** return type automatically, manually or using a conversion (from
+** convert).
+**
+** \todo FIXME: These macros should be rewritten / split into real code
to make
+** things clearer.
*/
-/*------------------.
-| Binary functors. |
-`------------------*/
+/*! Binary functors.
+**
+** Produce a functor named f_##OPNAME using the code OPCODE.
+**
+** \arg OPNAME Will produce the name of the function
+** \arg OPCODE Operation that may use \a val1 and \a val2
+*/
# define oln_arith_declare_binrecval_functor_(OPNAME, OPCODE) \
template<class T1, class T2, class Ret> \
@@ -70,8 +74,16 @@
: public f_##OPNAME< T1, T2, ntg_return_type(OPNAME, T1, T2) > \
{} /* no ; */
-// Functor used by operations between an image and a constant
+
+/*! Unary functor, using a constant.
+**
+** Produce a functor named f_##OPNAME using the code OPCODE. The object
+** is constructed using a constant.
+**
+** \arg OPNAME Will produce the name of the function
+** \arg OPCODE_CST Operation that may use \a val1 and \a cst_
+*/
# define oln_arith_declare_binrecvalcst_functor_(OPNAME, OPCODE_CST) \
template<class T1, class T2, class Ret> \
struct f_##OPNAME##_cst : std::unary_function<const T1&, \
@@ -89,12 +101,25 @@
T2 cst_; \
} /* no ; */
-/* Both the above. */
+
+/*! Produces an unary function and a binary and a Unary Functor using a
constant.
+**
+** \arg OPNAME Will produce the name of the function.
+** \arg OPCODE Operation that may use \a val1 and \a val2.
+** \arg OPCODE_CST Operation that may use \a val1 and \a cst_.
+** \see oln_arith_declare_binrecval_functor_
+** \see oln_arith_declare_binrecvalcst_functor_
+*/
# define oln_arith_declare_binrecval_functors_(OPNAME, OPCODE,
OPCODE_CST) \
oln_arith_declare_binrecval_functor_(OPNAME, OPCODE); \
oln_arith_declare_binrecvalcst_functor_(OPNAME, OPCODE_CST)
-/* For binary functions that work on a single known datatype. */
+/*! For binary functions that work on a single known datatype.
+**
+** \arg OPNAME Will produce the name of the function.
+** \arg OPCODE Operation that may use \a val1 and \a val2.
+** \arg TYPE Type that can be used.
+*/
# define oln_arith_declare_binfixedtype_functor_(OPNAME, OPCODE,
TYPE) \
struct f_##OPNAME : std::binary_function< const TYPE&, const
TYPE&, TYPE> \
{ \
@@ -106,7 +131,12 @@
} \
} /* no ; */
-/* For binary functions that work on a single known datatype. */
+/*! For Binary functions that work on a single known datatype.
+**
+** \arg OPNAME Will produce the name of the function.
+** \arg OPCODE_CST Operation that may use \a val1 and \a cst_
+** \arg TYPE Type that can be used.
+*/
# define oln_arith_declare_binfixedtypecst_functor_(OPNAME,
OPCODE_CST, TYPE) \
struct f_##OPNAME##_cst: std::unary_function<const TYPE, TYPE> \
{ \
@@ -121,12 +151,13 @@
TYPE cst_; \
} /* no ; */
-/* Both the above. */
+/*! oln_arith_declare_binfixedtype_functor_ &
oln_arith_declare_binfixedtypecst_functor_.
+*/
# define oln_arith_declare_binfixedtype_functors_(NAME, TYPE, CODE,
CODE_CST) \
oln_arith_declare_binfixedtype_functor_(NAME, CODE, TYPE); \
oln_arith_declare_binfixedtypecst_functor_(NAME, CODE_CST, TYPE)
-// Shortcuts
+/// Shortcut
#define default_functor_return_type_(OPNAME, I1, I2) \
typename f_##OPNAME<oln_value_type(I1), \
oln_value_type(I2), \
@@ -134,6 +165,7 @@
oln_value_type(I1), \
oln_value_type(I2))>::result_type
+/// Shortcut.
#define default_functor_type_cst_(OPNAME, I1, T2) \
f_##OPNAME##_cst<oln_value_type(I1), \
T2, \
@@ -141,13 +173,11 @@
oln_value_type(I1), \
T2)>
+/// Shortcut.
#define default_functor_return_type_cst_(OPNAME, I1, T2) \
typename default_functor_type_cst_(OPNAME, I1, T2)::result_type
-/*----------------------------.
-| Declare front-end functions |
-`----------------------------*/
-
+/// Declare front-end functions.
# define oln_arith_declare_binop_procs_(OPNAME) \
/* \
FIXME: this is a workaround for an odd bug of icc and como \
@@ -203,8 +233,8 @@
input1, input2); \
}
+/// Apply OPNAME with a constant as second operand.
# define oln_arith_declare_binopcst_procs_(OPNAME) \
- /* Apply OPNAME with a constant as second operand. */ \
\
/* FIXME: cf explications above */ \
template <class I, class T> \
@@ -243,8 +273,7 @@
oln_arith_declare_binop_procs_(OPNAME) \
oln_arith_declare_binopcst_procs_(OPNAME)
-/* Same as oln_arith_declare_nongenericbinop_procs_ but for non template
- functors. */
+/// Same as oln_arith_declare_nongenericbinop_procs_ but for non
template functors.
# define oln_arith_declare_nongenericbinop_procs_(OPNAME) \
/* Standard application of OPNAME */ \
template<class I1, class I2> inline \
@@ -267,8 +296,9 @@
/* Same as oln_arith_declare_nongenericbinopcst_procs_ but for non
template functors. */
+
+/// Apply OPNAME with a constant as second operand.
# define oln_arith_declare_nongenericbinopcst_procs_(OPNAME) \
- /* Apply OPNAME with a constant as second operand. */ \
template<class I, class T> inline \
typename mute<I, typename f_##OPNAME##_cst::result_type>::ret \
OPNAME##_cst(const abstract::image<I>& input, T val) \
@@ -298,7 +328,7 @@
| Unary functions. |
`------------------*/
-/* For binary functions that work on a single known datatype. */
+/*! Unary function for binary functions that work on a single known
datatype. */
# define oln_arith_declare_unfixedtype_functor_(OPNAME, TYPE, OPCODE) \
struct f_##OPNAME : std::unary_function< const TYPE&, TYPE> \
{ \
Index: olena/oln/arith/logic.hh
--- olena/oln/arith/logic.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/b/24_logic.hh 1.6.1.3 640)
+++ olena/oln/arith/logic.hh Sat, 13 Mar 2004 17:47:54 +0100 van-vl_n
(oln/b/24_logic.hh 1.6.1.3 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,25 +38,33 @@
namespace arith {
- // binary operators
-
+ /// Functor AND operators.
oln_arith_declare_binfixedtype_functors_(logic_and, ntg::bin,
val1 && val2,
val && cst_);
+
+ /// Functor OR operators.
oln_arith_declare_binfixedtype_functors_(logic_or, ntg::bin,
val1 || val2,
val || cst_);
+ /// Functor AND NOT operators.
oln_arith_declare_binfixedtype_functors_(logic_and_not, ntg::bin,
val1 && ! val2,
val && ! cst_);
+ /// Functor NOT operator.
+ oln_arith_declare_unfixedtype_functor_(logic_not, ntg::bin, ! val);
+
+ /// AND NOT operators.
oln_arith_declare_all_nongenericbinop_procs_(logic_and);
+
+ /// OR operators.
oln_arith_declare_all_nongenericbinop_procs_(logic_or);
- oln_arith_declare_all_nongenericbinop_procs_(logic_and_not);
- // unary operators
+ /// AND NOT operators.
+ oln_arith_declare_all_nongenericbinop_procs_(logic_and_not);
- oln_arith_declare_unfixedtype_functor_(logic_not, ntg::bin, ! val);
+ /// NOT operator.
oln_arith_declare_nongenericunop_procs_(logic_not);
} // end of arith
Index: olena/oln/arith/ops.hh
--- olena/oln/arith/ops.hh Wed, 08 Oct 2003 23:36:51 +0200 burrus_n
(oln/b/23_ops.hh 1.5.1.2.1.8 640)
+++ olena/oln/arith/ops.hh Sat, 13 Mar 2004 17:47:54 +0100 van-vl_n
(oln/b/23_ops.hh 1.5.1.2.1.8 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,6 +38,9 @@
# include <functional>
namespace oln {
+ /*!
+ ** \brief Namespace for arithmetic.
+ */
namespace arith {
oln_arith_declare_binrecval_functors_(plus,
Index: olena/oln/math/macros.hh
--- olena/oln/math/macros.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n
(oln/b/21_macros.hh 1.6.1.11 640)
+++ olena/oln/math/macros.hh Sat, 13 Mar 2004 17:53:02 +0100 van-vl_n
(oln/b/21_macros.hh 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
@@ -33,18 +33,19 @@
namespace oln {
+ /*! \namespace oln:math
+ ** useful functions.
+ **
+ ** \note FIXME: I'm not proud of the code below
+ ** think it could be better...
+ **
+ ** \todo FIXME: this code sounds really odd. Why does the operator()
+ ** take value<Self> instead of Self directly ?
+ ** FIXME: Self should be renamed into Exact.
+ */
namespace math {
- // FIXME: I'm not proud of the code below
- // I think it could be better...
-
- // FIXME: this code sounds really odd. Why does the operator()
- // take value<Self> instead of Self directly ?
-
- // FIXME: Self should be renamed into Exact.
-
- // sqr
-
+ //! \brief Square fctor.
template<class T>
struct f_sqr
{
@@ -55,6 +56,7 @@
}
};
+ //! Square function.
template<class T>
const T sqr(const T& val)
{
@@ -62,8 +64,7 @@
return f(val);
}
- // abs
-
+ //! Absolute value fctor.
template<class T>
struct f_abs
{
@@ -76,6 +77,7 @@
}
};
+ //! Absolute value function.
template<class T>
const T
abs(const T& val)
Index: olena/oln/config/pconf-hh.in
--- olena/oln/config/pconf-hh.in Sun, 19 Jan 2003 22:14:38 +0100 raph
(oln/p/17_pconf-hh.i 1.1 640)
+++ olena/oln/config/pconf-hh.in Sat, 13 Mar 2004 17:51:06 +0100
van-vl_n (oln/p/17_pconf-hh.i 1.1 640)
@@ -1,11 +1,11 @@
-/* Define to the address where bug reports for this package should be
sent. */
+/*! Define to the address where bug reports for this package should be
sent. */
#define OLN_PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
-/* Define to the full name of this package. */
+/*! Define to the full name of this package. */
#define OLN_PACKAGE_NAME "@PACKAGE_NAME@"
-/* Define to the full name and version of this package. */
+/*! Define to the full name and version of this package. */
#define OLN_PACKAGE_STRING "@PACKAGE_STRING@"
-/* Define to the version of this package. */
+/*! Define to the version of this package. */
#define OLN_PACKAGE_VERSION "@PACKAGE_VERSION@"
2
2
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/convert/basics.hh: Add comments.
* olena/oln/convert/bound.hh: Likewise.
* olena/oln/convert/abstract/colorconv.hh: Likewise.
* olena/oln/convert/conversion.hh: Likewise.
* olena/oln/convert/conversion_ng_se.hh: Likewise.
* olena/oln/convert/force.hh: Likewise.
* olena/oln/convert/nrgbxyz.hh: Likewise.
* olena/oln/convert/rgbnrgb.hh: Likewise.
* olena/oln/convert/rgbxyz.hh: Likewise.
* olena/oln/convert/abstract/conversion.hh: Likewise.
* olena/oln/convert/cast.hh: Likewise.
* olena/oln/convert/rgbhsv.hh: Likewise.
* olena/oln/convert/rgbhsl.hh: Likewise.
* olena/oln/convert/rgbhsi.hh: Likewise.
* olena/oln/convert/rgbyuv.hh: Likewise.
* olena/oln/convert/rgbyiq.hh: Likewise.
* olena/oln/convert/value_to_point.hh: Likewise.
* olena/oln/convert/stretch.hh: Fix bug.
+2004-03-13 Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/convert/stretch.hh: Add stretch_balance. Add comments.
2004-03-12 Damien Thivolle <damien(a)lrde.epita.fr>
Index: olena/oln/convert/basics.hh
--- olena/oln/convert/basics.hh Fri, 07 Nov 2003 17:26:19 +0100 burrus_n
(oln/23_basics.hh 1.6 640)
+++ olena/oln/convert/basics.hh Sat, 13 Mar 2004 17:12:58 +0100 van-vl_n
(oln/23_basics.hh 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
Index: olena/oln/convert/bound.hh
--- olena/oln/convert/bound.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/22_bound.hh 1.10 640)
+++ olena/oln/convert/bound.hh Sat, 13 Mar 2004 17:07:14 +0100 van-vl_n
(oln/22_bound.hh 1.10 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,9 +35,10 @@
namespace oln {
namespace convert {
- // FIXME: is this really useful with new types ?
-
- /* Like convert::force, but with saturation. */
+ /*! Like convert::force, but with saturation.
+ **
+ ** \note FIXME: is this really useful with new types ?
+ */
template<class Output, class Exact = mlc::final>
struct bound : public abstract::conversion_to_type< Output,
typename mlc::exact_vt<bound<Output, Exact>, Exact>::ret >
{
Index: olena/oln/convert/abstract/colorconv.hh
--- olena/oln/convert/abstract/colorconv.hh Thu, 31 Jul 2003 17:33:04
+0200 reda (oln/18_colorconv. 1.10 640)
+++ olena/oln/convert/abstract/colorconv.hh Sat, 13 Mar 2004 17:38:05
+0100 van-vl_n (oln/18_colorconv. 1.10 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,6 +37,16 @@
namespace abstract {
+ /*! Base class for color conversion.
+ **
+ ** \param icomps Number of components in the input.
+ ** \param iqbits Number of bits per components in the input.
+ ** \param icolor Input color.
+ ** \param ocomps Number of components in the output.
+ ** \param oqbits Number of bits per components in the output.
+ ** \param ocolor Output color.
+ ** \param Exact Exact class.
+ */
template< unsigned icomps,
unsigned iqbits,
template<unsigned> class icolor,
Index: olena/oln/convert/conversion.hh
--- olena/oln/convert/conversion.hh Thu, 07 Aug 2003 02:08:21 +0200
david (oln/21_conversion 1.16 640)
+++ olena/oln/convert/conversion.hh Sat, 13 Mar 2004 17:12:22 +0100
van-vl_n (oln/21_conversion 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
@@ -36,21 +36,31 @@
# include <functional>
namespace oln {
+ /*!
+ ** \brief Namespace for conversion (for example cast, color, or
neighborhood to window).
+ */
namespace convert {
- /* ConvOutput queries the output type of conversion ConvType for
- an input of type InputType. This comes handy when computing
- the return type of a function which takes a conversion function
- in argument. */
+ /*! Trait that returns the output of a conversion.
+ **
+ ** convoutput queries the output type of conversion ConvType for
+ ** an input of type InputType. This comes handy when computing
+ ** the return type of a function which takes a conversion function
+ ** in argument.
+ **
+ ** \note convoutput is exported in the namespace oln for convenience.
+ */
template<class ConvType, class Base, class InputType>
struct convoutput
{
typedef typename abstract::conversion<ConvType, Base>::template
output<InputType>::ret ret;
};
+ /// namespace internal, should not be used by end user.
namespace internal {
- /* Compose a conversion C and an adaptable unary function UF,
- producing an adaptable unary function. */
+ /*! Compose a conversion C and an adaptable unary function UF,
+ ** producing an adaptable unary function.
+ */
template <class C, class UF>
struct compconv1_ :
public std::unary_function <typename UF::argument_type,
@@ -72,8 +82,9 @@
const UF func_;
};
- /* Compose a conversion C and an adaptable binary function BF,
- producing an adaptable binary function. */
+ /*! Compose a conversion C and an adaptable binary function BF,
+ ** producing an adaptable binary function.
+ */
template <class C, class BF>
struct compconv2_ :
public std::binary_function <typename BF::first_argument_type,
@@ -99,8 +110,9 @@
} // end of internal
- /* Friendly procedure that build an internal::compconv1_ with
- type deduction. */
+ /*! Friendly procedure that build an internal::compconv1_ with
+ ** type deduction.
+ */
template <class C, class B, class UF>
internal::compconv1_<C, UF>
compconv1(const abstract::conversion<C, B>& conv, const UF &func)
@@ -108,7 +120,7 @@
return internal::compconv1_<C, UF>(conv.exact(), func);
}
- /* Likewise for compconv2_. */
+ /*! Likewise for compconv2_. */
template <class C, class B, class BF>
internal::compconv2_<C, BF>
compconv2(const abstract::conversion<C, B>& conv, const BF &func)
@@ -117,9 +129,12 @@
}
- /* The core oln::apply function, cannot apply all conversion function,
- because they do not all define result_type. So we define another
- apply function here, to apply conversions. */
+ /*! Apply function that retrive the result type within the
conversion class.
+ **
+ ** The core oln::apply function, cannot apply all conversion function,
+ ** because they do not all define result_type. So we define another
+ ** apply function here, to apply conversions.
+ */
template<class C, class B, class I> inline
typename mute<I, typename convoutput<C, B,
oln_value_type(I)>::ret>::ret
apply(const abstract::conversion<C, B>& conv, const
oln::abstract::image<I>& input)
Index: olena/oln/convert/conversion_ng_se.hh
--- olena/oln/convert/conversion_ng_se.hh Thu, 07 Aug 2003 02:08:21
+0200 david (oln/e/24_conversion 1.11 640)
+++ olena/oln/convert/conversion_ng_se.hh Sat, 13 Mar 2004 17:07:14
+0100 van-vl_n (oln/e/24_conversion 1.11 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2002 EPITA Research and Development Laboratory
+// Copyright (C) 2002, 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,7 +40,10 @@
namespace oln {
namespace convert {
-
+ /*! Convert a neighborhood to a window.
+ **
+ ** \see ng_to_cse
+ */
template<class N>
typename oln::abstract::neighborhood<N>::win_type
ng_to_se(const oln::abstract::neighborhood<N>& Ng)
@@ -52,6 +55,10 @@
return output;
}
+ /*! Convert a neighborhood to a window and add the center.
+ **
+ ** \see ng_to_cs
+ */
template<class N>
typename oln::abstract::neighborhood<N>::win_type
ng_to_cse(const oln::abstract::neighborhood<N>& Ng)
Index: olena/oln/convert/force.hh
--- olena/oln/convert/force.hh Fri, 07 Nov 2003 17:26:19 +0100 burrus_n
(oln/20_force.hh 1.12 640)
+++ olena/oln/convert/force.hh Sat, 13 Mar 2004 17:07:14 +0100 van-vl_n
(oln/20_force.hh 1.12 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,7 +35,7 @@
namespace oln {
namespace convert {
- /* Like cast::force, but as a conversion functor. */
+ /*! Like cast::force, but as a conversion functor. */
template<class Output, class Exact = mlc::final>
struct force : public abstract::conversion_to_type< Output,
typename mlc::exact_vt<force<Output, Exact>, Exact>::ret >
{
Index: olena/oln/convert/nrgbxyz.hh
--- olena/oln/convert/nrgbxyz.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/16_nrgbxyz.hh 1.12 640)
+++ olena/oln/convert/nrgbxyz.hh Sat, 13 Mar 2004 17:11:38 +0100
van-vl_n (oln/16_nrgbxyz.hh 1.12 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,19 +37,47 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
+/*! \file nrgbxyz.hh
+**
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
+ // FIXME: should it be removed?
using namespace ntg;
namespace convert {
- /*!
- ** obsolete a composition should be performed with nrgb->rgb and
rgb->xyz
+ /*! Functor for conversion from N-RGB to XYZ color space.
+ **
+ ** \obsolete A composition should be performed with nrgb->rgb and
rgb->xyz. It has
+ ** not been replaced within the function because a double
conversion 'reduces'
+ ** the color space. See the following example:
+ ** \code
+ ** // Obsolete:
+ ** //
+ ** // #include <oln/convert/nrgbxyz.hh>
+ ** // #include <ntg/all.hh>
+ ** // int main(int argc, char **argv)
+ ** // {
+ ** // ntg::nrgb_8 in(100, 60, 64);
+ ** // ntg::xyz_8 out = oln::convert::f_nrgb_to_xyz<8, 8>()(in);
+ ** // }
+ ** //
+ ** // Should be replaced by:
+ ** //
+ ** #include <oln/convert/rgbxyz.hh>
+ ** #include <oln/convert/rgbnrgb.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** ntg::nrgb_8 in(100, 60, 64);
+ ** ntg::xyz_8 out = oln::convert::f_rgb_to_xyz<8, 8>()
+ ** (oln::convert::f_nrgb_to_rgb<8, 8>()(in));
+ ** }
+ ** \endcode
*/
template <unsigned inbits, unsigned outbits>
struct f_nrgb_to_xyz
@@ -82,6 +110,12 @@
}
};
+ /*! Conversion from N-RGB to XYZ color space.
+ **
+ ** \obsolete A composition should be performed with nrgb->rgb and
rgb->xyz.
+ **
+ ** \see f_nrgb_to_xyz for more information.
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, xyz_traits>
nrgb_to_xyz(const color<3, inbits, nrgb_traits>& v)
@@ -91,8 +125,11 @@
return f(v);
}
- /*!
- ** obsolete a composition should be performed with xyz->rgb and
rgb->nrgb
+ /*! Functor for conversion from XYZ to N-RGB color space.
+ **
+ ** \obsolete A composition should be performed with xyz->rgb and
rgb->nrgb.
+ **
+ ** \see f_nrgb_to_xyz for more information.
*/
template<unsigned inbits, unsigned outbits>
struct f_xyz_to_nrgb
@@ -122,6 +159,13 @@
}
};
+
+ /*! Conversion from XYZ to N-RGB color space.
+ **
+ ** \obsolete a composition should be performed with xyz->rgb and
rgb->nrgb.
+ **
+ ** \see f_nrgb_to_xyz for more information.
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, nrgb_traits>
xyz_to_nrgb(const color<3, inbits, xyz_traits>& v)
Index: olena/oln/convert/rgbnrgb.hh
--- olena/oln/convert/rgbnrgb.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/17_rgbnrgb.hh 1.11 640)
+++ olena/oln/convert/rgbnrgb.hh Sat, 13 Mar 2004 17:10:08 +0100
van-vl_n (oln/17_rgbnrgb.hh 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
@@ -37,10 +37,10 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
+/*! \file rgbnrgb.hh
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
@@ -48,6 +48,10 @@
namespace convert {
+ /*! Functor for conversion from RGB to N-RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_nrgb
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -76,6 +80,10 @@
}
};
+ /*! Conversion from RGB to N-RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, nrgb_traits>
rgb_to_nrgb(const color<3, inbits, rgb_traits>& v)
@@ -85,6 +93,10 @@
return f(v);
}
+ /*! Functor for conversion from N-RGB to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
struct f_nrgb_to_rgb
: public abstract::color_conversion<3, inbits, nrgb_traits,
@@ -113,6 +125,10 @@
}
};
+ /*! Conversion from N-RGB to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
nrgb_to_rgb(const color<3, inbits, nrgb_traits>& v)
Index: olena/oln/convert/rgbxyz.hh
--- olena/oln/convert/rgbxyz.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/19_rgbxyz.hh 1.12 640)
+++ olena/oln/convert/rgbxyz.hh Sat, 13 Mar 2004 17:07:15 +0100 van-vl_n
(oln/19_rgbxyz.hh 1.12 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,10 +37,11 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
+/*! \file rgbxyz.hh
+**
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
@@ -48,6 +49,10 @@
namespace convert {
+ /* Functor for conversion from RGB to XYZ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
struct f_rgb_to_xyz
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -73,6 +78,11 @@
}
};
+
+ /* Conversion from RGB to XYZ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, xyz_traits>
rgb_to_xyz(const color<3, inbits, rgb_traits>& v)
@@ -82,6 +92,10 @@
return f(v);
}
+ /* Functor for conversion from XYZ to RGB
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
struct f_xyz_to_rgb
: public abstract::color_conversion<3, inbits, xyz_traits,
@@ -110,6 +124,10 @@
}
};
+ /* Functor for conversion from RGB to XYZ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
xyz_to_rgb(const color<3, outbits, xyz_traits>& v)
Index: olena/oln/convert/stretch.hh
--- olena/oln/convert/stretch.hh Sat, 13 Mar 2004 17:04:01 +0100
van-vl_n (oln/f/51_stretch.hh 1.14 640)
+++ olena/oln/convert/stretch.hh Sat, 13 Mar 2004 17:30:38 +0100
van-vl_n (oln/f/51_stretch.hh 1.14 640)
@@ -36,6 +36,8 @@
# include <set>
+# include <vector>
+
namespace oln {
namespace convert {
@@ -143,9 +145,9 @@
** = oln::level::frontp_connected_component<ntg::int_u8>(light,
** oln::neighb_c8(),
** card);
- ** oln::io::save(cc, "oln_convert_stretch_dark.pgm");
+ ** oln::io::save(cc, IMG_OUT "oln_convert_stretch_dark.pgm");
** oln::io::save(oln::convert::stretch_balance<ntg::int_u8>(cc),
- ** "oln_convert_stretch_balance.pgm");
+ ** IMG_OUT "oln_convert_stretch_balance.pgm");
** }
** \endcode
** \image html face_se.png
@@ -173,7 +175,8 @@
typename mute<I, DestValue>::ret out(in.size());
//FIXME: I would like to remove the static_cast.
- ntg_cumul_type(DestValue) tab[static_cast<int>(max_in - min_in + 1)];
+ std::vector<ntg_cumul_type(DestValue)>
+ tab(static_cast<int>(max_in - min_in + 1));
typedef typename std::set<oln_value_type(I)> set_type;
set_type s;
oln_iter_type(I) it(in);
Index: olena/oln/convert/abstract/conversion.hh
--- olena/oln/convert/abstract/conversion.hh Thu, 07 Aug 2003 02:08:21
+0200 david (oln/u/31_conversion 1.4 640)
+++ olena/oln/convert/abstract/conversion.hh Sat, 13 Mar 2004 17:14:06
+0100 van-vl_n (oln/u/31_conversion 1.4 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,6 +34,9 @@
namespace oln {
namespace convert {
+ /*!
+ ** \brief Namespace oln::convert::abstract.
+ */
namespace abstract {
// fwd_decl
@@ -51,7 +54,11 @@
template<class Conv>
struct conversion_traits;
+ /*!
+ ** Namespace oln::convert::abstract::internal, for internal usage
only.
+ */
namespace internal {
+ /// Retrieve the result type of a conversion.
template <class Base, class T>
struct output {};
@@ -73,7 +80,11 @@
} // end of namespace abstract
namespace abstract {
-
+ /*! Base class for conversion.
+ **
+ ** \note If you write an class inherited from this one, you
+ ** must write the specialization of the output trait.
+ */
template<class Exact, class Base>
struct conversion : public mlc_hierarchy::any< Exact >
{
@@ -90,6 +101,7 @@
typedef typename internal::output<Base, T>::ret ret;
};
+ /// Call the conversion written in the exact class.
template <class T>
typename output<T>::ret
operator()(const T& in) const
@@ -101,6 +113,7 @@
conversion() {}
};
+ /// Base class for the conversion to a specific type.
template<class Result_Type, class Exact = mlc::final, class Base
= mlc::final>
struct conversion_to_type :
public conversion< typename mlc::exact_vt<conversion_to_type<
Result_Type, Exact >, Exact>::ret,
@@ -128,9 +141,7 @@
conversion_to_type() {}
};
- /* If both input and output types of the conversion are fixed.
- Inherit from conversion_from_type_to_type<>. */
-
+ /// Base class if both input and output types of the conversion
are fixed.
template<class Argument_Type, class Result_Type,
class Exact = mlc::final, class Base = mlc::final>
struct conversion_from_type_to_type:
Index: olena/oln/convert/cast.hh
--- olena/oln/convert/cast.hh Fri, 07 Nov 2003 17:26:19 +0100 burrus_n
(oln/v/35_cast.hh 1.1 600)
+++ olena/oln/convert/cast.hh Sat, 13 Mar 2004 17:12:39 +0100 van-vl_n
(oln/v/35_cast.hh 1.1 600)
@@ -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,6 +34,8 @@
namespace oln {
namespace convert {
+ /*! Cast to an output.
+ */
template<class Output, class Exact = mlc::final>
struct cast : public abstract::conversion_to_type< Output,
typename mlc::exact_vt<cast<Output, Exact>, Exact>::ret >
{
Index: olena/oln/convert/rgbhsv.hh
--- olena/oln/convert/rgbhsv.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/35_rgbhsv.hh 1.1 644)
+++ olena/oln/convert/rgbhsv.hh Sat, 13 Mar 2004 17:07:15 +0100 van-vl_n
(oln/j/35_rgbhsv.hh 1.1 644)
@@ -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,9 +40,9 @@
# include <sstream>
-/*-----------------------------------------------------------------.
-| The formulas used here come from ``Color Conversion Algorithms'' |
-`-----------------------------------------------------------------*/
+/*! \file rgbhsv.hh
+** \ref The formulas used here come from ``Color Conversion Algorithms''
+*/
namespace oln {
@@ -50,6 +50,10 @@
namespace convert {
+ /*! Functor for conversion from RGB to HSV.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_hsv
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -98,6 +102,10 @@
}
};
+ /*! Conversion from RGB to HSV.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, hsv_traits>
rgb_to_hsv(const color<3, inbits, rgb_traits>& v)
@@ -106,6 +114,10 @@
return f(v);
}
+ /*! Functor conversion from HSV to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_hsv_to_rgb
: public abstract::color_conversion<3, inbits, hsv_traits,
@@ -174,6 +186,10 @@
}
};
+ /*! Conversion from HSV to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
hsv_to_rgb(const color<3, inbits, hsv_traits>& v)
Index: olena/oln/convert/rgbhsl.hh
--- olena/oln/convert/rgbhsl.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/36_rgbhsl.hh 1.1 644)
+++ olena/oln/convert/rgbhsl.hh Sat, 13 Mar 2004 17:10:46 +0100 van-vl_n
(oln/j/36_rgbhsl.hh 1.1 644)
@@ -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,15 +41,44 @@
# include <cstdlib>
# include <sstream>
-/*------------------------------------------------------------------.
-| The formulas used here come from ``Color space conversion''; Paul |
-| Bourke. |
-`------------------------------------------------------------------*/
+/*! \file rgbhsl.hh
+**
+** \ref The formulas used here come from ``Color space conversion''; Paul
+** Bourke.
+*/
namespace oln {
using namespace ntg;
namespace convert {
+ /*! Functor for conversion from RGB to HSL color space.
+ **
+ ** \note Every conversion should go though the RGB color space.
+ **
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <oln/convert/rgbhsl.hh>
+ ** #include <ntg/all.hh>
+ **
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> lena_rgb = oln::load(IMG_IN "lena.ppm");
+ **
+ ** oln::image2d<ntg::hsl_8> lena_hsl =
apply(oln::convert::f_rgb_to_hsl<8, 8>(), lena_rgb);
+ ** oln::image2d<ntg::hsl_8>::iter_type it(lena_hsl);
+ ** for_all(it)
+ ** lena_hsl[it][ntg::hsl_L] = 127;
+ **
+ ** oln::io::save(apply(oln::convert::f_hsl_to_rgb<8, 8>(), lena_hsl),
+ ** IMG_OUT "oln_convert_f_rgb_to_hsl.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena.png
+ ** \image latex lena.png
+ ** =>
+ ** \image html oln_convert_f_rgb_to_hsl.png
+ ** \image latex oln_convert_f_rgb_to_hsl.png
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_hsl
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -104,6 +133,10 @@
}
};
+ /*! Conversion from RGB to HSL color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, inbits, hsl_traits>
rgb_to_hsl(const color<3, outbits, rgb_traits>& v)
@@ -131,6 +164,10 @@
}
}
+ /*! Functor for conversion from HSL to RGB color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_hsl_to_rgb
: public abstract::color_conversion<3, inbits, hsl_traits,
@@ -171,6 +208,10 @@
}
};
+ /*! Conversion from HSL to RGB color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
hsl_to_rgb(const color<3, inbits, hsl_traits>& v)
Index: olena/oln/convert/rgbhsi.hh
--- olena/oln/convert/rgbhsi.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/37_rgbhsi.hh 1.1 644)
+++ olena/oln/convert/rgbhsi.hh Sat, 13 Mar 2004 17:07:15 +0100 van-vl_n
(oln/j/37_rgbhsi.hh 1.1 644)
@@ -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,10 +37,11 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
+/*! \file rgbhsi.hh
+**
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
@@ -52,6 +53,10 @@
static const float inv_sqrt6 = 1 / sqrt(6);
static const float inv_sqrt2 = 1 / sqrt(2);
+ /*! Functor for conversion from RGB to HSI color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_hsi
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -84,6 +89,10 @@
}
};
+ /*! Conversion from RGB to HSI color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, hsi_traits>
rgb_to_hsi(const color<3, inbits, rgb_traits>& v)
@@ -93,6 +102,10 @@
return f(v);
}
+ /*! Functor conversion from HSI to RGB color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_hsi_to_rgb
: public abstract::color_conversion<3, inbits, hsi_traits,
@@ -121,6 +134,10 @@
}
};
+ /*! Conversion from HSI to RGB color space.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
hsi_to_rgb (const color<3, inbits, hsi_traits>& v)
Index: olena/oln/convert/rgbyuv.hh
--- olena/oln/convert/rgbyuv.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/38_rgbyuv.hh 1.1 644)
+++ olena/oln/convert/rgbyuv.hh Sat, 13 Mar 2004 17:09:18 +0100 van-vl_n
(oln/j/38_rgbyuv.hh 1.1 644)
@@ -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,17 +37,20 @@
# include <sstream>
-/*---------------------------------------------------------------.
-| The formulas used here come from ``Colour Space Conversions'', |
-| IAdrian Ford and Alan Roberts; August 11,1998. |
-`---------------------------------------------------------------*/
-
+/*!\file rgbyuv.hh
+**
+** \ref The formulas used here come from ``Colour Space Conversions'',
+** IAdrian Ford and Alan Roberts; August 11,1998.
+*/
namespace oln {
using namespace ntg;
namespace convert {
-
+ /* Functor for conversion from RGB to YUV.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
struct f_rgb_to_yuv
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -75,7 +78,10 @@
s.str();
}
};
-
+ /* Conversion from RGB to YUV.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, yuv_traits>
rgb_to_yuv(const color<3, inbits, rgb_traits>& v)
@@ -84,7 +90,10 @@
return f(v);
}
-
+ /* Functor for conversion from YUV to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_yuv_to_rgb
: public abstract::color_conversion<3, inbits, yuv_traits,
@@ -111,6 +120,10 @@
}
};
+ /* Conversion from YUV to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
yuv_to_rgb(const color<3, inbits, yuv_traits>& v)
Index: olena/oln/convert/rgbyiq.hh
--- olena/oln/convert/rgbyiq.hh Thu, 22 Jan 2004 21:46:17 +0100 palma_g
(oln/j/39_rgbyiq.hh 1.1 644)
+++ olena/oln/convert/rgbyiq.hh Sat, 13 Mar 2004 17:07:15 +0100 van-vl_n
(oln/j/39_rgbyiq.hh 1.1 644)
@@ -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,17 +37,21 @@
# include <sstream>
-/*--------------------------------------------------------------.
-| The formulas used here come from ``Digital Image Processing |
-| Algorithms and Applications'', I. Pitas; Wiley-Interscience. |
-`--------------------------------------------------------------*/
-
+/*! \file rgbyiq.hh
+**
+** \ref The formulas used here come from ``Digital Image Processing
+** Algorithms and Applications'', I. Pitas; Wiley-Interscience.
+*/
namespace oln {
using namespace ntg;
namespace convert {
+ /* Functor for conversion from RGB to YIQ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_rgb_to_yiq
: public abstract::color_conversion<3, inbits, rgb_traits,
@@ -76,6 +80,10 @@
}
};
+ /* Conversion from RGB to YIQ.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, yiq_traits>
rgb_to_yiq(const color<3, inbits, rgb_traits>& v)
@@ -85,6 +93,10 @@
return f(v);
}
+ /* Functor for conversion from YIQ to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template<unsigned inbits, unsigned outbits>
struct f_yiq_to_rgb
: public abstract::color_conversion<3, inbits, yiq_traits,
@@ -110,6 +122,10 @@
}
};
+ /* Conversion from YIQ to RGB.
+ **
+ ** \see f_rgb_to_hsl
+ */
template <unsigned inbits, unsigned outbits>
color<3, outbits, rgb_traits>
yiq_to_rgb(const color<3, inbits, yiq_traits>& v)
Index: olena/oln/convert/value_to_point.hh
--- olena/oln/convert/value_to_point.hh Fri, 06 Feb 2004 15:26:24 +0100
van-vl_n (oln/j/43_value_to_p 1.2 644)
+++ olena/oln/convert/value_to_point.hh Sat, 13 Mar 2004 17:25:49 +0100
van-vl_n (oln/j/43_value_to_p 1.2 644)
@@ -35,7 +35,17 @@
namespace oln {
namespace convert {
-
+ /*! Convert a value of pixel to a point.
+ **
+ ** For example it transforms an RGB color to a 3D point (ntg::rgb_8
=> oln::point3d).
+ ** This function is useful to build the histogram. \n
+ ** Example:
+ ** \verbatim
+ ** f(oln::convert::value_to_point<ntg::rgb_8>()(ntg::rgb_8(1,6,64)));
+ ** // is equivalent to:
+ ** f(oln::point3d(1, 6, 64));
+ ** \endverbatim
+ */
template <typename Argument_type,
class Exact = mlc::final>
struct value_to_point:
@@ -47,8 +57,10 @@
Exact>::ret>
{
private:
+ /// By default a scalar is expected. If the type is a vector, a
specialization should be written.
typedef typename ntg_is_a(Argument_type,
ntg::non_vectorial)::ensure_type ensure_type;
public:
+ /// By default it return a point1d.
typedef point1d result_type;
typedef Argument_type argument_type;
@@ -61,6 +73,11 @@
}
};
+ /*! Specialization for color of three dimension.
+ **
+ ** \todo It could be generalized to n dimensions if there were a
trait that
+ ** give a pointkd for a given dimension k.
+ */
template <unsigned Qbits, template <unsigned> class S, class Exact>
struct value_to_point<ntg::color<3, Qbits, S>, Exact>:
public abstract::conversion_from_type_to_type
2
1
This function is useful for the doc. It should be used
each time the output value is an image of labels (most of
them are dark).
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/convert/stretch.hh: Add stretch_balance. Add comments.
Index: olena/oln/convert/stretch.hh
--- olena/oln/convert/stretch.hh Thu, 31 Jul 2003 18:08:39 +0200
burrus_n (oln/f/51_stretch.hh 1.13 600)
+++ olena/oln/convert/stretch.hh Sat, 13 Mar 2004 17:01:12 +0100
van-vl_n (oln/f/51_stretch.hh 1.13 600)
@@ -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,10 +34,35 @@
# include <oln/convert/abstract/conversion.hh>
+# include <set>
+
namespace oln {
namespace convert {
+ /*! Functor to stretch a value from a range Input to a range Output.
+ **
+ ** \see stretch_balance
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <oln/convert/stretch.hh>
+ ** #include <ntg/all.hh>
+ ** #include <iostream>
+ **
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::int_u8> lena = oln::load(IMG_IN "lena256.pgm");
+ **
+ ** oln::io::save(apply(oln::convert::stretch<ntg::int_u<3> >(),
lena),
+ ** IMG_OUT "oln_convert_stretch.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena256.png
+ ** \image latex lena256.png
+ ** =>
+ ** \image html oln_convert_stretch.png
+ ** \image latex oln_convert_stretch.png
+ */
template<class Output, class Exact = mlc::final>
struct stretch
: public abstract::conversion_to_type<Output, typename
mlc::exact_vt<stretch<Output, Exact>, Exact>::ret >
@@ -62,7 +87,124 @@
}
};
+ /*! Stretch the value of an image.
+ **
+ ** This function stretches values between \a min_in and \a max_in
+ ** of an image \in, to a range that goes from \a min_out to \a max_out.
+ ** \arg in Input image, must be have scalar values
+ ** \arg min_in Lower bound of the range in the input. All values
smaller
+ ** than min_in are converted to \a min_out.
+ ** \arg max_in Upper bound of the range in the input. All values
+ ** greater than max_in
+ ** are converted to \a max_out.
+ ** \arg min_out Low bound of the range in the output.
+ ** \arg max_out Upper bound of the range in the output.
+ **
+ ** Difference between "apply(stretch<T>(), im)" and
"stretch_balance<T>(im)":
+ ** the first one stretches all the range of oln_value_type(T), the
second
+ ** stretches only values that appear is the image:
+ ** \code
+ ** #include <oln/basics1d.hh>
+ ** #include <oln/convert/stretch.hh>
+ ** #include <ntg/all.hh>
+ ** #include <iostream>
+ **
+ ** int main()
+ ** {
+ **
+ ** oln::image1d<ntg::int_u<17> > im(4);
+ ** im(0) = 0; im(1) = 2; im(2) = 5000; im(3) = 4000;
+ **
+ ** // print "0 170 511 340"
+ ** //(values of the *image* are dispatched on the range [0..2^9-1])
+ ** std::cout << oln::convert::stretch_balance<ntg::int_u<9> >(im)
<< std::endl;
+ **
+ ** //print " 0 0 19 16" (19 is the result of 5000 * 2^9 / 2^17)
+ ** //(values of *int_u<17>* are dispatched on the range [0..2^9-1])
+ ** std::cout << apply(oln::convert::stretch<ntg::int_u<9> >(),
im) << std::endl;
+ ** }
+ ** \endcode
+ **
+ ** This function is useful to stretch images of label:
+ ** \code
+ ** #include <oln/basics2d.hh>
+ ** #include <oln/convert/stretch.hh>
+ ** #include <oln/level/cc.hh>
+ ** #include <ntg/all.hh>
+ ** #include <iostream>
+ **
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::bin> light = oln::load(IMG_IN "face_se.pbm");
+ **
+ ** //Extraction of the connected components:
+ ** unsigned card;
+ ** oln::image2d<ntg::int_u8> cc
+ ** = oln::level::frontp_connected_component<ntg::int_u8>(light,
+ ** oln::neighb_c8(),
+ ** card);
+ ** oln::io::save(cc, "oln_convert_stretch_dark.pgm");
+ ** oln::io::save(oln::convert::stretch_balance<ntg::int_u8>(cc),
+ ** "oln_convert_stretch_balance.pgm");
+ ** }
+ ** \endcode
+ ** \image html face_se.png
+ ** \image latex face_se.png
+ ** => Without stretch_balance:
+ ** \image html oln_convert_stretch_dark.png
+ ** \image latex oln_convert_stretch_dark.png
+ ** => With stretch_balance:
+ ** \image html oln_convert_stretch_balance.png
+ ** \image latex oln_convert_stretch_balance.png
+ */
+ template<class DestValue, class I>
+ typename mute<I, DestValue>::ret
+ stretch_balance(const oln::abstract::non_vectorial_image<I> &in,
+ const oln_value_type(I) & min_in
+ = ntg_min_val(oln_value_type(I)),
+ const oln_value_type(I) & max_in
+ = ntg_max_val(oln_value_type(I)),
+ const DestValue & min_out = ntg_min_val(DestValue),
+ const DestValue & max_out = ntg_max_val(DestValue))
+ {
+ typedef typename
+ ntg_is_a(DestValue, ntg::non_vectorial)::ensure_type ensure_type;
+
+ typename mute<I, DestValue>::ret out(in.size());
+ //FIXME: I would like to remove the static_cast.
+ ntg_cumul_type(DestValue) tab[static_cast<int>(max_in - min_in + 1)];
+ typedef typename std::set<oln_value_type(I)> set_type;
+ set_type s;
+ oln_iter_type(I) it(in);
+
+ for_all(it)
+ if (in[it] <= max_in && in[it] >= min_in)
+ s.insert(in[it]);
+ if (s.size() == 1)
+ {
+ for_all(it)
+ out[it] = ntg_zero_val(DestValue);
+ return out;
+ }
+ {
+ unsigned cpt = 0;
+ for (typename set_type::const_iterator it(s.begin());
+ it != s.end(); ++it, ++cpt)
+ tab[*it - min_in] = cpt * (max_out - min_out) / (s.size() - 1);
+ }
+ for_all(it)
+ if (min_in <= in[it])
+ {
+ if (in[it] <= max_in)
+ out[it] = tab[in[it] - min_in] + min_out;
+ else
+ out[it] = max_out;
+ }
+ else
+ out[it] = min_out;
+ return out;
+ }
} // end of convert.
} // end of oln.
2
2
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/core/accum.hh: Add comments.
* olena/oln/core/apply.hh: Likewise.
* olena/oln/core/compose.hh: Likewise.
* olena/oln/core/coord.hh: Likewise.
* olena/oln/core/dpoint1d.hh: Likewise.
* olena/oln/core/dpoint2d.hh: Likewise.
* olena/oln/core/dpoint3d.hh: Likewise.
* olena/oln/core/fold.hh: Likewise.
* olena/oln/core/image1d.hh: Likewise.
* olena/oln/core/image1d_size.hh: Likewise.
* olena/oln/core/image2d.hh: Likewise.
* olena/oln/core/image2d_size.hh: Likewise.
* olena/oln/core/image3d.hh: Likewise.
* olena/oln/core/image3d_size.hh: Likewise.
* olena/oln/core/image.hh: Likewise.
* olena/oln/core/point1d.hh: Likewise.
* olena/oln/core/point2d.hh: Likewise.
* olena/oln/core/point3d.hh: Likewise.
* olena/oln/core/traverse.hh: Likewise.
* olena/oln/core/abstract/image.hh: Correct comments.
* olena/oln/core/impl/image_impl.hh: Add comments.
* olena/oln/core/impl/image_array.hh: Likewise.
* olena/oln/core/impl/image_array3d.hh: Likewise.
* olena/oln/core/impl/image_array2d.hh: Likewise.
* olena/oln/core/impl/image_array1d.hh: Likewise.
* olena/oln/core/behavior.hh: Likewise.
Index: olena/oln/core/accum.hh
--- olena/oln/core/accum.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/d/40_accum.hh 1.4 600)
+++ olena/oln/core/accum.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/40_accum.hh 1.4 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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
@@ -28,9 +28,19 @@
#ifndef OLENA_CORE_ACCUM_HH
# define OLENA_CORE_ACCUM_HH
+
+/*! \class max_accumulator
+**
+** This is a \a functor. It saves the maximum T value
+** that has been passed as an argument of its operator()
+** method. To retrieve the value saved, just use the
+** max_accumulator as a T instance.
+*/
+
template <class T>
struct max_accumulator
{
+
max_accumulator (T t) : acc_(t)
{}
Index: olena/oln/core/apply.hh
--- olena/oln/core/apply.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/d/39_apply.hh 1.14 600)
+++ olena/oln/core/apply.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/39_apply.hh 1.14 600)
@@ -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,8 +40,9 @@
| Unary |
`------*/
- /* Standard unary 'apply' procedure. Apply function f to each
- element of input. */
+ /*! \brief Standard unary \a apply procedure. Apply function f to each
+ ** element of input.
+ */
template<class AdaptableUnaryFun, class I> inline
typename mute<I, typename AdaptableUnaryFun::result_type>::ret
apply(AdaptableUnaryFun f, const abstract::image<I>& input)
@@ -54,8 +55,10 @@
}
- /* Same as above, but the function is passed as a type
- and we build it ourself. */
+ /*! \brief Standard unary \a apply procedure. Apply function f to each
+ ** element of input, the function is passed as a type
+ ** and we build it ourself.
+ */
template<class AdaptableUnaryFun, class I> inline
typename mute<I, typename AdaptableUnaryFun::result_type>::ret
apply(const abstract::image<I>& input)
@@ -64,8 +67,11 @@
}
- /* Same as above, but for template functions passed as template-id.
- We need to instantiate the function for the type of the abstract::image. */
+ /*! \brief Standard unary \a apply procedure. Apply function f to each
+ ** element of input, the function is passed as a type
+ ** and we build it ourself. For template functions passed as template-id,
+ ** we need to instantiate the function for the type of the abstract::image.
+ */
template<template<class> class AdaptableUnaryFun,
class I> inline
typename mute<I, typename AdaptableUnaryFun<oln_value_type(I)>::result_type>::ret
@@ -81,10 +87,15 @@
| binary |
`-------*/
- /* FIXME: Don't we want to name these functions 'apply()' too? */
-
- /* Standard binary 'apply' procedure. Apply function f to each
- element of input1 and input2. */
+ /*!
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?
+ */
+
+ /*! \brief Standard binary \a apply procedure. Apply function f to each
+ ** element of input1 and input2.
+ **
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?
+ */
template<class AdaptableBinaryFun, class I1, class I2> inline
typename mute<I1, typename AdaptableBinaryFun::result_type>::ret
apply2(AdaptableBinaryFun f,
@@ -99,8 +110,12 @@
}
- /* Same as above, but the function is passed as a type
- and we build it ourself. */
+ /*! \brief Standard binary \a apply procedure. Apply function f to each
+ ** element of input1 and input2. The function is passed as a type
+ ** and we build it ourself.
+ **
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?
+ */
template<class AdaptableBinaryFun, class I1, class I2> inline
typename mute<I1, typename AdaptableBinaryFun::result_type>::ret
apply2(const abstract::image<I1>& input1, const abstract::image<I2>& input2)
@@ -108,8 +123,14 @@
return apply2(AdaptableBinaryFun(), input1, input2);
}
- /* Same as above, but for template functions passed as template-id.
- We need to instantiate the function for the type of the abstract::images. */
+ /*! \brief Standard binary \a apply procedure. Apply function f to each
+ ** element of input1 and input2. The function is passed as a type
+ ** and we build it ourself. For template functions passed as template-id,
+ ** we need to instantiate the function for the type of the
+ ** abstract::images.
+ **
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?
+ */
template<template <class, class> class AdaptableBinaryFun,
class I1, class I2> inline
typename mute<I1,
@@ -121,8 +142,16 @@
return apply2(tmp, input1, input2);
}
- /* Same as above, when I1 == I2 and the AdaptableBinaryFun template
- has only one parameter. */
+
+ /*! \brief Standard binary \a apply procedure. Apply function f to each
+ ** element of input1 and input2. The function is passed as a type
+ ** and we build it ourself. For template functions passed as template-id,
+ ** we need to instantiate the function for the type of the
+ ** abstract::images.
+ **
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?\n
+ ** FIXME: Workaround for g++-2.95 bug.
+ */
template<template <class> class AdaptableBinaryFun,
class I> inline
typename mute<I,
@@ -139,9 +168,10 @@
| self unary |
`-----------*/
- /* Main apply_self() function. Note we require a UnaryFun only,
- not a AdaptableUnaryFunc, because as we overwrite an abstract::image
- we already know the output type. */
+ /*! \brief Main apply_self() function. Note we require a UnaryFun only,
+ ** not a AdaptableUnaryFunc, because as we overwrite an abstract::image
+ ** we already know the output type.
+ */
template<class UnaryFun, class I> inline
abstract::image<I>& apply_self(UnaryFun f, abstract::image<I>& input)
{
@@ -151,7 +181,10 @@
}
- /* Same as above, but we instantiate the function ourself. */
+ /*! \brief Main apply_self() function. Note we require a UnaryFun only,
+ ** not a AdaptableUnaryFunc, because as we overwrite an abstract::image
+ ** we already know the output type. We instantiate the function ourself.
+ */
template<class UnaryFun, class I> inline
abstract::image<I>& apply_self(abstract::image<I>& input)
{
@@ -159,8 +192,12 @@
}
- /* If the function is passed as a template-id. Instantiate it
- for the type of the input elements. */
+ /*! \brief Main apply_self() function. Note we require a UnaryFun only,
+ ** not a AdaptableUnaryFunc, because as we overwrite an abstract::image
+ ** we already know the output type. We instantiate the function ourself.
+ **
+ ** \todo FIXME: Workaround for g++-2.95 bug.
+ */
template<template<class> class UnaryFun, class I> inline
abstract::image<I>& apply_self(abstract::image<I>& input)
{
@@ -174,7 +211,10 @@
| self binary |
`------------*/
- /* Main apply2_exact() function. See also the comment for apply_self(). */
+ /*! \brief Main apply2_exact() function.
+ **
+ ** \see apply_self()
+ */
template<class UnaryFun, class I1, class I2>
abstract::image<I1>& apply2_self(UnaryFun f,
abstract::image<I1>& input1, const abstract::image<I2>& input2)
@@ -186,7 +226,10 @@
}
- /* Same as above, but we instantiate the function ourself. */
+ /*! \brief We instantiate the function ourself.
+ **
+ ** \see apply_self()
+ */
template<class UnaryFun, class I1, class I2> inline
abstract::image<I1>& apply2_self(abstract::image<I1>& input1, const abstract::image<I1>& input2)
{
@@ -194,8 +237,13 @@
}
- /* If the function is passed as a template-id. Instantiate it
- for the type of the input elements. */
+ /*! \brief If the function is passed as a template-id, we
+ ** Instantiate it for the type of the input elements.
+ **
+ ** \todo FIXME: Workaround for g++-2.95 bug.
+ **
+ ** \see apply_self()
+ */
template<template<class, class> class UnaryFun, class I1, class I2> inline
abstract::image<I1>& apply2_self(abstract::image<I1>& input1, const abstract::image<I2>& input2)
{
@@ -205,7 +253,12 @@
}
- /* Same as above, but I1==I2 and the UnaryFun has only one parameter. */
+ /*! apply2_self() if I1==I2 and the UnaryFun has only one parameter.
+ **
+ ** \todo FIXME: Workaround for g++-2.95 bug.
+ **
+ ** \see apply_self()
+ */
template<template<class> class UnaryFun, class I> inline
abstract::image<I>& apply2_self(abstract::image<I>& input1, const abstract::image<I>& input2)
{
Index: olena/oln/core/compose.hh
--- olena/oln/core/compose.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/22_compose.hh 1.5 600)
+++ olena/oln/core/compose.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/22_compose.hh 1.5 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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,6 +34,12 @@
namespace internal {
+ /*! \class compose_uu_
+ **
+ ** The operator () of this class performs a composition between
+ ** two unary functors F1 & F2.
+ */
+
template< class F1, class F2 >
struct compose_uu_ :
public std::unary_function <typename F2::argument_type,
@@ -56,6 +62,13 @@
};
+ /*! \class compose_ub_
+ **
+ ** The operator () of this class performs a composition between
+ ** an unary functor F1 and a binary functor F2.
+ */
+
+
template< class F1, class F2 >
struct compose_ub_ :
public std::binary_function <typename F2::first_argument_type,
@@ -80,6 +93,12 @@
};
+ /*! \class compose_bu_
+ **
+ ** The operator () of this class performs a composition between
+ ** a binary functor F1 and an unary functor F2.
+ */
+
template< class F1, class F2 >
struct compose_bu_ :
public std::binary_function <typename F2::argument_type,
@@ -107,6 +126,7 @@
}
+ /// Compose two unary functors F1 & F2.
template<class UF1, class UF2>
internal::compose_uu_<UF1, UF2>
compose_uu(const UF1& f1, const UF2& f2)
@@ -114,6 +134,7 @@
return internal::compose_uu_<UF1, UF2>(f1, f2);
}
+ /// Compose an unary functors F1 with a binary functor F2.
template<class UF1, class BF2>
internal::compose_ub_<UF1, BF2>
compose_ub(const UF1& f1, const BF2& f2)
@@ -121,6 +142,7 @@
return internal::compose_ub_<UF1, BF2>(f1, f2);
}
+ /// Compose a binary functor F1 and an unary functor F2.
template<class BF1, class UF2>
internal::compose_bu_<BF1, UF2>
compose_bu(const BF1& f1, const UF2& f2)
@@ -128,6 +150,10 @@
return internal::compose_bu_<BF1, UF2>(f1, f2);
}
+ /*! \class f_identity
+ **
+ ** This functor returns its argument.
+ */
template<class T>
struct f_identity : std::unary_function<T, T>
Index: olena/oln/core/coord.hh
--- olena/oln/core/coord.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/d/29_coord.hh 1.3 600)
+++ olena/oln/core/coord.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/29_coord.hh 1.3 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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,6 +31,7 @@
namespace oln {
+ /// coord == int
typedef int coord;
@@ -39,6 +40,13 @@
{
template<class T> struct default_less;
+ /*! \brief default_less<coord>
+ **
+ ** Specialized version for \a coord. This functor
+ ** test if a coord \a lhs is less than another
+ ** coord \a rhs.
+ */
+
template<>
struct default_less<coord>
{
Index: olena/oln/core/dpoint1d.hh
--- olena/oln/core/dpoint1d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/d/27_dpoint1d.h 1.13 600)
+++ olena/oln/core/dpoint1d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/27_dpoint1d.h 1.13 600)
@@ -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,6 +41,11 @@
class dpoint1d; //fwd_decl
+ /*! \class dpoint_traits<dpoint1d>
+ **
+ ** The specialized version for dpoint1d.
+ */
+
template <>
struct dpoint_traits<dpoint1d>: public
dpoint_traits<abstract::dpoint<dpoint1d> >
@@ -49,6 +54,17 @@
typedef point1d point_type;
};
+ /*! \class dpoint1d
+ **
+ ** Subclass of abstract::dpoint, declaration of dpoint
+ ** for image1d. To instantiate a dpoint1d on an
+ ** oln::image1d<ntg::rgb_8> for example, use the
+ ** macro oln_dpoint_type(I).\n
+ ** oln_dpoint_type(oln::image1d<ntg::rgb_8>) p();\n
+ ** or\n
+ ** oln_dpoint_type(oln::image1d<ntg::rgb_8>) p(1);
+ */
+
class dpoint1d : public abstract::dpoint<dpoint1d>
{
@@ -58,15 +74,23 @@
friend class abstract::dpoint<dpoint1d>;
+
dpoint1d();
+ /// The coordinate of the dpoint1d is set to \a c.
+
dpoint1d(coord c);
+ /// The coordinate of the dpoint1d is set to the \p coordinate.
+
explicit dpoint1d(const point1d& p);
+ /// Return the value of the dpoint1d coordinate.
coord
col() const;
+ /// Return a reference to the dpoint1d coordinate.
+
coord&
col();
@@ -78,26 +102,53 @@
protected:
+ /*! \brief Return a dpoint1d whose coordinate is equal to
+ ** \a dp coordinate plus the current dpoint1d coordinate.
+ **
+ */
+
dpoint1d
plus_dp(const dpoint1d& dp) const;
+ /*! \brief Return a dpoint1d whose coordinate is equal to
+ ** the opposite of the current dpoint1d coordinate.
+ */
+
dpoint1d
minus() const;
+ /*! \brief Return a dpoint1d whose coordinate is equal to
+ ** the current dpoint1d coordinate minus 'dp' coordinate.
+ */
+
dpoint1d
minus_dp(const dpoint1d& dp) const;
+ /*! \brief Return a reference to the current dpoint1d
+ ** plus 'dp'.
+ */
+
dpoint1d&
plus_assign_dp(const dpoint1d& dp);
+ /*! \brief Return a reference to the current dpoint1d
+ ** minus 'dp'.
+ */
+
dpoint1d&
minus_assign_dp(const dpoint1d& dp);
};
+
namespace internal
{
+ /*! \class default_less<dpoint1d>
+ **
+ ** The specialized version for dpoint1d.
+ */
+
template<>
struct default_less<dpoint1d> :
public default_less<dpoint1d::super_type>
@@ -107,6 +158,9 @@
} // end of internal
} // end of oln
+
+/// Write on an output stream \a o the coordinate of the dpoint1d \a dp.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::dpoint1d& dp);
Index: olena/oln/core/dpoint2d.hh
--- olena/oln/core/dpoint2d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/d/25_dpoint2d.h 1.12 600)
+++ olena/oln/core/dpoint2d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/25_dpoint2d.h 1.12 600)
@@ -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,6 +38,13 @@
class point2d;
class dpoint2d;
+
+
+ /*! \class dpoint_traits<dpoint2d>
+ **
+ ** The specialized version for dpoint2d.
+ */
+
template<>
struct dpoint_traits<dpoint2d>: public
dpoint_traits<abstract::dpoint<dpoint2d> >
@@ -46,6 +53,18 @@
typedef point2d point_type;
};
+ /*! \class dpoint2d
+ **
+ ** Subclass of abstract::dpoint, declaration of dpoint
+ ** for image2d. To instantiate a dpoint2d on an
+ ** oln::image2d<ntg::rgb_8> for example, use the
+ ** macro oln_dpoint_type(I).\n
+ ** oln_dpoint_type(oln::image2d<ntg::rgb_8>) dp();\n
+ ** or\n
+ ** oln_dpoint_type(oln::image2d<ntg::rgb_8>) dp(1, 2);
+ */
+
+
class dpoint2d : public abstract::dpoint< dpoint2d >
{
@@ -57,19 +76,30 @@
dpoint2d();
+ /// The coordinates of the dpoint2d are set to \a row and \a col.
+
dpoint2d(coord row, coord col);
+ /// The coordinates of the dpoint2d are set to the \a p coordinates.
explicit dpoint2d(const point2d& p);
+ /// Return the value of the dpoint2d row coordinate.
+
coord
row() const;
+ /// Return a reference to the dpoint2d row coordinate.
+
coord&
row();
+ /// Return the value of the dpoint2d column coordinate.
+
coord
col() const;
+ /// Return a reference to the dpoint2d column coordinate.
+
coord&
col();
@@ -81,18 +111,40 @@
protected:
+
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** \a dp coordinates plus the current dpoint2d coordinates.
+ */
+
dpoint2d
plus_dp(const dpoint2d& dp) const;
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** the opposite of the current dpoint2d coordinates.
+ */
+
dpoint2d
minus() const;
+
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** the current dpoint2d coordinates minus \a dp coordinates.
+ */
+
dpoint2d
minus_dp(const dpoint2d& dp) const;
+ /*! \brief Return a reference to the current dpoint2d
+ ** plus \a dp.
+ */
+
dpoint2d&
plus_assign_dp(const dpoint2d& dp);
+ /*! \brief Return a reference to the current dpoint2d
+ ** minus \a dp.
+ */
+
dpoint2d&
minus_assign_dp(const dpoint2d& dp);
@@ -100,6 +152,11 @@
namespace internal
{
+ /*! \class default_less<dpoint2d>
+ **
+ ** The specialized version for dpoint2d.
+ */
+
template<>
struct default_less<dpoint2d> :
public default_less<dpoint2d::super_type>
@@ -108,6 +165,8 @@
} // end of oln
+/// Write on an output stream \a o the coordinates of the dpoint2d \a dp.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::dpoint2d& dp);
Index: olena/oln/core/dpoint3d.hh
--- olena/oln/core/dpoint3d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/d/23_dpoint3d.h 1.12 600)
+++ olena/oln/core/dpoint3d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/23_dpoint3d.h 1.12 600)
@@ -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,6 +38,11 @@
class point3d;
class dpoint3d;
+ /*! \class dpoint_traits<dpoint3d>
+ **
+ ** The specialized version for dpoint3d.
+ */
+
template<>
struct dpoint_traits<dpoint3d>: public
dpoint_traits<abstract::dpoint<dpoint3d> >
@@ -46,6 +51,17 @@
typedef point3d point_type;
};
+ /*! \class dpoint3d
+ **
+ ** Subclass of abstract::dpoint, declaration of dpoint
+ ** for image3d. To instantiate a dpoint3d on an
+ ** oln::image3d<ntg::rgb_8> for example, use the
+ ** macro oln_dpoint_type(I).\n
+ ** oln_dpoint_type(oln::image3d<ntg::rgb_8>) dp();\n
+ ** or\n
+ ** oln_dpoint_type(oln::image3d<ntg::rgb_8>) dp(1, 2, 3);
+ */
+
class dpoint3d : public abstract::dpoint< dpoint3d >
{
@@ -57,25 +73,44 @@
dpoint3d();
+ /// The coordinates of the dpoint3d are set to \a slice, \a row, and \a col.
+
dpoint3d(coord slice, coord row, coord col);
+ /// The coordinates of the dpoint3d are set to the \a p coordinates.
+
explicit dpoint3d(const point3d& p);
+
+ /// Return the value of the dpoint3d slice coordinate.
+
coord
slice() const;
+ /// Return a reference to the dpoint3d slice coordinate.
+
coord&
slice();
+ /// Give the value of the dpoint3d row coordinate.
+
coord
row() const;
+ /*! \brief Return a reference to the dpoint3d row coordinate.
+ **
+ */
+
coord&
row();
+ /// Return the value of the dpoint3d column coordinate.
+
coord
col() const;
+ /// Return a reference to the dpoint3d column coordinate.
+
coord&
col();
@@ -87,25 +122,50 @@
protected:
+ /*! \brief Return a dpoint3d whose coordinates are equal to
+ ** \a dp coordinates plus the current dpoint3d coordinates.
+ **
+ */
+
dpoint3d
plus_dp(const dpoint3d& dp) const;
+ /*! \brief Return a dpoint3d whose coordinates are equal to
+ ** the opposite of the current dpoint3d coordinates.
+ */
+
dpoint3d
minus() const;
+ /*! \brief Return a dpoint3d whose coordinates are equal to
+ ** the current dpoint3d coordinates minus \a dp coordinates.
+ */
+
dpoint3d
minus_dp(const dpoint3d& dp) const;
+ /*! \brief Return a reference to the current dpoint3d
+ ** plus \a dp.
+ */
+
dpoint3d&
plus_assign_dp(const dpoint3d& dp);
+ /*! \brief Return a reference to the current dpoint3d
+ ** minus 'dp'.
+ */
+
dpoint3d&
minus_assign_dp(const dpoint3d& dp);
};
-
namespace internal
{
+ /*! \class default_less<dpoint3d>
+ **
+ ** The specialized version for dpoint3d.
+ */
+
template<>
struct default_less<dpoint3d> :
public default_less<dpoint3d::super_type>
@@ -115,6 +175,8 @@
} // end of oln
+/// Write on an output stream \a o the coordinates of the dpoint3d \a dp.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::dpoint3d& dp);
Index: olena/oln/core/fold.hh
--- olena/oln/core/fold.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/7_fold.hh 1.13 600)
+++ olena/oln/core/fold.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/7_fold.hh 1.13 600)
@@ -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,17 +36,21 @@
namespace oln {
- // Compute f(...f(f(val,i_0),i_1)...,i_n), where i_0...i_n
- // are the value associated to each abstract::image point.
+
+ /*! \brief Compute f(...f(f(val,i_0),i_1)...,i_n), where i_0...i_n
+ ** are the value associated to each abstract::image point.
+ ** f could return a reference or a const. Make sure VAL is assignable.
+ **
+ ** \todo FIXME: Ensure that first_argument_type == result_type.
+ */
+
template<class AdaptableBinaryFun, class I> inline
typename AdaptableBinaryFun::result_type
fold(AdaptableBinaryFun f,
- // f could return a reference or a const. Make sure VAL is assignable.
typename mlc::typeadj<
typename AdaptableBinaryFun::result_type>::mutable_val val,
const abstract::image<I>& input)
{
- // FIXME: ensure that first_argument_type == result_type.
oln_iter_type(I) p(input);
for_all(p)
val = f(val, input[p]);
@@ -54,15 +58,18 @@
}
- // Compute f(...f(f(i_0,i_1),i_2)...,i_n).
+ /*! \brief Compute f(...f(f(i_0,i_1),i_2)...,i_n), where i_0...i_n
+ ** are the value associated to each abstract::image point.
+ ** f could return a reference or a const, so make sure VAL is assignable.
+ **
+ ** \todo FIXME: Ensure that first_argument_type == result_type.
+ */
template<class AdaptableBinaryFun, class I> inline
typename AdaptableBinaryFun::result_type
fold(AdaptableBinaryFun f, const abstract::image<I>& input)
{
- // FIXME: ensure that first_argument_type == result_type.
oln_iter_type(I) p(input);
p = begin;
- // f could return a reference or a const, so make sure VAL is assignable.
typename mlc::typeadj<
typename AdaptableBinaryFun::result_type>::mutable_val val
= input[p];
Index: olena/oln/core/image1d.hh
--- olena/oln/core/image1d.hh Mon, 02 Feb 2004 10:57:28 +0100 van-vl_n (oln/c/47_image1d.hh 1.28.1.1 600)
+++ olena/oln/core/image1d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/47_image1d.hh 1.28.1.1 600)
@@ -44,6 +44,12 @@
template<class T, class Exact = mlc::final>
class image1d; // fwd_decl
+ /*! \class image_id<image1d<T, Exact> >
+ **
+ ** Helper class used by image_traits to retrieve
+ ** the typedef associated to an image.
+ */
+
template<class T, class Exact>
struct image_id<image1d<T, Exact> >
{
@@ -53,6 +59,12 @@
typedef impl::image_array1d<T> impl_type;
};
+ /*! \class image_traits<image1d<T, Exact> >
+ **
+ ** Helper class usefull to retrieve all the type
+ ** relative to an image.
+ */
+
template<class T, class Exact>
struct image_traits<image1d<T, Exact> >:
public image_traits<image<image_id<image1d<T, Exact> >::dim,
@@ -66,6 +78,13 @@
// client can use image1d; instances are real images, that is,
// images with data ---conversely to proxy images
+ /*! \class image1d
+ **
+ ** To instantiate an image1d with oln::rgb_8 as value_type,
+ ** one can write:\n
+ ** oln::image1d<ntg::rgb_8> t;
+ */
+
template<class T, class Exact>
class image1d:
public image<image_id<image1d<T, Exact> >::dim,
@@ -93,22 +112,46 @@
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain
+ ** an image1d with \a ncols column plus a border
+ ** width equal to 2 by default.
+ */
+
image1d(coord ncols, coord border = 2) :
super_type(new impl_type(image1d_size(ncols, border)))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain an
+ ** image1d with a size equal to \a size.
+ */
+
image1d(const image1d_size& size) :
super_type(new impl_type(size))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Build a new image1d by performing
+ ** a shallow copy of \a rhs, all the points
+ ** will be shared between \a rhs and the
+ ** current image.
+ **
+ ** \see abstract::image::clone()
+ */
+
image1d(self_type& rhs) : // shallow copy
super_type(rhs)
{ mlc_init_static_hierarchy(Exact); }
+ /*! \brief Perform a shallow copy from \a rhs to
+ ** the current image, the points are not duplicated
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
exact_type&
operator=(self_type rhs)
{
@@ -116,6 +159,14 @@
}
// io
+
+ /*! \brief Perform a shallow copy from \a r to
+ ** the new image, the points are not duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image1d(const io::internal::anything& r)
: super_type()
{
@@ -123,6 +174,13 @@
r.assign(*this);
}
+ /*! \brief Perform a shallow copy from \a r to
+ ** the current image, the points are not duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image1d&
operator=(const io::internal::anything& r)
{
@@ -138,6 +196,8 @@
+ Exact::name() + ">";
}
+ /// Define ret equal to image1d<U>.
+
template<class U>
struct mute
{
@@ -148,11 +208,18 @@
protected:
+ /*! \brief Return a deep copy of the current image.
+ **
+ ** \warning It may be really dangerous to instantiate a self_type
+ ** and not an exact_type if Exact != mlc::final.
+ **
+ ** \todo FIXME: It may be really dangerous to instantiate a self_type
+ ** and not an exact_type if Exact != mlc::final.
+ */
+
self_type
clone_() const // deep copy
{
- // FIXME: it may be really dangerous to instantiate a self_type
- // and not an exact_type is Exact != mlc::final.
self_type output(this->ncols(), this->border());
clone_to(output.impl());
return output;
@@ -160,6 +227,11 @@
};
+ /*! \class dim_traits<1, T, Exact>
+ **
+ ** Define img_type equal to image1d<T, Exact>.
+ */
+
template <class T, class Exact>
struct dim_traits<1, T, Exact>
{
Index: olena/oln/core/image1d_size.hh
--- olena/oln/core/image1d_size.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/46_image1d_si 1.10 600)
+++ olena/oln/core/image1d_size.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/46_image1d_si 1.10 600)
@@ -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,21 +36,42 @@
struct image1d_size;
+ /*! \class image_size_traits<image1d_size>
+ **
+ ** The specialized version for image1d_size.
+ */
+
template<>
struct image_size_traits<image1d_size>
{
enum { dim = 1 };
};
+ /*! \class image1d_size
+ **
+ ** Size_type for image1d.
+ */
+
struct image1d_size : public abstract::image_size<image1d_size >
{
+ /*! \brief Image1d_size constructor.
+ **
+ ** \arg ncols The number of columns in
+ ** the image is set to \a ncols.
+ **
+ ** \arg border The border width of the image
+ ** is set to border.
+ */
+
image1d_size(coord ncols, coord border)
{
nth(0) = ncols;
border_ = border;
}
+ /// Return the number of columns in the image.
+
coord
ncols() const
{
@@ -58,6 +79,10 @@
return nth(0);
}
+ /*! \brief Return a reference to the number
+ ** of columns in the image.
+ */
+
coord&
ncols()
{
Index: olena/oln/core/image2d.hh
--- olena/oln/core/image2d.hh Mon, 02 Feb 2004 10:57:28 +0100 van-vl_n (oln/c/45_image2d.hh 1.30.1.1 600)
+++ olena/oln/core/image2d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/45_image2d.hh 1.30.1.1 600)
@@ -44,6 +44,12 @@
template<class T, class Exact = mlc::final>
class image2d; // fwd_decl
+ /*! \class image_id<image2d<T, Exact> >
+ **
+ ** Helper class used by image_traits to retrieve
+ ** the typedef associated to an image.
+ */
+
template<class T, class Exact>
struct image_id<image2d<T, Exact> >
{
@@ -53,6 +59,12 @@
typedef impl::image_array2d<T> impl_type;
};
+ /*! \class image_traits<image2d<T, Exact> >
+ **
+ ** Helper class usefull to retrieve all the type
+ ** relative to an image.
+ */
+
template<class T, class Exact>
struct image_traits<image2d<T, Exact> >:
public image_traits<image<image_id<image2d<T, Exact> >::dim,
@@ -64,6 +76,13 @@
// client can use image2d; instances are real images, that is,
// images with data ---conversely to proxy images
+ /*! \class image2d
+ **
+ ** To instantiate an image2d with oln::rgb_8 as value_type,
+ ** one can write:\n
+ ** oln::image2d<ntg::rgb_8> t = load("img.ppm");
+ */
+
template<class T, class Exact>
class image2d:
public image<image_id<image2d<T, Exact> >::dim,
@@ -85,24 +104,44 @@
friend class abstract::image<exact_type>;
+
image2d() :
super_type()
{
mlc_init_static_hierarchy(Exact);
}
+
+ /*! \brief Allocate memory to contain
+ ** an image2d with \a ncols column and
+ ** \a nrows rows plus a border width
+ ** equal to 2 by default.
+ */
+
image2d(coord nrows, coord ncols, coord border = 2) :
super_type(new impl_type(image2d_size(nrows, ncols, border)))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain an
+ ** image2d with a size equal to \a size.
+ */
+
image2d(const image2d_size& size) :
super_type(new impl_type(size))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Build a new image2d by performing
+ ** a shallow copy of \a rhs, the points are
+ ** not duplicated, but shared between \a rhs
+ ** and the new image.
+ **
+ ** \see abstract::image::clone()
+ */
+
image2d(self_type& rhs) : // shallow copy
super_type(rhs)
{
@@ -110,6 +149,13 @@
}
// io
+ /*! \brief Perform a shallow copy from \a r to
+ ** the new image, the points are not duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image2d(const io::internal::anything& r)
: super_type()
{
@@ -117,12 +163,26 @@
r.assign(*this);
}
+ /*! \brief Perform a shallow copy from \a rhs to
+ ** the current image, the points are ot duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image2d&
operator=(const io::internal::anything& r)
{
return r.assign(*this);
}
+ /*! \brief Perform a shallow copy from \a r to
+ ** the current image, the points are not duplicated
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
exact_type&
operator=(self_type rhs)
{
@@ -138,6 +198,8 @@
+ Exact::name() + ">";
}
+ /// Define ret equal to image2d<U>.
+
template<class U>
struct mute
{
@@ -148,11 +210,18 @@
protected:
+ /*! \brief Return a deep copy of the current image.
+ **
+ ** \warning It may be really dangerous to instantiate a self_type
+ ** and not an exact_type if Exact != mlc::final.
+ **
+ ** \todo FIXME: It may be really dangerous to instantiate a self_type
+ ** and not an exact_type is Exact != mlc::final.
+ */
+
self_type
clone_() const // deep copy
{
- // FIXME: it may be really dangerous to instantiate a self_type
- // and not an exact_type is Exact != mlc::final.
self_type output(this->nrows(), this->ncols(), this->border());
clone_to(output.impl());
return output;
@@ -160,6 +229,11 @@
};
+ /*! \class dim_traits<2, T, Exact>
+ **
+ ** Define img_type equal to image2d<T, Exact>.
+ */
+
template <class T, class Exact>
struct dim_traits<2, T, Exact>
{
Index: olena/oln/core/image2d_size.hh
--- olena/oln/core/image2d_size.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/44_image2d_si 1.10 600)
+++ olena/oln/core/image2d_size.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/44_image2d_si 1.10 600)
@@ -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,6 +36,11 @@
struct image2d_size;
+ /*! \class image_size_traits<image2d_size>
+ **
+ ** The specialized version for image2d_size.
+ */
+
template<>
struct image_size_traits<image2d_size>
{
@@ -43,8 +48,25 @@
};
+ /*! \class image2d_size
+ **
+ ** Size_type for image2d.
+ */
+
struct image2d_size : public abstract::image_size<image2d_size >
{
+ /*! \brief Image2d_size constructor.
+ **
+ ** \arg nrows The number of rows in
+ ** the image is set to \a nrows.
+ **
+ ** \arg ncols The number of columns in
+ ** the image is set to \a ncols.
+ **
+ ** \arg border The border width of the image
+ ** is set to border.
+ */
+
image2d_size(coord nrows, coord ncols, coord border)
{
nth(0) = nrows;
@@ -52,6 +74,8 @@
border_ = border;
}
+ /// Return the number of rows in the image.
+
coord
nrows() const
{
@@ -59,6 +83,8 @@
return nth(0);
}
+ /// Return a reference to the number of rows in the image.
+
coord&
nrows()
{
@@ -66,6 +92,8 @@
return nth(0);
}
+ /// Return the number of columns in the image.
+
coord
ncols() const
{
@@ -73,6 +101,8 @@
return nth(1);
}
+ /// Return a reference to the number of columns in the image.
+
coord&
ncols()
{
Index: olena/oln/core/image3d.hh
--- olena/oln/core/image3d.hh Mon, 02 Feb 2004 10:57:28 +0100 van-vl_n (oln/c/43_image3d.hh 1.27.1.1 600)
+++ olena/oln/core/image3d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/43_image3d.hh 1.27.1.1 600)
@@ -44,6 +44,12 @@
template<class T, class Exact = mlc::final>
class image3d; // fwd_decl
+ /*! \class image_id<image3d<T, Exact> >
+ **
+ ** Helper class used by image_traits to retrieve
+ ** the typedef associated to an image.
+ */
+
template<class T, class Exact>
struct image_id<image3d<T, Exact> >
{
@@ -53,6 +59,12 @@
typedef impl::image_array3d<T> impl_type;
};
+ /*! \class image_traits<image3d<T, Exact> >
+ **
+ ** Helper class usefull to retrieve all the type
+ ** relative to an image.
+ */
+
template<class T, class Exact>
struct image_traits<image3d<T, Exact> >:
public image_traits<image<image_id<image3d<T, Exact> >::dim,
@@ -64,6 +76,13 @@
// client can use image3d; instances are real images, that is,
// images with data ---conversely to proxy images
+ /*! \class image3d
+ **
+ ** To instantiate an image3d with oln::rgb_8 as value_type,
+ ** one can write:\n
+ ** oln::image3d<ntg::rgb_8> t;
+ */
+
template<class T, class Exact>
class image3d:
public image<image_id<image3d<T, Exact> >::dim,
@@ -91,19 +110,37 @@
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain
+ ** an image3d with \a ncols column,
+ ** \a nrows rows, and \a nslices slices
+ ** plus a border width equal to 2 by default.
+ */
+
image3d(coord nslices, coord nrows, coord ncols, coord border = 2) :
super_type(new impl_type(image3d_size(nslices, nrows, ncols, border)))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain an
+ ** image3d with a size equal to \a size.
+ */
+
image3d(const image3d_size& size) :
super_type(new impl_type(size))
{
mlc_init_static_hierarchy(Exact);
}
- // shallow copy
+ /*! \brief Build a new image3d by performing
+ ** a shallow copy of \a rhs, the points are
+ ** not duplicated, but shared between \a rhs
+ ** and the new image.
+ **
+ ** \see abstract::image::clone()
+ */
+
+
image3d(self_type& rhs) :
super_type(rhs)
{
@@ -111,17 +148,39 @@
}
// io
+ /*! \brief Perform a shallow copy from \a r to
+ ** the new image, the points are not duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image3d(const io::internal::anything& r) : super_type()
{
mlc_init_static_hierarchy(Exact);
r.assign(*this);
}
+
+ /*! \brief Perform a shallow copy from \a rhs to
+ ** the current image, the points are ot duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image3d&
operator=(const io::internal::anything& r)
{
return r.assign(*this);
}
+ /*! \brief Perform a shallow copy from \a r to
+ ** the current image, the points are not duplicated
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
exact_type&
operator=(self_type rhs)
{
@@ -137,6 +196,8 @@
+ Exact::name() + ">";
}
+ /// Define ret equal to image3d<U>.
+
template<class U>
struct mute
{
@@ -147,11 +208,18 @@
protected:
+ /*! \brief Return a deep copy of the current image.
+ **
+ ** \warning It may be really dangerous to instantiate a self_type
+ ** and not an exact_type if Exact != mlc::final.
+ **
+ ** \todo FIXME: It may be really dangerous to instantiate a self_type
+ ** and not an exact_type is Exact != mlc::final.
+ */
+
self_type
clone_() const // deep copy
{
- // FIXME: it may be really dangerous to instantiate a self_type
- // and not an exact_type is Exact != mlc::final.
self_type output(this->nslices(), this->nrows(), this->ncols(), this->border());
clone_to(output.impl());
return output;
@@ -159,6 +227,11 @@
};
+ /*! \class dim_traits<3, T, Exact>
+ **
+ ** Define img_type equal to image3d<T, Exact>.
+ */
+
template <class T, class Exact>
struct dim_traits<3, T, Exact>
{
Index: olena/oln/core/image3d_size.hh
--- olena/oln/core/image3d_size.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/42_image3d_si 1.10 600)
+++ olena/oln/core/image3d_size.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/42_image3d_si 1.10 600)
@@ -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,17 +36,42 @@
struct image3d_size;
+ /*! \class image_size_traits<image3d_size>
+ **
+ ** The specialized version for image3d_size.
+ */
template<>
struct image_size_traits<image3d_size>
{
enum { dim = 3 };
};
+ /*! \class image3d_size
+ **
+ ** Size_type for image3d.
+ */
+
struct image3d_size : public abstract::image_size<image3d_size >
{
public:
+ /*! \brief Image2d_size constructor.
+ **
+ ** \arg nslices The number of slices in
+ ** the image is set to \a nslices
+ **
+ ** \arg nrows The number of rows in
+ ** the image is set to \a nrows.
+ **
+ ** \arg ncols The number of columns in
+ ** the image is set to \a ncols.
+ **
+ ** \arg border The border width of the image
+ ** is set to border.
+ */
+
+
image3d_size(coord nslices, coord nrows, coord ncols, coord border)
{
nth(0) = nslices;
@@ -55,6 +80,8 @@
border_ = border;
}
+ /// Return the number of slices in the image.
+
coord
nslices() const
{
@@ -62,6 +89,8 @@
return nth(0);
}
+ /// Return a reference to the number of slices in the image.
+
coord&
nslices()
{
@@ -69,6 +98,8 @@
return nth(0);
}
+ /// Return the number of rows in the image.
+
coord
nrows() const
{
@@ -76,6 +107,8 @@
return nth(1);
}
+ /// Return a reference to the number of rows in the image.
+
coord&
nrows()
{
@@ -83,6 +116,8 @@
return nth(1);
}
+ /// Return the number of columns in the image.
+
coord
ncols() const
{
@@ -90,6 +125,8 @@
return nth(2);
}
+ /// Return a reference to the number of columns in the image.
+
coord&
ncols()
{
Index: olena/oln/core/image.hh
--- olena/oln/core/image.hh Mon, 02 Feb 2004 10:57:28 +0100 van-vl_n (oln/d/18_image.hh 1.20.2.1 600)
+++ olena/oln/core/image.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/18_image.hh 1.20.2.1 600)
@@ -35,11 +35,18 @@
# include <sstream>
+
namespace oln {
template<unsigned Dim, class T, class Impl, class Exact = mlc::final>
class image; //fwd_decl
+ /*! \class image_id<image<Dim, T, Impl, Exact> >
+ **
+ ** Helper class used by image_traits to retrieve
+ ** the typedef associated to an image.
+ */
+
template<unsigned Dim, class T, class Impl, class Exact>
struct image_id<image<Dim, T, Impl, Exact> >
{
@@ -49,7 +56,13 @@
typedef typename mlc::exact_vt<image<Dim, T, Impl, Exact>, Exact>::ret exact_type;
};
- template<class T, unsigned Dim, class Impl, class Exact>
+ /*! \class image_traits<image<Dim, T, Impl, Exact> >
+ **
+ ** Helper class usefull to retrieve all the type
+ ** relative to an image.
+ */
+
+ template<unsigned Dim, class T, class Impl, class Exact>
struct image_traits<image<Dim, T, Impl, Exact> >:
public image_traits<abstract::image_with_impl<typename image_id<image<Dim, T, Impl, Exact> >::impl_type,
typename image_id<image<Dim, T, Impl, Exact> >::exact_type> >
@@ -59,23 +72,53 @@
// image
+
+ /*! \class image
+ **
+ ** Generic image class, all the classic image class (image with dim = N)
+ ** will derive from it.
+ */
+
template<unsigned Dim, class T, class Impl, class Exact>
class image:
public abstract::image_with_impl<typename image_id<image<Dim, T, Impl, Exact> >::impl_type,
typename image_id<image<Dim, T, Impl, Exact> >::exact_type>
{
+
public:
typedef typename mlc::exact_vt<image<Dim, T, Impl, Exact>, Exact>::ret exact_type;
typedef typename image_traits<exact_type>::point_type point_type;
+ /*!< Prefer the macro oln_point_type(I) to retrieve the point_type of
+ ** an image.
+ **
+ ** \see abstract::point
+ */
typedef typename image_traits<exact_type>::dpoint_type dpoint_type;
+ /*!< Prefer the macro oln_dpoint_type(I) to retrieve the dpoint_type of
+ ** an image.
+ ** \see abstract::dpoint
+ **
+ */
typedef typename image_traits<exact_type>::iter_type iter_type;
+ /*!< Prefer the macro oln_iter_type(I) to retrieve the iter_type of
+ ** an image.
+ **
+ ** \see abstract::iter
+ */
typedef typename image_traits<exact_type>::fwd_iter_type fwd_iter_type;
+ /*!< Forward iterator type. */
typedef typename image_traits<exact_type>::bkd_iter_type bkd_iter_type;
+ /*!< Backward iterator type. */
typedef typename image_traits<exact_type>::value_type value_type;
+ /*!< Prefer the macro oln_value_type(I) to retrieve the value_type of
+ ** an image.
+ */
typedef typename image_traits<exact_type>::size_type size_type;
+ /*!< Indicate how the image size is handled. */
typedef typename image_traits<exact_type>::impl_type impl_type;
+ /*!< Underlying implementation. */
typedef image<Dim, T, Impl, Exact> self_type;
typedef typename abstract::image_with_impl<Impl,
@@ -86,6 +129,13 @@
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief The new image is a shallow copy of \a rhs.
+ ** The \a rhs points are not duplicated, they are shared by
+ ** the new image.
+ **
+ ** \see oln::abstract::image::clone()
+ */
+
image(self_type& rhs): super_type(rhs)
{
mlc_init_static_hierarchy(Exact);
@@ -100,11 +150,15 @@
return s.str();
}
+ /// The image data pointer is set to \a i.
+
image(impl_type* i) : super_type(i)
{
mlc_init_static_hierarchy(Exact);
}
+ /// Allocate memory according to the \a size value.
+
image(const size_type& size) :
super_type(new impl_type(size))
{
@@ -113,7 +167,11 @@
};
- // mute
+ /*! \class mute
+ **
+ ** \a ret is the same type as \a I excepted the value_type
+ ** which will be \a T.
+ */
template<class I, class T = typename mlc::exact<I>::ret::value_type>
struct mute
@@ -121,7 +179,14 @@
typedef typename mlc::exact<I>::ret::template mute<T>::ret ret;
};
- //define img_type equals to the image of dim Dim
+ //define img_type equal to the image of dim Dim
+
+ /*! \class dim_traits
+ **
+ ** Define img_type equal to the image of dim \a Dim
+ ** the generic declaration defines nothing this class
+ ** will be specialized for each dimension.
+ */
template <unsigned Dim, class T, class Exact = mlc::final>
struct dim_traits
{
Index: olena/oln/core/point1d.hh
--- olena/oln/core/point1d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/c/32_point1d.hh 1.14 600)
+++ olena/oln/core/point1d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/32_point1d.hh 1.14 600)
@@ -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,6 +41,12 @@
class dpoint1d;
class point1d;
+
+ /*! \class point_traits<point1d>
+ **
+ ** The specialized version for point1d.
+ */
+
template<>
struct point_traits<point1d> : public point_traits<abstract::point<point1d> >
{
@@ -48,6 +54,17 @@
typedef dpoint1d dpoint_type;
};
+ /*! \class point1d
+ **
+ ** Subclass of abstract::point, declaration of point
+ ** for image1d. To instantiate a point1d on an
+ ** oln::image1d<ntg::rgb_8> for example, use the
+ ** macro oln_point_type.\n
+ ** oln_point_type(oln::image1d<ntg::rgb_8>) p();\n
+ ** or\n
+ ** oln_point_type(oln::image1d<ntg::rgb_8>) p(1);
+ */
+
class point1d : public abstract::point<point1d>
{
public:
@@ -59,11 +76,17 @@
point1d();
+ /// The coordinate of the point1d is set to \a col.
+
point1d(coord col);
+ /// Return the value of the point1d coordinate.
+
coord
col() const;
+ /// Return a reference to the point1d coordinate.
+
coord&
col();
@@ -75,21 +98,46 @@
protected:
+
+ /*! \brief Return a point1d whose coordinate is equal to
+ ** \a dp coordinate plus the current point1d coordinate.
+ */
+
point1d
plus_dp(const dpoint1d& dp) const;
+ /*! \brief Return a point1d whose coordinate is equal to
+ ** the current point1d coordinate minus \a dp coordinate.
+ */
+
point1d
minus_dp(const dpoint1d& dp) const;
+ /*! \brief Return a reference to the current point1d
+ ** plus \a dp.
+ */
+
point1d&
plus_assign_dp(const dpoint1d& dp);
+ /*! \brief Return a reference to the current point1d
+ ** minus \a dp.
+ */
+
point1d&
minus_assign_dp(const dpoint1d& dp);
+ /*! \brief Return a dpoint1d whose coordinate is equal
+ ** to the current point1d coordinate minus \a p coordinate.
+ */
+
dpoint1d
minus_p(const point1d& p) const;
+ /*! \brief Return a point1d whose coordinate is equal to
+ ** the opposite of the current point1d coordinate.
+ */
+
point1d
minus() const;
@@ -97,6 +145,12 @@
namespace internal
{
+
+ /*! \class default_less<point1d>
+ **
+ ** The specialized version for point1d.
+ */
+
template<>
struct default_less<point1d> : public default_less<point1d::super_type>
{
@@ -106,6 +160,8 @@
} // oln
+/// Write on an output stream \a o the coordinate of the point1d \a p.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::point1d& p);
Index: olena/oln/core/point2d.hh
--- olena/oln/core/point2d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/c/30_point2d.hh 1.12 600)
+++ olena/oln/core/point2d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/30_point2d.hh 1.12 600)
@@ -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,14 +31,17 @@
# include <oln/core/coord.hh>
# include <oln/core/abstract/point.hh>
# include <iostream>
-
-
namespace oln {
// fwd decl
class dpoint2d;
class point2d;
+ /*! \class point_traits<point2d>
+ **
+ ** The specialized version for point2d.
+ */
+
template<>
struct point_traits<point2d>: public point_traits<abstract::point<point2d> >
{
@@ -46,6 +49,17 @@
typedef dpoint2d dpoint_type;
};
+ /*! \class point2d
+ **
+ ** Subclass of abstract::point, declaration of point
+ ** for image2d. To instantiate a dpoint2d on an
+ ** oln::image2d<ntg::rgb_8> for example, use the
+ ** macro oln_point_type(I).\n
+ ** oln_point_type(oln::image2d<ntg::rgb_8>) p();\n
+ ** or\n
+ ** oln_point_type(oln::image2d<ntg::rgb_8>) p(1, 2);
+ */
+
class point2d : public abstract::point<point2d >
{
public:
@@ -57,17 +71,27 @@
point2d();
+ /// The coordinates of the point2d are set to \a row and \a col.
+
point2d(coord row, coord col);
+ /// Return Give the value of the point2d row coordinate.
+
coord
row() const;
+ /// Return a reference to the point2d row coordinate.
+
coord&
row();
+ /// Return the value of the point2d col coordinate.
+
coord
col() const;
+ /// Return a reference to the point2d col coordinate.
+
coord&
col();
@@ -79,21 +103,45 @@
protected:
+ /*! \brief Return a point2d whose coordinates are equal to
+ ** \a dp coordinates plus the current point2d coordinates.
+ */
+
point2d
plus_dp(const dpoint2d& dp) const;
+ /*! \brief Return a point2d whose coordinates are equal to
+ ** the current point2d coordinates minus \a dp coordinates.
+ */
+
point2d
minus_dp(const dpoint2d& dp) const;
+ /*! \brief Return a reference to the current point2d
+ ** plus \a dp.
+ */
+
point2d&
plus_assign_dp(const dpoint2d& dp);
+ /*! \brief Return a reference to the current point2d
+ ** minus \a dp.
+ */
+
point2d&
minus_assign_dp(const dpoint2d& dp);
+ /*! \brief Return a dpoint2d whose coordinates are equal
+ ** to the current point2d coordinates minus \a p coordinates.
+ */
+
dpoint2d
minus_p(const point2d& p) const;
+ /*! \brief Return a point2d whose coordinates are equal to
+ ** the opposite of the current point2d coordinates.
+ */
+
point2d
minus() const;
@@ -101,6 +149,12 @@
namespace internal
{
+
+ /*! \class default_less<point2d>
+ **
+ ** The specialized version for point2d.
+ */
+
template<>
struct default_less<point2d> :
public default_less<point2d::super_type>
@@ -109,6 +163,8 @@
} // oln
+/// Write on an output stream \a o the coordinates of the point2d \a p.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::point2d& p);
Index: olena/oln/core/point3d.hh
--- olena/oln/core/point3d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/c/28_point3d.hh 1.14 600)
+++ olena/oln/core/point3d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/28_point3d.hh 1.14 600)
@@ -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,6 +33,7 @@
# include <oln/core/abstract/point.hh>
# include <iostream>
+
namespace oln {
@@ -40,6 +41,11 @@
class dpoint3d;
class point3d;
+ /*! \class point_traits<point3d>
+ **
+ ** The specialized version for point3d.
+ */
+
template<>
struct point_traits<point3d>: public point_traits<abstract::point<point3d> >
{
@@ -47,6 +53,17 @@
typedef dpoint3d dpoint_type;
};
+ /*! \class point3d
+ **
+ ** Subclass of abstract::point, declaration of point
+ ** for image3d. To instantiate a point3d on an
+ ** oln::image3d<ngt::rgb_8> for example, use the
+ ** macro oln_point_type(I).\n
+ ** oln_point_type(oln::image3d<ngt::rgb_8>) p();\n
+ ** or\n
+ ** oln_point_type(oln::image3d<ngt::rgb_8>) p(1, 2, 3);
+ */
+
class point3d : public abstract::point< point3d >
{
public:
@@ -56,25 +73,40 @@
friend class abstract::point< point3d >;
+
point3d();
+ /// The coordinates of the point3d are set to \a slice, \a row, and \a col.
+
point3d(coord slice, coord row, coord col);
+ /// Return the value of the point3d slice coordinate.
+
coord
slice() const;
+ /// Return a reference to the value of the point3d slice coordinate.
+
coord&
slice();
+ /// Return the value of the point3d row coordinate.
+
coord
row() const;
+ /// Return a reference to the point3d row coordinate.
+
coord&
row();
+ /// Return the value of the point3d col coordinate.
+
coord
col() const;
+ /// Return a reference to the point3d col coordinate.
+
coord&
col();
@@ -86,21 +118,45 @@
protected:
+ /*! \brief Return a point3d whose coordinates are equal to
+ ** \a dp coordinates plus the current point3d coordinates.
+ */
+
point3d
plus_dp(const dpoint3d& dp) const;
+ /*! \brief Return a point3d whose coordinates are equal to
+ ** the current point3d coordinates minus \a dp coordinates.
+ */
+
point3d
minus_dp(const dpoint3d& dp) const;
+ /*! \brief Return a reference to the current point3d
+ ** plus \a dp.
+ */
+
point3d&
plus_assign_dp(const dpoint3d& dp);
+ /*! \brief Return a reference to the current point3d
+ ** minus \a dp.
+ */
+
point3d&
minus_assign_dp(const dpoint3d& dp);
+ /*! \brief Return a dpoint3d whose coordinates are equal
+ ** to the current point3d coordinates minus \a p coordinates.
+ */
+
dpoint3d
minus_p(const point3d& p) const;
+ /*! \brief Return a point3d whose coordinates are equal to
+ ** the opposite of the current point3d coordinates.
+ */
+
point3d
minus() const;
@@ -108,6 +164,12 @@
namespace internal
{
+
+ /*! \class default_less<point3d>
+ **
+ ** The specialized version for point3d.
+ */
+
template<>
struct default_less<point3d> : public default_less<point3d::super_type>
{
@@ -117,6 +179,8 @@
} // end of oln
+/// Write on an output stream \a o the coordinates of the point3d \a p.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::point3d& p);
Index: olena/oln/core/traverse.hh
--- olena/oln/core/traverse.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/d/30_traverse.h 1.11 600)
+++ olena/oln/core/traverse.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/30_traverse.h 1.11 600)
@@ -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,7 +37,9 @@
// traverse (unary)
-
+ /*! \brief Call the functor \a f on each point of the
+ ** input image.
+ */
template<class I, class F>
const F&
traverse(F& f, const abstract::image<I>& input)
@@ -47,6 +49,10 @@
return f;
}
+
+ /*! \brief Create a functor \a f whose type is F, then
+ ** call it on each point of the input image.
+ */
template<class F, class I>
inline const F
traverse(const abstract::image<I>& input)
@@ -55,6 +61,9 @@
return traverse(f, input);
}
+ /*! \brief Create a functor \a f whose type is F<oln_value_type(I)>,
+ ** then call it on each point of the input image.
+ */
template<template<class> class F, class I>
inline const F<oln_value_type(I)>
traverse(const abstract::image<I>& input)
@@ -63,6 +72,10 @@
return traverse(f, input);
}
+
+ /*! \brief Create a functor \a f whose type is F<oln_value_type(I), I2>,
+ ** the call it on each point of the input image.
+ */
template<template<class, class> class F, class I2, class I>
inline const F<oln_value_type(I), I2>
traverse(const abstract::image<I>& input)
@@ -71,6 +84,10 @@
return traverse(f, input);
}
+ /*! \brief Create a functor \a f whose type is
+ ** F<oln_value_type(I), F2<oln_value_type(I)> >, then call it on
+ ** each point of the input image.
+ */
template<template<class,class> class F,
template<class> class F2,
class I>
@@ -85,7 +102,11 @@
// traverse2 (binary)
-
+ /*! \brief Call functor \a f whose type is F on each point
+ ** of the two input images.
+ **
+ ** \pre input1.size() == input2.size()
+ */
template<class I1, class I2, class F>
const F&
traverse2(F& f,
@@ -98,6 +119,12 @@
return f;
}
+ /*! \brief Create a functor \a f whose type is F<oln_value_type(I)>,
+ ** then call it on each point of the two input images.
+ **
+ ** \pre input1.size() == input2.size()
+ */
+
template<template<class> class F, class I>
inline const F<oln_value_type(I)>
traverse2(const abstract::image<I>& input1, const abstract::image<I>& input2)
@@ -106,6 +133,13 @@
return traverse2(f, input1, input2);
}
+ /*! \brief Create a functor \a f whose type is
+ ** F<oln_value_type(I1), oln_value_type(I2)>, then call it on each point
+ ** of the two input images.
+ **
+ ** \pre input1.size() == input2.size()
+ */
+
template<template<class,class> class F, class I1, class I2>
inline const F<oln_value_type(I1), oln_value_type(I2)>
traverse2(const abstract::image<I1>& input1,
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/t/25_image.hh 1.24 600)
+++ olena/oln/core/abstract/image.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/t/25_image.hh 1.24 600)
@@ -37,6 +37,9 @@
namespace oln {
+ /*! \namespace abstract
+ ** \brief abstract namespace.
+ */
namespace abstract {
Index: olena/oln/core/impl/image_impl.hh
--- olena/oln/core/impl/image_impl.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/29_image_impl 1.16 600)
+++ olena/oln/core/impl/image_impl.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/t/29_image_impl 1.16 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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
@@ -48,6 +48,12 @@
template<class Impl>
struct impl_traits;
+ /*! \class impl_traits<impl::image_impl<Exact> >
+ **
+ ** Specialized version for impl::image_impl<Exact>. Retrieve
+ ** associated types.
+ */
+
template<class Exact>
struct impl_traits<impl::image_impl<Exact> >
{
@@ -56,6 +62,11 @@
namespace impl {
+ /*! \class image_impl
+ **
+ ** Data array implementation for image
+ */
+
template<class Exact>
class image_impl : public mlc_hierarchy::any<Exact>
{
@@ -70,12 +81,19 @@
image_impl(const size_type s): refcount_(0), size_(s) {}
+
+ /// Notice that there is a new reference to the object.
+
void
ref() const
{
++refcount_;
}
+ /*! \brief Notice that there a reference to the object has disappeared.
+ ** When there is no reference left, the object is deleted.
+ */
+
void
unref() const
{
@@ -85,30 +103,40 @@
delete mlc::to_exact(this);
}
+ /// Return a constant reference to the value stored at \a p.
+
const value_type&
at(const point_type& p) const
{
return this->exact().at_(p);
}
+ /// Return a reference to the value stored at \p.
+
value_type&
at(const point_type& p)
{
return this->exact().at_(p);
}
+ /// Return true if \a p belongs to the image.
+
bool
hold(const point_type& p) const
{
return this->exact().hold_(p);
}
+ /// Return true if \a p belongs to the image or the image border.
+
bool
hold_large(const point_type& p) const
{
return this->exact().hold_large_(p);
}
+ /// Use the function for debugging purpose.
+
void
precondition_hold_large(const point_type& p) const
{
@@ -120,12 +148,17 @@
# endif
}
+
+ /// Perform a deep copy from the data array to output_data.
+
void
clone_to(exact_type* output_data) const
{
return this->exact().clone_to_(output_data);
}
+ /// Return the number of point in the image.
+
const
size_type& size() const
{
@@ -140,6 +173,10 @@
// borders
+ /*! \brief Reallocate the border regarding to the value of \a
+ ** new_border.
+ */
+
void
border_reallocate_and_copy(coord new_border, bool
copy_border)
@@ -147,18 +184,28 @@
this->exact().border_reallocate_and_copy_(new_border, copy_border);
}
+ /*! \brief The border points are all set to
+ ** the value of the closest image point.
+ */
+
void
border_replicate(void)
{
this->exact().border_replicate_();
}
+ /*! \brief The border points are set by mirroring
+ ** the image edges.
+ */
+
void
border_mirror(void)
{
this->exact().border_mirror_();
}
+ /// The border points are set to \a val.
+
void
border_assign(value_type val)
{
Index: olena/oln/core/impl/image_array.hh
--- olena/oln/core/impl/image_array.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/t/30_image_arra 1.14 600)
+++ olena/oln/core/impl/image_array.hh Fri, 12 Mar 2004 19:57:45 +0100 thivol_d (oln/t/30_image_arra 1.14 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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,6 +37,12 @@
namespace oln {
+ /*! \brief Allocate an array of \a s elements of \a T
+ ** type.
+ **
+ ** \pre s > 0
+ */
+
template<class T>
void
allocate_data_(T*& buffer, size_t s)
@@ -45,6 +51,11 @@
buffer = new T[s];
}
+ /*! \brief Free memory pointed to by buffer, then set buffer to 0.
+ **
+ ** \pre buffer != 0
+ */
+
template<class T>
void
desallocate_data_(T*& buffer)
@@ -59,14 +70,30 @@
class image_array;
} // end of impl
+
+ /*! \class impl_traits<impl::image_array<T, Exact> >
+ **
+ ** The specialized version for impl::image_array<T, Exact>
+ */
+
template<class T, class Exact>
struct impl_traits<impl::image_array<T, Exact> >: public impl_traits<impl::image_impl<Exact> >
{
};
+ /*! \namespace impl
+ **
+ ** \brief impl namespace.
+ */
+
namespace impl {
+ /*! \class image_array
+ **
+ ** Array implementation of image data.
+ */
+
template<class T, class Exact>
class image_array: public image_impl<Exact>
{
@@ -86,6 +113,12 @@
friend class image_impl<Exact>;
+ /*! \brief Constructor that allocates \a buffer_ to be
+ ** an array of \a s \a value_type.
+ **
+ ** \pre s > 0
+ */
+
image_array(const size_type& s): super_type(s), buffer_(0)
{
allocate_data_(buffer_, len(s));
@@ -96,6 +129,11 @@
void
operator=(const self_type&); // assign op w/o impl
+ /*! \brief Return a constant pointer to the data array.
+ **
+ ** \invariant buffer_ != 0
+ */
+
const T*
buffer() const
{
@@ -103,6 +141,11 @@
return buffer_;
}
+ /*! \brief Return a point to the data array.
+ **
+ ** \invariant buffer_ != 0
+ */
+
T*
buffer()
{
@@ -110,12 +153,14 @@
return buffer_;
}
+ /// Return the length of the data array.
size_t
len() const
{
return len(this->size());
}
+ /// Return the length of the data array.
size_t
len(const size_type& s) const
{
@@ -124,11 +169,20 @@
protected:
+
~image_array()
{
desallocate_data_(buffer_);
}
+ /*! \brief Perform a deep copy of the current data array.
+ ** This copy is pointed to by \a output_data.
+ **
+ ** \pre output_data != 0
+ **
+ ** \pre output_data->len() == len()
+ */
+
void
clone_to_(exact_type* output_data) const
{
Index: olena/oln/core/impl/image_array3d.hh
--- olena/oln/core/impl/image_array3d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/t/32_image_arra 1.10 600)
+++ olena/oln/core/impl/image_array3d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/t/32_image_arra 1.10 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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,6 +34,8 @@
namespace oln {
+ /// Build an image data array with the real data and the border.
+
template<class T>
void
pretreat_3d_data_(T*& buffer, T**& array2, T***& array,
@@ -64,6 +66,8 @@
array += s.border();
}
+ /// Free the image3d data array.
+
template<class T>
void
desallocate_3d_data_(T**& array2, T***& array, const
@@ -82,6 +86,12 @@
class image_array3d;
} // end of impl
+ /*! \class impl_traits<impl::image_array3d<T> >
+ **
+ ** Specialized version for impl::image_array3d<T>. Retrieve
+ ** associated types.
+ */
+
template<class T>
struct impl_traits<impl::image_array3d<T> >: public impl_traits<impl::image_array<T, impl::image_array3d<T> > >
{
@@ -94,6 +104,11 @@
namespace impl
{
+ /*! \class image_array3d
+ **
+ ** Data array implementation for image3d
+ */
+
template<class T>
class image_array3d :
public image_array<T, image_array3d<T> >
@@ -126,6 +141,8 @@
protected:
+ /// Return true if \a p belongs to the image.
+
bool
hold_(const point_type& p) const
{
@@ -137,6 +154,8 @@
&& p.col() < this->size_.ncols());
}
+ /// Return true if \a p belongs to the image or the image border
+
bool
hold_large_(const point_type& p) const
{
@@ -148,6 +167,8 @@
&& p.col() < this->size_.ncols() + this->size_.border());
}
+ /// Return a reference to the value stored at \a p.
+
value_type&
at_(const point_type& p)
{
@@ -155,6 +176,8 @@
return at_(p.slice(), p.row(), p.col());
}
+ /// Return a reference to the value stored at \a slice, \a row and \a col.
+
value_type&
at_(coord slice, coord row, coord col)
{
@@ -163,6 +186,8 @@
return array_[slice][row][col];
}
+ /// Return the total size of the data array.
+
size_t
len_(const size_type& s) const
{
@@ -174,6 +199,10 @@
// borders
+ /*! \brief Reallocate the border regarding to the value of \a
+ ** new_border.
+ */
+
void
border_reallocate_and_copy_(coord new_border, bool
copy_border)
@@ -212,6 +241,10 @@
array_ = array;
}
+ /*! \brief The border points are all set to
+ ** the value of the closest image point.
+ */
+
void
border_replicate_(void)
{
@@ -244,6 +277,10 @@
}
}
+ /*! \brief The border points are set by mirroring
+ ** the image edges.
+ */
+
void
border_mirror_(void)
{
@@ -276,6 +313,8 @@
}
}
+ /// The border points are set to \a val.
+
void
border_assign_(value_type val)
{
Index: olena/oln/core/impl/image_array2d.hh
--- olena/oln/core/impl/image_array2d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/t/33_image_arra 1.11 600)
+++ olena/oln/core/impl/image_array2d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/t/33_image_arra 1.11 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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,6 +34,8 @@
namespace oln {
+ /// Build an image data array with the real data and the border.
+
template<class T>
void
pretreat_2d_data_(T*& buffer, T**& array, const image2d_size& s)
@@ -53,6 +55,8 @@
array += s.border();
}
+ /// Free the image2d data array.
+
template<class T>
void
desallocate_2d_data_(T**& array, const image2d_size& s)
@@ -67,6 +71,12 @@
class image_array2d;
} // end of impl
+ /*! \class impl_traits<impl::image_array2d<T> >
+ **
+ ** Specialized version for impl::image_array2d<T>. Retrieve
+ ** associated types.
+ */
+
template<class T>
struct impl_traits<impl::image_array2d<T> >: public impl_traits<impl::image_array<T, impl::image_array2d<T> > >
{
@@ -80,6 +90,11 @@
namespace impl
{
+ /*! \class image_array2d
+ **
+ ** Data array implementation for image2d
+ */
+
template<class T>
class image_array2d :
public image_array<T, image_array2d<T> >
@@ -100,6 +115,8 @@
friend class image_impl<image_array2d<T> >;
friend class image_array<T, image_array2d<T> >;
+
+
image_array2d(const size_type& s): super_type(s)
{
pretreat_2d_data_(this->buffer_, array_, s);
@@ -112,6 +129,8 @@
protected:
+ /// Return true if \a p belongs to the image.
+
bool
hold_(const point_type& p) const
{
@@ -122,6 +141,8 @@
p.col() < this->size_.ncols();
}
+ /// Return true if \a p belongs to the image or the image border
+
bool
hold_large_(const point_type& p) const
{
@@ -132,12 +153,16 @@
p.col() < this->size_.ncols() + this->size_.border();
}
+ /// Return a reference to the value stored at \a p.
+
value_type&
at_(const point_type& p)
{
return at_(p.row(), p.col());
}
+ /// Return a reference to the value stored at \a row and \a col.
+
value_type&
at_(coord row, coord col)
{
@@ -146,6 +171,8 @@
return array_[row][col];
}
+ /// Return the total size of the data array.
+
size_t
len_(const size_type& s) const
{
@@ -156,6 +183,10 @@
// borders
+ /*! \brief Reallocate the border regarding to the value of \a
+ ** new_border.
+ */
+
void
border_reallocate_and_copy_(coord new_border, bool
copy_border)
@@ -188,6 +219,11 @@
array_ = array;
}
+
+ /*! \brief The border points are all set to
+ ** the value of the closest image point.
+ */
+
void
border_replicate_(void)
{
@@ -209,6 +245,10 @@
}
}
+ /*! \brief The border points are set by mirroring
+ ** the image edges.
+ */
+
void
border_mirror_(void)
{
@@ -231,6 +271,8 @@
}
}
+ /// The border points are set to \a val.
+
void
border_assign_(value_type val)
{
Index: olena/oln/core/impl/image_array1d.hh
--- olena/oln/core/impl/image_array1d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n (oln/t/34_image_arra 1.12 600)
+++ olena/oln/core/impl/image_array1d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/t/34_image_arra 1.12 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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,6 +34,9 @@
namespace oln {
+
+ /// Build an image data array with the real data and the border.
+
template<class T>
void
pretreat_1d_data_(T*& buffer, T*& buffer_, const image1d_size& s)
@@ -48,6 +51,12 @@
class image_array1d;
} // end of impl
+ /*! \class impl_traits<impl::image_array1d<T> >
+ **
+ ** Specialized version for impl::image_array1d<T>. Retrieve
+ ** associated types.
+ */
+
template<class T>
struct impl_traits<impl::image_array1d<T> >: public impl_traits<impl::image_array<T, impl::image_array1d<T> > >
{
@@ -59,6 +68,12 @@
namespace impl {
+
+ /*! \class image_array1d
+ **
+ ** Data array implementation for image1d
+ */
+
template<class T>
class image_array1d :
public image_array<T, image_array1d<T> >
@@ -88,6 +103,8 @@
protected:
+ /// Return true if \a p belongs to the image.
+
bool
hold_(const point_type& p) const
{
@@ -96,6 +113,8 @@
p.col() < this->size_.ncols();
}
+ /// Return true if \a p belongs to the image or the image border
+
bool
hold_large_(const point_type& p) const
{
@@ -104,12 +123,15 @@
p.col() < this->size_.ncols() + this->size_.border();
}
+
+ /// Return a reference to the value stored at \a p.
value_type&
at_(const point_type& p)
{
return at_(p.col());
}
+ /// Return a reference to the value stored at \a col.
value_type&
at_(coord col)
{
@@ -118,6 +140,8 @@
return buffer__[col];
}
+
+ /// Return the total size of the data array.
size_t
len_(const size_type& s) const
{
@@ -126,6 +150,10 @@
}
// borders
+
+ /*! \brief Reallocate the border regarding to the value of \a
+ ** new_border.
+ */
void
border_reallocate_and_copy_(coord new_border, bool copy_border)
{
@@ -150,6 +178,11 @@
}
+ /*! \brief The border points are all set to
+ ** the value of the closest image point.
+ */
+
+
void
border_replicate_(void)
{
@@ -160,6 +193,10 @@
}
}
+ /*! \brief The border points are set by mirroring
+ ** the image edges.
+ */
+
void
border_mirror_(void)
{
@@ -170,6 +207,8 @@
}
}
+ /// The border points are set to \a val.
+
void
border_assign_(value_type val)
{
Index: olena/oln/core/behavior.hh
--- olena/oln/core/behavior.hh Tue, 24 Feb 2004 16:33:38 +0100 palma_g (oln/j/47_behavior.h 1.2 600)
+++ olena/oln/core/behavior.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/j/47_behavior.h 1.2 600)
@@ -33,7 +33,9 @@
namespace oln {
/*! \class mirror_behavior
**
- ** make the border be a mirror of the image
+ ** Make the border be a mirror of the image.
+ **
+ ** \see abstract::image_size::border_
*/
// mirror the image content into the border
template <class Exact = mlc::final>
@@ -52,6 +54,13 @@
};
// set the border to a specific value
+
+ /*! \class value_behavior
+ **
+ ** Set the border to a specific value.
+ **
+ ** \see abstract::image_size::border_
+ */
template <class T, class Exact = mlc::final>
class value_behavior:
public abstract::behavior<mlc_2_exact_vt_type(value_behavior, T, Exact)>
@@ -76,6 +85,13 @@
};
// replicate the border
+
+ /*! \brief replicate_behavior
+ **
+ ** Replicate the border.
+ **
+ ** \see abstract::image_size::border_
+ */
template <class Exact = mlc::final>
class replicate_behavior:
public abstract::behavior<mlc_exact_vt_type(replicate_behavior<Exact>, Exact)>
@@ -92,17 +108,20 @@
};
// tools to call ctors with type inference
+ /// To call Ctors with type inference.
inline mirror_behavior<> mirror_bhv()
{
return mirror_behavior<>();
}
+ /// To call Ctors with type inference.
template <class T>
inline value_behavior<T> value_bhv(const T &value)
{
return value_behavior<T>(value);
}
+ /// To call Ctors with type inference.
inline replicate_behavior<> replicate_bhv()
{
return replicate_behavior<>();
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr
2
4
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
2
1
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/topo/dmap.hh: Correct comments.
* olena/oln/topo/tarjan/flat-zone.hh: Likewise.
+2004-03-14 Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/convert/nrgbxyz.hh: Correct comments.
* olena/oln/convert/stretch.hh: Likewise.
* olena/oln/level/cc.hh: Likewise.
Index: olena/oln/topo/dmap.hh
--- olena/oln/topo/dmap.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n
(oln/p/2_dmap.hh 1.8 640)
+++ olena/oln/topo/dmap.hh Sun, 14 Mar 2004 22:25:33 +0100 van-vl_n
(oln/p/2_dmap.hh 1.8 640)
@@ -650,8 +650,8 @@
** IMG_OUT "oln_topo_dmap.pgm");
** }
** \endcode
- ** \image html face_se.png
- ** \image latex face_se.png
+ ** \image html face_se_pbm.png
+ ** \image latex face_se_pbm.png
** =>
** \image html oln_topo_dmap.png
** \image latex oln_topo_dmap.png
Index: olena/oln/topo/tarjan/flat-zone.hh
--- olena/oln/topo/tarjan/flat-zone.hh Sun, 14 Mar 2004 18:15:46 +0100
van-vl_n (oln/r/35_flat-zone. 1.10 640)
+++ olena/oln/topo/tarjan/flat-zone.hh Sun, 14 Mar 2004 22:25:09 +0100
van-vl_n (oln/r/35_flat-zone. 1.10 640)
@@ -57,8 +57,8 @@
** IMG_OUT "oln_topo_flat_zone.pgm");
** }
** \endcode
- ** \image html test-cmap.png width=6cm
- ** \image latex test-cmap.png width=6cm
+ ** \image html test-cmap_pgm.png width=6cm
+ ** \image latex test-cmap_pgm.png width=6cm
** =>
** \image html oln_topo_flat_zone.png width=6cm
** \image latex oln_topo_flat_zone.png width=6cm
1
0