Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
Morpho : Gradient, gradient+ gradient-, Laplace. Arith : +, -.
* oln/morpho/laplace.hh: New.
* oln/morpho/inside_gradient.hh: New.
* oln/morpho/gradient.hh: New.
* oln/morpho/external_gradient.hh: New.
* oln/arith: New.
* oln/arith/plus.hh: New.
* oln/arith/minus.hh: New.
* oln/core/concept/operators.hh: .
* oln/core/2d/image2d.hh: .
arith/minus.hh | 64 +++++++++++++++++++++++++++++++++
arith/plus.hh | 64 +++++++++++++++++++++++++++++++++
core/2d/image2d.hh | 2 -
core/concept/operators.hh | 3 +
morpho/external_gradient.hh | 83 +++++++++++++++++++++++++++++++++++++++++++
morpho/gradient.hh | 84 ++++++++++++++++++++++++++++++++++++++++++++
morpho/inside_gradient.hh | 83 +++++++++++++++++++++++++++++++++++++++++++
morpho/laplace.hh | 84 ++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 465 insertions(+), 2 deletions(-)
Index: oln/morpho/laplace.hh
--- oln/morpho/laplace.hh (revision 0)
+++ oln/morpho/laplace.hh (revision 0)
@@ -0,0 +1,84 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_MORPHO_LAPLACE_HH
+# define OLN_MORPHO_LAPLACE_HH
+
+#include <oln/morpho/external_gradient.hh>
+#include <oln/morpho/inside_gradient.hh>
+#include <oln/arith/minus.hh>
+
+namespace oln
+{
+
+ namespace morpho
+ {
+
+ // Fwd decl.
+
+ template <typename I>
+ oln_plain(I)
+ laplace(const Image_with_Nbh<I>& input);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ template <typename I>
+ oln_plain(I)
+ laplace_(const Image_with_Nbh<I>& input)
+ {
+ return external_gradient(input) - inside_gradient(input);
+ }
+
+
+ // FIXME: Add a fast version.
+
+ } // end of namespace oln::morpho::impl
+
+
+ // Facade.
+
+ template <typename I>
+ oln_plain(I)
+ laplace(const Image_with_Nbh<I>& input)
+ {
+ return impl::laplace_(exact(input));
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::morpho
+
+} // end of namespace oln
+
+
+#endif // ! OLN_MORPHO_LAPLACE_HH
Index: oln/morpho/inside_gradient.hh
--- oln/morpho/inside_gradient.hh (revision 0)
+++ oln/morpho/inside_gradient.hh (revision 0)
@@ -0,0 +1,83 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_MORPHO_INSIDE_GRADIENT_HH
+# define OLN_MORPHO_INSIDE_GRADIENT_HH
+
+#include <oln/morpho/elementary_erosion.hh>
+#include <oln/arith/minus.hh>
+
+namespace oln
+{
+
+ namespace morpho
+ {
+
+ // Fwd decl.
+
+ template <typename I>
+ oln_plain(I)
+ inside_gradient(const Image_with_Nbh<I>& input);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ template <typename I>
+ oln_plain(I)
+ inside_gradient_(const Image_with_Nbh<I>& input)
+ {
+ return input - elementary_erosion(input);
+ }
+
+
+ // FIXME: Add a fast version.
+
+ } // end of namespace oln::morpho::impl
+
+
+ // Facade.
+
+ template <typename I>
+ oln_plain(I)
+ inside_gradient(const Image_with_Nbh<I>& input)
+ {
+ return impl::inside_gradient_(exact(input));
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::morpho
+
+} // end of namespace oln
+
+
+#endif // ! OLN_MORPHO_INSIDE_GRADIENT_HH
Index: oln/morpho/gradient.hh
--- oln/morpho/gradient.hh (revision 0)
+++ oln/morpho/gradient.hh (revision 0)
@@ -0,0 +1,84 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_MORPHO_GRADIENT_HH
+# define OLN_MORPHO_GRADIENT_HH
+
+#include <oln/morpho/elementary_erosion.hh>
+#include <oln/morpho/elementary_dilation.hh>
+#include <oln/arith/minus.hh>
+
+namespace oln
+{
+
+ namespace morpho
+ {
+
+ // Fwd decl.
+
+ template <typename I>
+ oln_plain(I)
+ gradient(const Image_with_Nbh<I>& input);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ template <typename I>
+ oln_plain(I)
+ gradient_(const Image_with_Nbh<I>& input)
+ {
+ return elementary_dilation(input) - elementary_erosion(input);
+ }
+
+
+ // FIXME: Add a fast version.
+
+ } // end of namespace oln::morpho::impl
+
+
+ // Facade.
+
+ template <typename I>
+ oln_plain(I)
+ gradient(const Image_with_Nbh<I>& input)
+ {
+ return impl::gradient_(exact(input));
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::morpho
+
+} // end of namespace oln
+
+
+#endif // ! OLN_MORPHO_GRADIENT_HH
Index: oln/morpho/external_gradient.hh
--- oln/morpho/external_gradient.hh (revision 0)
+++ oln/morpho/external_gradient.hh (revision 0)
@@ -0,0 +1,83 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_MORPHO_EXTERNAL_GRADIENT_HH
+# define OLN_MORPHO_EXTERNAL_GRADIENT_HH
+
+#include <oln/morpho/elementary_dilation.hh>
+#include <oln/arith/minus.hh>
+
+namespace oln
+{
+
+ namespace morpho
+ {
+
+ // Fwd decl.
+
+ template <typename I>
+ oln_plain(I)
+ external_gradient(const Image_with_Nbh<I>& input);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ template <typename I>
+ oln_plain(I)
+ external_gradient_(const Image_with_Nbh<I>& input)
+ {
+ return elementary_dilation(input) - input;
+ }
+
+
+ // FIXME: Add a fast version.
+
+ } // end of namespace oln::morpho::impl
+
+
+ // Facade.
+
+ template <typename I>
+ oln_plain(I)
+ external_gradient(const Image_with_Nbh<I>& input)
+ {
+ return impl::external_gradient_(exact(input));
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::morpho
+
+} // end of namespace oln
+
+
+#endif // ! OLN_MORPHO_EXTERNAL_GRADIENT_HH
Index: oln/arith/plus.hh
--- oln/arith/plus.hh (revision 0)
+++ oln/arith/plus.hh (revision 0)
@@ -0,0 +1,64 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_ARITH_PLUS_HH
+# define OLN_ARITH_PLUS_HH
+
+
+namespace oln
+{
+
+ namespace arith
+ {
+
+ // Fwd decl.
+
+ template <typename I>
+ oln_plain(I)
+ operator + (const Image<I>& lhs, const Image<I>& rhs);
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename I>
+ oln_plain(I)
+ operator + (const Image<I>& lhs, const Image<I>& rhs)
+ {
+ oln_plain(I) output;
+ init(output, with, lhs);
+ oln_piter(I) p(lhs.points());
+ for_all(p)
+ output(p) = lhs(p) + rhs(p);
+ return output;
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::arith
+
+} // end of namespace oln
+
+#endif // ! OLN_ARITH_PLUS_HH
Index: oln/arith/minus.hh
--- oln/arith/minus.hh (revision 0)
+++ oln/arith/minus.hh (revision 0)
@@ -0,0 +1,64 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_ARITH_MINUS_HH
+# define OLN_ARITH_MINUS_HH
+
+
+namespace oln
+{
+
+// namespace arith
+// {
+
+ // Fwd decl.
+
+ template <typename I>
+ oln_plain(I)
+ operator - (const Image<I>& lhs, const Image<I>& rhs);
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename I>
+ oln_plain(I)
+ operator - (const Image<I>& lhs, const Image<I>& rhs)
+ {
+ oln_plain(I) output;
+ init(output, with, lhs);
+ oln_piter(I) p(lhs.points());
+ for_all(p)
+ output(p) = lhs(p) - rhs(p);
+ return output;
+ }
+
+# endif // ! OLN_INCLUDE_ONLY
+
+// } // end of namespace oln::arith
+
+} // end of namespace oln
+
+#endif // ! OLN_ARITH_MINUS_HH
Index: oln/core/concept/operators.hh
--- oln/core/concept/operators.hh (revision 901)
+++ oln/core/concept/operators.hh (working copy)
@@ -158,12 +158,13 @@
return exact(rhs).op_unary_minus_();
}
- template <typename T>
+/* template <typename T>
T operator- (const Any<T>& lhs, const Any<T>& rhs)
{
T tmp = exact(lhs);
return tmp -= rhs;
}
+*/
// template <typename L, typename R>
// xtd_op_minus_trait(L, R) operator- (const Any<L>& lhs, const
Any<R>& rhs)
Index: oln/core/2d/image2d.hh
--- oln/core/2d/image2d.hh (revision 901)
+++ oln/core/2d/image2d.hh (working copy)
@@ -213,7 +213,7 @@
box2d b;
bool box_ok = init(b, with, dat);
postcondition(box_ok);
- array2d_<T,int> ptr = new array2d_<T,int>(b.pmin().row(),
+ array2d_<T,int>* ptr = new array2d_<T,int>(b.pmin().row(),
b.pmin().col(),
b.pmax().row(),
b.pmax().col());