Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/iter_morpher.hh: To have a specific default iterator.
Index: olena/oln/morpher/iter_morpher.hh
--- olena/oln/morpher/iter_morpher.hh Mon, 29 Mar 2004 09:31:08 +0200 odou_s ()
+++ olena/oln/morpher/iter_morpher.hh Mon, 29 Mar 2004 06:15:32 +0200 odou_s (oln/m/41_iter_morph 644)
@@ -0,0 +1,196 @@
+// Copyright (C) 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
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef ITER_MORPHER_HH
+# define ITER_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class SrcType, class IterType, class Exact = mlc::final>
+ struct iter_morpher;
+
+ } // end of namespace morpher
+
+ /// Inherits identification's informations about the iter morpher.
+ template <class SrcType, class IterType, class Exact>
+ struct image_id< morpher::iter_morpher<SrcType, IterType, Exact> > : public image_id<SrcType>
+ {};
+
+ /// Inherits identification's informations about the const iter morpher.
+ template <class SrcType, class IterType, class Exact>
+ struct image_id< morpher::iter_morpher<const SrcType, IterType, Exact> > : public image_id<SrcType>
+ {};
+
+ /// Traits for iter morpher.
+ template <class SrcType, class IterType>
+ struct image_traits < morpher::iter_morpher<SrcType, IterType> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
+ morpher::iter_morpher<SrcType, IterType> > >
+ {
+ typedef IterType iter_type;
+ };
+
+ /// Traits for const iter morpher.
+ template <class SrcType, class IterType>
+ struct image_traits < morpher::iter_morpher<const SrcType, IterType> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(SrcType),
+ morpher::iter_morpher<const SrcType, IterType> > >
+ {
+ typedef IterType iter_type;
+ };
+
+ namespace morpher {
+
+ template <class SrcType, class IterType, class Exact>
+ struct iter_morpher
+ : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> >
+ {
+ /// The type of the object instantiated. iter morpher can be derived.
+ typedef typename image_id< iter_morpher<SrcType, IterType, Exact> >::exact_type exact_type;
+ typedef iter_morpher<SrcType, IterType, Exact> self_type;
+ typedef IterType iter_type;
+ typedef abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> > super_type;
+
+ /// Construct the iter morpher with an image \a ima.
+ iter_morpher(const SrcType &ima)
+ : super_type(ima)
+ {}
+
+ /// Construct the iter morpher with another iter morpher.
+ iter_morpher(const self_type& r)
+ : super_type(r.get_ima())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ iter_morpher() {}
+
+ /*! Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "iter_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' declared images.
+ template <class SrcType, class IterType, class Exact>
+ struct iter_morpher<const SrcType, IterType, Exact>
+ : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> >
+ {
+ /// The type of the object instantiated. iter morpher can be derived.
+ typedef typename image_id< iter_morpher<SrcType, IterType, Exact> >::exact_type exact_type;
+ typedef iter_morpher<const SrcType, IterType, Exact> self_type;
+ typedef IterType iter_type;
+ typedef abstract::generic_morpher<SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> > super_type;
+
+ /// Construct the iter morpher with an image \a ima.
+ iter_morpher(const SrcType &ima)
+ : super_type(ima)
+ {}
+
+ /// Construct the iter morpher with another iter morpher.
+ iter_morpher(const iter_morpher<const SrcType, IterType>& r)
+ : super_type(r.get_ima()) {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ iter_morpher()
+ {}
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "iter_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /*!
+ ** \brief Instantiate a temporary read-only iter morpher.
+ **
+ ** The image will be viewed according to its iterator type.
+ ** For example, the foo function will print the size of the picture
+ ** (the bkd_iter_type is used transparently).
+ **
+ ** \code
+ ** #include <oln/morpher/iter_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** template <class E>
+ ** void foo(const oln::abstract::image<E>& img)
+ ** {
+ ** oln_iter_type(oln::abstract::image<E>) it(img);
+ ** for_all(it)
+ ** {
+ ** std::cout << it.row() << " " << it.col() << std::endl;
+ ** break;
+ ** }
+ ** }
+ ** int main()
+ ** {
+ ** const oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** assert(imc.has_impl());
+ ** foo(oln::morpher::iter_morph<oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>)>(imc));
+ ** }
+ ** \endcode
+ */
+ template <class IterType, class I>
+ const iter_morpher<I, IterType> iter_morph(I &ima)
+ {
+ return iter_morpher<I, IterType>(ima);
+ }
+
+ } // End of namespace morpher.
+
+} // End of namespace oln.
+
+#endif // !ITER_MORPHER
--
Simon Odou
simon(a)lrde.epita.fr
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* oln/morpher/piece_morpher.hh: To use a piece of image like a real one.
* oln/core/abstract/image_with_impl.hh:
* oln/core/point2d.hh: Able to construct a point2d from a point1d.
* oln/core/point2d.hxx: Likewise.
* oln/core/point3d.hh: Able to construct a point3d from a point2d.
* oln/core/point3d.hxx: Likewise.
* oln/core/abstract/image_with_dim.hh: Fix a bug.
* oln/core/abstract/image_with_impl.hh: Fix (same).
Index: olena/oln/core/point2d.hh
--- olena/oln/core/point2d.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/30_point2d.hh 1.13 600)
+++ olena/oln/core/point2d.hh Mon, 29 Mar 2004 05:38:52 +0200 odou_s (oln/c/30_point2d.hh 1.13 600)
@@ -75,6 +75,10 @@
point2d(coord row, coord col);
+ /// The coordinates of the point2d are set to \a p and \a col.
+
+ point2d(const point1d& p, coord col);
+
/// Return Give the value of the point2d row coordinate.
coord
Index: olena/oln/core/point2d.hxx
--- olena/oln/core/point2d.hxx Mon, 19 Jan 2004 18:35:23 +0100 astrid (oln/c/29_point2d.hx 1.6 640)
+++ olena/oln/core/point2d.hxx Mon, 29 Mar 2004 05:39:17 +0200 odou_s (oln/c/29_point2d.hx 1.6 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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
@@ -48,6 +48,13 @@
nth(1) = col;
}
+ inline
+ point2d::point2d(const point1d& p, coord row)
+ {
+ nth(0) = row;
+ nth(1) = p.col();
+ }
+
inline coord
point2d::row() const
{
Index: olena/oln/core/point3d.hh
--- olena/oln/core/point3d.hh Fri, 12 Mar 2004 20:17:58 +0100 thivol_d (oln/c/28_point3d.hh 1.15 600)
+++ olena/oln/core/point3d.hh Mon, 29 Mar 2004 05:40:21 +0200 odou_s (oln/c/28_point3d.hh 1.15 600)
@@ -80,6 +80,10 @@
point3d(coord slice, coord row, coord col);
+ /// The coordinates of the point3d are set to \a p, and \a slice.
+
+ point3d(const point2d& p, coord slice);
+
/// Return the value of the point3d slice coordinate.
coord
Index: olena/oln/core/point3d.hxx
--- olena/oln/core/point3d.hxx Mon, 28 Jul 2003 14:14:03 +0200 david (oln/c/27_point3d.hx 1.5 640)
+++ olena/oln/core/point3d.hxx Mon, 29 Mar 2004 05:39:24 +0200 odou_s (oln/c/27_point3d.hx 1.5 640)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 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
@@ -51,6 +51,14 @@
nth(2) = col;
}
+ inline
+ point3d::point3d(const point2d& p, coord slice)
+ {
+ nth(0) = slice;
+ nth(1) = p.row();
+ nth(2) = p.col();
+ }
+
inline coord
point3d::slice() const
{
Index: olena/oln/core/abstract/image_with_dim.hh
--- olena/oln/core/abstract/image_with_dim.hh Sun, 14 Mar 2004 19:03:34 +0100 van-vl_n (oln/t/26_image_with 1.21 600)
+++ olena/oln/core/abstract/image_with_dim.hh Mon, 29 Mar 2004 00:47:04 +0200 odou_s (oln/t/26_image_with 1.21 600)
@@ -325,7 +325,7 @@
coord
nrows() const
{
- return this->size().nrows();
+ return this->exact().size().nrows();
}
@@ -334,7 +334,7 @@
coord
ncols() const
{
- return this->size().ncols();
+ return this->exact().size().ncols();
}
/*! \brief Return the value stored at \a row, \a col
Index: olena/oln/core/abstract/image_with_impl.hh
--- olena/oln/core/abstract/image_with_impl.hh Fri, 26 Mar 2004 12:53:24 +0100 thivol_d (oln/t/27_image_with 1.14.1.10 640)
+++ olena/oln/core/abstract/image_with_impl.hh Mon, 29 Mar 2004 00:51:00 +0200 odou_s (oln/t/27_image_with 1.14.1.10 640)
@@ -145,6 +145,17 @@
return impl_;
}
+ /*!
+ ** \brief Get the size of the image.
+ ** \return The size.
+ */
+ const size_type&
+ size() const
+ {
+ assertion(has_impl());
+ return this->exact().impl()->size();
+ }
+
/// Return the core data of the image.
impl_type*
Index: olena/oln/morpher/piece_morpher.hh
--- olena/oln/morpher/piece_morpher.hh Mon, 29 Mar 2004 09:25:14 +0200 odou_s ()
+++ olena/oln/morpher/piece_morpher.hh Mon, 29 Mar 2004 09:15:56 +0200 odou_s (oln/m/40_piece_morp 644)
@@ -0,0 +1,314 @@
+// Copyright (C) 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
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef PIECE_MORPHER_HH
+# define PIECE_MORPHER_HH
+
+# include <oln/morpher/generic_morpher.hh>
+
+namespace oln {
+
+ namespace morpher {
+
+ template <class I, class Exact = mlc::final>
+ struct piece_morpher;
+
+ } // end of namespace morpher
+
+ /// Inherits identification's informations about the piece morpher.
+ template <class I, class Exact>
+ struct image_id< morpher::piece_morpher<I, Exact> > : public image_id<I>
+ {};
+
+ /// Inherits identification's informations about the const piece morpher.
+ template <class I, class Exact>
+ struct image_id< morpher::piece_morpher<const I, Exact> > : public image_id<I>
+ {};
+
+ /// Traits for piece morpher.
+ template <class I>
+ struct image_traits < morpher::piece_morpher<I> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(I),
+ morpher::piece_morpher<I> > >
+ {};
+
+ /// Traits for const piece morpher.
+ template <class I>
+ struct image_traits < morpher::piece_morpher<const I> > :
+ public image_traits<abstract::image_with_impl<oln_impl_type(I),
+ morpher::piece_morpher<const I> > >
+ {};
+
+
+ namespace morpher {
+
+ /// Abstract piece morpher class used for code factorization.
+ template <class SrcType, class Exact>
+ class super_piece_morpher : public abstract::generic_morpher<SrcType, SrcType, Exact>
+ {
+ public:
+
+ typedef abstract::generic_morpher<SrcType, SrcType, Exact> super_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+
+ protected:
+
+ /*!
+ ** \brief Default constructor.
+ ** \arg ima will be the image.
+ ** \arg p The reference point.
+ ** \arg s The size of the piece of image.
+ **
+ ** One can not use this constructor to instantiate this class
+ ** since it is protected.
+ */
+ super_piece_morpher(const SrcType &ima, const dpoint_type& p,
+ const size_type& s)
+ : super_type(ima), size_(s), p_(p)
+ {}
+
+ const size_type size_; ///< The size of the piece of picture.
+ const dpoint_type p_; ///< The reference point of the piece of picture.
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ super_piece_morpher() : size_(size_) {}
+
+ public:
+
+ /// Return the size (different from the original picture).
+ const size_type size() const
+ {
+ return size_;
+ }
+
+ /// Return the reference point.
+ const dpoint_type ref_point() const
+ {
+ return p_;
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "super_piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /*!
+ ** \brief The default piece morpher class.
+ **
+ ** Using this class, a piece of picture is a picture.
+ **
+ ** \see oln::morpher::abstract::generic_morpher
+ ** \see oln::morpher::piece_morph
+ */
+ template <class SrcType, class Exact>
+ struct piece_morpher
+ : public super_piece_morpher<SrcType, piece_morpher<SrcType, Exact> >
+ {
+ /// The type of the object instantiated. piece morpher can be derived.
+ typedef typename image_id<piece_morpher<SrcType, Exact> >::exact_type exact_type;
+ typedef piece_morpher<SrcType, Exact> self_type;
+ typedef super_piece_morpher<SrcType, piece_morpher<SrcType, Exact> > super_type;
+
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef oln_value_type(SrcType) value_type;
+
+ /// Construct the piece morpher with an image \a ima.
+ piece_morpher(const SrcType &ima, const dpoint_type p,
+ const size_type s)
+ : super_type(ima, p, s)
+ {}
+
+ /// Construct the piece morpher with another piece morpher.
+ piece_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.ref_point(), r.size())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ piece_morpher()
+ {}
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ value_type& at(const point_type& p)
+ {
+ return const_cast<value_type &>(this->ima_)[p + p_];
+ }
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type at(const point_type& p) const
+ {
+ return this->ima_[p + p_];
+ }
+
+ /*! Perform a shallow copy from the decorated image of \a rhs
+ ** to the current decorated image. The points will be shared
+ ** by the two images.
+ */
+ self_type&
+ assign(self_type& rhs)
+ {
+ oln_iter_type(SrcType) it(rhs);
+
+ for_all(it)
+ this->at(it) = rhs[it];
+ return this->exact();
+ }
+
+ /*!
+ ** \brief This operator= assigns rhs to the current image.
+ */
+ self_type&
+ operator=(SrcType& rhs)
+ {
+ return this->exact().assign(rhs);
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+ /// The specialized version for `const' declared images.
+ template <class SrcType, class Exact>
+ struct piece_morpher<const SrcType, Exact>
+ : public super_piece_morpher< SrcType, piece_morpher<const SrcType, Exact> >
+ {
+ /// The type of the object instantiated. piece morpher can be derived.
+ typedef typename image_id<piece_morpher<SrcType, Exact> >::exact_type exact_type;
+ typedef piece_morpher<const SrcType, Exact> self_type;
+ typedef super_piece_morpher<SrcType, piece_morpher<const SrcType, Exact> > super_type;
+
+ typedef oln_point_type(SrcType) point_type;
+ typedef oln_dpoint_type(SrcType) dpoint_type;
+ typedef oln_size_type(SrcType) size_type;
+ typedef oln_value_type(SrcType) value_type;
+
+ /*!
+ ** \brief Construct a piece morpher.
+ ** \arg ima The image.
+ ** \arg p The reference point.
+ ** \arg s The size.
+ */
+ piece_morpher(const SrcType &ima, const dpoint_type p,
+ const size_type s)
+ : super_type(ima, p, s)
+ {}
+
+ /// Construct a piece morpher from another one.
+ piece_morpher(const self_type& r)
+ : super_type(r.get_ima(), r.ref_point(), r.size())
+ {}
+
+ /*!
+ ** \brief Empty constructor.
+ **
+ ** Needed by mlc_hierarchy::any_with_diamond.
+ */
+ piece_morpher() {}
+
+ /*!
+ ** \brief Return the stored value at the point.
+ ** \arg p The point.
+ ** \return The stored value.
+ */
+ const value_type at(const point_type &p) const
+ {
+ return this->ima_[p + p_];
+ }
+
+ /// Useful to debug.
+ static std::string name()
+ {
+ return "piece_morpher<" + super_type::name() + ">";
+ }
+
+ };
+
+
+ /*!
+ ** \brief Instantiate a temporary read-only piece morpher.
+ ** \arg ima The image.
+ ** \arg p The reference's point.
+ ** \arg s The size of the window.
+ **
+ ** A piece of the image will be viewed.
+ **
+ ** \code
+ ** #include <oln/morpher/piece_morpher.hh>
+ ** #include <oln/basics2d.hh>
+ ** #include <ntg/all.hh>
+ ** int main()
+ ** {
+ ** oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
+ ** oln::save(oln::morpher::piece_morph(imc,
+ ** oln::dpoint2d(246, 244),
+ ** oln::image2d_size(30, 60, imc.border())),
+ ** IMG_OUT "oln_morpher_piece_morpher.pgm");
+ ** }
+ ** \endcode
+ ** \image html lena_ppm.png
+ ** \image latex lena_ppm.png
+ ** =>
+ ** \image html oln_morpher_piece_morpher.png
+ ** \image latex oln_morpher_piece_morpher.png
+ */
+ template <class I, class PointType, class SizeType>
+ const piece_morpher<I> piece_morph(I &ima, const PointType p, const SizeType s)
+ {
+ return piece_morpher<I>(ima, p, s);
+ }
+
+
+ } // end namespace morpher
+
+} // end namespace oln
+
+#endif // !PIECE_MORPHER
--
Simon Odou
simon(a)lrde.epita.fr
I uncommented some lines in attributes.hh. Why were they
commented?
olena/tests/convol does not pass make check (due to errors
in the gaussian).
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/utils/histogram.hh: Change the return type
of `at' method to const value_type.
* olena/oln/morpho/attributes.hh: Uncomment some lines.
* olena/oln/convol/nagao.hh: Correct comments.
* olena/oln/convol/nagao.hxx: Likewise.
* olena/oln/utils/se_stat.hh: Likewise.
* olena/oln/utils/se_stat.hxx: Likewise.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Fri, 19 Mar 2004 11:53:50 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.11 640)
+++ olena/oln/utils/histogram.hh Sat, 27 Mar 2004 15:51:26 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.11 640)
@@ -122,7 +122,7 @@
this->exact().clear_impl();
}
/// Read the number of occurrence of \a v.
- const cpt_type&
+ const cpt_type
operator[](const value_type &v)const
{
return this->exact().at(v);
@@ -256,7 +256,7 @@
}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const T &v)const
{
return img_[v2p_(v)];
@@ -404,7 +404,7 @@
min_(ntg_min_val(value_type)), max_(ntg_max_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
adjust(i);
@@ -503,7 +503,7 @@
upper_type(input, v2p), min_(ntg_min_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
return img_[v2p_(i)];
@@ -594,7 +594,7 @@
upper_type(input, v2p),max_(ntg_max_val(value_type)) {}
/// operator[] should be called.
- const cpt_type&
+ const cpt_type
at(const value_type& i) const
{
return img_[v2p_(i)];
Index: olena/oln/morpho/attributes.hh
--- olena/oln/morpho/attributes.hh Thu, 25 Mar 2004 15:00:37 +0100
palma_g (oln/j/45_attributes 1.10 644)
+++ olena/oln/morpho/attributes.hh Sat, 27 Mar 2004 15:51:59 +0100
van-vl_n (oln/j/45_attributes 1.10 644)
@@ -1213,11 +1213,11 @@
**
** \arg p Point to consider in the image.
*/
- dist_type(//const im_type&,
+ dist_type(const im_type&,
const point_type &p,
- const env_type &) //:
- // value_(ntg_zero_val(value_type)),
- //center_(p)
+ const env_type &):
+ value_(ntg_zero_val(value_type)),
+ center_(p)
{
};
Index: olena/oln/convol/nagao.hh
--- olena/oln/convol/nagao.hh Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/22_nagao.hh 1.1 600)
+++ olena/oln/convol/nagao.hh Sat, 27 Mar 2004 15:48:41 +0100 van-vl_n
(oln/m/22_nagao.hh 1.1 600)
@@ -127,7 +127,7 @@
/*! A Nagao filter generalized.
**
- ** Each point in the input correspond to the mean of the
+ ** Each point in the input corresponds to the mean of the
** window in which has the smallest variance.
**
** \paran in Input image.
Index: olena/oln/utils/se_stat.hh
--- olena/oln/utils/se_stat.hh Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/23_se_stat.hh 1.1 644)
+++ olena/oln/utils/se_stat.hh Sat, 27 Mar 2004 15:50:13 +0100 van-vl_n
(oln/m/23_se_stat.hh 1.1 644)
@@ -96,16 +96,16 @@
** \param Sum type used to compute the sum and the average.
** \param Var type used to compute the variance.
**
- ** \note There is two parameters because for vectorial types the sum
+ ** \note There are two parameters because for vectorial types the sum
** is usually a vector, and the variance a non vectorial type.
*/
template <typename Sum = ntg::float_s, typename Var = ntg::float_s>
class se_stat
{
public:
- /// type of used to sum the value (usually floating point values)
+ /// type of used to sum values (usually floating point values)
typedef Sum sum_type;
- /// type of used for the variance (usually floating point values)
+ /// type of the variance (usually floating point values)
typedef Var variance_type;
/*! Build a se stat.
@@ -121,7 +121,7 @@
compute(im, p, s);
}
- /// Computes the mean and the variance.
+ /// Compute the mean and the variance.
template <class I, class S>
se_stat &
compute(const oln::abstract::image<I> &im,
Index: olena/oln/utils/se_stat.hxx
--- olena/oln/utils/se_stat.hxx Fri, 26 Mar 2004 20:56:28 +0100 van-vl_n
(oln/m/24_se_stat.hx 1.1 644)
+++ olena/oln/utils/se_stat.hxx Sat, 27 Mar 2004 15:50:23 +0100 van-vl_n
(oln/m/24_se_stat.hx 1.1 644)
@@ -32,7 +32,7 @@
namespace oln {
namespace utils {
- /// Computes the mean and the variance.
+ /// Compute the mean and the variance.
template <typename Sum, typename Var>
template <class I, class S>
inline se_stat<Sum, Var> &
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/core/abstract/image.hh: Add macros.
* olena/oln/morpher/generic_morpher.hh: generic_morpher implementation.
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh Mon, 15 Mar 2004 19:40:09 +0100 odou_s (oln/t/25_image.hh 1.27 640)
+++ olena/oln/core/abstract/image.hh Thu, 25 Mar 2004 20:08:16 +0100 thivol_d (oln/t/25_image.hh 1.27 640)
@@ -125,7 +125,7 @@
** at \a p in the current image.
*/
- const value_type&
+ const value_type
operator[](const abstract::point<point_type>& p) const
{
return this->exact().at(p.exact());
@@ -343,11 +343,36 @@
# define oln_concrete_type(ImgType) \
typename mute<ImgType>::ret
+# define oln_exact_type(ImgType) \
+mlc_exact_type(ImgType)::exact_type
+# define oln_exact_type_(ImgType) \
+mlc_exact_type_(ImgType)::exact_type
+
# define oln_iter_type(Iterable) \
mlc_exact_type(Iterable)::iter_type
# define oln_iter_type_(Iterable) \
mlc_exact_type_(Iterable)::iter_type
+# define oln_fwd_iter_type(Fwd_Iterable) \
+mlc_exact_type(Fwd_Iterable)::fwd_iter_type
+# define oln_fwd_iter_type_(Fwd_Iterable) \
+mlc_exact_type_(Fwd_Iterable)
+
+# define oln_bkd_iter_type(Bkd_Iterable) \
+mlc_exact_type(Bkd_Iterable)::bkd_iter_type
+# define oln_bkd_iter_type_(Bkd_Iterable) \
+mlc_exact_type_(Bkd_Iterable)::bkd_iter_type
+
+# define oln_size_type(ImgType) \
+mlc_exact_type(ImgType)::size_type
+# define oln_size_type_(ImgType) \
+mlc_exact_type_(ImgType)::size_type
+
+# define oln_impl_type(ImgType) \
+mlc_exact_type(ImgType)::impl_type
+# define oln_impl_type_(ImgType) \
+mlc_exact_type_(ImgType)::impl_type
+
# define oln_point_type(Pointable) \
mlc_exact_type(Pointable)::point_type
# define oln_point_type_(Pointable) \
Index: olena/oln/morpher/generic_morpher.hh
--- olena/oln/morpher/generic_morpher.hh Thu, 25 Mar 2004 20:12:11 +0100 thivol_d ()
+++ olena/oln/morpher/generic_morpher.hh Thu, 25 Mar 2004 20:09:08 +0100 thivol_d (oln/m/18_generic_mo 644)
@@ -0,0 +1,226 @@
+// 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
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+
+
+#ifndef GENERIC_MORPHER_HH
+# define GENERIC_MORPHER_HH
+
+# include <string>
+
+
+# include <oln/basics1d.hh>
+# include <oln/basics2d.hh>
+# include <oln/basics3d.hh>
+# include <ntg/all.hh>
+
+namespace oln {
+
+ /*! \namespace morpher
+ **
+ ** Contain all the morpher relative declarations and functions.
+ */
+
+ namespace morpher {
+
+ /*! \namespace abstract
+ **
+ ** generic_morpher implementation.
+ */
+
+ namespace abstract {
+
+ /*! \class gm_inherit
+ **
+ ** Perform a conditionnal inheritance for the \a generic_morpher
+ ** class regarding its template parameters.
+ */
+ template <class T, class Exact>
+ struct gm_inherit;
+
+ /*! \class gm_inherit<oln::image1d<T>, Exact >
+ **
+ ** Return \a image1d with an \a exact_type of \a Exact.
+ */
+ template <class T, class Exact>
+ struct gm_inherit<oln::image1d<T>, Exact >
+ {
+ typedef oln::image1d<T, Exact> ret;
+ };
+
+ /*! \class gm_inherit<oln::image1d<T>, Exact >
+ **
+ ** Return \a image2d with an \a exact_type of \a Exact.
+ */
+ template <class T, class Exact>
+ struct gm_inherit<oln::image2d<T>, Exact >
+ {
+ typedef oln::image2d<T, Exact> ret;
+ };
+
+ /*! \class gm_inherit<oln::image1d<T>, Exact >
+ **
+ ** Return \a image3d with an \a exact_type of \a Exact.
+ */
+ template <class T, class Exact>
+ struct gm_inherit<oln::image3d<T>, Exact >
+ {
+ typedef oln::image3d<T, Exact> ret;
+ };
+
+ /*! \class generic_morpher
+ **
+ ** An abstract class from whom derive all other
+ ** concrete morphers. Define a default implementation
+ ** for all the dispatched methods of the image hierarchy.
+ */
+
+ template <class Inherit, class Deco, class Exact>
+ class generic_morpher : public gm_inherit<
+ Inherit,
+ Exact>::ret
+ {
+ protected:
+
+ /*! \brief Construct an instance of generic_morpher by assigning
+ ** \a Ima to Ima_.
+ */
+ generic_morpher(const Deco &Ima) : super_type(), Ima_(Ima) {}
+
+ /// Default Constructor.
+ generic_morpher(): Ima(Deco()) {}
+
+ /// The decorated image.
+ const Deco &Ima_;
+
+ public:
+
+ /// Type of the decorated image.
+ typedef Deco deco_type;
+ typedef oln_point_type(Deco) point_type;
+ typedef oln_dpoint_type(Deco) dpoint_type;
+ typedef oln_iter_type(Deco) iter_type;
+ typedef oln_fwd_iter_type(Deco) fwd_iter_type;
+ typedef oln_bkd_iter_type(Deco) bkd_iter_type;
+ typedef oln_value_type(Deco) value_type;
+ typedef oln_size_type(Deco) size_type;
+
+ /// Underlying implementation of the decorated image.
+ typedef oln_impl_type(Deco) impl_type;
+
+ /// Exact type of the decorated image.
+ typedef oln_exact_type(Deco) image_type;
+
+ typedef typename gm_inherit<Inherit, Exact>::ret super_type;
+
+ /// Return the decorated image.
+ const Deco&
+ get_ima() const
+ {
+ return this->Ima_;
+ }
+
+ /// Return the value stored at \a p in the decorated image.
+ const value_type
+ at(const point_type& p) const
+ {
+ return this->Ima_.exact().at(p);
+ }
+
+ /// Return a reference to the value stored at \a p in the decorated image.
+ value_type&
+ at(const point_type& p)
+ {
+ return this->Ima_.exact().at(p);
+ }
+
+ /// Return a pointer to the value container of the decorated image.
+ const impl_type*
+ impl() const
+ {
+ return this->Ima_.exact().impl();
+ }
+
+ /// Return a pointer to the value container of the decorated image.
+ impl_type*
+ impl()
+ {
+ return this->Ima_.exact().impl();
+ }
+
+ /// Return a copy of the decorated image.
+ image_type
+ clone_() const
+ {
+ return this->Ima_.exact().clone_();
+ }
+
+ /// Return the size of the decorated image.
+ size_t
+ npoints_()
+ {
+ return this->Ima_.exact().npoints_();
+ }
+
+ /// Assign \a rhs to the decorated image.
+ image_type&
+ assign(deco_type& rhs)
+ {
+ return this->Ima_.exact().assign(rhs);
+ }
+
+ /// Assign the decorated image to \a r
+ deco_type&
+ operator=(const oln::io::internal::anything& r)
+ {
+ return r.assign(this->Ima_);
+ }
+
+ /*! \brief Set the border width of the decorated image to
+ ** \a min_border.
+ */
+ void
+ border_set_width(oln::coord min_border,
+ bool copy_border = false) const
+ {
+ return this->Ima_.exact().border_set_width(min_border, copy_border);
+ }
+
+ static std::string name()
+ { return "generic_morpher<" + super_type::name() + ">"; }
+
+
+ };
+
+ } // end of namespace abstract
+
+ } // end of namespace morpher
+
+} // end of namespace oln
+
+
+#endif // !GENERIC_MORPHER_HH
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr