https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add set compute with an accumulator.
* tests/set/compute.cc: New.
* tests/set/Makefile.am: Update.
* tests/set/diff.cc: Upgrade doc style.
Fix clumsy include.
* mln/set/compute.hh: New.
* mln/set/all.hh: Update.
mln/set/all.hh | 11 +++-
mln/set/compute.hh | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/set/Makefile.am | 2
tests/set/compute.cc | 44 +++++++++++++++++++
tests/set/diff.cc | 10 ++--
5 files changed, 170 insertions(+), 9 deletions(-)
Index: tests/set/compute.cc
--- tests/set/compute.cc (revision 0)
+++ tests/set/compute.cc (revision 0)
@@ -0,0 +1,44 @@
+// Copyright (C) 2008 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/set/compute.cc
+///
+/// Tests on mln::set::compute.
+
+#include <mln/core/site_set/p_set.hh>
+#include <mln/core/alias/point2d.hh>
+#include <mln/accu/count.hh>
+#include <mln/set/compute.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ p_set<point2d> s;
+ mln_assertion(set::compute(accu::meta::count(), s) == 0);
+}
Index: tests/set/Makefile.am
--- tests/set/Makefile.am (revision 2869)
+++ tests/set/Makefile.am (working copy)
@@ -3,12 +3,14 @@
include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
+ compute \
diff \
inter \
is_subset_of \
sym_diff \
uni
+compute_SOURCES = compute.cc
diff_SOURCES = diff.cc
inter_SOURCES = inter.cc
is_subset_of_SOURCES = is_subset_of.cc
Index: tests/set/diff.cc
--- tests/set/diff.cc (revision 2869)
+++ tests/set/diff.cc (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 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
@@ -25,13 +26,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/set/diff.cc
- *
- * \brief Tests on mln::set::diff.
- */
+/// \file tests/set/diff.cc
+///
+/// Tests on mln::set::diff.
#include <mln/core/site_set/p_set.hh>
-#include <mln/core/alias/dpoint2d.hh>
+#include <mln/core/alias/point2d.hh>
#include <mln/set/diff.hh>
Index: mln/set/all.hh
--- mln/set/all.hh (revision 2869)
+++ mln/set/all.hh (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 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_SET_ALL_HH
# define MLN_SET_ALL_HH
-/*! \file mln/set/all.hh
- *
- * \brief File that includes all set-related routines.
- */
+/// \file mln/set/all.hh
+///
+/// File that includes all set-related routines.
namespace mln
@@ -42,6 +42,8 @@
}
+
+# include <mln/set/compute.hh>
# include <mln/set/diff.hh>
# include <mln/set/inter.hh>
# include <mln/set/get.hh>
@@ -50,4 +52,5 @@
# include <mln/set/sym_diff.hh>
# include <mln/set/uni.hh>
+
#endif // ! MLN_SET_ALL_HH
Index: mln/set/compute.hh
--- mln/set/compute.hh (revision 0)
+++ mln/set/compute.hh (revision 0)
@@ -0,0 +1,112 @@
+// Copyright (C) 2008 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_SET_COMPUTE_HH
+# define MLN_SET_COMPUTE_HH
+
+/// \file mln/set/compute.hh
+///
+/// Compute an accumulator on a site set.
+
+# include <mln/core/concept/meta_accumulator.hh>
+# include <mln/core/concept/site_set.hh>
+
+
+namespace mln
+{
+
+ namespace set
+ {
+
+ /*! Compute an accumulator onto the sites of a site set.
+ *
+ * \param[in] a An accumulator.
+ * \param[in] s A site set.
+ * \return The accumulator result.
+ */
+ template <typename A, typename S>
+ mln_result(A)
+ compute(const Accumulator<A>& a, const Site_Set<S>& s);
+
+
+ /*! Compute an accumulator onto the sites of a site set.
+ *
+ * \param[in] a A meta-accumulator.
+ * \param[in] s A site set.
+ * \return The accumulator result.
+ */
+ template <typename A, typename S>
+ mln_accu_with(A, mln_site(S))::result
+ compute(const Meta_Accumulator<A>& a, const Site_Set<S>& s);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename A, typename S>
+ inline
+ mln_result(A)
+ compute(const Accumulator<A>& a_, const Site_Set<S>& s_)
+ {
+ trace::entering("set::compute");
+
+ A a = exact(a_);
+ const S& s = exact(s_);
+
+ mln_piter(S) p(s);
+ for_all(p)
+ a.take(p);
+
+ trace::exiting("set::compute");
+ return a.to_result();
+ }
+
+ template <typename A, typename S>
+ mln_accu_with(A, mln_site(S))::result
+ compute(const Meta_Accumulator<A>& a_, const Site_Set<S>& s_)
+ {
+ trace::entering("set::compute");
+
+ mln_accu_with(A, mln_site(S)) a = accu::unmeta(exact(a_), mln_site(S)());
+ const S& s = exact(s_);
+
+ mln_piter(S) p(s);
+ for_all(p)
+ a.take(p);
+
+ trace::exiting("set::compute");
+ return a.to_result();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::set
+
+} // end of namespace mln
+
+
+#endif // ! MLN_SET_COMPUTE_HH
#43: Fix the initialization of all global constants.
------------------------+---------------------------------------------------
Reporter: garrigues | Owner: Olena Team
Type: defect | Status: closed
Priority: major | Milestone: Olena 1.0
Component: Milena | Version: 1.0
Resolution: fixed | Keywords:
------------------------+---------------------------------------------------
Comment (by lazzara):
Fixed in branches/cleanup-2008 with revision #2818 and #2865.
The associated test is named "global_vars" and is available in
milena/tests.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/43#comment:4>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update unary logical not.
* mln/fun/v2b/lnot.hh: New.
* mln/fun/v2b/all.hh: Update.
* mln/logical/not.hh: Rely on level transform.
fun/v2b/all.hh | 19 ++++++--------
fun/v2b/lnot.hh | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
logical/not.hh | 70 +++++++++++-----------------------------------------
3 files changed, 99 insertions(+), 65 deletions(-)
Index: mln/fun/v2b/all.hh
--- mln/fun/v2b/all.hh (revision 2868)
+++ mln/fun/v2b/all.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 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 +28,9 @@
#ifndef MLN_FUN_V2B_ALL_HH
# define MLN_FUN_V2B_ALL_HH
-/*! \file mln/fun/v2b/all.hh
- *
- * \brief File that includes all functions from point to value.
- */
+/// \file mln/fun/v2b/all.hh
+///
+/// File that includes all functions from value to logic value.
namespace mln
@@ -40,15 +39,15 @@
namespace fun
{
- /// Namespace of functions from point to value.
- namespace v2b
- {
- }
- }
+ /// Namespace of functions from value to logic value.
+ namespace v2b {}
}
+}
+# include <mln/fun/v2b/lnot.hh>
# include <mln/fun/v2b/threshold.hh>
+
#endif // ! MLN_FUN_V2B_ALL_HH
Index: mln/fun/v2b/lnot.hh
--- mln/fun/v2b/lnot.hh (revision 0)
+++ mln/fun/v2b/lnot.hh (revision 0)
@@ -0,0 +1,75 @@
+// Copyright (C) 2008 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_V2B_LNOT_HH
+# define MLN_FUN_V2B_LNOT_HH
+
+/// \file mln/fun/v2b/lnot.hh
+///
+/// Functor that computes "logical not" on a value.
+
+# include <mln/core/concept/function.hh>
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2b
+ {
+
+ /// Functor computing logical-not on a value.
+ template <typename V>
+ struct lnot : public Function_v2b< lnot<V> >
+ {
+ typedef V result;
+ V operator()(const V& v) const;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename V>
+ inline
+ V
+ lnot<V>::operator()(const V& v) const
+ {
+ return ! v;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::fun::v2b
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_V2B_LNOT_HH
Index: mln/logical/not.hh
--- mln/logical/not.hh (revision 2868)
+++ mln/logical/not.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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,18 +29,12 @@
#ifndef MLN_LOGICAL_NOT_HH
# define MLN_LOGICAL_NOT_HH
-/*! \file mln/logical/not.hh
- *
- * \brief Point-wise "logical not" of a binary image.
- *
- * \todo Add static assertion and save one iterator in in-place version.
- */
-
-# include <mln/core/concept/image.hh>
+/// \file mln/logical/not.hh
+///
+/// Point-wise "logical not" of a binary image.
-
-// Specializations are in:
-# include <mln/logical/not.spe.hh>
+# include <mln/logical/includes.hh>
+# include <mln/fun/v2b/lnot.hh>
namespace mln
@@ -73,58 +68,21 @@
void not_inplace(Image<I>& input);
-# ifndef MLN_INCLUDE_ONLY
-
- namespace impl
- {
-
- namespace generic
- {
- template <typename I, typename O>
- inline
- void not_(const I& input, O& output)
- {
- trace::entering("logical::impl::generic::not_");
-
- mln_piter(I) p(input.domain());
- for_all(p)
- output(p) = ! input(p);
- trace::exiting("logical::impl::generic::not_");
- }
-
- template <typename I>
- inline
- void not_inplace(I& inout)
- {
- trace::entering("logical::impl::generic::not_");
-
- mln_piter(I) p(inout.domain());
- for_all(p)
- inout(p) = ! inout(p);
-
- trace::exiting("logical::impl::generic::not_");
- }
- }
-
- } // end of namespace mln::logical::impl
-
-
- // Facades.
+# ifndef MLN_INCLUDE_ONLY
template <typename I>
inline
mln_concrete(I) not_(const Image<I>& input)
{
- trace::entering("logical::not");
+ trace::entering("logical::not_");
mln_precondition(exact(input).has_data());
- mln_concrete(I) output;
- initialize(output, input);
- impl::not_(mln_trait_image_speed(I)(), exact(input), output);
+ fun::v2b::lnot<mln_value(I)> f;
+ mln_concrete(I) output = level::transform(input, f);
- trace::exiting("logical::not");
+ trace::exiting("logical::not_");
return output;
}
@@ -135,7 +93,9 @@
trace::entering("logical::not_inplace");
mln_precondition(exact(input).has_data());
- impl::not_inplace(mln_trait_image_speed(I)(), exact(input));
+
+ fun::v2b::lnot<mln_value(I)> f;
+ level::transform_inplace(input, f);
trace::exiting("logical::not_inplace");
}
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Nicolas Ballas <ballas(a)lrde.epita.fr>
Temporary fix in complex_image properties.
* doc/tutorial/design/include/imagetours.tex: Update documentation.
* mln/core/image/complex_image.hh: Fix properties.
doc/tutorial/design/include/imagetours.tex | 8 ++++----
mln/core/image/complex_image.hh | 8 +++++---
2 files changed, 9 insertions(+), 7 deletions(-)
Index: doc/tutorial/design/include/imagetours.tex
--- doc/tutorial/design/include/imagetours.tex (revision 2863)
+++ doc/tutorial/design/include/imagetours.tex (working copy)
@@ -39,7 +39,7 @@
%%However, the $site$ concept allows Milena to deal with complicated image type
%%(for instance see the \verb+graph_image+ type).
-An image is composed by a set of localized objects ($sites$): the definition domain of the image.
+An image is composed by a set of localized objects ($sites$), the definition domain of the image.
A value is associated to each site of the image. This is the destination domain
of the image.
To access to a value localized at the site p in an image named $ima$, we
@@ -75,10 +75,10 @@
%% Primary image definition
-Primary images are a major category of Milena image type.
+Primary images are a major category of the Milena image types.
Primary images are not based on another image type.
They are sufficient to define themselves.
-Thus, a primary image types directly holds in memory its data (values).
+Thus, a primary image types directly holds its data (values) in memory.
\begin{itemize}
@@ -145,7 +145,7 @@
will be transformed).
Since, it extends an image, an image morpher is also an image type.
-The Milena library provide different kinds of morphers.
+The Milena library provides different kinds of morphers.
Domain morphers only modify the domain (the set of points/sites composing the image) of the input image.
Value morphers only change the input image values (cast the values into another
type\ldots{})
Index: mln/core/image/complex_image.hh
--- mln/core/image/complex_image.hh (revision 2863)
+++ mln/core/image/complex_image.hh (working copy)
@@ -85,9 +85,11 @@
// Value.
typedef trait::image::value_access::direct value_access;
- // FIXME: Is that right?
- typedef trait::image::vw_io::read_write vw_io;
- typedef trait::image::vw_set::multi vw_set;
+ // FIXME: This image is value wise read_write, and provides
+ // an access to its values throught a multi-set,
+ // but we need to add the corresponding interface in the class.
+ typedef trait::image::vw_io::none vw_io;
+ typedef trait::image::vw_set::none vw_set;
typedef trait::image::value_storage::disrupted value_storage;
typedef trait::image::value_browsing::site_wise_only value_browsing;
typedef trait::image::value_alignement::irrelevant value_alignement;