oln 10.84: doc (topo)

The directory oln/topo/combinatorial-map is not well documented. Index: olena/ChangeLog from Niels Van Vliet <niels@lrde.epita.fr> * olena/oln/core/abstract/iter1d.hh: Fix a bug. * olena/oln/core/abstract/iter2d.hh: Fix a bug. * olena/oln/core/abstract/iter3d.hh: Fix a bug. * olena/oln/morpho/attribute_union_find.hh: Add a FIXME. * olena/oln/topo/dmap.hh: Add comments. * olena/oln/topo/tarjan/union.hh: Likewise. * olena/oln/topo/inter-pixel/inter-pixel.hh: Likewise. * olena/oln/topo/tarjan/flat-zone.hh: Likewise. * olena/oln/topo/combinatorial-map/cmap.hh: Likewise. * olena/oln/topo/combinatorial-map/internal/zeta.hh: Likewise. * olena/oln/topo/inter-pixel/fwd-dir-iter.hh: Likewise. * olena/oln/topo/inter-pixel/bkd-dir-iter.hh: Likewise. * olena/oln/topo/inter-pixel/node.hh: Likewise. * olena/oln/topo/inter-pixel/internal/dir-iter.hh: Likewise. * olena/oln/topo/inter-pixel/internal/dir.hh: Likewise. * olena/oln/topo/combinatorial-map/internal/alpha.hh: Likewise. * olena/oln/topo/combinatorial-map/internal/anyfunc.hh: Likewise. * olena/oln/topo/combinatorial-map/internal/beta.hh: Likewise. * olena/oln/topo/combinatorial-map/internal/lambda.hh: Likewise. * olena/oln/topo/combinatorial-map/internal/level.hh: Likewise. * olena/oln/topo/combinatorial-map/internal/sigma.hh : Likewise. Index: olena/oln/core/abstract/iter1d.hh --- olena/oln/core/abstract/iter1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/10_iter1d.hh 1.17 640) +++ olena/oln/core/abstract/iter1d.hh Sun, 14 Mar 2004 16:55:35 +0100 van-vl_n (oln/d/10_iter1d.hh 1.17 640) @@ -119,6 +119,12 @@ /*! ** \brief Constructor + */ + iter1d() : super_type(), ncols_(0) + {} + + /*! + ** \brief Constructor ** \arg size The size of the image to iterate. ** \pre size.ncols() > 0. ** Index: olena/oln/core/abstract/iter2d.hh --- olena/oln/core/abstract/iter2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/9_iter2d.hh 1.17 640) +++ olena/oln/core/abstract/iter2d.hh Sun, 14 Mar 2004 16:59:19 +0100 van-vl_n (oln/d/9_iter2d.hh 1.17 640) @@ -134,6 +134,12 @@ } /*! + ** \brief Constructor + */ + 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. Index: olena/oln/core/abstract/iter3d.hh --- olena/oln/core/abstract/iter3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/8_iter3d.hh 1.17 640) +++ olena/oln/core/abstract/iter3d.hh Sun, 14 Mar 2004 16:59:54 +0100 van-vl_n (oln/d/8_iter3d.hh 1.17 640) @@ -150,6 +150,12 @@ } /*! + ** \brief Constructor + */ + 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. Index: olena/oln/topo/dmap.hh --- olena/oln/topo/dmap.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/p/2_dmap.hh 1.7 640) +++ olena/oln/topo/dmap.hh Sun, 14 Mar 2004 14:37:47 +0100 van-vl_n (oln/p/2_dmap.hh 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 @@ -36,10 +36,21 @@ // # include <math.h> # include <utility> +/*! \file dmap.hh +** +** \ref B.J.H. Verwer, Local distances for distance transformations +** in two and three dimensions, Pattern Recognition Letters 12 (1991) 671-682 +*/ + namespace oln { + /// Namespce topo. namespace topo { - + /*! Chamfer mask. + ** + ** The Chamfer mask is a weighted masks that provides an approximation + ** of the real Euclidean distance in the discrete space. + */ template<class T> struct chamfer { @@ -55,80 +66,634 @@ const float coef; }; + /*! Produce a chamfer mask 3x3 + ** + ** \bug FIXME: This highly not thread safe ! + ** + ** \verbatim + ** Example of oln::topo::mk_chamfer_3x3<1,2>(3) w; + ** w.delta(): 1 + ** w.coef: 3 + ** w.fwd: + ** 2 1 2 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 2 1 2 + ** \endverbatim + */ template<int d10, int d11> inline const chamfer<int>& mk_chamfer_3x3(float coef = 1.f); + /*! Produce a chamfer mask 3x3 + ** + ** \bug FIXME: This highly not thread safe ! + ** + ** \verbatim + ** Example of oln::topo::mk_chamfer_3x3(1.5, 2.5) w; + ** w.delta(): 1 + ** w.coef: 1 + ** w.fwd: + ** 2.5 1.5 2.5 + ** 1.5 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1.5 + ** 2.5 1.5 2.5 + ** \endverbatim + */ inline const chamfer<float>& mk_chamfer_3x3(float d10, float d11); + /*! Chamfer 5x5 + ** + ** \verbatim + ** Example of oln::topo::mk_chamfer_5x5<1, 2, 3>(4) w; + ** w.delta(): 2 + ** w.coef: 4 + ** w.fwd: + ** . 3 . 3 . + ** 3 2 1 2 3 + ** . 1 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 1 . + ** 3 2 1 2 3 + ** . 3 . 3 . + ** \endverbatim + */ template<int d10, int d11, int d21> inline const chamfer<int>& mk_chamfer_5x5(float coef = 1.f); + /*! Chamfer 5x5 using float + ** + ** \see mk_chamfer_5x5 + */ inline const chamfer<float>& mk_chamfer_5x5(float d10, float d11, float d21); - // REF: B.J.H. Verwer, Local distances for distance transformations - // in two and three dimensions, Pattern Recognition Letters 12 (1991) 671-682 + /*! Chamfer_1_1 + ** + ** \verbatim + ** Example of oln::topo::chamfer_1_1() w; + ** w.delta(): 1 + ** w.coef: 0.9003 + ** w.fwd: + ** 1 1 1 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 1 1 1 + ** \endverbatim + */ inline const chamfer<int>& chamfer_1_1(); + + /*! Chamfer_1_2 + ** + ** \verbatim + ** Example of oln::topo::chamfer_1_2() w; + ** w.delta(): 1 + ** w.coef: 1.2732 + ** w.fwd: + ** 2 1 2 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 2 1 2 + ** \endverbatim + */ inline const chamfer<int>& chamfer_1_2(); + /*! Chamfer_2_3 + ** + ** \verbatim + ** Example of oln::topo::chamfer_2_3() w; + ** w.delta(): 1 + ** w.coef: 2.1736 + ** w.fwd: + ** 3 2 3 + ** 2 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 2 + ** 3 2 3 + ** \endverbatim + */ inline const chamfer<int>& chamfer_2_3(); + /*! Chamfer_5_7 + ** + ** \verbatim + ** Example of oln::topo::chamfer_5_7() w; + ** w.delta(): 1 + ** w.coef: 5.2474 + ** w.fwd: + ** 7 5 7 + ** 5 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 5 + ** 7 5 7 + ** \endverbatim + */ inline const chamfer<int>& chamfer_5_7(); + /*! Chamfer_12_17 + ** + ** \verbatim + ** Example of oln::topo::chamfer_12_17() w; + ** w.delta(): 1 + ** w.coef: 12.6684 + ** w.fwd: + ** 17 12 17 + ** 12 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 12 + ** 17 12 17 + ** \endverbatim + */ inline const chamfer<int>& chamfer_12_17(); + /*! Chessboard + ** + ** \verbatim + ** Example of oln::topo::chessboard() w; + ** w.delta(): 1 + ** w.coef: 0.9003 + ** w.fwd: + ** 1 1 1 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 1 1 1 + ** \endverbatim + */ inline const chamfer<int>& chessboard(); + /*! Cityblock + ** + ** \verbatim + ** Example of oln::topo::cityblock() w; + ** w.delta(): 1 + ** w.coef: 1.2732 + ** w.fwd: + ** 2 1 2 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 2 1 2 + ** \endverbatim + */ inline const chamfer<int>& cityblock(); + /*! Chamfer_4_6_9 + ** + ** \verbatim + ** Example of oln::topo::chamfer_4_6_9() w; + ** w.delta(): 2 + ** w.coef: 4.1203 + ** w.fwd: + ** . 9 . 9 . + ** 9 6 4 6 9 + ** . 4 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 4 . + ** 9 6 4 6 9 + ** . 9 . 9 . + ** \endverbatim + */ inline const chamfer<int>& chamfer_4_6_9(); + /*! Chamfer_5_7_11 + ** + ** \verbatim + ** Example of oln::topo::chamfer_5_7_11() w; + ** w.delta(): 2 + ** w.coef: 5.0206 + ** w.fwd: + ** . 11 . 11 . + ** 11 7 5 7 11 + ** . 5 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 5 . + ** 11 7 5 7 11 + ** . 11 . 11 . + ** \endverbatim + */ inline const chamfer<int>& chamfer_5_7_11(); + /*! Chamfer_9_13_20 + ** + ** \verbatim + ** Example of oln::topo::chamfer_9_13_20() w; + ** w.delta(): 2 + ** w.coef: 9.1409 + ** w.fwd: + ** . 20 . 20 . + ** 20 13 9 13 20 + ** . 9 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 9 . + ** 20 13 9 13 20 + ** . 20 . 20 . + ** \endverbatim + */ inline const chamfer<int>& chamfer_9_13_20(); + /*! Chamfer_16_23_36 + ** + ** \verbatim + ** Example of oln::topo::chamfer_16_23_36() w; + ** w.delta(): 2 + ** w.coef: 16.3351 + ** w.fwd: + ** . 36 . 36 . + ** 36 23 16 23 36 + ** . 16 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 16 . + ** 36 23 16 23 36 + ** . 36 . 36 . + ** \endverbatim + */ inline const chamfer<int>& chamfer_16_23_36(); + /*! Best set 3x3 + ** + ** \verbatim + ** Example of oln::topo::best_set_3x3() w; + ** w.delta(): 1 + ** w.coef: 1 + ** w.fwd: + ** 1.3408 0.9481 1.3408 + ** 0.9481 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 0.9481 + ** 1.3408 0.9481 1.3408 + ** \endverbatim + */ inline const chamfer<float>& best_set_3x3(); + /*! Best set 5x5 + ** + ** \verbatim + ** Example of oln::topo::best_set_5x5() w; + ** w.delta(): 2 + ** w.coef: 1 + ** w.fwd: + ** . 2.2044 . 2.2044 . + ** 2.2044 1.406 0.9801 1.406 2.2044 + ** . 0.9801 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 0.9801 . + ** 2.2044 1.406 0.9801 1.406 2.2044 + ** . 2.2044 . 2.2044 . + ** \endverbatim + */ inline const chamfer<float>& best_set_5x5(); // maximum absolute error for integer local distances (Table 2) + /* Maximum absolute error for integer local distances for chamfer_1_1. + ** + ** \verbatim + ** oln::topo::mchamfer_1_1() = + ** w.delta(): 1 + ** w.coef: 0.8536 + ** w.fwd: + ** 1 1 1 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 1 1 1 + ** \endverbatim + */ inline const chamfer<int>& mchamfer_1_1(); + /* Maximum absolute error for integer local distances for chamfer_1_2. + ** + ** \verbatim + ** oln::topo::mchamfer_1_2() = + ** w.delta(): 1 + ** w.coef: 1.2071 + ** w.fwd: + ** 2 1 2 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 2 1 2 + ** \endverbatim + */ inline const chamfer<int>& mchamfer_1_2(); + /* Maximum absolute error for integer local distances for chamfer_2_3. + ** + ** \verbatim + ** oln::topo::mchamfer_2_3() = + ** w.delta(): 1 + ** w.coef: 2.118 + ** w.fwd: + ** 3 2 3 + ** 2 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 2 + ** 3 2 3 + ** \endverbatim + */ inline const chamfer<int>& mchamfer_2_3(); + /* Maximum absolute error for integer local distances for chamfer_5_7. + ** + ** \verbatim + ** oln::topo::mchamfer_5_7() = + ** w.delta(): 1 + ** w.coef: 5.1675 + ** w.fwd: + ** 7 5 7 + ** 5 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 5 + ** 7 5 7 + ** \endverbatim + */ inline const chamfer<int>& mchamfer_5_7(); + /* Maximum absolute error for integer local distances for chamfer_12_17. + ** + ** \verbatim + ** oln::topo::mchamfer_12_17() = + ** w.delta(): 1 + ** w.coef: 12.5 + ** w.fwd: + ** 17 12 17 + ** 12 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 12 + ** 17 12 17 + ** \endverbatim + */ inline const chamfer<int>& mchamfer_12_17(); + /* Maximum absolute error for integer local distances for chessboard. + ** + ** \verbatim + ** oln::topo::mchessboard() = + ** w.delta(): 1 + ** w.coef: 0.8536 + ** w.fwd: + ** 1 1 1 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 1 1 1 + ** \endverbatim + */ inline const chamfer<int>& mchessboard(); + /* Maximum absolute error for integer local distances for cityblock. + ** + ** \verbatim + ** oln::topo::mcityblock() = + ** w.delta(): 1 + ** w.coef: 1.2071 + ** w.fwd: + ** 2 1 2 + ** 1 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 1 + ** 2 1 2 + ** \endverbatim + */ inline const chamfer<int>& mcityblock(); + /* Maximum absolute error for integer local distances for chamfer_4_6_9. + ** + ** \verbatim + ** oln::topo::mchamfer_4_6_9() = + ** w.delta(): 2 + ** w.coef: 4.1213 + ** w.fwd: + ** . 9 . 9 . + ** 9 6 4 6 9 + ** . 4 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 4 . + ** 9 6 4 6 9 + ** . 9 . 9 . + ** \endverbatim + */ inline const chamfer<int>& mchamfer_4_6_9(); + /* Maximum absolute error for integer local distances for chamfer_5_7_11. + ** + ** \verbatim + ** oln::topo::mchamfer_5_7_11() = + ** w.delta(): 2 + ** w.coef: 5.0092 + ** w.fwd: + ** . 11 . 11 . + ** 11 7 5 7 11 + ** . 5 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 5 . + ** 11 7 5 7 11 + ** . 11 . 11 . + ** \endverbatim + */ inline const chamfer<int>& mchamfer_5_7_11(); + /* Maximum absolute error for integer local distances for chamfer_9_13_20. + ** + ** \verbatim + ** oln::topo::mchamfer_9_13_20() = + ** w.delta(): 2 + ** w.coef: 9.0819 + ** w.fwd: + ** . 20 . 20 . + ** 20 13 9 13 20 + ** . 9 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 9 . + ** 20 13 9 13 20 + ** . 20 . 20 . + ** \endverbatim + */ inline const chamfer<int>& mchamfer_9_13_20(); + /* Maximum absolute error for integer local distances for chamfer_17_24_38. + ** + ** \verbatim + ** oln::topo::mchamfer_17_24_38() = + ** w.delta(): 2 + ** w.coef: 17.2174 + ** w.fwd: + ** . 38 . 38 . + ** 38 24 17 24 38 + ** . 17 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 17 . + ** 38 24 17 24 38 + ** . 38 . 38 . + ** \endverbatim + */ inline const chamfer<int>& mchamfer_17_24_38(); + /* Maximum absolute error for integer local distances for best_set_3x3. + ** + ** \verbatim + ** oln::topo:mbest_set_3x3() = + ** w.delta(): 1 + ** w.coef: 1 + ** w.fwd: + ** 1.35825 0.96043 1.35825 + ** 0.96043 . . + ** . . . + ** w.bkd: + ** . . . + ** . . 0.96043 + ** 1.35825 0.96043 1.35825 + ** \endverbatim + */ inline const chamfer<float>& mbest_set_3x3(); + /* Maximum absolute error for integer local distances for best_set_5x5. + ** + ** \verbatim + ** oln::topo:mbest_set_5x5() = + ** w.delta(): 2 + ** w.coef: 1 + ** w.fwd: + ** . 2.20585 . 2.20585 . + ** 2.20585 1.3951 0.986485 1.3951 2.20585 + ** . 0.986485 . . . + ** . . . . . + ** . . . . . + ** w.bkd: + ** . . . . . + ** . . . . . + ** . . . 0.986485 . + ** 2.20585 1.3951 0.986485 1.3951 2.20585 + ** . 2.20585 . 2.20585 . + ** \endverbatim + */ inline const chamfer<float>& mbest_set_5x5(); + /*! Distance map + ** + ** \param T Type of the distance. + ** \param T2 Type of the chamfer distance. + ** + ** \note Do not forget to call \a compute. + ** + ** \code + ** #include <oln/basics2d.hh> + ** #include <oln/topo/dmap.hh> + ** #include <oln/convert/stretch.hh> + ** + ** int main() + ** { + ** oln::image2d<ntg::bin> in = oln::load(IMG_IN "face_se.pbm"); + ** + ** oln::topo::dmap<ntg::int_u<16>, int> m(in.size(), oln::topo::chessboard()); + ** m.compute(in); + ** save(oln::convert::stretch_balance<ntg::int_u8>(m.imap()), + ** IMG_OUT "oln_topo_dmap.pgm"); + ** } + ** \endcode + ** \image html face_se.png + ** \image latex face_se.png + ** => + ** \image html oln_topo_dmap.png + ** \image latex oln_topo_dmap.png + */ template<class T, class T2> class dmap { public: typedef image2d<ntg::bin>::point_type point_type; + /*! Constructor. + ** + ** \arg size Size of the image on which the dmap will be compute. + ** \arg ch Chamfer distance used. + */ dmap(const image2d_size& size, const chamfer<T2>& ch); + /// Compute the distance map. template <class V> void compute(const image2d<V>& input, float infty = 0.f); + /// Compute the distance map. template <class V> void compute(const image2d<V>& input, image2d<point2d>& nearest_point_map, float infty = 0.f); + /// Return the distance map of type T. const image2d<T>& imap() const; + /// Return the distance map divided by the Chamfer coefficient. image2d<float> to_image() const; + /// Distance of a point p. const T& operator[](const point_type& p) const; + /// Distance of a point2d(row, col). const T& operator()(coord row, coord col) const; @@ -138,7 +703,7 @@ float inFty_; T infTy_; }; - + /// Distance map using the Euclidean distance. template <class I> image2d<float> exact_dmap(const abstract::image<I>& input); Index: olena/oln/morpho/attribute_union_find.hh --- olena/oln/morpho/attribute_union_find.hh Fri, 12 Mar 2004 13:29:59 +0100 palma_g (oln/q/50_attribute_ 1.15 640) +++ olena/oln/morpho/attribute_union_find.hh Sun, 14 Mar 2004 14:26:36 +0100 van-vl_n (oln/q/50_attribute_ 1.15 640) @@ -48,6 +48,9 @@ ** \param T Exact type of images to process. ** \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 + ** (oln::topo::tarjan::tarjan_set). */ template<class T, class ATTRIBUTE, class Env = attr_env_type(ATTRIBUTE)> struct tarjan_set Index: olena/oln/topo/tarjan/union.hh --- olena/oln/topo/tarjan/union.hh Thu, 07 Aug 2003 10:35:19 +0200 sylvain (oln/r/33_union.hh 1.8 640) +++ olena/oln/topo/tarjan/union.hh Sun, 14 Mar 2004 14:29:23 +0100 van-vl_n (oln/r/33_union.hh 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 @@ -35,12 +35,19 @@ namespace oln { namespace topo { - + /// Namespace Tarjan namespace tarjan { struct empty_class {}; + /*! Tarjan set. + ** + ** \attention FIXME: a similar class is defined in + ** oln/morpho/attribute_union_find.hh (oln::morpho::tarjan::tarjan_set). + ** The one in morpho is more general. I think that this class should + ** be removed. + */ template< class I, class aux_data_type> struct tarjan_set { Index: olena/oln/topo/inter-pixel/inter-pixel.hh --- olena/oln/topo/inter-pixel/inter-pixel.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/r/34_inter-pixe 1.12 640) +++ olena/oln/topo/inter-pixel/inter-pixel.hh Sun, 14 Mar 2004 17:13:37 +0100 van-vl_n (oln/r/34_inter-pixe 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 @@ -40,10 +40,36 @@ namespace topo { namespace inter_pixel { - + /// Return the inter pixel type of an image type. # define oln_interpixel_type(ImgType) \ typename oln::mute< ImgType, oln_node_type(ImgType) >::ret + /*! Inter pixel class. + ** + ** This example give the node of the black connected component (bottom left). + ** \code + ** #include <ntg/int.hh> + ** #include <oln/basics2d.hh> + ** #include <oln/topo/inter-pixel/inter-pixel.hh> + ** #include <iostream> + ** using namespace oln::topo::inter_pixel; + ** + ** int main() + ** { + ** typedef oln::image2d<ntg::int_u8> img_type; + ** img_type in = oln::load(IMG_IN "test-cmap.pgm"); + ** interpixel<oln::image2d<ntg::int_u8> > ip(in); + ** std::cout << ip << std::endl; + ** // Print: + ** // (5,0): east north south + ** // (5,5): north west south + ** // (7,5): east north west + ** // (10,9): east north west + ** // (10,11): north west south + ** // (11,14): north west south + ** } + ** \todo FIXME: Test the output values in the tests. + */ template <class I> class interpixel { @@ -59,6 +85,7 @@ typedef oln_interpixel_type(I) inter_pixel_type; public: + /// Construct an inter pixel map of the image \a img. interpixel(const I & img) : data_(img.nrows() + 1, img.ncols() + 1) { @@ -77,12 +104,17 @@ } } + /// FIXME: add doc. const node_type& operator[](const point_type & p) const { return data_[p]; } + /*! FIXME: add doc. + ** + ** \pre precondition(data_[in.first].get(in.second) == true) + */ head_type folw(const head_type& in) const { @@ -111,6 +143,7 @@ return out; } + /// Print the inter pixel map. std::ostream& print(std::ostream & ostr) const { Index: olena/oln/topo/tarjan/flat-zone.hh --- olena/oln/topo/tarjan/flat-zone.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/r/35_flat-zone. 1.9 640) +++ olena/oln/topo/tarjan/flat-zone.hh Sun, 14 Mar 2004 16:27:18 +0100 van-vl_n (oln/r/35_flat-zone. 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,10 +39,30 @@ namespace tarjan { - /*----------. - | flat_zone | - `----------*/ - + /*! Create an image of label of the flat zones. + ** + ** \todo FIXME: many assertions are missing. + ** + ** \code + ** #include <oln/basics2d.hh> + ** #include <oln/topo/tarjan/flat-zone.hh> + ** #include <oln/convert/stretch.hh> + ** + ** int main() + ** { + ** typedef oln::image2d<ntg::int_u8> img_type; + ** img_type in = oln::load(IMG_IN "test-cmap.pgm"); + ** oln::topo::tarjan::flat_zone<img_type> z(in); + ** save(oln::convert::stretch_balance<ntg::int_u8>(z.label, 0, 255), + ** IMG_OUT "oln_topo_flat_zone.pgm"); + ** } + ** \endcode + ** \image html test-cmap.png width=6cm + ** \image latex test-cmap.png width=6cm + ** => + ** \image html oln_topo_flat_zone.png width=6cm + ** \image latex oln_topo_flat_zone.png width=6cm + */ template <class I> struct flat_zone { @@ -54,6 +74,7 @@ const image_type &input; tarjan_cc cc; + /// output image. image2d<unsigned> label; std::vector<point_type> look_up_table; @@ -61,7 +82,10 @@ image2d< std::vector<oln::point2d> > ima_region; unsigned nlabels_; - + /*! Initialize the flat-zone with an image. + ** + ** \a doit is called. + */ flat_zone(const image_type& input_) : input(input_), cc(input_), label(input_.size()), ima_region(input_.size()), @@ -69,7 +93,7 @@ { doit(); } - + /// Compute the image of label. void doit() { @@ -158,25 +182,29 @@ } } - + /// Get the label of a point \a p. const unsigned get_label(const point_type & p) const { return label[p]; } - + /// Get the root point of a label \a l. const point_type& get_root(unsigned l) const { return look_up_table[l]; } - + /// Number of label. const unsigned nlabels() const { return nlabels_; } + /*! Merge two flat zone. + ** + ** \note FIMXE: should be protected, shouldn't it? + */ void merge(const int l1, const int l2) { Index: olena/oln/topo/combinatorial-map/cmap.hh --- olena/oln/topo/combinatorial-map/cmap.hh Thu, 07 Aug 2003 10:35:19 +0200 sylvain (oln/r/36_cmap.hh 1.11 640) +++ olena/oln/topo/combinatorial-map/cmap.hh Sun, 14 Mar 2004 17:54:55 +0100 van-vl_n (oln/r/36_cmap.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,16 +37,27 @@ # include <algorithm> # include <iterator> +/*! \file cmap.hh +** +** \attention FIXME: There is some problems in the directory topo/combinatorial-map/, +** such as non static functions, or the redefinition of the class any.\n +** FIXME: The documentation is not good enough.\n +** FIXME: Real test are missing. +** FIXME: Some part of this file are inside "#if 0" comments. +*/ + namespace oln { namespace topo { - + /// Namespace for combinatorial map. namespace combinatorial_map { - // REF: Braquelaire, J. P. and Brun, L. Image Segmentation with - // Topological Maps and Inter-pixel Representation}, Journal of - // Visual Communication and Image representation, 1998, vol. 9 - + /*! Combinatorial map. + ** + ** \ref Braquelaire, J. P. and Brun, L. Image Segmentation with + ** Topological Maps and Inter-pixel Representation}, Journal of + ** Visual Communication and Image representation, 1998, vol. 9 + */ template <class I> class cmap { @@ -135,10 +146,7 @@ # endif - /*------------------. - | merging algorithm | - `------------------*/ - + /// Merging algorithm. void merge(const unsigned l1, const unsigned l2) { @@ -167,10 +175,7 @@ inter.clear(); } - /*------. - | print | - `------*/ - + /// Print std::ostream& print(std::ostream & ostr) const { @@ -185,10 +190,7 @@ private: - /*---------------------------. - | building combinatorial map | - `---------------------------*/ - + /// Building combinatorial map. void build_zeta_(const inter_pixel::interpixel<I> & ip) { @@ -272,10 +274,8 @@ } } - /*---------------------------. - | Internal methods for merge | - `---------------------------*/ + ///Internal methods for merge bool make_inter1_(const unsigned l1, const unsigned l2, Index: olena/oln/topo/combinatorial-map/internal/zeta.hh --- olena/oln/topo/combinatorial-map/internal/zeta.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/r/43_zeta.hh 1.3 640) +++ olena/oln/topo/combinatorial-map/internal/zeta.hh Sun, 14 Mar 2004 17:36:42 +0100 van-vl_n (oln/r/43_zeta.hh 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 @@ -36,6 +36,12 @@ namespace internal { + /* zeta function. + ** + ** Tabular of 4 elements. + ** + ** \todo FIXME: Add doc. + */ struct zeta { zeta() : empty_(true) Index: olena/oln/topo/inter-pixel/fwd-dir-iter.hh --- olena/oln/topo/inter-pixel/fwd-dir-iter.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/r/44_fwd-dir-it 1.4 640) +++ olena/oln/topo/inter-pixel/fwd-dir-iter.hh Sun, 14 Mar 2004 16:29:01 +0100 van-vl_n (oln/r/44_fwd-dir-it 1.4 640) @@ -1,5 +1,5 @@ -// 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 @@ -54,7 +54,7 @@ namespace topo { namespace inter_pixel { - + /// Backward iterator on direction. template<unsigned Dim, class Exact> class fwd_dir_iter : public internal::dir_iter_<Dim, typename mlc::exact_vt<fwd_dir_iter<Dim, Exact>, Exact>::ret> @@ -67,6 +67,10 @@ fwd_dir_iter() : super(), begin_(internal::dir_traits<Dim>::first()) {} fwd_dir_iter(dir_type i) : super(i), begin_(i) {} + /*! Assignment. + ** + ** \bug FIXME: I am not sure that this respect the new paradigm. + */ template<class U> U operator=(U u) @@ -74,12 +78,14 @@ return super::operator=(u); } + /// Next direction. dir_type next() { return internal::dir_traits<Dim>::next(this->cur_); } + /// First direction. dir_type begin() { @@ -89,7 +95,7 @@ private: dir_type begin_; }; - +/// Type of direction inter pixel iterator of an image type \a ImgType. # define oln_fwd_dir_iter_type(ImgType) \ oln::topo::inter_pixel::fwd_dir_iter< ImgType::dim > Index: olena/oln/topo/inter-pixel/bkd-dir-iter.hh --- olena/oln/topo/inter-pixel/bkd-dir-iter.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/r/45_bkd-dir-it 1.4 640) +++ olena/oln/topo/inter-pixel/bkd-dir-iter.hh Sun, 14 Mar 2004 15:40:27 +0100 van-vl_n (oln/r/45_bkd-dir-it 1.4 640) @@ -1,5 +1,5 @@ -// 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 @@ -52,7 +52,7 @@ namespace topo { namespace inter_pixel { - + /// Backward iterator on direction. template<unsigned Dim, class Exact> class bkd_dir_iter : public internal::dir_iter_<Dim, typename mlc::exact_vt<bkd_dir_iter<Dim, Exact>, Exact>::ret> @@ -65,16 +65,22 @@ bkd_dir_iter() : super(), begin_(internal::dir_traits<Dim>::last()) {} bkd_dir_iter(dir_type i) : super(i), begin_(i) {} + /*! Assignment. + ** + ** \bug FIXME: I am not sure that this respect the new paradigm. + */ template<class U> U operator=(U u) { return super::operator=(u); } + /// Next direction. dir_type next() { return internal::dir_traits<Dim>::prev(this->cur_); } + /// First direction. dir_type begin() { @@ -85,6 +91,7 @@ dir_type begin_; }; +/// Type of direction inter pixel backward iterator of an image type \a ImgType. # define oln_bkd_dir_iter_type(ImgType) \ oln::topo::inter_pixel::bkd_dir_iter< ImgType::dim > Index: olena/oln/topo/inter-pixel/node.hh --- olena/oln/topo/inter-pixel/node.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/r/46_node.hh 1.4 640) +++ olena/oln/topo/inter-pixel/node.hh Sun, 14 Mar 2004 15:35:11 +0100 van-vl_n (oln/r/46_node.hh 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 @@ -33,9 +33,15 @@ namespace oln { namespace topo { - + /// Namespace for inter pixel, namespace inter_pixel { - + /*! Inter pixel node. + ** + ** A node is a junction of edge; the edge are + ** represented by the directions. + ** + ** \param I image. + */ template<class I> class node { @@ -51,6 +57,7 @@ data_[i] = false; } + /// Add an adge (a direction). void set(dir_type i) { @@ -60,12 +67,13 @@ data_[i] = true; } + /// Return true if the direction \i joins the node. bool get(dir_type i) const { return data_[i]; } - + /// Degree of the node. unsigned rank() const { @@ -76,10 +84,11 @@ unsigned rank_; bool data_[dim * 2]; }; - +/// Type of node of a given image type. # define oln_node_type(ImgType) \ oln::topo::inter_pixel::node< ImgType > +/// A pair of a point and a direction. # define oln_head_type(ImgType) \ typename std::pair<oln_point_type(ImgType), oln_dir_type(ImgType) > Index: olena/oln/topo/inter-pixel/internal/dir-iter.hh --- olena/oln/topo/inter-pixel/internal/dir-iter.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/r/47_dir-iter.h 1.5 640) +++ olena/oln/topo/inter-pixel/internal/dir-iter.hh Sun, 14 Mar 2004 15:26:31 +0100 van-vl_n (oln/r/47_dir-iter.h 1.5 640) @@ -47,6 +47,7 @@ } } + /// Traits for iterator for 1D directions. template<class Exact> struct iter_traits<topo::inter_pixel::internal::dir_iter_<1, Exact> > : public iter_traits<abstract::iter1d<Exact> > @@ -56,6 +57,7 @@ typedef dpoint1d dpoint_type; }; + /// Traits for iterator for 2D directions. template<class Exact> struct iter_traits<topo::inter_pixel::internal::dir_iter_<2, Exact> > : public iter_traits<abstract::iter2d<Exact> > @@ -65,6 +67,7 @@ typedef dpoint2d dpoint_type; }; + /// Traits for iterator for 3D directions. template<class Exact> struct iter_traits<topo::inter_pixel::internal::dir_iter_<3, Exact> > : public iter_traits<abstract::iter3d<Exact> > Index: olena/oln/topo/inter-pixel/internal/dir.hh --- olena/oln/topo/inter-pixel/internal/dir.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/r/48_dir.hh 1.2 640) +++ olena/oln/topo/inter-pixel/internal/dir.hh Sun, 14 Mar 2004 15:21:33 +0100 van-vl_n (oln/r/48_dir.hh 1.2 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,53 +37,61 @@ namespace topo { namespace inter_pixel { - + /// oln::topo::inter_pixel Internal namespace. namespace internal { - + /// Provides the enum dir. template<unsigned Dim> struct dir_traits {}; - + /// Provides the enum dir for 2D. template<> struct dir_traits<2> { + //// Direction in 2D. typedef enum dir { east, north, west, south } ret; + /// First direction. static ret first() { return east; } + /// Last direction. static ret last() { return south; } - + /// Prev direction (with Prev(first()) == last()). static ret prev(ret i) { return i == first() ? last() : ret(i - 1); } + /// Next direction (with next(last()) == first()). static ret next(ret i) { return i == last() ? first() : ret(i + 1); } - // FIXME: no modulus + /*! Opposit direction. + ** + ** \note FIXME: no modulus. + */ static ret opposite(ret i) { return ret((i + 2) % 4); } }; - +/// Direction trait for an image \a ImgType. # define oln_dir_traits_type(ImgType) \ oln::topo::inter_pixel::internal::dir_traits< ImgType::dim > +/// Direction for an image \a ImgType. # define oln_dir_type(ImgType) \ typename oln_dir_traits_type(ImgType)::ret Index: olena/oln/topo/combinatorial-map/internal/alpha.hh --- olena/oln/topo/combinatorial-map/internal/alpha.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/v/2_alpha.hh 1.2 600) +++ olena/oln/topo/combinatorial-map/internal/alpha.hh Sun, 14 Mar 2004 17:39:38 +0100 van-vl_n (oln/v/2_alpha.hh 1.2 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 @@ -35,10 +35,14 @@ namespace combinatorial_map { namespace internal { - + /*! Alpha function. + ** + ** Returns (d + ((d % 2) * 2 ) - 1). + */ template <class U> struct alpha { + /// Returns (d + ((d % 2) * 2 ) - 1). static U result(const U & d) { Index: olena/oln/topo/combinatorial-map/internal/anyfunc.hh --- olena/oln/topo/combinatorial-map/internal/anyfunc.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/v/3_anyfunc.hh 1.2 600) +++ olena/oln/topo/combinatorial-map/internal/anyfunc.hh Sun, 14 Mar 2004 18:08:30 +0100 van-vl_n (oln/v/3_anyfunc.hh 1.2 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,16 +31,19 @@ # include <mlc/contract.hh> # include <vector> - namespace oln { namespace topo { namespace combinatorial_map { + /// oln::combinatorial_map::internal namespace internal { - // any + /*! any + ** + ** \deprecated FIXME: totally obsolete. + */ template <class Inf> class any { @@ -49,37 +52,46 @@ Inf & self() { return static_cast<Inf &>(*this); } }; + /*! Function stored in a vector. + ** + ** + ** \warning FIXME: It has nothing to do there. + */ template <class U, class V, class Inf> class anyfunc : public any<Inf> { protected: anyfunc() : f_(1) {} + /// Construct a function on [0..n]. anyfunc(unsigned n) : f_(n+1) { assertion(n); } public: + /// Retrieve the value f(e). V operator()(const U & e) const { assertion(e < f_.size()); return f_[e]; } + /// Resize the domain of f. void resize(unsigned n) { self().resize_(n); } - + /// Assign a value \e to f(i). void assign(const U & i, const V & e) { assertion(i < f_.size()); self().assign_(i, e); } + /// f(i) = 0. void erase(const U & i) { assertion(i < f_.size()); self().erase_(i); } - + /// Print the function. std::ostream & print(std::ostream & ostr) const { for (unsigned i = 1; i < f_.size(); ++i) Index: olena/oln/topo/combinatorial-map/internal/beta.hh --- olena/oln/topo/combinatorial-map/internal/beta.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/v/5_beta.hh 1.2 600) +++ olena/oln/topo/combinatorial-map/internal/beta.hh Sun, 14 Mar 2004 17:31:51 +0100 van-vl_n (oln/v/5_beta.hh 1.2 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,7 @@ namespace internal { + /// This function must be built using assign. template<class U, class V = U> class beta : public anyfunc<U, V, beta<U, V> > { Index: olena/oln/topo/combinatorial-map/internal/lambda.hh --- olena/oln/topo/combinatorial-map/internal/lambda.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/v/6_lambda.hh 1.2 600) +++ olena/oln/topo/combinatorial-map/internal/lambda.hh Sun, 14 Mar 2004 17:41:58 +0100 van-vl_n (oln/v/6_lambda.hh 1.2 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 @@ -39,6 +39,10 @@ namespace internal { + /* lambda function. + ** + ** \todo FIXNE: add doc. + */ template <class U, class V = U> class lambda : public anyfunc<U, V, lambda<U, V> > { Index: olena/oln/topo/combinatorial-map/internal/level.hh --- olena/oln/topo/combinatorial-map/internal/level.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/v/7_level.hh 1.2 600) +++ olena/oln/topo/combinatorial-map/internal/level.hh Sun, 14 Mar 2004 17:34:56 +0100 van-vl_n (oln/v/7_level.hh 1.2 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,7 +38,13 @@ namespace combinatorial_map { namespace internal { - + /* Node of a tree + ** + ** \var node::lb left brother. + ** \var node::rb right brother. + ** \var node::fchild first child. + ** \var node::father father. + */ template <class U> struct node { @@ -47,6 +53,10 @@ U fchild, lb, rb, father; }; + /* Level function. + ** + ** \todo FIXME: add doc. + */ template <class U> class level { Index: olena/oln/topo/combinatorial-map/internal/sigma.hh --- olena/oln/topo/combinatorial-map/internal/sigma.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/v/9_sigma.hh 1.2 600) +++ olena/oln/topo/combinatorial-map/internal/sigma.hh Sun, 14 Mar 2004 17:40:57 +0100 van-vl_n (oln/v/9_sigma.hh 1.2 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 @@ -43,6 +43,10 @@ namespace internal { + /* sigma function + ** + ** \todo Add doc. + */ template <class U> class sigma : public anyfunc< U, U, sigma<U> > {
participants (1)
-
Niels Van Vliet