https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add an ''un-projection'' image morpher.
* mln/fun/v2v/projection.hh: New.
* mln/fun/v2v/all.hh: Update.
* tests/fun/v2v/projection.cc: New.
* tests/fun/v2v/Makefile.am: Update.
* mln/core/image/unproject_image.hh: New.
* mln/core/image/all.hh: Update.
* tests/core/image/unproject_image.cc: New.
* tests/core/image/Makefile.am: Update.
mln/core/image/all.hh | 35 ++--
mln/core/image/unproject_image.hh | 272 ++++++++++++++++++++++++++++++++++++
mln/fun/v2v/all.hh | 17 +-
mln/fun/v2v/projection.hh | 91 ++++++++++++
tests/core/image/Makefile.am | 19 +-
tests/core/image/unproject_image.cc | 63 ++++++++
tests/fun/v2v/Makefile.am | 6
tests/fun/v2v/projection.cc | 73 +++++++++
8 files changed, 543 insertions(+), 33 deletions(-)
Index: mln/core/image/all.hh
--- mln/core/image/all.hh (revision 3532)
+++ mln/core/image/all.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
+// (LRDE)
//
// 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 +34,6 @@
/// File that includes all image types.
-//# include <mln/core/image/bgraph_image.hh>
-//# include <mln/core/image/bgraph_psite.hh>
# include <mln/core/image/cast_image.hh>
# include <mln/core/image/ch_piter.hh>
# include <mln/core/image/complex_image.hh>
@@ -46,7 +45,6 @@
# include <mln/core/image/flat_image.hh>
# include <mln/core/image/image_if.hh>
# include <mln/core/image/sub_image.hh>
-//# include <mln/core/image/fi_adaptor.hh>
# include <mln/core/image/image1d.hh>
# include <mln/core/image/decorated_image.hh>
# include <mln/core/image/extended.hh>
@@ -55,28 +53,16 @@
# include <mln/core/image/extension_val.hh>
# include <mln/core/image/flat_image.hh>
# include <mln/core/image/graph_elt_window.hh>
-//# include <mln/core/image/graph_image.hh>
# include <mln/core/image/graph_window_piter.hh>
-//# include <mln/core/image/hexa.hh>
-//# include <mln/core/image/hexa_piter.hh>
# include <mln/core/image/image1d.hh>
# include <mln/core/image/image2d.hh>
-//# include <mln/core/image/image2d_h.hh>
# include <mln/core/image/image3d.hh>
# include <mln/core/image/image_if.hh>
# include <mln/core/image/interpolated.hh>
# include <mln/core/image/lazy_image.hh>
# include <mln/core/image/line_graph_elt_window.hh>
-//# include <mln/core/image/mono_obased_rle_encode.hh>
-//# include <mln/core/image/mono_obased_rle_image.hh>
-//# include <mln/core/image/mono_rle_encode.hh>
-//# include <mln/core/image/mono_rle_image.hh>
-//# include <mln/core/image/obased_rle_encode.hh>
-//# include <mln/core/image/obased_rle_image.hh>
# include <mln/core/image/p2p_image.hh>
# include <mln/core/image/plain.hh>
-//# include <mln/core/image/rle_encode.hh>
-//# include <mln/core/image/rle_image.hh>
# include <mln/core/image/safe.hh>
# include <mln/core/image/slice_image.hh>
# include <mln/core/image/sparse_encode.hh>
@@ -86,6 +72,23 @@
# include <mln/core/image/t_image.hh>
# include <mln/core/image/tr_image.hh>
# include <mln/core/image/tr_mesh.hh>
+# include <mln/core/image/unproject_image.hh>
+
+//# include <mln/core/image/bgraph_image.hh>
+//# include <mln/core/image/bgraph_psite.hh>
+//# include <mln/core/image/fi_adaptor.hh>
+//# include <mln/core/image/graph_image.hh>
+//# include <mln/core/image/hexa.hh>
+//# include <mln/core/image/hexa_piter.hh>
+//# include <mln/core/image/image2d_h.hh>
+//# include <mln/core/image/mono_obased_rle_encode.hh>
+//# include <mln/core/image/mono_obased_rle_image.hh>
+//# include <mln/core/image/mono_rle_encode.hh>
+//# include <mln/core/image/mono_rle_image.hh>
+//# include <mln/core/image/obased_rle_encode.hh>
+//# include <mln/core/image/obased_rle_image.hh>
+//# include <mln/core/image/rle_encode.hh>
+//# include <mln/core/image/rle_image.hh>
//# include <mln/core/image/value_enc_image.hh>
//# include <mln/core/image/value_encode.hh>
Index: mln/core/image/unproject_image.hh
--- mln/core/image/unproject_image.hh (revision 0)
+++ mln/core/image/unproject_image.hh (revision 0)
@@ -0,0 +1,272 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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 MLN_CORE_IMAGE_UNPROJECT_IMAGE_HH
+# define MLN_CORE_IMAGE_UNPROJECT_IMAGE_HH
+
+/// \file mln/core/image/unproject_image.hh
+///
+/// Definition of a morpher that un-projects an image.
+/// FIXME: Doc!
+
+# include <mln/core/internal/image_domain_morpher.hh>
+# include <mln/core/grids.hh>
+# include <mln/core/site_set/box.hh>
+
+
+namespace mln
+{
+
+
+ // Forward declaration.
+ template <typename I, typename D, typename F> struct unproject_image;
+
+
+ namespace internal
+ {
+
+ /// Data structure for \c mln::unproject_image<I,D,F>.
+ template <typename I, typename D, typename F>
+ struct data< unproject_image<I,D,F> >
+ {
+ data(I& ima, const D& dom, const F& f);
+
+ I ima_;
+ D dom_;
+ F f_;
+ };
+
+ } // end of namespace mln::internal
+
+
+ namespace trait
+ {
+
+ template <typename I, typename D, typename F>
+ struct image_< unproject_image<I,D,F> > : default_image_morpher< I,
+ mln_value(I),
+ unproject_image<I,D,F> >
+ {
+ typedef trait::image::category::domain_morpher category;
+
+ // FIXME:
+// typedef trait::image::dimension::two_d dimension;
+
+ typedef trait::image::ext_domain::none ext_domain; // No extension of domain.
+ typedef trait::image::ext_value::irrelevant ext_value;
+ typedef trait::image::ext_io::irrelevant ext_io;
+
+ typedef trait::image::vw_io::none vw_io;
+ typedef trait::image::vw_set::none vw_set;
+ typedef trait::image::value_alignment::not_aligned value_alignment;
+ typedef trait::image::value_storage::disrupted value_storage;
+ };
+
+ } // end of namespace mln::trait
+
+
+
+ /// FIXME: Doc!
+ template <typename I, typename D, typename F>
+ struct unproject_image : public internal::image_domain_morpher< I,
+ D,
+ unproject_image<I,D,F> >
+ {
+ // FIXME:
+ typedef void skeleton;
+// /// Skeleton.
+// typedef unproject_image< tag::image_<I> > skeleton;
+
+
+ /// Constructor without argument.
+ unproject_image();
+
+ /// Constructor from an image \p ima, a domain \p dom, and a function \p f.
+ unproject_image(I& ima, const D& dom, const F& f);
+
+ void init_(I& ima, const D& dom, const F& f);
+
+
+ /// Give the definition domain.
+ const D& domain() const;
+
+ /// Read-only access to the image value located at point \p p.
+ mln_rvalue(I) operator()(const mln_psite(D)& p) const;
+
+ /// Read-write access to the image value located at point \p p.
+ mln_morpher_lvalue(I) operator()(const mln_psite(D)& p);
+
+
+// /// Const promotion via conversion.
+// operator unproject_image<const I, D, F>() const;
+ };
+
+
+
+ template <typename I, typename D, typename F>
+ unproject_image<I, D, F>
+ unproject(Image<I>& ima, const Site_Set<D>& dom, const Function_v2v<F>& f);
+
+ template <typename I, typename D, typename F>
+ unproject_image<const I, D, F>
+ unproject(const Image<I>& ima, const Site_Set<D>& dom, const Function_v2v<F>& f);
+
+
+
+
+// namespace trait
+// {
+
+// template <typename I, typename D, typename F,
+// typename V>
+// struct ch_value< unproject_image<I,D,F>, V >
+// {
+// // FIXME: Somthing like:
+// typedef pw::image< pw::cst_<mln_value(I)>, D> I_;
+// typedef mln_ch_value(I_,V) ret;
+// };
+
+// } // end of namespace mln::trait
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // internal::data< unproject_image<I,D,F> >
+
+ namespace internal
+ {
+
+ template <typename I, typename D, typename F>
+ inline
+ data< unproject_image<I,D,F> >::data(I& ima, const D& dom, const F& f)
+ : ima_(ima),
+ dom_(dom),
+ f_(f)
+ {
+ }
+
+ }
+
+
+ // unproject_image<I,D,F>
+
+ template <typename I, typename D, typename F>
+ inline
+ unproject_image<I,D,F>::unproject_image()
+ {
+ }
+
+ template <typename I, typename D, typename F>
+ inline
+ unproject_image<I,D,F>::unproject_image(I& ima, const D& dom, const F& f)
+ {
+ init_(ima, dom, f);
+ }
+
+ template <typename I, typename D, typename F>
+ inline
+ void
+ unproject_image<I,D,F>::init_(I& ima, const D& dom, const F& f)
+ {
+ mln_precondition(! this->is_valid());
+ this->data_ = new internal::data< unproject_image<I,D,F> >(ima, dom, f);
+ }
+
+ template <typename I, typename D, typename F>
+ inline
+ const D&
+ unproject_image<I,D,F>::domain() const
+ {
+ mln_precondition(this->is_valid());
+ return this->data_->dom_;
+ }
+
+ template <typename I, typename D, typename F>
+ inline
+ mln_rvalue(I)
+ unproject_image<I,D,F>::operator()(const mln_psite(D)& p) const
+ {
+ mln_precondition(this->has(p));
+ mln_result(F) p_ = this->data_->f_(p);
+ mln_precondition(this->data_->ima_.has(p_));
+ return this->data_->ima_(p_);
+ }
+
+ template <typename I, typename D, typename F>
+ inline
+ mln_morpher_lvalue(I)
+ unproject_image<I,D,F>::operator()(const mln_psite(D)& p)
+ {
+ mln_precondition(this->has(p));
+ mln_result(F) p_ = this->data_->f_(p);
+ mln_precondition(this->data_->ima_.has(p_));
+ return this->data_->ima_(p_);
+ }
+
+
+ // Routines.
+
+ template <typename I, typename D, typename F>
+ inline
+ unproject_image<I, D, F>
+ unproject(Image<I>& ima_, const Site_Set<D>& dom, const Function_v2v<F>& f)
+ {
+ mlc_converts_to(mln_psite(D), mln_argument(F))::check();
+ mlc_converts_to(mln_result(F), mln_psite(I))::check();
+
+ I& ima = exact(ima_);
+ mln_precondition(ima.is_valid());
+
+ unproject_image<I,D,F> tmp(ima, exact(dom), exact(f));
+ return tmp;
+ }
+
+ template <typename I, typename D, typename F>
+ inline
+ unproject_image<const I, D, F>
+ unproject(const Image<I>& ima_, const Site_Set<D>& dom, const Function_v2v<F>& f)
+ {
+ mlc_converts_to(mln_psite(D), mln_argument(F))::check();
+ mlc_converts_to(mln_result(F), mln_psite(I))::check();
+
+ const I& ima = exact(ima_);
+ mln_precondition(ima.is_valid());
+
+ unproject_image<const I,D,F> tmp(ima, exact(dom), exact(f));
+ return tmp;
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_CORE_IMAGE_UNPROJECT_IMAGE_HH
Index: mln/fun/v2v/all.hh
--- mln/fun/v2v/all.hh (revision 3532)
+++ mln/fun/v2v/all.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// 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,10 +29,9 @@
#ifndef MLN_FUN_V2V_ALL_HH
# define MLN_FUN_V2V_ALL_HH
-/*! \file mln/fun/v2v/all.hh
- *
- * \brief File that includes all functions from value to value.
- */
+/// \file mln/fun/v2v/all.hh
+///
+/// File that includes all functions from value to value.
namespace mln
@@ -41,12 +41,10 @@
{
/// Namespace of functions from value to value.
- namespace v2v
- {
- }
- }
+ namespace v2v {}
}
+}
# include <mln/fun/v2v/abs.hh>
@@ -57,6 +55,7 @@
# include <mln/fun/v2v/id.hh>
# include <mln/fun/v2v/linear.hh>
# include <mln/fun/v2v/norm.hh>
+# include <mln/fun/v2v/projection.hh>
# include <mln/fun/v2v/rgb_to_hsi.hh>
# include <mln/fun/v2v/saturate.hh>
Index: mln/fun/v2v/projection.hh
--- mln/fun/v2v/projection.hh (revision 0)
+++ mln/fun/v2v/projection.hh (revision 0)
@@ -0,0 +1,91 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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 MLN_FUN_V2V_PROJECTION_HH
+# define MLN_FUN_V2V_PROJECTION_HH
+
+/// \file mln/fun/v2v/projection.hh
+///
+/// FIXME.
+
+# include <mln/core/concept/function.hh>
+# include <mln/core/point.hh>
+# include <mln/core/grids.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ template <typename P, unsigned dir>
+ struct projection : public Function_v2v< projection<P,dir> >
+ {
+ private:
+ typedef mln_grid(P) G_;
+ typedef mln_coord(P) C_;
+ enum { n_ = G_::dim };
+
+ public:
+
+ typedef point<mln_regular_grid_from_dim(n_ - 1), C_> result;
+ typedef P argument;
+
+ result operator()(const P& p) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P, unsigned dir>
+ inline
+ typename projection<P, dir>::result
+ projection<P, dir>::operator()(const P& p) const
+ {
+ result tmp;
+ for (unsigned i = 0, j = 0; i < n_; ++i)
+ if (i == dir)
+ continue;
+ else
+ tmp[j++] = p[i];
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::v2v
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_V2V_PROJECTION_HH
Index: tests/core/image/unproject_image.cc
--- tests/core/image/unproject_image.cc (revision 0)
+++ tests/core/image/unproject_image.cc (revision 0)
@@ -0,0 +1,63 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+
+/// \file tests/core/image/unproject_image.cc
+///
+/// Tests on mln::unproject_image.
+
+#include <mln/core/image/image1d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/unproject_image.hh>
+#include <mln/core/var.hh>
+
+#include <mln/fun/v2v/projection.hh>
+
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ image1d<int> ima(3);
+ debug::iota(ima);
+
+ debug::println(ima);
+ std::cout << std::endl;
+
+ fun::v2v::projection<point2d, 0> f;
+
+ mln_VAR( ima_, unproject(ima, make::box2d(3, 3), f) );
+ debug::println(ima_);
+
+ ima_(point2d(1,1)) = 9;
+ debug::println(ima_);
+
+ debug::println(ima);
+}
Index: tests/core/image/Makefile.am
--- tests/core/image/Makefile.am (revision 3532)
+++ tests/core/image/Makefile.am (working copy)
@@ -4,7 +4,6 @@
##FIXME: re-enable tests
check_PROGRAMS = \
-## bgraph_image \
cast_image \
complex_image \
decorated_image \
@@ -18,20 +17,25 @@
image_if \
interpolated \
line_graph_image \
-## mono_obased_rle_image \
-## mono_rle_image \
-## obased_rle_image \
p2p_image \
plain \
-## rle_image \
safe_image \
slice_image \
-## sparse_image \
sub_image \
t_image \
- tr_image
+ tr_image \
+ unproject_image
+
+## bgraph_image \
+## mono_obased_rle_image \
+## mono_rle_image \
+## obased_rle_image \
+## rle_image \
+## sparse_image \
## value_enc_image
+
+
noinst_HEADERS = complex_image.hh
##bgraph_image_SOURCES = bgraph_image.cc
@@ -60,6 +64,7 @@
sub_image_SOURCES = sub_image.cc
t_image_SOURCES = t_image.cc
tr_image_SOURCES = tr_image.cc
+unproject_image_SOURCES = unproject_image.cc
##value_enc_image_SOURCES = value_enc_image.cc
# Tests depending on the FreeImagePlus library.
Index: tests/fun/v2v/projection.cc
--- tests/fun/v2v/projection.cc (revision 0)
+++ tests/fun/v2v/projection.cc (revision 0)
@@ -0,0 +1,73 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+
+/// \file tests/fun/v2v/projection.cc
+///
+/// Test on mln::fun::v2v::projection.
+
+#include <mln/fun/v2v/projection.hh>
+
+#include <mln/core/alias/point3d.hh>
+#include <mln/core/alias/point2d.hh>
+#include <mln/core/alias/point1d.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ {
+ typedef point2d P;
+ P p(0,1);
+ {
+ fun::v2v::projection<P,0> f;
+ mln_assertion(f(p) == point1d(1));
+ }
+ {
+ fun::v2v::projection<P,1> f;
+ mln_assertion(f(p) == point1d(0));
+ }
+ }
+
+ {
+ typedef point3d P;
+ P p(0,1,2);
+ {
+ fun::v2v::projection<P,0> f;
+ mln_assertion(f(p) == point2d(1,2));
+ }
+ {
+ fun::v2v::projection<P,1> f;
+ mln_assertion(f(p) == point2d(0,2));
+ }
+ {
+ fun::v2v::projection<P,2> f;
+ mln_assertion(f(p) == point2d(0,1));
+ }
+ }
+
+}
Index: tests/fun/v2v/Makefile.am
--- tests/fun/v2v/Makefile.am (revision 3532)
+++ tests/fun/v2v/Makefile.am (working copy)
@@ -2,9 +2,13 @@
include $(top_srcdir)/milena/tests/tests.mk
-check_PROGRAMS = norm rgb_hsi_conversion
+check_PROGRAMS = \
+ norm \
+ projection \
+ rgb_hsi_conversion
norm_SOURCES = norm.cc
+projection_SOURCES = projection.cc
rgb_hsi_conversion_SOURCES = rgb_hsi_conversion.cc
TESTS = $(check_PROGRAMS)
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add routines to deal with images of accumulators.
* mln/accu/image: New directory.
* mln/accu/image/init.hh: New.
* mln/accu/image/take.hh: New.
* mln/accu/image/set_value.hh: New.
* mln/accu/image/all.hh: New.
* mln/accu/image/take_as_init.hh: New.
* mln/accu/image/to_result.hh: New.
* mln/accu/all.hh: Update.
* tests/accu/image: New.
* tests/accu/image/to_result.cc: New.
* tests/accu/image/init.cc: New.
* tests/accu/image/take.cc: New.
* tests/accu/image/Makefile.am: New.
* tests/accu/image/set_value.cc: New.
* tests/accu/image/take_as_init.cc: New.
* tests/accu/Makefile.am: Update.
mln/accu/all.hh | 8 +
mln/accu/image/all.hh | 56 +++++++++++
mln/accu/image/init.hh | 162 +++++++++++++++++++++++++++++++++
mln/accu/image/set_value.hh | 166 ++++++++++++++++++++++++++++++++++
mln/accu/image/take.hh | 186 +++++++++++++++++++++++++++++++++++++++
mln/accu/image/take_as_init.hh | 166 ++++++++++++++++++++++++++++++++++
mln/accu/image/to_result.hh | 178 +++++++++++++++++++++++++++++++++++++
tests/accu/Makefile.am | 3
tests/accu/image/Makefile.am | 18 +++
tests/accu/image/init.cc | 45 +++++++++
tests/accu/image/set_value.cc | 48 ++++++++++
tests/accu/image/take.cc | 58 ++++++++++++
tests/accu/image/take_as_init.cc | 48 ++++++++++
tests/accu/image/to_result.cc | 49 ++++++++++
14 files changed, 1189 insertions(+), 2 deletions(-)
Index: mln/accu/image/init.hh
--- mln/accu/image/init.hh (revision 0)
+++ mln/accu/image/init.hh (revision 0)
@@ -0,0 +1,162 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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 MLN_ACCU_IMAGE_INIT_HH
+# define MLN_ACCU_IMAGE_INIT_HH
+
+/// \file mln/accu/image/init.hh
+///
+/// Initialize an image of accumulators.
+
+# include <mln/core/concept/accumulator.hh>
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace image
+ {
+
+ template <typename I>
+ void
+ init(Image<I>& input);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ namespace generic
+ {
+
+ template <typename I>
+ void
+ init(Image<I>& input_)
+ {
+ trace::entering("accu::impl::image::generic::init");
+
+ I& input = exact(input_);
+ mln_precondition(input.is_valid());
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ input(p).init();
+
+ trace::exiting("accu::impl::image::generic::init");
+ }
+
+ } // end of namespace mln::accu::image::impl::generic
+
+
+ // Fastest version.
+
+ template <typename I>
+ void
+ init_fastest(Image<I>& input_)
+ {
+ trace::entering("accu::impl::image::init_fastest");
+
+ I& input = exact(input_);
+ mln_precondition(input.is_valid());
+
+ mln_pixter(I) px(input);
+ for_all(px)
+ px.val().init();
+
+ trace::exiting("accu::impl::image::init_fastest");
+ }
+
+ } // end of namespace mln::accu::image::impl
+
+
+
+ // Dispatch.
+
+ namespace internal
+ {
+
+ template <typename I>
+ void
+ init_dispatch(trait::image::speed::any,
+ Image<I>& input)
+ {
+ impl::generic::init(input);
+ }
+
+ template <typename I>
+ void
+ init_dispatch(trait::image::speed::fastest,
+ Image<I>& input)
+ {
+ impl::init_fastest(input);
+ }
+
+ template <typename I>
+ void
+ init_dispatch(Image<I>& input)
+ {
+ init_dispatch(mln_trait_image_speed(I)(),
+ input);
+ }
+
+ } // end of namespace mln::accu::image::internal
+
+
+ // Facade.
+
+ template <typename I>
+ void
+ init(Image<I>& input)
+ {
+ trace::entering("accu::image::init");
+
+ mlc_is_a(mln_value(I), Accumulator)::check();
+
+ mln_precondition(exact(input).is_valid());
+ internal::init_dispatch(input);
+
+ trace::exiting("accu::image::init");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::image
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_IMAGE_INIT_HH
Index: mln/accu/image/take.hh
--- mln/accu/image/take.hh (revision 0)
+++ mln/accu/image/take.hh (revision 0)
@@ -0,0 +1,186 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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 MLN_ACCU_IMAGE_TAKE_HH
+# define MLN_ACCU_IMAGE_TAKE_HH
+
+/// \file mln/accu/image/take.hh
+///
+/// Update an image of accumulators by taking the contents of another
+/// image.
+
+# include <mln/core/concept/accumulator.hh>
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace image
+ {
+
+ template <typename I, typename J>
+ void
+ take(Image<I>& input, const Image<J>& arg);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ namespace generic
+ {
+
+ template <typename I, typename J>
+ void
+ take(Image<I>& input_, const Image<J>& arg_)
+ {
+ trace::entering("accu::impl::image::generic::take");
+
+ I& input = exact(input_);
+ const J& arg = exact(arg_);
+
+ mln_precondition(input.is_valid());
+ mln_precondition(arg.is_valid());
+ mln_precondition(arg.domain() <= input.domain());
+
+ mln_piter(J) p(arg.domain());
+ for_all(p)
+ input(p).take(arg(p));
+
+ trace::exiting("accu::impl::image::generic::take");
+ }
+
+ } // end of namespace mln::accu::image::impl::generic
+
+
+ // Fastest version.
+
+ template <typename I, typename J>
+ void
+ take_fastest(Image<I>& input_, const Image<J>& arg_)
+ {
+ trace::entering("accu::impl::image::take_fastest");
+
+ I& input = exact(input_);
+ const J& arg = exact(arg_);
+
+ mln_precondition(input.is_valid());
+ mln_precondition(arg.is_valid());
+ mln_precondition(arg.domain() == input.domain());
+
+ mln_pixter(I) p_in(input);
+ mln_pixter(const J) p_arg(arg);
+ for_all_2(p_in, p_arg)
+ p_in.val().take( p_arg.val() );
+
+ trace::exiting("accu::impl::image::take_fastest");
+ }
+
+ } // end of namespace mln::accu::image::impl
+
+
+
+ // Dispatch.
+
+ namespace internal
+ {
+
+ template <typename I, typename J>
+ void
+ take_dispatch(trait::image::speed::any,
+ trait::image::speed::any,
+ Image<I>& input, const Image<J>& arg)
+ {
+ impl::generic::take(input, arg);
+ }
+
+ template <typename I, typename J>
+ void
+ take_dispatch(trait::image::speed::fastest,
+ trait::image::speed::fastest,
+ Image<I>& input, const Image<J>& arg)
+ {
+ if (exact(arg).domain() == exact(input).domain())
+ impl::take_fastest(input, arg);
+ else
+ impl::generic::take(input, arg);
+ }
+
+ template <typename I, typename J>
+ void
+ take_dispatch(Image<I>& input, const Image<J>& arg)
+ {
+ take_dispatch(mln_trait_image_speed(I)(),
+ mln_trait_image_speed(J)(),
+ input, arg);
+ }
+
+ } // end of namespace mln::accu::image::internal
+
+
+ // Facade.
+
+ template <typename I, typename J>
+ void
+ take(Image<I>& input_, const Image<J>& arg_)
+ {
+ trace::entering("accu::image::take");
+
+ mlc_is_a(mln_value(I), Accumulator)::check();
+ mlc_converts_to(mln_value(J),
+ mln_deduce(I, value, argument))::check();
+
+ I& input = exact(input_);
+ const J& arg = exact(arg_);
+
+ mln_precondition(input.is_valid());
+ mln_precondition(arg.is_valid());
+ mln_precondition(arg.domain() <= input.domain());
+
+ internal::take_dispatch(input, arg);
+
+ trace::exiting("accu::image::take");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::image
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_IMAGE_TAKE_HH
Index: mln/accu/image/set_value.hh
--- mln/accu/image/set_value.hh (revision 0)
+++ mln/accu/image/set_value.hh (revision 0)
@@ -0,0 +1,166 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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 MLN_ACCU_IMAGE_SET_VALUE_HH
+# define MLN_ACCU_IMAGE_SET_VALUE_HH
+
+/// \file mln/accu/image/set_value.hh
+///
+/// Set the values of an image of accumulators.
+
+# include <mln/core/concept/accumulator.hh>
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace image
+ {
+
+ template <typename I>
+ void
+ set_value(Image<I>& input,
+ const mln_deduce(I, value, result)& res);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ namespace generic
+ {
+
+ template <typename I>
+ void
+ set_value(Image<I>& input_,
+ const mln_deduce(I, value, result)& res)
+ {
+ trace::entering("accu::impl::image::generic::set_value");
+
+ I& input = exact(input_);
+ mln_precondition(input.is_valid());
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ input(p).set_value(res);
+
+ trace::exiting("accu::impl::image::generic::set_value");
+ }
+
+ } // end of namespace mln::accu::image::impl::generic
+
+
+ // Fastest version.
+
+ template <typename I>
+ void
+ set_value_fastest(Image<I>& input_,
+ const mln_deduce(I, value, result)& res)
+ {
+ trace::entering("accu::impl::image::set_value_fastest");
+
+ I& input = exact(input_);
+ mln_precondition(input.is_valid());
+
+ mln_pixter(I) px(input);
+ for_all(px)
+ px.val().set_value(res);
+
+ trace::exiting("accu::impl::image::set_value_fastest");
+ }
+
+ } // end of namespace mln::accu::image::impl
+
+
+
+ // Dispatch.
+
+ namespace internal
+ {
+
+ template <typename I, typename V>
+ void
+ set_value_dispatch(trait::image::speed::any,
+ Image<I>& input, const V& res)
+ {
+ impl::generic::set_value(input, res);
+ }
+
+ template <typename I, typename V>
+ void
+ set_value_dispatch(trait::image::speed::fastest,
+ Image<I>& input, const V& res)
+ {
+ impl::set_value_fastest(input, res);
+ }
+
+ template <typename I, typename V>
+ void
+ set_value_dispatch(Image<I>& input, const V& res)
+ {
+ set_value_dispatch(mln_trait_image_speed(I)(),
+ input, res);
+ }
+
+ } // end of namespace mln::accu::image::internal
+
+
+ // Facade.
+
+ template <typename I>
+ void
+ set_value(Image<I>& input,
+ const mln_deduce(I, value, result)& res)
+ {
+ trace::entering("accu::image::set_value");
+
+ mlc_is_a(mln_value(I), Accumulator)::check();
+
+ mln_precondition(exact(input).is_valid());
+ internal::set_value_dispatch(input, res);
+
+ trace::exiting("accu::image::set_value");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::image
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_IMAGE_SET_VALUE_HH
Index: mln/accu/image/all.hh
--- mln/accu/image/all.hh (revision 0)
+++ mln/accu/image/all.hh (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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 MLN_ACCU_IMAGE_ALL_HH
+# define MLN_ACCU_IMAGE_ALL_HH
+
+/// \file mln/accu/image/all.hh
+///
+/// File that includes all accumulator image routines.
+
+
+namespace mln
+{
+
+ /// Namespace of accumulators.
+ namespace accu
+ {
+ /// Namespace of accumulator image routines.
+ namespace image {}
+
+ }
+}
+
+
+# include <mln/accu/image/init.hh>
+# include <mln/accu/image/set_value.hh>
+# include <mln/accu/image/take_as_init.hh>
+# include <mln/accu/image/take.hh>
+# include <mln/accu/image/to_result.hh>
+
+
+#endif // ! MLN_ACCU_IMAGE_ALL_HH
Index: mln/accu/image/take_as_init.hh
--- mln/accu/image/take_as_init.hh (revision 0)
+++ mln/accu/image/take_as_init.hh (revision 0)
@@ -0,0 +1,166 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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 MLN_ACCU_IMAGE_TAKE_AS_INIT_HH
+# define MLN_ACCU_IMAGE_TAKE_AS_INIT_HH
+
+/// \file mln/accu/image/take_as_init.hh
+///
+/// Initialize an image of accumulators by taking a first value.
+
+# include <mln/core/concept/accumulator.hh>
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace image
+ {
+
+ template <typename I>
+ void
+ take_as_init(Image<I>& input,
+ const mln_deduce(I, value, argument)& v);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ namespace generic
+ {
+
+ template <typename I>
+ void
+ take_as_init(Image<I>& input_,
+ const mln_deduce(I, value, argument)& v)
+ {
+ trace::entering("accu::impl::image::generic::take_as_init");
+
+ I& input = exact(input_);
+ mln_precondition(input.is_valid());
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ input(p).take_as_init(v);
+
+ trace::exiting("accu::impl::image::generic::take_as_init");
+ }
+
+ } // end of namespace mln::accu::image::impl::generic
+
+
+ // Fastest version.
+
+ template <typename I>
+ void
+ take_as_init_fastest(Image<I>& input_,
+ const mln_deduce(I, value, argument)& v)
+ {
+ trace::entering("accu::impl::image::take_as_init_fastest");
+
+ I& input = exact(input_);
+ mln_precondition(input.is_valid());
+
+ mln_pixter(I) px(input);
+ for_all(px)
+ px.val().take_as_init(v);
+
+ trace::exiting("accu::impl::image::take_as_init_fastest");
+ }
+
+ } // end of namespace mln::accu::image::impl
+
+
+
+ // Dispatch.
+
+ namespace internal
+ {
+
+ template <typename I, typename V>
+ void
+ take_as_init_dispatch(trait::image::speed::any,
+ Image<I>& input, const V& v)
+ {
+ impl::generic::take_as_init(input, v);
+ }
+
+ template <typename I, typename V>
+ void
+ take_as_init_dispatch(trait::image::speed::fastest,
+ Image<I>& input, const V& v)
+ {
+ impl::take_as_init_fastest(input, v);
+ }
+
+ template <typename I, typename V>
+ void
+ take_as_init_dispatch(Image<I>& input, const V& v)
+ {
+ take_as_init_dispatch(mln_trait_image_speed(I)(),
+ input, v);
+ }
+
+ } // end of namespace mln::accu::image::internal
+
+
+ // Facade.
+
+ template <typename I>
+ void
+ take_as_init(Image<I>& input,
+ const mln_deduce(I, value, argument)& v)
+ {
+ trace::entering("accu::image::take_as_init");
+
+ mlc_is_a(mln_value(I), Accumulator)::check();
+
+ mln_precondition(exact(input).is_valid());
+ internal::take_as_init_dispatch(input, v);
+
+ trace::exiting("accu::image::take_as_init");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::image
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_IMAGE_TAKE_AS_INIT_HH
Property changes on: mln/accu/image/take_as_init.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: mln/accu/image/to_result.hh
--- mln/accu/image/to_result.hh (revision 0)
+++ mln/accu/image/to_result.hh (revision 0)
@@ -0,0 +1,178 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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 MLN_ACCU_IMAGE_TO_RESULT_HH
+# define MLN_ACCU_IMAGE_TO_RESULT_HH
+
+/// \file mln/accu/image/to_result.hh
+///
+/// Convert an image of accumulators into a result image.
+
+# include <mln/core/concept/accumulator.hh>
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+ namespace image
+ {
+
+ template <typename I>
+ mln_ch_value(I, mln_deduce(I, value, result))
+ to_result(const Image<I>& input);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ // Generic version.
+
+ namespace generic
+ {
+
+ template <typename I>
+ mln_ch_value(I, mln_deduce(I, value, result))
+ to_result(const Image<I>& input_)
+ {
+ trace::entering("accu::impl::image::generic::to_result");
+
+ const I& input = exact(input_);
+ mln_precondition(input.is_valid());
+
+ typedef mln_deduce(I, value, result) R;
+ mln_ch_value(I, R) output;
+ initialize(output, input);
+
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ output(p) = input(p).to_result();
+
+ trace::exiting("accu::impl::image::generic::to_result");
+ return output;
+ }
+
+ } // end of namespace mln::accu::image::impl::generic
+
+
+ // Fastest version.
+
+ template <typename I>
+ mln_ch_value(I, mln_deduce(I, value, result))
+ to_result_fastest(const Image<I>& input_)
+ {
+ trace::entering("accu::impl::image::to_result_fastest");
+
+ const I& input = exact(input_);
+ mln_precondition(input.is_valid());
+
+ typedef mln_deduce(I, value, result) R;
+ typedef mln_ch_value(I, R) O;
+ O output;
+ initialize(output, input);
+
+ mln_pixter(const I) p_in(input);
+ mln_pixter(O) p_out(output);
+ for_all_2(p_in, p_out)
+ p_out.val() = p_in.val().to_result();
+
+ trace::exiting("accu::impl::image::to_result_fastest");
+ return output;
+ }
+
+ } // end of namespace mln::accu::image::impl
+
+
+
+ // Dispatch.
+
+ namespace internal
+ {
+
+ template <typename I>
+ mln_ch_value(I, mln_deduce(I, value, result))
+ to_result_dispatch(trait::image::speed::any,
+ const Image<I>& input)
+ {
+ return impl::generic::to_result(input);
+ }
+
+ template <typename I>
+ mln_ch_value(I, mln_deduce(I, value, result))
+ to_result_dispatch(trait::image::speed::fastest,
+ const Image<I>& input)
+ {
+ return impl::to_result_fastest(input);
+ }
+
+ template <typename I>
+ mln_ch_value(I, mln_deduce(I, value, result))
+ to_result_dispatch(const Image<I>& input)
+ {
+ return to_result_dispatch(mln_trait_image_speed(I)(),
+ input);
+ }
+
+ } // end of namespace mln::accu::image::internal
+
+
+ // Facade.
+
+ template <typename I>
+ mln_ch_value(I, mln_deduce(I, value, result))
+ to_result(const Image<I>& input)
+ {
+ trace::entering("accu::image::to_result");
+
+ mlc_is_a(mln_value(I), Accumulator)::check();
+
+ mln_precondition(exact(input).is_valid());
+
+ typedef mln_deduce(I, value, result) R;
+ mln_ch_value(I, R) output;
+ output = internal::to_result_dispatch(input);
+
+ trace::exiting("accu::image::to_result");
+ return output;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu::image
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_IMAGE_TO_RESULT_HH
Property changes on: mln/accu/image/to_result.hh
___________________________________________________________________
Added: svn:mergeinfo
Index: mln/accu/all.hh
--- mln/accu/all.hh (revision 3531)
+++ mln/accu/all.hh (working copy)
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
-// (LRDE)
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -93,5 +93,9 @@
# include <mln/accu/transform_line.hh>
# include <mln/accu/transform_snake.hh>
+// Sub-directories
+
+# include <mln/accu/image/all.hh>
+
#endif // ! MLN_ACCU_ALL_HH
Index: tests/accu/image/to_result.cc
--- tests/accu/image/to_result.cc (revision 0)
+++ tests/accu/image/to_result.cc (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+
+/// \file tests/accu/image/to_result.cc
+///
+/// Tests on mln::accu::image::to_result.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/accu/count.hh>
+#include <mln/accu/image/init.hh>
+#include <mln/accu/image/to_result.hh>
+#include <mln/debug/println.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef accu::count<int> A;
+ image2d<A> ima(2, 2);
+
+ accu::image::init(ima);
+ image2d<unsigned> res = accu::image::to_result(ima);
+ debug::println(res);
+}
Property changes on: tests/accu/image/to_result.cc
___________________________________________________________________
Added: svn:mergeinfo
Index: tests/accu/image/init.cc
--- tests/accu/image/init.cc (revision 0)
+++ tests/accu/image/init.cc (revision 0)
@@ -0,0 +1,45 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+
+/// \file tests/accu/image/init.cc
+///
+/// Tests on mln::accu::image::init.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/accu/count.hh>
+#include <mln/accu/image/init.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef accu::count<int> A;
+ image2d<A> ima(2, 2);
+
+ accu::image::init(ima);
+}
Index: tests/accu/image/take.cc
--- tests/accu/image/take.cc (revision 0)
+++ tests/accu/image/take.cc (revision 0)
@@ -0,0 +1,58 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+
+/// \file tests/accu/image/take.cc
+///
+/// Tests on mln::accu::image::take.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/data/fill.hh>
+#include <mln/accu/sum.hh>
+#include <mln/accu/image/init.hh>
+#include <mln/accu/image/take.hh>
+
+#include <mln/debug/println.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef accu::sum<int> A;
+ image2d<A> ima(2, 2);
+ accu::image::init(ima);
+ debug::println(ima);
+
+ image2d<int> dta(2, 2);
+ data::fill(dta, 7);
+
+ accu::image::take(ima, dta);
+ debug::println(ima);
+
+ accu::image::take(ima, ima);
+ debug::println(ima);
+}
Index: tests/accu/image/Makefile.am
--- tests/accu/image/Makefile.am (revision 0)
+++ tests/accu/image/Makefile.am (revision 0)
@@ -0,0 +1,18 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ init \
+ set_value \
+ take \
+ take_as_init \
+ to_result
+
+init_SOURCES = init.cc
+set_value_SOURCES = set_value.cc
+take_SOURCES = take.cc
+take_as_init_SOURCES = take_as_init.cc
+to_result_SOURCES = to_result.cc
+
+TESTS = $(check_PROGRAMS)
Index: tests/accu/image/set_value.cc
--- tests/accu/image/set_value.cc (revision 0)
+++ tests/accu/image/set_value.cc (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+
+/// \file tests/accu/image/set_value.cc
+///
+/// Tests on mln::accu::image::set_value.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/accu/count.hh>
+#include <mln/accu/image/set_value.hh>
+
+#include <mln/debug/println.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef accu::count<int> A;
+ image2d<A> ima(2, 2);
+
+ accu::image::set_value(ima, 3);
+ debug::println(ima);
+}
Index: tests/accu/image/take_as_init.cc
--- tests/accu/image/take_as_init.cc (revision 0)
+++ tests/accu/image/take_as_init.cc (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// 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.
+
+/// \file tests/accu/image/take_as_init.cc
+///
+/// Tests on mln::accu::image::take_as_init.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/accu/sum.hh>
+#include <mln/accu/image/take_as_init.hh>
+
+#include <mln/debug/println.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef accu::sum<int> A;
+ image2d<A> ima(2, 2);
+
+ accu::image::take_as_init(ima, 3);
+ debug::println(ima);
+}
Property changes on: tests/accu/image/take_as_init.cc
___________________________________________________________________
Added: svn:mergeinfo
Index: tests/accu/Makefile.am
--- tests/accu/Makefile.am (revision 3531)
+++ tests/accu/Makefile.am (working copy)
@@ -2,6 +2,9 @@
include $(top_srcdir)/milena/tests/tests.mk
+SUBDIRS = \
+ image
+
check_PROGRAMS = \
all_accus \
bbox \
* milena/doc/tutorial/tutorial.tex: Fix syntax errors.
---
milena/ChangeLog | 6 ++++
milena/doc/tutorial/tutorial.tex | 55 ++++++++++++++++++--------------------
2 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 991185f..3e5daca 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-13 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
+ Fix tutorial compilation.
+
+ * milena/doc/tutorial/tutorial.tex: Fix syntax errors.
+
2009-03-13 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix missing trace in mln::test routines.
diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex
index 903ac14..a36a365 100644
--- a/milena/doc/tutorial/tutorial.tex
+++ b/milena/doc/tutorial/tutorial.tex
@@ -305,10 +305,6 @@ $$
\end{latexonly}
}
-\newcommand{\path}[1]{
-\textit{#1}
-}
-
\newcommand{\dir}[1]{
\textbf{\textit{#1}}
}
@@ -387,16 +383,16 @@ It is a more detailed explanations of the library's features.
\textit{end users} and \textit{designers} may be also interested by all the
examples provided with the documentation and the tutorial. The source code is
-available in \path{milena/doc/examples} (FIXME: ref) and is usually pointed
+available in \hpath{milena/doc/examples} (FIXME: ref) and is usually pointed
out and commented by the documentation.
Taking a look at the test suite is also a good idea. The tests usually focus on
a single functionality and handle several use cases which may overlap your needs.
-The test suite is located at \path{milena/tests} (FIXME: ref?).
+The test suite is located at \hpath{milena/tests} (FIXME: ref?).
Still not enough information? More information about all the functions is
available in the User HTML documentation (FIXME:ref).
-It mainly targets \textit{designers} and \texit{providers}.
+It mainly targets \textit{designers} and \textit{providers}.
The latter may also be interested by the Developer HTML documentation
(FIXME:ref).
@@ -437,7 +433,7 @@ We strongly advise you to not use it for production use.
%download page.
%--------------------------
-\subdoxysection{tuto1downloadingsvn}{Downloading from SVN}
+\doxysubsection{tuto1downloadingsvn}{Downloading from SVN}
First, be sure that SVN is already installed on your system.
Open a terminal and type:
@@ -486,17 +482,17 @@ and/or use the other documentations ressources (\ref{tuto1ressources}).
%--------------------------
-\subdoxysection{tuto1downloadingpackages}{Downloading packaged releases}
+\doxysubsection{tuto1downloadingpackages}{Downloading packaged releases}
%details.
Milena's packages can be downloaded from:
-\begin{centerize}
+\begin{center}
\begin{verbatim}
http://www.lrde.epita.fr/Olena/Download
\end{verbatim}
-\end{centerize}
+\end{center}
On this page you will find the latest and past releases.
Currently, we provide only '.tar.gz' and 'tar.bz2' archives.
@@ -568,33 +564,33 @@ you finding what you need, you will find a description of all these
subdirectories.
-List of \path{milena}'s subdirectories:
+List of \hpath{milena}'s subdirectories:
\begin{itemize}
-\dir{apps} --- A full example of a 3D mesh visualization tool. It
+\item \dir{apps} --- A full example of a 3D mesh visualization tool. It
uses milena.
-\dir{doc} --- THE directory you must know. Contains all the
+\item \dir{doc} --- THE directory you must know. Contains all the
documentation material.
-\dir{img} --- A set of common test images. They are used in the
+\item \dir{img} --- A set of common test images. They are used in the
test suite. Feel free to use it in your programs.
-\dir{mesh} --- A set of 3D meshes. They can be used with the full
- example located in \path{milena/apps}.
+\item \dir{mesh} --- A set of 3D meshes. They can be used with the full
+ example located in \hpath{milena/apps}.
-\dir{mln} --- The core of the libray. Contains all the library headers.
+\item \dir{mln} --- The core of the libray. Contains all the library headers.
-\dir{tests} --- The test suite. Is it subdivided in sub directories.
- The directory hierarchy respects \path{milena/mln}'s.
+\item \dir{tests} --- The test suite. Is it subdivided in sub directories.
+ The directory hierarchy respects \hpath{milena/mln}'s.
-\dir{tools} --- Small tools written with milena. They can be used as examples.
+\item \dir{tools} --- Small tools written with milena. They can be used as examples.
\end{itemize}
-List of \path{mln}'s subdirectories:
+List of \hpath{mln}'s subdirectories:
\begin{itemize}
\item \dir{accu} --- Set of Accumulators.
\item \dir{algebra} --- Algebraic structures like vectors or matrices.
@@ -645,12 +641,12 @@ List of \path{mln}'s subdirectories:
\item \dir{util} --- Various utilitarian classes.
\item \dir{value} --- Set of value types which can be used in an image.
\item \dir{win} --- Set of various window kinds.
-\end{itemize}}
+\end{itemize}
-The source code and the material of the documentation is available in \path{
+The source code and the material of the documentation is available in \hpath{
milena/doc}.
-List of \path{doc}'s subdirectories:
+List of \hpath{doc}'s subdirectories:
\begin{itemize}
\item \dir{examples} --- All the source code of the documentation examples.
\item \dir{benchmark} --- Some benchmarks.
@@ -746,6 +742,7 @@ The buildfarm can show you whether it is safe to update your svn copy of Milena
--- Through this page, you can see exactly which tests do not compile or pass.
This page is updated every night.
+\end{itemize}
%**************************
@@ -910,7 +907,7 @@ $ cd /my/path/to/olena-1.0/build
\end{verbatim}
If you did not change the default install path prefix, set to
-\path{/usr/local}, you will need to have administrator privileges to
+\hpath{/usr/local}, you will need to have administrator privileges to
perform the installation. Then, you may type:
\begin{verbatim}
$ sudo make install
@@ -943,7 +940,7 @@ compiled if you want to use them.
\doxysubsection{tuto2examples}{Examples}
Examples are part of the documentation. The sources are located in
-\path{milena/doc/examples}.
+\hpath{milena/doc/examples}.
To compile the examples simply run:
\begin{verbatim}
@@ -959,7 +956,7 @@ $ make examples
\end{verbatim}
Text and image outputs will be respectively stored in
-\path{build/milena/doc/outputs} and \path{build/milena/doc/figures}.
+\hpath{build/milena/doc/outputs} and \hpath{build/milena/doc/figures}.
@@ -973,7 +970,7 @@ Currently two tools are available:
area\_flooding.cc & FIXME:description \\
\hline
seed2tiling.cc & FIXME:description \\
-\end{itemize}
+\end{tabular}
To build these tools, run:
\begin{verbatim}
--
1.5.6.5