Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
October 2008
- 14 participants
- 373 discussions
04 Oct '08
* mln/topo/center_only_iter.hh: New.
* tests/topo/complex.cc: Exercise this iterator.
---
milena/ChangeLog | 7 ++
milena/mln/topo/center_only_iter.hh | 134 +++++++++++++++++++++++++++++++++++
milena/tests/topo/complex.cc | 14 ++++
3 files changed, 155 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/topo/center_only_iter.hh
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 5097f23..5375a7d 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2008-10-04 Roland Levillain <roland(a)lrde.epita.fr>
+ Add a complex relative iterator iterating on its center only.
+
+ * mln/topo/center_only_iter.hh: New.
+ * tests/topo/complex.cc: Exercise this iterator.
+
+2008-10-04 Roland Levillain <roland(a)lrde.epita.fr>
+
Fix initialization and access to values in mln::complex_image.
* mln/core/image/complex_image.hh
diff --git a/milena/mln/topo/center_only_iter.hh b/milena/mln/topo/center_only_iter.hh
new file mode 100644
index 0000000..d55ffca
--- /dev/null
+++ b/milena/mln/topo/center_only_iter.hh
@@ -0,0 +1,134 @@
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_TOPO_CENTER_ONLY_ITER_HH
+# define MLN_TOPO_CENTER_ONLY_ITER_HH
+
+/// \file mln/topo/center_only_iter.hh
+///
+/// \brief Definition of a complex relative iterator iterating on its
+/// center (reference face) only.
+///
+/// \see mln/topo/centered_iter_adapter.hh
+
+# include <mln/topo/internal/complex_relative_iterator_base.hh>
+# include <mln/topo/face.hh>
+
+
+namespace mln
+{
+
+ namespace topo
+ {
+
+ // Forward declaration.
+ template <unsigned D> class face;
+
+
+ /*----------------------------.
+ | topo::center_only_iter<D>. |
+ `----------------------------*/
+
+ /** \brief Iterator on all the adjacent (n-1)-faces of the n-face
+ of an mln::complex<D>.
+
+ \arg \p D The dimension of the complex this iterator belongs to.
+
+ mln::topo::center_only_iter inherits from
+ mln::topo::internal::forward_complex_relative_iterator_base,
+ but it could inherit from
+ mln::topo::internal::backward_complex_relative_iterator_base
+ as well, since it always contains a single element, the
+ center/reference face (and the traversal order is
+ meaningless).
+
+ This iterator is essentially used to implement other iterators.
+ \see mln::topo::centered_iter_adapter
+ \see mln::complex_lower_window
+ \see mln::complex_higher_window
+ \see mln::complex_lower_higher_window */
+ template <unsigned D>
+ class center_only_iter
+ : public internal::forward_complex_relative_iterator_base< face<D>,
+ center_only_iter<D> >
+ {
+ private:
+ typedef center_only_iter<D> self_;
+ typedef internal::forward_complex_relative_iterator_base< face<D>,
+ self_ > super_;
+
+ public:
+ /// Construction.
+ /// \{
+ center_only_iter();
+ template <typename Fref>
+ center_only_iter(const Fref& f_ref);
+ /// \}
+
+ /// Compute the set of faces adjacent to the reference face.
+ void update_adj_faces_();
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ /*----------------------------.
+ | topo::center_only_iter<D>. |
+ `----------------------------*/
+
+ template <unsigned D>
+ inline
+ center_only_iter<D>::center_only_iter()
+ {
+ }
+
+ template <unsigned D>
+ template <typename Fref>
+ inline
+ center_only_iter<D>::center_only_iter(const Fref& f_ref)
+ : super_(f_ref)
+ {
+ }
+
+ template <unsigned D>
+ inline
+ void
+ center_only_iter<D>::update_adj_faces_()
+ {
+ mln_precondition(this->c_);
+ this->adj_faces_.clear();
+ this->adj_faces_.push_back(*this->c_);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::topo
+
+} // end of namespace mln
+
+#endif // ! MLN_TOPO_CENTER_ONLY_ITER_HH
diff --git a/milena/tests/topo/complex.cc b/milena/tests/topo/complex.cc
index 9e559de..92d0398 100644
--- a/milena/tests/topo/complex.cc
+++ b/milena/tests/topo/complex.cc
@@ -33,6 +33,7 @@
#include <iostream>
#include <mln/topo/complex.hh>
+#include <mln/topo/center_only_iter.hh>
using namespace mln;
@@ -324,6 +325,19 @@ int main()
face<D>'s.
-----------------------------------------------------------------
*/
+
+ /*------------------.
+ | Other iterators. |
+ `------------------*/
+
+ // For each face, iterate on itself. (This iterator is not
+ // interesting as-is, but is useful when combined with others,
+ // e.g. in topo::centered_iter_adapter).
+ topo::center_only_iter<D> center(fwd_f);
+ for_all(fwd_f)
+ for_all(center)
+ std::cout << " " << center << std::endl;
+ std::cout << std::endl;
}
--
1.6.0.1
1
0
04 Oct '08
* mln/core/image/complex_image.hh
(mln::complex_image<D, P, V>::face_values): Rename as...
(mln::complex_image<D, P, V>::values): ...this.
Fix access to the array of values.
(mln::complex_image<D, P, V>::complex_image(const p_complex<D, P>&)):
Initialize faces of all dimensions, including D.
(mln::init_): Likewise.
Fix the use of values from model.
---
milena/ChangeLog | 13 +++++++++++++
milena/mln/core/image/complex_image.hh | 12 ++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 1b2d085..5097f23 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,18 @@
2008-10-04 Roland Levillain <roland(a)lrde.epita.fr>
+ Fix initialization and access to values in mln::complex_image.
+
+ * mln/core/image/complex_image.hh
+ (mln::complex_image<D, P, V>::face_values): Rename as...
+ (mln::complex_image<D, P, V>::values): ...this.
+ Fix access to the array of values.
+ (mln::complex_image<D, P, V>::complex_image(const p_complex<D, P>&)):
+ Initialize faces of all dimensions, including D.
+ (mln::init_): Likewise.
+ Fix the use of values from model.
+
+2008-10-04 Roland Levillain <roland(a)lrde.epita.fr>
+
Remove a warning about not used arguments in mln::fill_dispatch.
* mln/extension/fill.hh
diff --git a/milena/mln/core/image/complex_image.hh b/milena/mln/core/image/complex_image.hh
index a9cea01..add88e9 100644
--- a/milena/mln/core/image/complex_image.hh
+++ b/milena/mln/core/image/complex_image.hh
@@ -154,7 +154,7 @@ namespace mln
const p_complex<D, P>& domain() const;
/// Return the array of values associated to the faces.
- const metal::vec<D + 1, std::vector<V> >& face_values() const;
+ const metal::vec<D + 1, std::vector<V> >& values() const;
/// \}
};
@@ -178,8 +178,8 @@ namespace mln
const complex_image<D, P, W>& model)
{
metal::vec<D + 1, std::vector<V> > values;
- for (unsigned i = 0; i < D; ++i)
- values[i].resize(model.values[i].size());
+ for (unsigned i = 0; i <= D; ++i)
+ values[i].resize(model.values()[i].size());
target.init_(model.domain(), values);
}
@@ -222,7 +222,7 @@ namespace mln
complex_image<D, P, V>::complex_image(const p_complex<D, P>& pc)
{
metal::vec<D + 1, std::vector<V> > values;
- for (unsigned i = 0; i < D; ++i)
+ for (unsigned i = 0; i <= D; ++i)
values[i].resize(pc.cplx().nfaces(i));
init_(pc, values);
}
@@ -272,9 +272,9 @@ namespace mln
template <unsigned D, typename P, typename V>
inline
const metal::vec< D + 1, std::vector<V> >&
- complex_image<D, P, V>::face_values() const
+ complex_image<D, P, V>::values() const
{
- return this->data_->val_;
+ return this->data_->values_;
}
template <unsigned D, typename P, typename V>
--
1.6.0.1
1
0
2509: Remove a warning about not used arguments in mln::fill_dispatch.
by Roland Levillain 04 Oct '08
by Roland Levillain 04 Oct '08
04 Oct '08
* mln/extension/fill.hh
(mln::fill_dispatch(none, any, I&, const mln_value(I)&)): Here.
---
milena/ChangeLog | 7 +++++++
milena/mln/extension/fill.hh | 2 +-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 1775284..1b2d085 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,12 @@
2008-10-04 Roland Levillain <roland(a)lrde.epita.fr>
+ Remove a warning about not used arguments in mln::fill_dispatch.
+
+ * mln/extension/fill.hh
+ (mln::fill_dispatch(none, any, I&, const mln_value(I)&)): Here.
+
+2008-10-04 Roland Levillain <roland(a)lrde.epita.fr>
+
* mln/core/window.hh: Fix a closing-namespace comment.
2008-10-04 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
diff --git a/milena/mln/extension/fill.hh b/milena/mln/extension/fill.hh
index 0259c5c..54b0619 100644
--- a/milena/mln/extension/fill.hh
+++ b/milena/mln/extension/fill.hh
@@ -129,7 +129,7 @@ namespace mln
template <typename I>
void fill_dispatch(mln::trait::image::ext_domain::none,
mln::trait::image::ext_io::any,
- I& ima, const mln_value(I)& val)
+ I& /* ima */, const mln_value(I)& /* val */)
{
// No-op cause no extension domain, no border.
}
--
1.6.0.1
1
0
04 Oct '08
---
milena/ChangeLog | 4 ++++
milena/mln/core/window.hh | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4ff6cb2..1775284 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,7 @@
+2008-10-04 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * mln/core/window.hh: Fix a closing-namespace comment.
+
2008-10-04 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Replace the inplace routine by the rw method.
diff --git a/milena/mln/core/window.hh b/milena/mln/core/window.hh
index b24cfcb..9689983 100644
--- a/milena/mln/core/window.hh
+++ b/milena/mln/core/window.hh
@@ -73,7 +73,7 @@ namespace mln
typedef trait::window::definition::unique definition;
};
- } // end of namespace trait
+ } // end of namespace mln::trait
--
1.6.0.1
1
0
* mln/core/image/complex_lower_neighborhood.hh,
* mln/core/image/complex_higher_neighborhood.hh,
* mln/core/image/complex_lower_higher_neighborhood.hh:
Do it.
---
milena/ChangeLog | 9 +++++++++
.../mln/core/image/complex_higher_neighborhood.hh | 6 +++---
.../image/complex_lower_higher_neighborhood.hh | 6 +++---
.../mln/core/image/complex_lower_neighborhood.hh | 6 +++---
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 2eaf357..4ff6cb2 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -144,6 +144,15 @@
2008-10-03 Roland Levillain <roland(a)lrde.epita.fr>
+ Fix header guards of complex neighborhoods.
+
+ * mln/core/image/complex_lower_neighborhood.hh,
+ * mln/core/image/complex_higher_neighborhood.hh,
+ * mln/core/image/complex_lower_higher_neighborhood.hh:
+ Do it.
+
+2008-10-03 Roland Levillain <roland(a)lrde.epita.fr>
+
Exercise neighborhood and piters on lower+higher-dim. adjacent faces.
* tests/core/image/complex_image.cc: Here.
diff --git a/milena/mln/core/image/complex_higher_neighborhood.hh b/milena/mln/core/image/complex_higher_neighborhood.hh
index 3b56d68..ed26932 100644
--- a/milena/mln/core/image/complex_higher_neighborhood.hh
+++ b/milena/mln/core/image/complex_higher_neighborhood.hh
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_COMPLEX_HIGHER_NEIGHBORHOOD_HH
-# define MLN_CORE_COMPLEX_HIGHER_NEIGHBORHOOD_HH
+#ifndef MLN_CORE_IMAGE_COMPLEX_HIGHER_NEIGHBORHOOD_HH
+# define MLN_CORE_IMAGE_COMPLEX_HIGHER_NEIGHBORHOOD_HH
/// \file mln/core/complex_higher_neighborhood.hh
/// \brief A neighborhood centered on a n-face of complex returning its
@@ -116,4 +116,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_CORE_COMPLEX_HIGHER_NEIGHBORHOOD_HH
+#endif // ! MLN_CORE_IMAGE_COMPLEX_HIGHER_NEIGHBORHOOD_HH
diff --git a/milena/mln/core/image/complex_lower_higher_neighborhood.hh b/milena/mln/core/image/complex_lower_higher_neighborhood.hh
index 3780709..9127442 100644
--- a/milena/mln/core/image/complex_lower_higher_neighborhood.hh
+++ b/milena/mln/core/image/complex_lower_higher_neighborhood.hh
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_COMPLEX_LOWER_HIGHER_NEIGHBORHOOD_HH
-# define MLN_CORE_COMPLEX_LOWER_HIGHER_NEIGHBORHOOD_HH
+#ifndef MLN_CORE_IMAGE_COMPLEX_LOWER_HIGHER_NEIGHBORHOOD_HH
+# define MLN_CORE_IMAGE_COMPLEX_LOWER_HIGHER_NEIGHBORHOOD_HH
/// \file mln/core/complex_lower_higher_neighborhood.hh
/// \brief A neighborhood centered on a n-face of complex returning its
@@ -118,4 +118,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_CORE_COMPLEX_LOWER_HIGHER_NEIGHBORHOOD_HH
+#endif // ! MLN_CORE_IMAGE_COMPLEX_LOWER_HIGHER_NEIGHBORHOOD_HH
diff --git a/milena/mln/core/image/complex_lower_neighborhood.hh b/milena/mln/core/image/complex_lower_neighborhood.hh
index 6c21acc..c02b8b8 100644
--- a/milena/mln/core/image/complex_lower_neighborhood.hh
+++ b/milena/mln/core/image/complex_lower_neighborhood.hh
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_COMPLEX_LOWER_NEIGHBORHOOD_HH
-# define MLN_CORE_COMPLEX_LOWER_NEIGHBORHOOD_HH
+#ifndef MLN_CORE_IMAGE_COMPLEX_LOWER_NEIGHBORHOOD_HH
+# define MLN_CORE_IMAGE_COMPLEX_LOWER_NEIGHBORHOOD_HH
/// \file mln/core/complex_lower_neighborhood.hh
/// \brief A neighborhood centered on a n-face of complex returning its
@@ -116,4 +116,4 @@ namespace mln
} // end of namespace mln
-#endif // ! MLN_CORE_COMPLEX_LOWER_NEIGHBORHOOD_HH
+#endif // ! MLN_CORE_IMAGE_COMPLEX_LOWER_NEIGHBORHOOD_HH
--
1.6.0.1
1
0
04 Oct '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Replace the inplace routine by the rw method.
Get rid of the old inplace/instant files.
* sandbox/geraud/dead: New directory.
* mln/core/image/instant.hh: Move...
* sandbox/geraud/dead/instant.hh: ...here.
* mln/core/image/inplace.hh: Move...
* sandbox/geraud/dead/inplace.hh: ...here.
Add the rw method to do the job.
* mln/core/internal/image_morpher.hh (rw): New.
Update other files.
* tools/seed2tiling.cc,
* tests/core/site_set/p_image.cc,
* tests/core/image/sub_image.cc,
* tests/draw/line.cc,
* tests/level/memcpy_.cc,
* tests/convert/to_p_set.cc,
* tests/convert/to_window.cc,
* tests/display/show.cc,
* tests/display/save_and_show.cc,
* tests/display/color_pretty.cc,
* tests/canvas/chamfer.cc,
* doc/oldies/2008__tour1.cc,
* doc/oldies/2008__tour3.cc,
* doc/tutorial/examples/sub_image.cc,
* doc/tutorial/examples/p_line2d.cc,
* doc/tutorial/examples/for_Z.cc,
* doc/examples/tuto_bis.cc,
* mln/core/image/status.txt,
* mln/core/image/all.hh,
* mln/core/image/hexa_piter.hh,
* mln/core/image/sub_image.hh,
* mln/level/fill_with_image.hh,
* mln/level/paste.spe.hh,
* mln/level/replace.hh,
* mln/level/paste.hh,
* mln/level/fill_with_value.hh,
* mln/accu/rank.hh,
* mln/accu/rank_high_quant.hh,
* mln/accu/rank_bool.hh,
* mln/geom/chamfer.hh,
* sandbox/duhamel/slow_seed2tiling.cc,
* sandbox/duhamel/color_sub.cc,
* sandbox/duhamel/chamfer.cc,
* sandbox/duhamel/chamfer.hh,
* sandbox/geraud/fllt.svg.6.cc,
* sandbox/geraud/cs2d/tuto.cc,
* sandbox/geraud/fllt/fllt_tree_to_image.hh,
* sandbox/geraud/fllt/fllt.svg.3.cc,
* sandbox/geraud/fllt/fllt.svg.4.cc,
* sandbox/geraud/fllt/fllt.svg.5.cc,
* sandbox/geraud/fllt/fllt.svg.6.cc,
* sandbox/geraud/fllt/fllt_test.hh,
* sandbox/geraud/Rd/debase.union_find.hh,
* sandbox/vigouroux/yuv/get_blue.hh,
* sandbox/vigouroux/yuv/get_red.hh,
* sandbox/vigouroux/yuv/rgb_to_yuv.hh,
* sandbox/vigouroux/yuv/get_green.hh,
* sandbox/vigouroux/hsi/get_blue.hh,
* sandbox/vigouroux/hsi/get_red.hh,
* sandbox/vigouroux/hsi/rgb_to_hsi.hh,
* sandbox/vigouroux/hsi/get_green.hh,
* sandbox/vigouroux/function.hh,
* sandbox/vigouroux/tests.cc,
* sandbox/vigouroux/cmy/rgb_to_cmy.hh,
* sandbox/vigouroux/cmy/get_blue.hh,
* sandbox/vigouroux/cmy/fun.hh,
* sandbox/vigouroux/cmy/get_green.hh,
* sandbox/vigouroux/xyz/rgb_to_xyz.hh,
* sandbox/vigouroux/xyz/get_blue.hh,
* sandbox/vigouroux/xyz/get_red.hh,
* sandbox/vigouroux/xyz/get_green.hh,
* sandbox/vigouroux/yiq/get_blue.hh,
* sandbox/vigouroux/yiq/get_red.hh,
* sandbox/vigouroux/yiq/rgb_to_yiq.hh,
* sandbox/vigouroux/yiq/get_green.hh,
* sandbox/vigouroux/conv/getred.hh,
* sandbox/vigouroux/conv/tored.hh,
* sandbox/vigouroux/conv/torgb.hh,
* sandbox/vigouroux/conv/rgbto.hh,
* sandbox/vigouroux/color/rgb_to_hsl.hh,
* sandbox/vigouroux/color/rgb_to_cmy.hh,
* sandbox/vigouroux/color/rgb_to_xyz.hh,
* sandbox/vigouroux/color/tests.cc,
* sandbox/vigouroux/color/rgb_to_hsv.hh,
* sandbox/vigouroux/color/rgb_to_yiq.hh,
* sandbox/vigouroux/color/rgb_to_hsi.hh,
* sandbox/vigouroux/color/rgb_to_yuv.hh,
* sandbox/garrigues/level_set.hh,
* sandbox/garrigues/fllt/fllt_simple.svg.1.cc,
* sandbox/garrigues/fllt/fllt_simple.svg.3.cc,
* sandbox/garrigues/fllt/fllt_simple.cc,
* sandbox/garrigues/fllt/compute_level_set_fast2.hh,
* sandbox/garrigues/fllt/debug.hh,
* sandbox/garrigues/fllt/compute_level_set_fast.hh,
* sandbox/garrigues/fllt/fllt_simple.svg.2.cc,
* sandbox/garrigues/fllt/fllt.hh,
* sandbox/garrigues/fllt/compute_level_set.hh,
* sandbox/garrigues/tiled_image2d/tiled_image2d.hh,
* sandbox/garrigues/factures/extract_array_highlight.cc,
* sandbox/garrigues/factures/extract_array.cc,
* sandbox/ballas/test.cc: Update.
doc/examples/tuto_bis.cc | 2 -
doc/oldies/2008__tour1.cc | 21 ++++++------
doc/oldies/2008__tour3.cc | 7 ++--
doc/tutorial/examples/for_Z.cc | 2 -
doc/tutorial/examples/p_line2d.cc | 13 -------
doc/tutorial/examples/sub_image.cc | 7 ----
mln/accu/rank.hh | 2 -
mln/accu/rank_bool.hh | 2 -
mln/accu/rank_high_quant.hh | 5 +-
mln/core/image/all.hh | 1
mln/core/image/hexa_piter.hh | 2 -
mln/core/image/status.txt | 3 -
mln/core/image/sub_image.hh | 31 +-----------------
mln/core/internal/image_morpher.hh | 21 ++++++++++++
mln/geom/chamfer.hh | 8 ++--
mln/level/fill_with_image.hh | 2 -
mln/level/fill_with_value.hh | 18 +---------
mln/level/paste.hh | 2 -
mln/level/paste.spe.hh | 5 ++
mln/level/replace.hh | 2 -
sandbox/ballas/test.cc | 26 +++++++--------
sandbox/duhamel/chamfer.cc | 2 -
sandbox/duhamel/chamfer.hh | 4 +-
sandbox/duhamel/color_sub.cc | 8 ++--
sandbox/duhamel/slow_seed2tiling.cc | 2 -
sandbox/garrigues/factures/extract_array.cc | 6 +--
sandbox/garrigues/factures/extract_array_highlight.cc | 4 +-
sandbox/garrigues/fllt/compute_level_set.hh | 2 -
sandbox/garrigues/fllt/compute_level_set_fast.hh | 2 -
sandbox/garrigues/fllt/compute_level_set_fast2.hh | 2 -
sandbox/garrigues/fllt/debug.hh | 6 +--
sandbox/garrigues/fllt/fllt.hh | 2 -
sandbox/garrigues/fllt/fllt_simple.cc | 2 -
sandbox/garrigues/fllt/fllt_simple.svg.1.cc | 2 -
sandbox/garrigues/fllt/fllt_simple.svg.2.cc | 2 -
sandbox/garrigues/fllt/fllt_simple.svg.3.cc | 2 -
sandbox/garrigues/level_set.hh | 2 -
sandbox/garrigues/tiled_image2d/tiled_image2d.hh | 2 -
sandbox/geraud/Rd/debase.union_find.hh | 6 +--
sandbox/geraud/cs2d/tuto.cc | 8 ++--
sandbox/geraud/fllt.svg.6.cc | 4 +-
sandbox/geraud/fllt/fllt.svg.3.cc | 2 -
sandbox/geraud/fllt/fllt.svg.4.cc | 6 +--
sandbox/geraud/fllt/fllt.svg.5.cc | 6 +--
sandbox/geraud/fllt/fllt.svg.6.cc | 4 +-
sandbox/geraud/fllt/fllt_test.hh | 2 -
sandbox/geraud/fllt/fllt_tree_to_image.hh | 2 -
sandbox/vigouroux/cmy/fun.hh | 2 -
sandbox/vigouroux/cmy/get_blue.hh | 2 -
sandbox/vigouroux/cmy/get_green.hh | 2 -
sandbox/vigouroux/cmy/rgb_to_cmy.hh | 2 -
sandbox/vigouroux/color/rgb_to_cmy.hh | 2 -
sandbox/vigouroux/color/rgb_to_hsi.hh | 2 -
sandbox/vigouroux/color/rgb_to_hsl.hh | 2 -
sandbox/vigouroux/color/rgb_to_hsv.hh | 2 -
sandbox/vigouroux/color/rgb_to_xyz.hh | 2 -
sandbox/vigouroux/color/rgb_to_yiq.hh | 2 -
sandbox/vigouroux/color/rgb_to_yuv.hh | 2 -
sandbox/vigouroux/color/tests.cc | 2 -
sandbox/vigouroux/conv/getred.hh | 2 -
sandbox/vigouroux/conv/rgbto.hh | 2 -
sandbox/vigouroux/conv/tored.hh | 2 -
sandbox/vigouroux/conv/torgb.hh | 2 -
sandbox/vigouroux/function.hh | 2 -
sandbox/vigouroux/hsi/get_blue.hh | 2 -
sandbox/vigouroux/hsi/get_green.hh | 2 -
sandbox/vigouroux/hsi/get_red.hh | 2 -
sandbox/vigouroux/hsi/rgb_to_hsi.hh | 2 -
sandbox/vigouroux/tests.cc | 2 -
sandbox/vigouroux/xyz/get_blue.hh | 2 -
sandbox/vigouroux/xyz/get_green.hh | 2 -
sandbox/vigouroux/xyz/get_red.hh | 2 -
sandbox/vigouroux/xyz/rgb_to_xyz.hh | 2 -
sandbox/vigouroux/yiq/get_blue.hh | 2 -
sandbox/vigouroux/yiq/get_green.hh | 2 -
sandbox/vigouroux/yiq/get_red.hh | 2 -
sandbox/vigouroux/yiq/rgb_to_yiq.hh | 2 -
sandbox/vigouroux/yuv/get_blue.hh | 2 -
sandbox/vigouroux/yuv/get_green.hh | 2 -
sandbox/vigouroux/yuv/get_red.hh | 2 -
sandbox/vigouroux/yuv/rgb_to_yuv.hh | 2 -
tests/canvas/chamfer.cc | 2 -
tests/convert/to_p_set.cc | 6 +--
tests/convert/to_window.cc | 4 +-
tests/core/image/sub_image.cc | 8 ++--
tests/core/site_set/p_image.cc | 2 -
tests/display/color_pretty.cc | 6 +--
tests/display/save_and_show.cc | 4 +-
tests/display/show.cc | 4 +-
tests/draw/line.cc | 6 +--
tests/level/memcpy_.cc | 7 ++--
tools/seed2tiling.cc | 2 -
92 files changed, 182 insertions(+), 211 deletions(-)
Index: tools/seed2tiling.cc
--- tools/seed2tiling.cc (revision 2505)
+++ tools/seed2tiling.cc (working copy)
@@ -49,7 +49,7 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/image/sub_image.hh>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/make/win_chamfer.hh>
Index: tests/core/site_set/p_image.cc
--- tests/core/site_set/p_image.cc (revision 2505)
+++ tests/core/site_set/p_image.cc (working copy)
@@ -54,7 +54,7 @@
mln_assertion(ps.nsites() == 0);
mln_assertion(ps.is_empty());
- mln_fwd_piter_(box2d) p(inplace(make::box2d(13,13,19,15)));
+ mln_fwd_piter_(box2d) p(make::box2d(13,13,19,15));
for_all(p)
{
ps.insert(p);
Index: tests/core/image/sub_image.cc
--- tests/core/image/sub_image.cc (revision 2505)
+++ tests/core/image/sub_image.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -32,7 +32,7 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/image/sub_image.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/level/fill.hh>
#include <mln/debug/println.hh>
@@ -46,8 +46,8 @@
level::fill(ima, 0);
debug::println(ima);
- level::fill(inplace(ima | make::box2d(1,1, 3,3)), 5);
- level::fill(inplace(ima | make::box2d(4,4, 6,6)), 1);
+ level::fill((ima | make::box2d(1,1, 3,3)).rw(), 5);
+ level::fill((ima | make::box2d(4,4, 6,6)).rw(), 1);
debug::println(ima);
}
Index: tests/draw/line.cc
--- tests/draw/line.cc (revision 2505)
+++ tests/draw/line.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -34,7 +34,7 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/image/sub_image.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/level/fill.hh>
#include <mln/level/compare.hh>
@@ -62,7 +62,7 @@
image2d<bool> ima3(10,10);
level::fill(ima3, false);
- level::fill(inplace(ima3 | l), true);
+ level::fill((ima3 | l).rw(), true);
mln_assertion(ima3 == ima);
}
Index: tests/level/memcpy_.cc
--- tests/level/memcpy_.cc (revision 2505)
+++ tests/level/memcpy_.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -33,7 +33,7 @@
*/
#include <mln/core/image/image2d.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/debug/iota.hh>
#include <mln/level/memcpy_.hh>
@@ -50,7 +50,8 @@
src = point2d(0, 2),
dest = point2d(1, 2);
- level::memcpy_(inplace(make::pixel(ima, dest)),
+ pixel<I> pix = make::pixel(ima, dest);
+ level::memcpy_(pix,
make::pixel(ima, src),
2 + 2 * ima.border());
Index: tests/convert/to_p_set.cc
--- tests/convert/to_p_set.cc (revision 2505)
+++ tests/convert/to_p_set.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007. 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -36,7 +36,7 @@
#include <mln/core/alias/window2d.hh>
#include <mln/core/alias/box2d.hh>
#include <mln/core/alias/neighb2d.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/level/fill.hh>
@@ -75,7 +75,7 @@
// Image :
image2d<bool> ima(make::box2d(-6, -6, 6, 6));
level::fill(ima, false);
- level::fill(inplace(ima | ref), true);
+ level::fill((ima | ref).rw(), true);
p_set<point2d> test_ima = convert::to_p_set(ima);
test(ref, test_ima);
Index: tests/convert/to_window.cc
--- tests/convert/to_window.cc (revision 2505)
+++ tests/convert/to_window.cc (working copy)
@@ -36,7 +36,7 @@
#include <mln/core/alias/window2d.hh>
#include <mln/core/alias/box2d.hh>
#include <mln/core/alias/neighb2d.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/level/fill.hh>
@@ -77,7 +77,7 @@
// Image :
image2d<bool> ima(make::box2d(-6, -6, 6, 6));
level::fill(ima, false);
- level::fill(inplace(ima | convert::to_p_set(ref)), true);
+ level::fill((ima | convert::to_p_set(ref)).rw(), true);
window2d test_ima = convert::to_window(ima);
test(ref, test_ima);
Index: tests/display/show.cc
--- tests/display/show.cc (revision 2505)
+++ tests/display/show.cc (working copy)
@@ -37,7 +37,7 @@
#include <mln/value/rgb8.hh>
#include <mln/core/image/sub_image.hh>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/display/save.hh>
@@ -69,7 +69,7 @@
// Call color_pretty for sub_image.
for (unsigned i = 2; i < 6; i += 2)
{
- image_if_value<image2d<unsigned> > t = inplace (tmp | i);
+ image_if_value<image2d<unsigned> > t = tmp | i;
display::save (t);
display::show (t, "display", 1);
}
Index: tests/display/save_and_show.cc
--- tests/display/save_and_show.cc (revision 2505)
+++ tests/display/save_and_show.cc (working copy)
@@ -37,7 +37,7 @@
#include <mln/value/rgb8.hh>
#include <mln/core/image/sub_image.hh>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
@@ -67,7 +67,7 @@
// Call color_pretty for sub_image.
for (unsigned i = 2; i < 6; i += 2)
{
- image_if_value<image2d<unsigned> > t = inplace (tmp | i);
+ image_if_value<image2d<unsigned> > t = tmp | i;
display::save_and_show (t, "display", 1);
}
Index: tests/display/color_pretty.cc
--- tests/display/color_pretty.cc (revision 2505)
+++ tests/display/color_pretty.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -35,7 +35,7 @@
# include <mln/level/fill.hh>
# include <mln/core/site_set/p_set.hh>
# include <mln/core/image/sub_image.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/value/rgb8.hh>
# include <mln/display/color_pretty.hh>
# include <mln/level/compare.hh>
@@ -55,7 +55,7 @@
s.insert(point2d(0, 0));
s.insert(point2d(1, 1));
- sub_image<image2d<int_u8>, p_set<point2d > > input = inplace(ima | s);
+ sub_image<image2d<int_u8>, p_set<point2d > > input = ima | s;
image2d<value::rgb8> out = display::color_pretty(input);
value::rgb8 vs[2][2] = {
Index: tests/canvas/chamfer.cc
--- tests/canvas/chamfer.cc (revision 2505)
+++ tests/canvas/chamfer.cc (working copy)
@@ -32,7 +32,7 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/image/sub_image.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/level/fill.hh>
#include <mln/debug/println.hh>
Index: doc/oldies/2008__tour1.cc
--- doc/oldies/2008__tour1.cc (revision 2505)
+++ doc/oldies/2008__tour1.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2001, 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2007, 2008 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
@@ -165,7 +166,7 @@
// Memory has been allocated so data can be stored but pixel values
// have not been initialized yet. So we fill img3a, that is, all
// pixels of img3a, with the value 'a':
- level::fill(inplace(img3a), 'a');
+ level::fill(img3a, 'a');
// The "fill" algorithm is located in the sub-namespace "level"
// since this algorithm deals with the "level" of pixel values.
@@ -183,12 +184,14 @@
// Most algorithms in Olena are constructed following the classical
// scheme: "output algo(input)", where the input image is only read.
// However some few algorithms take an input image in order to
- // modify it. To enforce this particular feature, the user shall
- // explicitly state that the image is provided so that its data is
- // modified "inplace".
+ // modify it.
- // The algorithm call shall be "level::fill(inplace(ima), val)".
- // When forgetting the "inplace(..)" statement it does not compile.
+ // Obsolete: To enforce this particular feature, the user shall
+ // Obsolete: explicitly state that the image is provided so that its data is
+ // Obsolete: modified "inplace".
+
+ // Obsolete: The algorithm call shall be "level::fill(inplace(ima), val)".
+ // Obsolete: When forgetting the "inplace(..)" statement it does not compile.
// We then define below a second image to play with. As you can see
@@ -198,10 +201,10 @@
image1d<char> img3b(5, 14);
// We initialize the image values.
- level::fill(inplace(img3b), 'b');
+ level::fill(img3b, 'b');
// Last we now paste the contents of img3b in img3a...
- level::paste(img3b, inplace(img3a));
+ level::paste(img3b, img3a);
// ...and print the result.
debug::println(img3a);
Index: doc/oldies/2008__tour3.cc
--- doc/oldies/2008__tour3.cc (revision 2505)
+++ doc/oldies/2008__tour3.cc (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2001, 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2007, 2008 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
@@ -76,7 +77,7 @@
0, 1, 1 };
// ...the debug::fill routine allows for manually initializing
// image data:
- debug::fill(inplace(img), vals);
+ debug::fill(img, vals);
std::cout << "img = " << std::endl;
debug::println(img);
// img =
@@ -137,7 +138,7 @@
// And now for a little test: what is the result of this code?
{
image2d<int> test(ima.points());
- level::fill(inplace(test), ima);
+ level::fill(test, ima);
(test + c4).at(1, 1) = 9;
debug::println(test);
}
Index: doc/tutorial/examples/sub_image.cc
--- doc/tutorial/examples/sub_image.cc (revision 2505)
+++ doc/tutorial/examples/sub_image.cc (working copy)
@@ -22,13 +22,8 @@
debug::println(sub);
debug::println(morpho::gradient_elementary(sub, c4()));
- level::fill_with_value(ima | box2d(2,3), 0);
+ level::fill_with_value((ima | box2d(2,3)).rw(), 0);
debug::println(ima);
trait::image::print(sub);
-
-
- {
- instant_<I> tmp(ima);
- }
}
Index: doc/tutorial/examples/p_line2d.cc
--- doc/tutorial/examples/p_line2d.cc (revision 2505)
+++ doc/tutorial/examples/p_line2d.cc (working copy)
@@ -10,10 +10,6 @@
-# include <mln/core/image/instant.hh>
-
-
-
int main()
{
using namespace mln;
@@ -25,7 +21,7 @@
point2d(1,1));
std::cout << line << std::endl;
- level::fill(inplace(ima | line), 'x');
+ level::fill((ima | line).rw(), 'x');
debug::println(ima);
p_set<point2d> s;
@@ -35,11 +31,4 @@
debug::println(pw::cst('o') | line);
// ...
-
-
- {
- typedef image2d<char> I;
- instant_<I> ima_(ima);
- debug::println(ima_);
- }
}
Index: doc/tutorial/examples/for_Z.cc
--- doc/tutorial/examples/for_Z.cc (revision 2505)
+++ doc/tutorial/examples/for_Z.cc (working copy)
@@ -207,7 +207,7 @@
// image2d<rgb8> cool(ima.domain());
// level::fill(cool, literal::black);
-// level::fill( inplace(cool | (pw::value(lab) == 1u)),
+// level::fill( (cool | (pw::value(lab) == 1u)).rw(),
// literal::red );
// debug::println(cool);
Index: doc/examples/tuto_bis.cc
--- doc/examples/tuto_bis.cc (revision 2505)
+++ doc/examples/tuto_bis.cc (working copy)
@@ -227,7 +227,7 @@
- mln_VAR(edge, extend(inplace(ima | is_edge),
+ mln_VAR(edge, extend((ima | is_edge).rw(),
pw::value(ima)));
level::paste(morpho::gradient(edge, e2c), edge);
// ^^^
Index: mln/core/image/status.txt
--- mln/core/image/status.txt (revision 2505)
+++ mln/core/image/status.txt (working copy)
@@ -45,7 +45,7 @@
** domain morpher
ok image_if
-... sub_image = 1st attempt to use the 'instant' mechanism...
+ok sub_image
rm image_if_interval
rm image_if_value
@@ -56,7 +56,6 @@
** identity morpher
-new instant
new extension_ima
new extension_fun
new extension_val
Index: mln/core/image/all.hh
--- mln/core/image/all.hh (revision 2505)
+++ mln/core/image/all.hh (working copy)
@@ -36,7 +36,6 @@
*/
-# include <mln/core/image/instant.hh>
// FIXME: Complete...
Index: mln/core/image/hexa_piter.hh
--- mln/core/image/hexa_piter.hh (revision 2505)
+++ mln/core/image/hexa_piter.hh (working copy)
@@ -37,7 +37,7 @@
# include <mln/core/alias/box2d.hh>
# include <mln/core/alias/box2d_h.hh>
-# include <mln/core/image/inplace.hh>
+
namespace mln
{
Index: mln/core/image/sub_image.hh
--- mln/core/image/sub_image.hh (revision 2505)
+++ mln/core/image/sub_image.hh (working copy)
@@ -39,7 +39,7 @@
*/
# include <mln/core/internal/image_domain_morpher.hh>
-# include <mln/core/image/instant.hh>
+
namespace mln
@@ -129,27 +129,11 @@
operator|(const Image<I>& ima, const Site_Set<S>& pset);
-// template <typename I, typename S>
-// sub_image<I, S>
-// operator|(Image<I>& ima, const Site_Set<S>& pset);
-
-
-// REPLACEMENT:
-
template <typename I, typename S>
- instant_< sub_image<I, S> >
+ sub_image<I, S>
operator|(Image<I>& ima, const Site_Set<S>& pset);
-// NEW:
-
- template <typename I, typename S>
- sub_image<I, S>
- operator|(instant_<I> ima, const Site_Set<S>& pset)
- {
- return ima.un_instant() | pset;
- }
-
template <typename I, typename S, typename J>
void init_(tag::image_t, sub_image<I,S>& target, const J& model);
@@ -241,18 +225,9 @@
return tmp;
}
-// template <typename I, typename S>
-// inline
-// sub_image<I, S>
-// operator|(Image<I>& ima, const Site_Set<S>& pset)
-// {
-// sub_image<I, S> tmp(exact(ima), exact(pset));
-// return tmp;
-// }
-
template <typename I, typename S>
inline
- instant_< sub_image<I, S> >
+ sub_image<I, S>
operator|(Image<I>& ima, const Site_Set<S>& pset)
{
sub_image<I, S> tmp(exact(ima), exact(pset));
Index: mln/core/internal/image_morpher.hh
--- mln/core/internal/image_morpher.hh (revision 2505)
+++ mln/core/internal/image_morpher.hh (working copy)
@@ -31,11 +31,14 @@
/*! \file mln/core/internal/image_morpher.hh
*
* \brief Definition of a base class for image morphers.
+ *
+ * \todo Add the appropriate checks in .rw().
*/
# include <mln/core/internal/image_base.hh>
# include <mln/metal/const.hh>
# include <mln/metal/is_const.hh>
+# include <mln/metal/is_not_const.hh>
namespace mln
@@ -77,6 +80,12 @@
/// Conversion to the underlying (morphed) image.
operator I() const; // FIXME: Very dangerous? Remove?
+
+ /// State that the morpher is writable. This allows for C++ to
+ /// use it as a mutable object even if it is a temporary object.
+ E& rw();
+
+
protected:
image_morpher();
};
@@ -162,6 +171,18 @@
this->delegatee_()->has_data();
}
+ template <typename I, typename T, typename S, typename E>
+ inline
+ E&
+ image_morpher<I, T, S, E>::rw()
+ {
+ mlc_is_not_const(I)::check();
+ mlc_equal(mln_trait_image_value_io(I),
+ mln::trait::image::value_io::read_write)::check();
+ // FIXME Nicolas: pw_io == read_write OR vw_io == read_write...
+ return exact(*this);
+ }
+
} // end of namespace mln::internal
Index: mln/level/fill_with_image.hh
--- mln/level/fill_with_image.hh (revision 2505)
+++ mln/level/fill_with_image.hh (working copy)
@@ -36,7 +36,7 @@
*/
# include <mln/core/concept/image.hh>
-# include <mln/core/image/inplace.hh>
+
// Specializations are in:
# include <mln/level/fill_with_image.spe.hh>
Index: mln/level/paste.spe.hh
--- mln/level/paste.spe.hh (revision 2505)
+++ mln/level/paste.spe.hh (working copy)
@@ -73,9 +73,12 @@
// typename I::line_piter p(data.domain()); // FIXME: Alias mln_line_piter!
// // mln_line_piter(I) p(data.domain());
// for_all(p)
-// memcpy_(inplace(make::pixel(destination, p)),
+// {
+// FIXME: TYPE pix = make::pixel(destination, p);
+// memcpy_(pix,
// make::pixel(data, p),
// n);
+// }
// trace::exiting("level::impl::paste_lines_");
// }
Index: mln/level/replace.hh
--- mln/level/replace.hh (revision 2505)
+++ mln/level/replace.hh (working copy)
@@ -72,7 +72,7 @@
const mln_value(I)& new_value)
{
trace::entering("level::impl::generic::replace");
- level::fill(inplace(exact(input_) | pw::value(input_) == pw::cst(old_value)), new_value);
+ level::fill((exact(input_) | pw::value(input_) == pw::cst(old_value)).rw(), new_value);
trace::exiting("level::impl::generic::replace");
}
Index: mln/level/paste.hh
--- mln/level/paste.hh (revision 2505)
+++ mln/level/paste.hh (working copy)
@@ -35,7 +35,7 @@
*/
# include <mln/core/concept/image.hh>
-# include <mln/core/image/inplace.hh>
+
// Specializations are in:
Index: mln/level/fill_with_value.hh
--- mln/level/fill_with_value.hh (revision 2505)
+++ mln/level/fill_with_value.hh (working copy)
@@ -44,8 +44,8 @@
# include <cstdlib>
# include <mln/core/concept/image.hh>
-# include <mln/core/image/inplace.hh>
-# include <mln/core/image/instant.hh>
+
+
// Specializations are in:
# include <mln/level/fill_with_value.spe.hh>
@@ -68,11 +68,6 @@
void fill_with_value(Image<I>& ima, const V& val);
- // Case of instant images.
- template <typename I, typename V>
- void fill_with_value(const Image< instant_<I> >& ima, const V& val);
-
-
# ifndef MLN_INCLUDE_ONLY
@@ -138,15 +133,6 @@
}
- // Un-instant.
-
- template <typename I, typename V>
- void fill_with_value(const Image< instant_<I> >& ima, const V& val)
- {
- fill_with_value(exact(ima).un_instant_(), val);
- }
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::level
Index: mln/accu/rank.hh
--- mln/accu/rank.hh (revision 2505)
+++ mln/accu/rank.hh (working copy)
@@ -39,7 +39,7 @@
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/trait/value_.hh>
# include <mln/util/pix.hh>
-# include <mln/core/image/inplace.hh>
+
namespace mln
{
Index: mln/accu/rank_high_quant.hh
--- mln/accu/rank_high_quant.hh (revision 2505)
+++ mln/accu/rank_high_quant.hh (working copy)
@@ -38,7 +38,7 @@
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/trait/value_.hh>
# include <mln/util/pix.hh>
-# include <mln/core/image/inplace.hh>
+
namespace mln
{
@@ -149,8 +149,7 @@
T
rank_<T>::to_result() const
{
- // Fixme : Call to inplace to unconst (*this).
- inplace(*this).sort();
+ const_cast<rank_<T>&>(*this).sort();
if (n_ == elts_.size())
return elts_[k_];
Index: mln/accu/rank_bool.hh
--- mln/accu/rank_bool.hh (revision 2505)
+++ mln/accu/rank_bool.hh (working copy)
@@ -38,7 +38,7 @@
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/trait/value_.hh>
# include <mln/util/pix.hh>
-# include <mln/core/image/inplace.hh>
+
namespace mln
{
Index: mln/geom/chamfer.hh
--- mln/geom/chamfer.hh (revision 2505)
+++ mln/geom/chamfer.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -37,7 +37,7 @@
# include <mln/core/alias/w_window2d_int.hh>
# include <mln/core/alias/w_window2d_float.hh>
# include <mln/core/image/sub_image.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/core/image/image_if.hh>
# include <mln/canvas/chamfer.hh>
@@ -83,8 +83,8 @@
inline
void init() { initialize(output, exact(input));
- level::fill(inplace(output | (input | pw::cst(true)).domain()), 0);
- level::fill(inplace(output | (input | pw::cst(false)).domain()), max); }
+ level::fill((output | (input | pw::cst(true)).domain()).rw(), 0);
+ level::fill((output | (input | pw::cst(false)).domain()).rw(), max); }
inline
bool handles(const P& p) const { return input(p) == false; }
Index: sandbox/duhamel/slow_seed2tiling.cc
--- sandbox/duhamel/slow_seed2tiling.cc (revision 2505)
+++ sandbox/duhamel/slow_seed2tiling.cc (working copy)
@@ -50,7 +50,7 @@
#include <mln/core/image/image2d.hh>
#include <mln/core/image/sub_image.hh>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/make/win_chamfer.hh>
Index: sandbox/duhamel/color_sub.cc
--- sandbox/duhamel/color_sub.cc (revision 2505)
+++ sandbox/duhamel/color_sub.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -32,7 +32,7 @@
# include <mln/core/image2d_b.hh>
# include <mln/core/image/sub_image.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/value/int_u8.hh>
# include <mln/value/rgb8.hh>
# include <mln/level/fill.hh>
@@ -43,7 +43,7 @@
# include <mln/core/image_if_value.hh>
# include <mln/core/image/sub_image.hh>
# include <mln/core/image_if_value.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/debug/println.hh>
# include <mln/core/alias/w_window2d_int.hh>
@@ -64,7 +64,7 @@
image2d_b<bool> input = io::pbm::load("../../img/toto.pbm");
const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 0> ();
image2d_b<unsigned> tmp = geom::chamfer(input, w_win, max);
- image2d_b<value::rgb8> out = display::color_pretty(inplace (tmp | 4));
+ image2d_b<value::rgb8> out = display::color_pretty(tmp | 4);
io::ppm::save(out, "out.ppm");
std::cout << "out.ppm generate" << std::endl;
}
Index: sandbox/duhamel/chamfer.cc
--- sandbox/duhamel/chamfer.cc (revision 2505)
+++ sandbox/duhamel/chamfer.cc (working copy)
@@ -1,7 +1,7 @@
#include <mln/core/image2d_b.hh>
#include <mln/core/image/sub_image.hh>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/level/fill.hh>
# include <mln/debug/println.hh>
Index: sandbox/duhamel/chamfer.hh
--- sandbox/duhamel/chamfer.hh (revision 2505)
+++ sandbox/duhamel/chamfer.hh (working copy)
@@ -76,8 +76,8 @@
unsigned max;
void init() { initialize(output, exact(input));
- level::fill(inplace(output | (input | true).domain()), 0);
- level::fill(inplace(output | (input | false).domain()), max); }
+ level::fill((output | (input | true).domain()).rw(), 0);
+ level::fill((output | (input | false).domain()).rw(), max); }
bool handles(const P& p) const { return input(p) == false; }
// end of requirements
Index: sandbox/geraud/fllt.svg.6.cc
--- sandbox/geraud/fllt.svg.6.cc (revision 2505)
+++ sandbox/geraud/fllt.svg.6.cc (working copy)
@@ -1003,7 +1003,7 @@
fllt_tree(P, V) subtree(node);
fllt_branch_iter_ind(P, V) s(fllt_branch(P, V)(subtree, *node));
for_all(s)
- level::fill(inplace(output | (*s).elt().points), (*s).elt().value);
+ level::fill(output | (*s).elt().points), (*s).elt().value);
}
void area_filter(image2d<value::int_u8>& output,
@@ -1037,7 +1037,7 @@
}
accu += (*node).elt().nsites;
- level::fill(inplace(output | (*node).elt().points), g);
+ level::fill(output | (*node).elt().points), g);
for (int i = 0; i < node->children().size();i++)
area_filter_min(output, node->children()[i], min_area, g, accu);
Index: sandbox/geraud/cs2d/tuto.cc
--- sandbox/geraud/cs2d/tuto.cc (revision 2505)
+++ sandbox/geraud/cs2d/tuto.cc (working copy)
@@ -66,9 +66,9 @@
//
// o o o
- level::fill(inplace(ima | is_cell), 'c');
- level::fill(inplace(ima | is_edge), 'e');
- level::fill(inplace(ima | is_point), 'p');
+ level::fill((ima | is_cell).rw(), 'c');
+ level::fill((ima | is_edge).rw(), 'e');
+ level::fill((ima | is_point).rw(), 'p');
debug::println(ima);
// c e c e c
@@ -85,7 +85,7 @@
// 0 0 0 0 0
// 0 0 0 0 0
- level::fill(inplace(ima | is_cell), fun::p2v::iota);
+ level::fill((ima | is_cell).rw(), fun::p2v::iota);
debug::println(ima | is_cell);
// 1 2 3
//
Index: sandbox/geraud/fllt/fllt_tree_to_image.hh
--- sandbox/geraud/fllt/fllt_tree_to_image.hh (revision 2505)
+++ sandbox/geraud/fllt/fllt_tree_to_image.hh (working copy)
@@ -9,7 +9,7 @@
void fllt_tree_to_image_(I& output,
fllt_node(point2d, value::int_u8)* node)
{
- level::fill(inplace(output | node->elt().points), node->elt().value);
+ level::fill((output | node->elt().points).rw(), node->elt().value);
for (int i = 0; i < node->children().size(); i++)
fllt_tree_to_image_(output, node->children()[i]);
Index: sandbox/geraud/fllt/fllt.svg.3.cc
--- sandbox/geraud/fllt/fllt.svg.3.cc (revision 2505)
+++ sandbox/geraud/fllt/fllt.svg.3.cc (working copy)
@@ -189,7 +189,7 @@
{
// R <- 0 and N <- 0
if (N_box.is_valid() != 0)
- level::fill(inplace(is | N_box.to_result()), in_O);
+ level::fill((is | N_box.to_result()).rw(), in_O);
clear_N(N);
N_box.init();
Index: sandbox/geraud/fllt/fllt.svg.4.cc
--- sandbox/geraud/fllt/fllt.svg.4.cc (revision 2505)
+++ sandbox/geraud/fllt/fllt.svg.4.cc (working copy)
@@ -195,8 +195,8 @@
// R <- 0 and N <- 0
if (N_box.is_valid() != 0)
{
-// level::fill(inplace(is | N_box.to_result()), in_O);
- level::fill(inplace(deja_vu | N_box.to_result()), false);
+// level::fill((is | N_box.to_result()).rw(), in_O);
+ level::fill(deja_vu | N_box.to_result()), false);
}
clear_N(N);
N_box.init();
@@ -296,7 +296,7 @@
for (unsigned i = 0; i < 256; ++i)
if (N[i].nsites())
- level::fill(inplace(deja_vu | N[i]), false);
+ level::fill(deja_vu | N[i]), false);
// {
// mln_piter(arr_t) p(N[i]);
// for_all(p)
Index: sandbox/geraud/fllt/fllt.svg.5.cc
--- sandbox/geraud/fllt/fllt.svg.5.cc (revision 2505)
+++ sandbox/geraud/fllt/fllt.svg.5.cc (working copy)
@@ -197,8 +197,8 @@
// R <- 0 and N <- 0
if (N_box.is_valid() != 0)
{
-// level::fill(inplace(is | N_box.to_result()), in_O);
- level::fill(inplace(deja_vu | N_box.to_result()), false);
+// level::fill((is | N_box.to_result()).rw(), in_O);
+ level::fill(deja_vu | N_box.to_result()), false);
}
clear_N(N);
N_box.init();
@@ -302,7 +302,7 @@
for (unsigned i = 0; i < 256; ++i)
if (N[i]->nsites())
- level::fill(inplace(deja_vu | *N[i]), false);
+ level::fill(deja_vu | *N[i]), false);
// mln_invariant(deja_vu == ((pw::value(is) == pw::cst(in_R)) | input.domain()));
Index: sandbox/geraud/fllt/fllt.svg.6.cc
--- sandbox/geraud/fllt/fllt.svg.6.cc (revision 2505)
+++ sandbox/geraud/fllt/fllt.svg.6.cc (working copy)
@@ -1003,7 +1003,7 @@
fllt_tree(P, V) subtree(node);
fllt_branch_iter_ind(P, V) s(fllt_branch(P, V)(subtree, *node));
for_all(s)
- level::fill(inplace(output | (*s).elt().points), (*s).elt().value);
+ level::fill(output | (*s).elt().points), (*s).elt().value);
}
void area_filter(image2d<value::int_u8>& output,
@@ -1037,7 +1037,7 @@
}
accu += (*node).elt().nsites;
- level::fill(inplace(output | (*node).elt().points), g);
+ level::fill(output | (*node).elt().points), g);
for (int i = 0; i < node->children().size();i++)
area_filter_min(output, node->children()[i], min_area, g, accu);
Index: sandbox/geraud/fllt/fllt_test.hh
--- sandbox/geraud/fllt/fllt_test.hh (revision 2505)
+++ sandbox/geraud/fllt/fllt_test.hh (working copy)
@@ -474,7 +474,7 @@
fllt_branch_iter(P, V) n(*child);
for_all(n)
- level::fill(inplace(ima | (*n).elt().points), true);
+ level::fill((ima | (*n).elt().points).rw(), true);
tmp.append((*n).elt().points);
Index: sandbox/geraud/Rd/debase.union_find.hh
--- sandbox/geraud/Rd/debase.union_find.hh (revision 2505)
+++ sandbox/geraud/Rd/debase.union_find.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -70,7 +70,7 @@
// init
std::cout << "0 ";
- level::fill(inplace(is_proc), false);
+ level::fill(is_proc, false);
S = histo_reverse_sort(g);
// first pass
@@ -91,7 +91,7 @@
// second pass
std::cout << "2 ";
- level::fill(inplace(is_proc), false);
+ level::fill(is_proc, false);
for (int i = S.size() - 1; i >= 0; --i)
{
point p = S[i];
Index: sandbox/vigouroux/yuv/get_blue.hh
--- sandbox/vigouroux/yuv/get_blue.hh (revision 2505)
+++ sandbox/vigouroux/yuv/get_blue.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/yuv/get_red.hh
--- sandbox/vigouroux/yuv/get_red.hh (revision 2505)
+++ sandbox/vigouroux/yuv/get_red.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/yuv/rgb_to_yuv.hh
--- sandbox/vigouroux/yuv/rgb_to_yuv.hh (revision 2505)
+++ sandbox/vigouroux/yuv/rgb_to_yuv.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/yuv/get_green.hh
--- sandbox/vigouroux/yuv/get_green.hh (revision 2505)
+++ sandbox/vigouroux/yuv/get_green.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/hsi/get_blue.hh
--- sandbox/vigouroux/hsi/get_blue.hh (revision 2505)
+++ sandbox/vigouroux/hsi/get_blue.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/hsi/get_red.hh
--- sandbox/vigouroux/hsi/get_red.hh (revision 2505)
+++ sandbox/vigouroux/hsi/get_red.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/hsi/rgb_to_hsi.hh
--- sandbox/vigouroux/hsi/rgb_to_hsi.hh (revision 2505)
+++ sandbox/vigouroux/hsi/rgb_to_hsi.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/hsi/get_green.hh
--- sandbox/vigouroux/hsi/get_green.hh (revision 2505)
+++ sandbox/vigouroux/hsi/get_green.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/function.hh
--- sandbox/vigouroux/function.hh (revision 2505)
+++ sandbox/vigouroux/function.hh (working copy)
@@ -1,5 +1,5 @@
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/tests.cc
--- sandbox/vigouroux/tests.cc (revision 2505)
+++ sandbox/vigouroux/tests.cc (working copy)
@@ -1,5 +1,5 @@
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/cmy/rgb_to_cmy.hh
--- sandbox/vigouroux/cmy/rgb_to_cmy.hh (revision 2505)
+++ sandbox/vigouroux/cmy/rgb_to_cmy.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/cmy/get_blue.hh
--- sandbox/vigouroux/cmy/get_blue.hh (revision 2505)
+++ sandbox/vigouroux/cmy/get_blue.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/cmy/fun.hh
--- sandbox/vigouroux/cmy/fun.hh (revision 2505)
+++ sandbox/vigouroux/cmy/fun.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/cmy/get_green.hh
--- sandbox/vigouroux/cmy/get_green.hh (revision 2505)
+++ sandbox/vigouroux/cmy/get_green.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/xyz/rgb_to_xyz.hh
--- sandbox/vigouroux/xyz/rgb_to_xyz.hh (revision 2505)
+++ sandbox/vigouroux/xyz/rgb_to_xyz.hh (working copy)
@@ -2,7 +2,7 @@
# define OLENA_CONVERT_RGBXYZ_HH
# include <mln/core/image_if_value.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/core/alias/w_window2d_int.hh>
# include <mln/display/show.hh>
# include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/xyz/get_blue.hh
--- sandbox/vigouroux/xyz/get_blue.hh (revision 2505)
+++ sandbox/vigouroux/xyz/get_blue.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/xyz/get_red.hh
--- sandbox/vigouroux/xyz/get_red.hh (revision 2505)
+++ sandbox/vigouroux/xyz/get_red.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/xyz/get_green.hh
--- sandbox/vigouroux/xyz/get_green.hh (revision 2505)
+++ sandbox/vigouroux/xyz/get_green.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/yiq/get_blue.hh
--- sandbox/vigouroux/yiq/get_blue.hh (revision 2505)
+++ sandbox/vigouroux/yiq/get_blue.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/yiq/get_red.hh
--- sandbox/vigouroux/yiq/get_red.hh (revision 2505)
+++ sandbox/vigouroux/yiq/get_red.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/yiq/rgb_to_yiq.hh
--- sandbox/vigouroux/yiq/rgb_to_yiq.hh (revision 2505)
+++ sandbox/vigouroux/yiq/rgb_to_yiq.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/yiq/get_green.hh
--- sandbox/vigouroux/yiq/get_green.hh (revision 2505)
+++ sandbox/vigouroux/yiq/get_green.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/conv/getred.hh
--- sandbox/vigouroux/conv/getred.hh (revision 2505)
+++ sandbox/vigouroux/conv/getred.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/conv/tored.hh
--- sandbox/vigouroux/conv/tored.hh (revision 2505)
+++ sandbox/vigouroux/conv/tored.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/conv/torgb.hh
--- sandbox/vigouroux/conv/torgb.hh (revision 2505)
+++ sandbox/vigouroux/conv/torgb.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/conv/rgbto.hh
--- sandbox/vigouroux/conv/rgbto.hh (revision 2505)
+++ sandbox/vigouroux/conv/rgbto.hh (working copy)
@@ -1,7 +1,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/color/rgb_to_hsl.hh
--- sandbox/vigouroux/color/rgb_to_hsl.hh (revision 2505)
+++ sandbox/vigouroux/color/rgb_to_hsl.hh (working copy)
@@ -2,7 +2,7 @@
# define OLENA_CONVERT_NRGBHSL_HH
# include <mln/core/image_if_value.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/core/alias/w_window2d_int.hh>
# include <mln/display/show.hh>
# include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/color/rgb_to_cmy.hh
--- sandbox/vigouroux/color/rgb_to_cmy.hh (revision 2505)
+++ sandbox/vigouroux/color/rgb_to_cmy.hh (working copy)
@@ -1,5 +1,5 @@
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/color/rgb_to_xyz.hh
--- sandbox/vigouroux/color/rgb_to_xyz.hh (revision 2505)
+++ sandbox/vigouroux/color/rgb_to_xyz.hh (working copy)
@@ -2,7 +2,7 @@
# define OLENA_CONVERT_RGBXYZ_HH
# include <mln/core/image_if_value.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/core/alias/w_window2d_int.hh>
# include <mln/display/show.hh>
# include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/color/tests.cc
--- sandbox/vigouroux/color/tests.cc (revision 2505)
+++ sandbox/vigouroux/color/tests.cc (working copy)
@@ -1,5 +1,5 @@
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/color/rgb_to_hsv.hh
--- sandbox/vigouroux/color/rgb_to_hsv.hh (revision 2505)
+++ sandbox/vigouroux/color/rgb_to_hsv.hh (working copy)
@@ -2,7 +2,7 @@
# define OLENA_CONVERT_NRGBHSV_HH
# include <mln/core/image_if_value.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/core/alias/w_window2d_int.hh>
# include <mln/display/show.hh>
# include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/color/rgb_to_yiq.hh
--- sandbox/vigouroux/color/rgb_to_yiq.hh (revision 2505)
+++ sandbox/vigouroux/color/rgb_to_yiq.hh (working copy)
@@ -1,5 +1,5 @@
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/color/rgb_to_hsi.hh
--- sandbox/vigouroux/color/rgb_to_hsi.hh (revision 2505)
+++ sandbox/vigouroux/color/rgb_to_hsi.hh (working copy)
@@ -2,7 +2,7 @@
#include <cmath>
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/vigouroux/color/rgb_to_yuv.hh
--- sandbox/vigouroux/color/rgb_to_yuv.hh (revision 2505)
+++ sandbox/vigouroux/color/rgb_to_yuv.hh (working copy)
@@ -1,5 +1,5 @@
#include <mln/core/image_if_value.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/core/alias/w_window2d_int.hh>
#include <mln/display/show.hh>
#include <mln/io/ppm/save.hh>
Index: sandbox/garrigues/level_set.hh
--- sandbox/garrigues/level_set.hh (revision 2505)
+++ sandbox/garrigues/level_set.hh (working copy)
@@ -43,7 +43,7 @@
# include <mln/core/alias/point2d.hh>
# include <mln/core/site_set/p_set.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/core/alias/neighb2d.hh>
# include <mln/core/clock_neighb2d.hh>
# include <mln/core/p_if_piter.hh>
Index: sandbox/garrigues/fllt/fllt_simple.svg.1.cc
--- sandbox/garrigues/fllt/fllt_simple.svg.1.cc (revision 2505)
+++ sandbox/garrigues/fllt/fllt_simple.svg.1.cc (working copy)
@@ -192,7 +192,7 @@
std::cout << "Step 2" << std::endl;
#endif
if (N_box.is_valid())
- level::fill(inplace(is | N_box.to_result()), in_O);
+ level::fill((is | N_box.to_result()).rw(), in_O);
N_box.init();
R_box.init();
Index: sandbox/garrigues/fllt/fllt_simple.svg.3.cc
--- sandbox/garrigues/fllt/fllt_simple.svg.3.cc (revision 2505)
+++ sandbox/garrigues/fllt/fllt_simple.svg.3.cc (working copy)
@@ -387,7 +387,7 @@
std::cout << "Step 2" << std::endl;
#endif
if (N_box.is_valid())
- level::fill(inplace(is | N_box.to_result()), in_O);
+ level::fill((is | N_box.to_result()).rw(), in_O);
N_box.init();
R_box.init();
Index: sandbox/garrigues/fllt/fllt_simple.cc
--- sandbox/garrigues/fllt/fllt_simple.cc (revision 2505)
+++ sandbox/garrigues/fllt/fllt_simple.cc (working copy)
@@ -505,7 +505,7 @@
std::cout << "Step 2" << std::endl;
#endif
if (N_box.is_valid())
- level::fill(inplace(is | N_box.to_result()), in_O);
+ level::fill((is | N_box.to_result()).rw(), in_O);
N_box.init();
R_box.init();
Index: sandbox/garrigues/fllt/compute_level_set_fast2.hh
--- sandbox/garrigues/fllt/compute_level_set_fast2.hh (revision 2505)
+++ sandbox/garrigues/fllt/compute_level_set_fast2.hh (working copy)
@@ -244,7 +244,7 @@
// static image2d<bool> border_ima(tmp.domain());
// level::fill(border_ima, false);
-// // level::fill(inplace(border_ima | N), true);
+// // level::fill((border_ima | N).rw(), true);
// // std::cout << "tmp border = " << tmp.border () << std::endl;
// // std::cout << "ima border = " << border_ima.border () << std::endl;
// mln_piter(p_image2d<P>) z(N);
Index: sandbox/garrigues/fllt/debug.hh
--- sandbox/garrigues/fllt/debug.hh (revision 2505)
+++ sandbox/garrigues/fllt/debug.hh (working copy)
@@ -187,11 +187,11 @@
level::fill(out, literal::white);
if (R.nsites() != 0)
- level::fill(inplace(out | R), literal::green);
+ level::fill((out | R).rw(), literal::green);
if (A.nsites() != 0)
- level::fill(inplace(out | A), literal::blue);
+ level::fill((out | A).rw(), literal::blue);
if (N.nsites() != 0)
- level::fill(inplace(out | N), literal::red);
+ level::fill((out | N).rw(), literal::red);
io::ppm::save(out, filename.str());
}
Index: sandbox/garrigues/fllt/compute_level_set_fast.hh
--- sandbox/garrigues/fllt/compute_level_set_fast.hh (revision 2505)
+++ sandbox/garrigues/fllt/compute_level_set_fast.hh (working copy)
@@ -238,7 +238,7 @@
// static image2d<bool> border_ima(tmp.domain());
// level::fill(border_ima, false);
-// // level::fill(inplace(border_ima | N), true);
+// // level::fill((border_ima | N).rw(), true);
// // std::cout << "tmp border = " << tmp.border () << std::endl;
// // std::cout << "ima border = " << border_ima.border () << std::endl;
// mln_piter(p_image2d<P>) z(N);
Index: sandbox/garrigues/fllt/fllt_simple.svg.2.cc
--- sandbox/garrigues/fllt/fllt_simple.svg.2.cc (revision 2505)
+++ sandbox/garrigues/fllt/fllt_simple.svg.2.cc (working copy)
@@ -209,7 +209,7 @@
std::cout << "Step 2" << std::endl;
#endif
if (N_box.is_valid())
- level::fill(inplace(is | N_box.to_result()), in_O);
+ level::fill((is | N_box.to_result()).rw(), in_O);
N_box.init();
R_box.init();
Index: sandbox/garrigues/fllt/fllt.hh
--- sandbox/garrigues/fllt/fllt.hh (revision 2505)
+++ sandbox/garrigues/fllt/fllt.hh (working copy)
@@ -37,7 +37,7 @@
# include <mln/core/image/image2d.hh>
# include <mln/core/site_set/p_set.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/core/alias/neighb2d.hh>
# include <mln/core/p_if_piter.hh>
# include <mln/core/site_set/p_if.hh>
Index: sandbox/garrigues/fllt/compute_level_set.hh
--- sandbox/garrigues/fllt/compute_level_set.hh (revision 2505)
+++ sandbox/garrigues/fllt/compute_level_set.hh (working copy)
@@ -179,7 +179,7 @@
static image2d<bool> border_ima(tmp.domain());
level::fill(border_ima, false);
- // level::fill(inplace(border_ima | N), true);
+ // level::fill((border_ima | N).rw(), true);
// std::cout << "tmp border = " << tmp.border () << std::endl;
// std::cout << "ima border = " << border_ima.border () << std::endl;
mln_piter(p_set<P>) z(N);
Index: sandbox/garrigues/tiled_image2d/tiled_image2d.hh
--- sandbox/garrigues/tiled_image2d/tiled_image2d.hh (revision 2505)
+++ sandbox/garrigues/tiled_image2d/tiled_image2d.hh (working copy)
@@ -36,7 +36,7 @@
# include <mln/core/internal/image_primary.hh>
# include <mln/core/internal/fixme.hh>
# include <mln/core/alias/box2d.hh>
-# include <mln/core/image/inplace.hh>
+
# include <mln/core/routine/init.hh>
# include <mln/core/line_piter.hh>
Index: sandbox/garrigues/factures/extract_array_highlight.cc
--- sandbox/garrigues/factures/extract_array_highlight.cc (revision 2505)
+++ sandbox/garrigues/factures/extract_array_highlight.cc (working copy)
@@ -37,7 +37,7 @@
#include <mln/win/disk2d.hh>
#include <mln/pw/all.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/level/stretch.hh>
#include <mln/level/median.hh>
#include <mln/morpho/gradient.hh>
@@ -150,7 +150,7 @@
// Binarisation.
ima2d_bool bin(in.domain());
- level::paste(inplace(pw::value(in) > pw::cst(50) | in.domain()), bin);
+ level::paste(pw::value(in) > pw::cst(50) | in.domain(), bin);
image2d<value::rgb8> output_h = highlight_hlines(bin);
image2d<value::rgb8> output_v = highlight_vlines(bin);
Index: sandbox/garrigues/factures/extract_array.cc
--- sandbox/garrigues/factures/extract_array.cc (revision 2505)
+++ sandbox/garrigues/factures/extract_array.cc (working copy)
@@ -35,7 +35,7 @@
#include <mln/win/rectangle2d.hh>
#include <mln/pw/all.hh>
-#include <mln/core/image/inplace.hh>
+
#include <mln/level/stretch.hh>
#include <mln/labeling/level.hh>
#include <mln/literal/all.hh>
@@ -63,7 +63,7 @@
// Binarisation.
ima2d_bool bin(small.domain());
- level::paste(inplace(pw::value(small) > pw::cst(50) | small.domain()), bin);
+ level::paste(pw::value(small) > pw::cst(50) | small.domain(), bin);
// Labeling.
unsigned nlabels;
@@ -108,7 +108,7 @@
// Draw the bounding boxes.
for (int i = 0; i < nlabels; i++)
if (is_array[i])
- draw::box(output, inplace(caracteristics[i].to_result().first), inplace(value::rgb8(literal::green)));
+ draw::box(output, caracteristics[i].to_result().first, value::rgb8(literal::green));
io::ppm::save(output, "array.ppm");
}
Index: sandbox/ballas/test.cc
--- sandbox/ballas/test.cc (revision 2505)
+++ sandbox/ballas/test.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -40,30 +40,30 @@
image1d<float> ima1d3(5);
image1d<double> ima1d4(5);
- level::fill(inplace(ima1d1), 5);
- level::fill(inplace(ima1d2), 5);
- level::fill(inplace(ima1d3), 5);
- level::fill(inplace(ima1d4), 5);
+ level::fill(ima1d1, 5);
+ level::fill(ima1d2, 5);
+ level::fill(ima1d3, 5);
+ level::fill(ima1d4, 5);
image2d<char> ima2d1(5, 5);
image2d<int> ima2d2(5, 5);
image2d<float> ima2d3(5, 5);
image2d<double> ima2d4(5, 5);
- level::fill(inplace(ima2d1), 5);
- level::fill(inplace(ima2d2), 5);
- level::fill(inplace(ima2d3), 5);
- level::fill(inplace(ima2d4), 5);
+ level::fill(ima2d1, 5);
+ level::fill(ima2d2, 5);
+ level::fill(ima2d3, 5);
+ level::fill(ima2d4, 5);
image3d<char> ima3d1(5, 5, 5);
image3d<int> ima3d2(5, 5, 5);
image3d<float> ima3d3(5, 5, 5);
image3d<double> ima3d4(5, 5, 5);
- level::fill(inplace(ima3d1), 5);
- level::fill(inplace(ima3d2), 5);
- level::fill(inplace(ima3d3), 5);
- level::fill(inplace(ima3d4), 5);
+ level::fill(ima3d1, 5);
+ level::fill(ima3d2, 5);
+ level::fill(ima3d3, 5);
+ level::fill(ima3d4, 5);
return 0;
}
1
0
04 Oct '08
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add multiple-size windows and dual neighborhoods.
* tests/make: New.
* tests/make/dual_neighb.cc: New.
* tests/make/Makefile.am: New.
* tests/Makefile.am: Update.
* mln/core/concept/window.hh (todo): New.
* mln/make/dual_neighb.hh: New.
* mln/make/double_neighb2d.hh: Fix dox.
(todo): New.
* mln/README: Remove; obsolete file contents.
* mln/win/multiple.hh: Remove non-activate code.
(W): New static checks.
Copy to...
* mln/win/multiple_size.hh: ...this new file.
(size_around): Activate.
(multiple): Rename as...
(multiple_size): ...this new class.
(size_): Replace this attribute by...
(size_): ...this new method.
(change_target): Remove; useless.
(siae): Remove; obsolete.
(set_window): Remove no more valid tests.
* mln/win/all.hh: Update.
mln/core/concept/window.hh | 2
mln/make/double_neighb2d.hh | 4 -
mln/make/dual_neighb.hh | 94 ++++++++++++++++++++++++
mln/win/all.hh | 1
mln/win/multiple.hh | 33 ++------
mln/win/multiple_size.hh | 166 +++++++++++++++++++-------------------------
tests/Makefile.am | 1
tests/make/Makefile.am | 10 ++
tests/make/dual_neighb.cc | 65 +++++++++++++++++
9 files changed, 260 insertions(+), 116 deletions(-)
Index: tests/make/dual_neighb.cc
--- tests/make/dual_neighb.cc (revision 0)
+++ tests/make/dual_neighb.cc (revision 0)
@@ -0,0 +1,65 @@
+// Copyright (C) 2008 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.
+
+/*! \file tests/make/dual_neighb.cc
+ *
+ * \brief Tests on mln::make::dual_neighb.
+ */
+
+#include <mln/make/dual_neighb.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/image/image2d.hh>
+
+
+
+template <typename I, typename N>
+unsigned count(const I& ima, const N& nbh)
+{
+ mln_piter(I) p(ima.domain());
+ mln_niter(N) n(nbh, p);
+ unsigned c = 0;
+ for_all(p)
+ for_all(n)
+ { std::cout << n << std::endl; ++c; }
+ return c;
+}
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<bool> ima(1, 2, 1);
+ ima.at(0, 0) = true;
+ ima.at(0, 1) = false;
+
+ mln_assertion( count(ima, make::dual_neighb(ima, c4(), c8()))
+ == c4().size() + c8().size() );
+
+ // We can observe that the neighboord is not restricted by the
+ // respective domains defined by ima(p) == false and true.
+}
Index: tests/make/Makefile.am
--- tests/make/Makefile.am (revision 0)
+++ tests/make/Makefile.am (revision 0)
@@ -0,0 +1,10 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ dual_neighb
+
+dual_neighb_SOURCES = dual_neighb.cc
+
+TESTS = $(check_PROGRAMS)
Index: tests/Makefile.am
--- tests/Makefile.am (revision 2504)
+++ tests/Makefile.am (working copy)
@@ -25,6 +25,7 @@
linear \
literal \
logical \
+ make \
math \
metal \
morpho \
Index: mln/core/concept/window.hh
--- mln/core/concept/window.hh (revision 2504)
+++ mln/core/concept/window.hh (working copy)
@@ -32,6 +32,8 @@
* \brief Definition of the concept of mln::Window.
*
* \todo Operator== should test if the cmp is possible.
+ *
+ * \todo Add an is_valid() method.
*/
# include <mln/core/concept/object.hh>
Index: mln/make/dual_neighb.hh
--- mln/make/dual_neighb.hh (revision 0)
+++ mln/make/dual_neighb.hh (revision 0)
@@ -0,0 +1,94 @@
+// Copyright (C) 2008 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 MLN_MAKE_DUAL_NEIGHB_HH
+# define MLN_MAKE_DUAL_NEIGHB_HH
+
+/*! \file mln/make/dual_neighb.hh
+ *
+ * \brief Routine to create a dual neighborhood.
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/core/concept/neighborhood.hh>
+# include <mln/pw/value.hh>
+# include <mln/win/multiple_size.hh>
+# include <mln/core/neighb.hh>
+
+
+namespace mln
+{
+
+ namespace make
+ {
+
+ template <typename I, typename N>
+ neighb< win::multiple_size< mln_window(N), pw::value_<I> > >
+ dual_neighb(const Image<I>& ima,
+ const Neighborhood<N>& nbh_true,
+ const Neighborhood<N>& nbh_false);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename N>
+ inline
+ neighb< win::multiple_size< mln_window(N), pw::value_<I> > >
+ dual_neighb(const Image<I>& ima_,
+ const Neighborhood<N>& nbh_true_,
+ const Neighborhood<N>& nbh_false_)
+ {
+ trace::entering("make::dual_neighb");
+
+ mlc_is(mln_trait_image_kind(I), trait::image::kind::logic)::check();
+
+ const I& ima = exact(ima_);
+ const N& nbh_true = exact(nbh_true_);
+ const N& nbh_false = exact(nbh_false_);
+ mln_precondition(ima.has_data());
+
+ typedef win::multiple_size< mln_window(N), pw::value_<I> > W;
+ W win(pw::value(ima));
+ win.set_window(false, nbh_false.win()); // 0
+ win.set_window(true, nbh_true .win()); // 1
+
+ neighb<W> nbh(win);
+
+ trace::exiting("make::dual_neighb");
+ return nbh;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::make
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MAKE_DUAL_NEIGHB_HH
Index: mln/make/double_neighb2d.hh
--- mln/make/double_neighb2d.hh (revision 2504)
+++ mln/make/double_neighb2d.hh (working copy)
@@ -30,7 +30,9 @@
/*! \file mln/make/double_neighb2d.hh
*
- * \brief Routine to create a dual neighborhood.
+ * \brief Routine to create a double neighborhood.
+ *
+ * \todo Add overload with 'when_*' being Neighborhood<N>...
*/
# include <mln/convert/to.hh>
Index: mln/win/multiple_size.hh
--- mln/win/multiple_size.hh (revision 2504)
+++ mln/win/multiple_size.hh (working copy)
@@ -25,12 +25,12 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_WIN_MULTIPLE_HH
-# define MLN_WIN_MULTIPLE_HH
+#ifndef MLN_WIN_MULTIPLE_SIZE_HH
+# define MLN_WIN_MULTIPLE_SIZE_HH
-/*! \file mln/win/multiple.hh
+/*! \file mln/win/multiple_size.hh
*
- * \brief Definition of a multiple window.
+ * \brief Definition of a multiple-size window.
*/
# include <mln/core/internal/window_base.hh>
@@ -45,8 +45,8 @@
// Forward declarations.
namespace win
{
- template <typename W, typename F> class multiple;
- template <typename W, typename F> class multiple_qiter;
+ template <typename W, typename F> class multiple_size;
+ template <typename W, typename F> class multiple_size_qiter;
}
@@ -55,9 +55,9 @@
{
template <typename W, typename F>
- struct window_< win::multiple<W,F> >
+ struct window_< win::multiple_size<W,F> >
{
- typedef trait::window::size::fixed size;
+ typedef trait::window::size::unknown size;
typedef trait::window::support::regular support;
typedef trait::window::definition::n_ary definition;
};
@@ -70,7 +70,14 @@
{
template <typename W, typename F>
- class multiple : public internal::window_base< mln_dpsite(W), multiple<W,F> >
+ class multiple_size
+
+ : public internal::window_base< mln_dpsite(W), multiple_size<W,F> >,
+
+ private metal::and_< mlc_is(mln_trait_window_size(W),
+ trait::window::size::fixed),
+ mlc_is(mln_trait_window_support(W),
+ trait::window::support::regular) >::check_t
{
public:
@@ -78,17 +85,17 @@
typedef mln_psite(W) psite;
typedef mln_site(W) site;
- typedef multiple< window<dpsite>, F > regular;
+ typedef multiple_size< window<dpsite>, F > regular;
- typedef multiple_qiter<W,F> fwd_qiter;
- typedef multiple_qiter<W,F> bkd_qiter;
- typedef multiple_qiter<W,F> qiter;
+ typedef multiple_size_qiter<W,F> fwd_qiter;
+ typedef multiple_size_qiter<W,F> bkd_qiter;
+ typedef multiple_size_qiter<W,F> qiter;
typedef W element;
- multiple();
+ multiple_size();
- multiple(const F& f);
+ multiple_size(const F& f);
bool is_empty() const;
@@ -100,9 +107,7 @@
const F& function() const;
- unsigned size() const;
-
-// unsigned size_around(const mln_psite(W)& p) const;
+ unsigned size_around(const mln_psite(W)& p) const;
const mln_dpsite(W)& ith_dp_around(unsigned i, const mln_psite(W)& p) const;
@@ -122,20 +127,18 @@
template <typename W, typename F>
- class multiple_qiter
- : public internal::site_relative_iterator_base< multiple<W,F>,
- multiple_qiter<W,F> >
+ class multiple_size_qiter
+ : public internal::site_relative_iterator_base< multiple_size<W,F>,
+ multiple_size_qiter<W,F> >
{
- typedef multiple_qiter<W,F> self_;
- typedef internal::site_relative_iterator_base< multiple<W,F>, self_ > super_;
+ typedef multiple_size_qiter<W,F> self_;
+ typedef internal::site_relative_iterator_base< multiple_size<W,F>, self_ > super_;
public:
- multiple_qiter();
+ multiple_size_qiter();
template <typename P>
- multiple_qiter(const multiple<W,F>& w, const P& c);
-
- void change_target(const multiple<W,F>& w); // Overridden to initialize size_.
+ multiple_size_qiter(const multiple_size<W,F>& w, const P& c);
/// Test the iterator validity.
bool is_valid_() const;
@@ -154,26 +157,25 @@
private:
unsigned i_;
- unsigned size_;
-// unsigned n_() const;
+ unsigned size_() const;
};
# ifndef MLN_INCLUDE_ONLY
- // win::multiple<W,F>
+ // win::multiple_size<W,F>
template <typename W, typename F>
inline
- multiple<W,F>::multiple()
+ multiple_size<W,F>::multiple_size()
: f_()
{
}
template <typename W, typename F>
inline
- multiple<W,F>::multiple(const F& f)
+ multiple_size<W,F>::multiple_size(const F& f)
: f_(f)
{
}
@@ -181,7 +183,7 @@
template <typename W, typename F>
inline
bool
- multiple<W,F>::is_empty() const
+ multiple_size<W,F>::is_empty() const
{
return win_.is_empty();
}
@@ -189,18 +191,16 @@
template <typename W, typename F>
inline
void
- multiple<W,F>::set_window(unsigned i, const W& win)
+ multiple_size<W,F>::set_window(unsigned i, const W& win)
{
mln_precondition(i == win_.nelements());
- if (i >= 1)
- mln_precondition(win.size() == win_[0].size());
win_.append(win);
}
template <typename W, typename F>
inline
const W&
- multiple<W,F>::window(unsigned i) const
+ multiple_size<W,F>::window(unsigned i) const
{
mln_precondition(i < win_.nelements());
return win_[i];
@@ -209,7 +209,7 @@
template <typename W, typename F>
inline
unsigned
- multiple<W,F>::nwindows() const
+ multiple_size<W,F>::nwindows() const
{
return win_.nelements();
}
@@ -217,27 +217,15 @@
template <typename W, typename F>
inline
const F&
- multiple<W,F>::function() const
+ multiple_size<W,F>::function() const
{
return f_;
}
template <typename W, typename F>
inline
- unsigned
- multiple<W,F>::size() const
- {
- mln_precondition(win_.nelements() >= 2); // Multiple cannot be just 1 element.
- unsigned s = win_[0].size();
- for (unsigned i = 1; i < win_.nelements(); ++i)
- mln_precondition(win_[i].size() == s);
- return s;
- }
-
- template <typename W, typename F>
- inline
bool
- multiple<W,F>::is_centered() const
+ multiple_size<W,F>::is_centered() const
{
mln_precondition(win_.nelements() >= 1);
for (unsigned i = 0; i < win_.nelements(); ++i)
@@ -249,7 +237,7 @@
template <typename W, typename F>
inline
bool
- multiple<W,F>::is_symmetric() const
+ multiple_size<W,F>::is_symmetric() const
{
mln_precondition(win_.nelements() >= 1);
for (unsigned i = 0; i < win_.nelements(); ++i)
@@ -258,11 +246,10 @@
return true;
}
-
template <typename W, typename F>
inline
void
- multiple<W,F>::sym()
+ multiple_size<W,F>::sym()
{
mln_precondition(win_.nelements() >= 1);
for (unsigned i = 0; i < win_.nelements(); ++i)
@@ -272,7 +259,7 @@
template <typename W, typename F>
inline
unsigned
- multiple<W,F>::delta() const
+ multiple_size<W,F>::delta() const
{
mln_precondition(win_.nelements() >= 1);
unsigned d = win_[0].delta();
@@ -285,74 +272,67 @@
return d;
}
-// template <typename W, typename F>
-// inline
-// unsigned
-// multiple<W,F>::size_around(const mln_psite(W)& p) const
-// {
-// mln_precondition(f_(p) < win_.nelements());
-// return win_[f_(p)].size();
-// }
+ template <typename W, typename F>
+ inline
+ unsigned
+ multiple_size<W,F>::size_around(const mln_psite(W)& p) const
+ {
+ mln_precondition(win_.nelements() >= 2);
+ mln_precondition(f_(p) < win_.nelements());
+ return win_[f_(p)].size();
+ }
template <typename W, typename F>
inline
const mln_dpsite(W)&
- multiple<W,F>::ith_dp_around(unsigned i, const mln_psite(W)& p) const
+ multiple_size<W,F>::ith_dp_around(unsigned i, const mln_psite(W)& p) const
{
+ mln_precondition(win_.nelements() >= 2);
mln_precondition(f_(p) < win_.nelements());
mln_precondition(i < win_[f_(p)].size());
return win_[f_(p)].dp(i);
}
- // win::multiple_qiter<W,F>
+ // win::multiple_size_qiter<W,F>
template <typename W, typename F>
inline
- multiple_qiter<W,F>::multiple_qiter()
+ multiple_size_qiter<W,F>::multiple_size_qiter()
{
}
template <typename W, typename F>
template <typename P>
inline
- multiple_qiter<W,F>::multiple_qiter(const multiple<W,F>& w, const P& c)
+ multiple_size_qiter<W,F>::multiple_size_qiter(const multiple_size<W,F>& w, const P& c)
{
this->center_at(c);
// We have to first change the center so that 'invalidate' can
// work when changing the target.
- change_target(w);
- }
-
- template <typename W, typename F>
- inline
- void
- multiple_qiter<W,F>::change_target(const multiple<W,F>& w)
- {
- this->super_::change_target(w);
- size_ = w.size();
+ this->change_target(w);
}
template <typename W, typename F>
inline
bool
- multiple_qiter<W,F>::is_valid_() const
+ multiple_size_qiter<W,F>::is_valid_() const
{
- return i_ < size_;
+ return i_ < size_();
}
template <typename W, typename F>
inline
void
- multiple_qiter<W,F>::invalidate_()
+ multiple_size_qiter<W,F>::invalidate_()
{
- i_ = size_;
+ i_ = size_();
}
template <typename W, typename F>
inline
void
- multiple_qiter<W,F>::do_start_()
+ multiple_size_qiter<W,F>::do_start_()
{
i_ = 0;
}
@@ -360,7 +340,7 @@
template <typename W, typename F>
inline
void
- multiple_qiter<W,F>::do_next_()
+ multiple_size_qiter<W,F>::do_next_()
{
++i_;
}
@@ -368,18 +348,18 @@
template <typename W, typename F>
inline
mln_psite(W)
- multiple_qiter<W,F>::compute_p_() const
+ multiple_size_qiter<W,F>::compute_p_() const
{
return *this->c_ + this->s_->ith_dp_around(i_, *this->c_);
}
-// template <typename W, typename F>
-// inline
-// unsigned
-// multiple_qiter<W,F>::size_() const
-// {
-// return this->s_->size_around(*this->c_);
-// }
+ template <typename W, typename F>
+ inline
+ unsigned
+ multiple_size_qiter<W,F>::size_() const
+ {
+ return this->s_->size_around(*this->c_);
+ }
# endif // ! MLN_INCLUDE_ONLY
@@ -389,4 +369,4 @@
} // end of namespace mln
-#endif // ! MLN_WIN_MULTIPLE_HH
+#endif // ! MLN_WIN_MULTIPLE_SIZE_HH
Index: mln/win/multiple.hh
--- mln/win/multiple.hh (revision 2504)
+++ mln/win/multiple.hh (working copy)
@@ -31,6 +31,8 @@
/*! \file mln/win/multiple.hh
*
* \brief Definition of a multiple window.
+ *
+ * \todo Implementation of the bkd_qiter (see FIXME).
*/
# include <mln/core/internal/window_base.hh>
@@ -70,7 +72,14 @@
{
template <typename W, typename F>
- class multiple : public internal::window_base< mln_dpsite(W), multiple<W,F> >
+ class multiple
+
+ : public internal::window_base< mln_dpsite(W), multiple<W,F> >,
+
+ private metal::and_< mlc_is(mln_trait_window_size(W),
+ trait::window::size::fixed),
+ mlc_is(mln_trait_window_support(W),
+ trait::window::support::regular) >::check_t
{
public:
@@ -81,7 +90,7 @@
typedef multiple< window<dpsite>, F > regular;
typedef multiple_qiter<W,F> fwd_qiter;
- typedef multiple_qiter<W,F> bkd_qiter;
+ typedef /* FIXME: */ multiple_qiter<W,F> bkd_qiter;
typedef multiple_qiter<W,F> qiter;
typedef W element;
@@ -102,8 +111,6 @@
unsigned size() const;
-// unsigned size_around(const mln_psite(W)& p) const;
-
const mln_dpsite(W)& ith_dp_around(unsigned i, const mln_psite(W)& p) const;
bool is_centered() const;
@@ -155,7 +162,6 @@
private:
unsigned i_;
unsigned size_;
-// unsigned n_() const;
};
@@ -285,15 +291,6 @@
return d;
}
-// template <typename W, typename F>
-// inline
-// unsigned
-// multiple<W,F>::size_around(const mln_psite(W)& p) const
-// {
-// mln_precondition(f_(p) < win_.nelements());
-// return win_[f_(p)].size();
-// }
-
template <typename W, typename F>
inline
const mln_dpsite(W)&
@@ -373,14 +370,6 @@
return *this->c_ + this->s_->ith_dp_around(i_, *this->c_);
}
-// template <typename W, typename F>
-// inline
-// unsigned
-// multiple_qiter<W,F>::size_() const
-// {
-// return this->s_->size_around(*this->c_);
-// }
-
# endif // ! MLN_INCLUDE_ONLY
Index: mln/win/all.hh
--- mln/win/all.hh (revision 2504)
+++ mln/win/all.hh (working copy)
@@ -53,6 +53,7 @@
# include <mln/win/hline2d.hh>
# include <mln/win/line.hh>
# include <mln/win/multiple.hh>
+# include <mln/win/multiple_size.hh>
# include <mln/win/octagon2d.hh>
# include <mln/win/rectangle2d.hh>
# include <mln/win/segment1d.hh>
1
0
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008
ChangeLog:
2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
Various small fixes.
* milena/mln/algebra/vec.hh: add missing header.
* milena/mln/core/image/obased_rle_image.hh,
* milena/mln/core/image/rle_image.hh: Use pruns.
* milena/mln/core/image/obased_rle_image.hh,
* milena/mln/core/image/t_image.hh: add missing init_ function.
* milena/mln/core/image/tr_image.hh,
* milena/tests/core/alias/point1d.cc,
* milena/tests/core/alias/point2d.cc: cleanup.
* milena/tests/core/image/Makefile.am: Disable known broken test
such as graph related tests.
* milena/tests/core/image/tr_image.cc: make it compile.
---
mln/algebra/vec.hh | 1
mln/core/image/obased_rle_image.hh | 45 +++++++++++++++++++++++--------------
mln/core/image/rle_image.hh | 12 ++++-----
mln/core/image/t_image.hh | 14 +++++++++++
mln/core/image/tr_image.hh | 23 +++++++-----------
tests/core/alias/point1d.cc | 1
tests/core/alias/point2d.cc | 2 -
tests/core/image/Makefile.am | 20 ++++++++--------
tests/core/image/tr_image.cc | 13 ++++++----
9 files changed, 76 insertions(+), 55 deletions(-)
Index: branches/cleanup-2008/milena/tests/core/image/Makefile.am
===================================================================
--- branches/cleanup-2008/milena/tests/core/image/Makefile.am (revision 2503)
+++ branches/cleanup-2008/milena/tests/core/image/Makefile.am (revision 2504)
@@ -17,13 +17,13 @@
image_if \
## interpolated \
line_graph_image \
- mono_obased_rle_image \
- mono_rle_image \
- obased_rle_image \
+## mono_obased_rle_image \
+## mono_rle_image \
+## obased_rle_image \
plain \
- rle_image \
+## rle_image \
safe_image \
- sparse_image \
+## sparse_image \
sub_image \
t_image \
tr_image \
@@ -44,13 +44,13 @@
image_if_SOURCES = image_if.cc
##interpolated_SOURCES = interpolated.cc
line_graph_image_SOURCES = line_graph_image.cc
-mono_obased_rle_image_SOURCES = mono_obased_rle_image.cc
-mono_rle_image_SOURCES = mono_rle_image.cc
-obased_rle_image_SOURCES = obased_rle_image.cc
+##mono_obased_rle_image_SOURCES = mono_obased_rle_image.cc
+##mono_rle_image_SOURCES = mono_rle_image.cc
+##obased_rle_image_SOURCES = obased_rle_image.cc
plain_SOURCES = plain.cc
-rle_image_SOURCES = rle_image.cc
+##rle_image_SOURCES = rle_image.cc
safe_image_SOURCES = safe_image.cc
-sparse_image_SOURCES = sparse_image.cc
+##sparse_image_SOURCES = sparse_image.cc
sub_image_SOURCES = sub_image.cc
t_image_SOURCES = t_image.cc
tr_image_SOURCES = tr_image.cc
Index: branches/cleanup-2008/milena/tests/core/image/tr_image.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/image/tr_image.cc (revision 2503)
+++ branches/cleanup-2008/milena/tests/core/image/tr_image.cc (revision 2504)
@@ -32,7 +32,7 @@
#include <iostream>
-#include <mln/fun/x2x/rotation.hh>
+#include <mln/fun/x2x/geom/rotation.hh>
#include <mln/core/image/image3d.hh>
#include <mln/value/int_u8.hh>
#include <mln/core/image/tr_image.hh>
@@ -50,16 +50,19 @@
debug::iota(in);
debug::println(in);
- fun::x2x::rotation<3,float> rot1(1.67, 0);
+ fun::x2x::geom::rotation<3,float> rot1(1.67, literal::zero);
- tr_image<fun::x2x::rotation<3,float>, image3d<int_u8> > inter(in, rot1);
+ tr_image<mln_pset_(image3d<int_u8>),
+ image3d<int_u8>,
+ fun::x2x::geom::rotation<3,float> >
+ inter(out.domain(), in, rot1);
image3d<int_u8>::fwd_piter p(out.domain());
for_all(p)
{
- algebra::vec<3,int> vec = (image3d<int_u8>::point)p;
- if (inter.has(vec))
+ algebra::vec<3,int> vec = p.to_site().to_vec();
+ if (inter.has(p))
out(p) = inter(vec);
else
out(p) = 255;
Index: branches/cleanup-2008/milena/tests/core/alias/point1d.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/alias/point1d.cc (revision 2503)
+++ branches/cleanup-2008/milena/tests/core/alias/point1d.cc (revision 2504)
@@ -44,7 +44,6 @@
p[0] = 4;
algebra::vec<1,def::coord> v = p;
- std::cout << v << std::endl;
p.ind() += 1;
mln_assertion(p.ind() == 5 && p[0] == 5);
Index: branches/cleanup-2008/milena/tests/core/alias/point2d.cc
===================================================================
--- branches/cleanup-2008/milena/tests/core/alias/point2d.cc (revision 2503)
+++ branches/cleanup-2008/milena/tests/core/alias/point2d.cc (revision 2504)
@@ -73,6 +73,4 @@
q.set_all(0);
for (unsigned i = 0; i < p.dim; ++i)
mln_assertion(q[i] == 0);
-
- std::cout << 3.4 * algebra::vec<2, def::coord>(p) << std::endl;
}
Index: branches/cleanup-2008/milena/mln/core/image/obased_rle_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/image/obased_rle_image.hh (revision 2503)
+++ branches/cleanup-2008/milena/mln/core/image/obased_rle_image.hh (revision 2504)
@@ -34,8 +34,8 @@
*/
# include <mln/core/internal/run_image.hh>
-# include <mln/core/p_runs.hh>
-# include <mln/core/runs_psite.hh>
+# include <mln/core/site_set/p_run.hh>
+# include <mln/core/site_set/p_set_of.hh>
# include <mln/core/site_set/box.hh>
# include <mln/value/set.hh>
# include <vector>
@@ -52,9 +52,9 @@
/// Data structure for \c mln::obased_rle_image<P,T>.
template <typename P, typename T>
- struct data_< obased_rle_image<P,T> >
+ struct data< obased_rle_image<P,T> >
{
- data_(const std::set<T>& values);
+ data(const std::set<T>& values);
/// Objects.
std::vector< std::vector<unsigned> > obj_;
@@ -69,7 +69,7 @@
std::vector<T> values_;
/// domain of the image
- p_runs_<P> domain_;
+ p_set_of< p_run<P> > domain_;
/// Return the size of the data in memory.
unsigned memory_size() const;
@@ -118,24 +118,27 @@
typedef T value;
typedef T& lvalue;
typedef const T rvalue;
- typedef runs_psite<P> psite;
- typedef p_runs_<P> pset;
+ typedef p_set_of< p_run<P> > pset;
+ typedef mln_psite(pset) psite;
/// Skeleton.
typedef obased_rle_image< tag::psite_<P>, tag::value_<T> > skeleton;
-
+ /// Constructor
obased_rle_image(const std::set<T>& values);
+ /// Initialize an empty image
+ void init_(const std::set<T>& values);
+
/// Add a new range to the image.
void insert(const p_run<P>& pr, T value);
/// Read-only access to the image value located at point \p p.
- rvalue operator() (const runs_psite<P>& site) const;
+ rvalue operator() (const mln_psite(pset)& site) const;
/// Read-write access to the image value located at point \p p.
- lvalue operator() (const runs_psite<P>& site);
+ lvalue operator() (const mln_psite(pset)& site);
/// Test if this image has been initialized.
bool has_data() const;
@@ -176,7 +179,7 @@
{
return domain_.memory_size() + bbox_.size()
* (sizeof(T) + sizeof(box<P>) + sizeof(std::vector<unsigned>))
- + (sizeof(unsigned) + sizeof(T)) * domain_.nruns();
+ + (sizeof(unsigned) + sizeof(T)) * domain_.nsites();
}
template <typename P, typename T>
@@ -193,7 +196,15 @@
inline
obased_rle_image<P, T>::obased_rle_image(const std::set<T>& values)
{
- this->data_ = new internal::data_< obased_rle_image<P,T> >(values);
+ init_(values);
+ }
+
+ template <typename P, typename T>
+ inline
+ void
+ obased_rle_image<P, T>::init_(const std::set<T>& values)
+ {
+ this->data_ = new internal::data< obased_rle_image<P,T> >(values);
}
template <typename P, typename T>
@@ -209,8 +220,8 @@
void
obased_rle_image<P, T>::insert(const p_run<P>& pr, T value)
{
- mln_assertion(this->data_->v_obj_.size() == 0 || this->data_->domain_.nruns() == 0 ||
- pr.first() > this->data_->domain_[this->data_->domain_.nruns() - 1].first());
+ mln_assertion(this->data_->v_obj_.size() == 0 || this->data_->domain_.nsites() == 0 ||
+ pr[0] > this->data_->domain_[this->data_->domain_.nsites() - 1].start());
this->data_->domain_.insert(pr);
this->data_->values_.push_back(value);
unsigned i;
@@ -218,7 +229,7 @@
&& this->data_->v_obj_[i] != value; ++i)
;
mln_assertion(i != this->data_->v_obj_.size());
- this->data_->obj_[i].push_back(this->data_->domain_.nruns() - 1);
+ this->data_->obj_[i].push_back(this->data_->domain_.nsites() - 1);
this->data_->bbox_[i].take(pr.bbox().pmin());
this->data_->bbox_[i].take(pr.bbox().pmax());
}
@@ -226,7 +237,7 @@
template <typename P, typename T>
inline
typename obased_rle_image<P, T>::rvalue
- obased_rle_image<P, T>::operator() (const runs_psite<P>& site)
+ obased_rle_image<P, T>::operator() (const mln_psite(pset)& site)
const
{
mln_precondition(this->has(site));
@@ -236,7 +247,7 @@
template <typename P, typename T>
inline
typename obased_rle_image<P, T>::lvalue
- obased_rle_image<P, T>::operator() (const runs_psite<P>& site)
+ obased_rle_image<P, T>::operator() (const mln_psite(pset)& site)
{
mln_precondition(this->has(site));
return this->data_->values_[site.index()];
Index: branches/cleanup-2008/milena/mln/core/image/rle_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/image/rle_image.hh (revision 2503)
+++ branches/cleanup-2008/milena/mln/core/image/rle_image.hh (revision 2504)
@@ -115,17 +115,17 @@
/// Skeleton.
typedef rle_image< tag::psite_<P>, tag::value_<T> > skeleton;
-
+ /// Constructor.
rle_image();
/// Add a new range to the image.
void insert(const p_run<P>& pr, T value);
/// Read-only access to the image value located at point \p p.
- rvalue operator() (const runs_psite<P>& site) const;
+ rvalue operator() (const mln_psite(pset)& site) const;
/// Read-write access to the image value located at point \p p.
- lvalue operator() (const runs_psite<P>& site);
+ lvalue operator() (const mln_psite(pset)& site);
/// Test if this image has been initialized.
bool has_data() const;
@@ -190,7 +190,7 @@
if (!this->has_data())
this->data_ = new internal::data< rle_image<P,T> >();
mln_assertion(this->data_->values_.size() == 0 ||
- pr.first() > this->data_->domain_[this->data_->domain_.nruns() - 1].first());
+ pr[0] > this->data_->domain_[this->data_->domain_.nsites() - 1].start());
this->data_->domain_.insert(pr);
this->data_->values_.push_back(value);
}
@@ -198,7 +198,7 @@
template <typename P, typename T>
inline
typename rle_image<P, T>::rvalue
- rle_image<P, T>::operator() (const runs_psite<P>& site)
+ rle_image<P, T>::operator() (const mln_psite(pset)& site)
const
{
mln_precondition(this->has(site));
@@ -208,7 +208,7 @@
template <typename P, typename T>
inline
typename rle_image<P, T>::lvalue
- rle_image<P, T>::operator() (const runs_psite<P>& site)
+ rle_image<P, T>::operator() (const mln_psite(pset)& site)
{
mln_precondition(this->has(site));
return this->data_->values_[site.index()];
Index: branches/cleanup-2008/milena/mln/core/image/tr_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/image/tr_image.hh (revision 2503)
+++ branches/cleanup-2008/milena/mln/core/image/tr_image.hh (revision 2504)
@@ -51,7 +51,7 @@
namespace internal
{
- /// Data structure for \c mln::tr_image<T,I>.
+ /// Data structure for \c mln::tr_image<S,I,T>.
template <typename S, typename I, typename T>
struct data< tr_image<S,I,T> >
{
@@ -117,7 +117,7 @@
if we do not provide set_ima(). */
tr_image();
-
+ /// Initialize an empty image.
void init_(const S& s, I& ima, const T& tr);
/// Test if this image has been initialized.
@@ -163,13 +163,13 @@
inline
tr_image<S,I,T>::tr_image(const S& s, I& ima, const T& tr)
{
- mln_precondition(ima.has_data());
- this->data_ = new internal::data< tr_image<S,I,T> >(s, ima, tr);
+ init_(s, ima, tr);
}
template <typename S, typename I, typename T>
inline
- void tr_image<S,I,T>::init_(const S& s, I& ima, const T& tr)
+ void
+ tr_image<S,I,T>::init_(const S& s, I& ima, const T& tr)
{
mln_precondition(ima.has_data());
this->data_ = new internal::data< tr_image<S,I,T> >(s, ima, tr);
@@ -177,13 +177,8 @@
template <typename S, typename I, typename T>
inline
- tr_image<S,I,T>::tr_image()
- {
- }
-
- template <typename S, typename I, typename T>
- inline
- bool tr_image<S,I,T>::has_data() const
+ bool
+ tr_image<S,I,T>::has_data() const
{
mln_invariant(this->delegatee_()->has_data());
return true;
@@ -191,7 +186,8 @@
template <typename S, typename I, typename T>
inline
- bool tr_image<S,I,T>::has(const algebra::vec<I::psite::dim, float>& v) const
+ bool
+ tr_image<S,I,T>::has(const algebra::vec<I::psite::dim, float>& v) const
{
mln_psite(I) p;
algebra::vec<I::point::dim, float> v2 = this->data_->tr_.inv()(v);
@@ -215,7 +211,6 @@
mln_value(I)
tr_image<S,I,T>::operator()(const psite& p)
{
- std::cout << "yay" << std::endl;
algebra::vec<I::psite::dim, float> v = p;
return this->data_->ima_(this->data_->tr_.inv()(v));
}
Index: branches/cleanup-2008/milena/mln/core/image/t_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/image/t_image.hh (revision 2503)
+++ branches/cleanup-2008/milena/mln/core/image/t_image.hh (revision 2504)
@@ -119,6 +119,11 @@
/// \param dim2 The second dimension to be swapped.
t_image(I& ima, unsigned dim1, unsigned dim2);
+
+ /// Initialize an empty image.
+ void init_(I& ima, unsigned dim1, unsigned dim2);
+
+
/// Test if this image has been initialized.
bool has_data() const;
@@ -182,6 +187,14 @@
inline
t_image<I>::t_image(I& ima, unsigned dim1, unsigned dim2)
{
+ init_(ima, dim1, dim2);
+ }
+
+ template <typename I>
+ inline
+ void
+ t_image<I>::init_(I& ima, unsigned dim1, unsigned dim2)
+ {
mln_precondition(ima.has_data());
/* FIXME: Add a precondition on the fact that the domain of ima is
a box. */
@@ -193,6 +206,7 @@
this->data_ = new internal::data< t_image<I> >(ima, dim1, dim2, box);
}
+
template <typename I>
inline
bool t_image<I>::has_data() const
Index: branches/cleanup-2008/milena/mln/algebra/vec.hh
===================================================================
--- branches/cleanup-2008/milena/mln/algebra/vec.hh (revision 2503)
+++ branches/cleanup-2008/milena/mln/algebra/vec.hh (revision 2504)
@@ -39,6 +39,7 @@
# include <mln/core/concept/object.hh>
+# include <mln/literal/zero.hh>
# include <mln/trait/all.hh>
# include <mln/trait/value_.hh>
# include <mln/fun/i2v/all_to.hh>
1
0
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
ChangeLog:
2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
Update tutorial..
* milena/doc/tutorial/tutorial.tex:
- Add a new section about sites
- Add new subsections about image domain and values.
- Talk about operator '/' used to create sub images.
---
tutorial.tex | 460 ++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 304 insertions(+), 156 deletions(-)
Index: branches/cleanup-2008/milena/doc/tutorial/tutorial.tex
===================================================================
--- branches/cleanup-2008/milena/doc/tutorial/tutorial.tex (revision 2502)
+++ branches/cleanup-2008/milena/doc/tutorial/tutorial.tex (revision 2503)
@@ -4,6 +4,7 @@
\usepackage{makeidx}
\usepackage{xcolor}
\usepackage{color}
+\usepackage{html}
\newcommand{\img}[4]{
\begin{figure}[ht!]
@@ -19,37 +20,66 @@
\author{LRDE}
\date{}
+\definecolor{ccomment}{rgb}{0.5,0,0}
+\definecolor{cstring}{rgb}{0,0.32,0.5}
+\definecolor{cidentifier}{rgb}{0,0.5,0}
+\definecolor{cbg}{rgb}{0.95,0.95,0.95}
+
%%%LISTINGS SETTINGS
\lstset{frameround=fttt}
\lstloadlanguages{C++}
\lstset{language=C++}
-\lstset{backgroundcolor=\color{black},
-basicstyle=\bfseries\color{white},
-identifierstyle=\color{green},
-stringstyle=\color{yellow},
-commentstyle=\color{red},
+
+%\lstset{backgroundcolor=\color{black},
+%basicstyle=\bfseries\color{white},
+%identifierstyle=\color{green},
+%stringstyle=\color{yellow},
+%commentstyle=\color{red},
+%showstringspaces=false,linewidth=14cm}
+
+\lstset{backgroundcolor=\color{cbg},
+basicstyle=\bfseries\color{black},
+identifierstyle=\color{black},
+stringstyle=\color{cstring},
+commentstyle=\color{ccomment},
showstringspaces=false,linewidth=14cm}
+\newenvironment{doxycode}
+{% This is the begin code
+\begin{latexonly}%
+\begin{lstlisting}[frame=single]%
+\end{latexonly}%
+\begin{htmlonly}%
+\backslash code%
+\end{htmlonly}%
+}
+{%
+\begin{htmlonly}%
+\backslash endcode%
+\end{htmlonly}%
+\begin{latexonly}%
+\end{lstlisting}%
+\end{latexonly}%
+}
+
+
+
\begin{document}
\tableofcontents
-ajouter dans => milena/doc/tutorial |
--------------------------------------------------
-
-\chapter{Foreword}
+\chapter*{Foreword}
-The following tutorial talks about 2D images. We chose that kind of images
-because it is easier to understand and this is the
-most used. \\
+The following tutorial explains the basic concepts behind Olena and how to use
+the most common objects and routines.
+This tutorial includes many code examples and figures. In order to make this
+tutorial easier to understand, we will mainly talk about 2D images. This is
+not so restrictive since 1D, 3D, $n$D images behave the same way.
-FIXME
-[dessin de grille 2d, colonnes/lignes numerotees + repere x/y]
-Intersection <=> point 2d <=> milieu d'un pixel \\
Since examples are based on 2D images pixels are actually "points" however we
-will call them "sites" which is the most generic name.\\
+will call them "sites" which is the most generic name.\newline
Here is also a list of common variable name conventions:
\begin{figure}[ht!]
@@ -63,21 +93,53 @@
\end{tabular}
\end{figure}
-Methods provided by the objects in the library are in constant time. If you need
-a specific method but you cannot find it, you may find an algorithm which can
-compute the information you need.
-
Olena is organized in a namespace hierarchy. Everything is declared by Olena
within the 'oln::' namespace, and possibly a sub-namespace such as
'oln::arith::' (arithmetic operations on images), 'oln::morpho::' (morphological
-operations), etc. For the sake of simplicity, we will neglect the 'oln::'
+operations), etc. Usually, the namespace hierarchy is mapped to the mln
+directory tree. For the sake of simplicity, we will neglect the 'oln::'
prefix in all the code examples.
+Methods provided by objects in the library are in constant time. If you need
+a specific method but you cannot find it, you may find an algorithm which can
+compute the information you need.
+
+\clearpage
+\newpage
+\chapter{Site}
+
+Usually, when talking about images, we think about common images composed of a
+set of pixels.
+Since Olena is generic, we want to support many kind of images, even images
+which are not composed of a set of pixels, such as images of images.
+
+In order to express this genericity, we have the ``site'' concept.
+This concept allows us to divide a pixel into two information:
+\begin{itemize}
+ \item The coordinates (the site itself).
+ \item The value.
+\end{itemize}
+
+Let's say we have 2D grid like this:
+
+//FIXME
+[dessin de grille 2d, colonnes/lignes numerotees + repere x/y]
+Intersection == point 2d == milieu d'un pixel \\
+
+On a regular grid like this, in 2D, we usually use a 2D point as a site which
+means we have the following equivalence:
+
+\begin{center}
+ Intersection $\equiv$ point2d (2D site) $\equiv$ center of a pixel
+\end{center}
+
+The site does not store any value but refer to an area where we will be able
+to read its value.
-\chapter{Concepts}
-//FIXME lister \underline{TOUS} les concepts (core/concepts)
-\section{Site set}
+\clearpage
+\newpage
+\chapter{Site set}
Site sets are used:
\begin{enumerate}
@@ -85,66 +147,67 @@
\item As Site container.
\end{enumerate}
+They do not actually store any image value. They only store site information.
+
Here is a list of all the site set concepts which can be found in
core/site\_set:
\begin{tabular}{|l|p{8cm}|}
\hline
-Site set & Description \\ \hline
+Site set & Description \\
+\hline
-p\_key & \\ \hline
-p\_priority & \\ \hline
-p\_box & \\ \hline
-p\_bgraph & \\ \hline
-p\_double & \\ \hline
-p\_if & \\ \hline
-p\_line\_graph & \\ \hline
-p\_queue\_fast & \\ \hline
-p\_set & \\ \hline
-p\_faces & \\ \hline
-p\_queue & \\ \hline
-p\_set\_of & \\ \hline
-line2d & \\ \hline
-p\_complex & \\ \hline
-p\_graph & \\ \hline
-p\_image & \\ \hline
-p\_mutable\_array\_of & \\ \hline
-p\_run & \\ \hline
-p\_vaccess & \\ \hline
+p\_array & site array. \\
+\hline
+p\_box & compact domain definde on a regular grid (in 2D, a rectangle). \\
+\hline
+p\_if & site set verifying a predicate. \\
+\hline
+p\_queue & site queue. \\
+\hline
+p\_run & site range. \\
+\hline
+p\_runs & site range set. \\
+\hline
+p\_set & mathematical site set. \\
+\hline
+p\_vaccess & site set ordered by value. \\
+\hline
+p\_edges & set of graph edges associated to sites. \\
+\hline
+p\_vertices & set of graph vertices associated to sites.\\
+\hline
\end{tabular}
-\subsection{Basic interface}
+\section{Basic interface}
Common basic interface:\\
\begin{tabular}{|l|l|l|l|p{4cm}|}
\hline
-Return Type & Name & Arguments & Const & Commor type automatically from the
-given container type
-passed as parameter. These macros can be used with any container like images or
-site sets.ents \\ \hline
+Return Type & Name & Arguments & Const & Comments \\ \hline
bool & is\_valid & - & X & Returns true if it has been initialized. The
-default constructor does not do it. \\ \hline
+default constructor does not initialize it. \\ \hline
bool & has & const P\& p & X & \\ \hline
\end{tabular} \\
-\subsection{Optional interface}
+\section{Optional interface}
Site sets may have other methods depending on their type: \\
\begin{tabular}{|l|l|l|l|p{4cm}|}
\hline
Return Type & Name & Arguments & Const & Comments \\ \hline
-size\_t & nsites & - & - & \\ \hline
+size\_t & nsites & - & - & Return the number of sites. \\ \hline
const Box\& & bbox & - & X & Bounding box. Available only on grid site sets.
\\ \hline
\end{tabular} \\
The previous methods are available depending on the site set. A box
will have the bbox() method since it can be retrived in constant time: a box
-is it's own bounding box (see \ref{fig:box_bbox}).
+is it's own bounding box.
\begin{lstlisting}[frame=single]
box2d b(2,3);
@@ -164,6 +227,7 @@
P\_array and box both have a nsites method since the internal structure allow a
constant time retrieval.
+%\begin{doxycode}
\begin{lstlisting}[frame=single]
p_array<point2d> arr;
@@ -175,13 +239,12 @@
// it can be retrieved in constant time.
std::cout << "nsites = " << arr.nsites() << std::endl;
\end{lstlisting}
-
-
+%\end{doxycode}
\clearpage
\newpage
-\section{Image}
+\chapter{Image}
An image is composed both of:
\begin{itemize}
@@ -196,31 +259,21 @@
\item A site set, also called the "domain".
\end{itemize}
-An image2d will always have its bouding box defined by a box2d whatever the
-site set used to define its domain.
-The Value set, which includes all the possible values a site can have, is also
-called "destination" set.
-
-An image has a virtual border which is defined thanks to its domain. The
- border is virtual since the image can have an extended domain as well.
-That one is optional, it defines sites outside the virtual border which is
-useful in algorithms when working with sites being part of the domain but close
-to the borders. The extended domain can be defined thanks to a function, an
-image or a site set.
-
-//FIXME: remove this line
-ici, site <=> Point2d
-
-
\section{About value, rvalue and lvalue}
+Since the values are of a specific type, it exists a set of all the possible
+site values. This set is called "destination" set. It may be iterable and
+printable if it is finite and not too huge.
+
Image types provide a method to access values, namely "operator() const".
Yet, its signature is NOT "value operator()(const site\& p) const"
but "rvalue operator()(const psite\& p) const"
For instance, with I being image2d$<$int\_u8$>$, we have :
+\begin{center}
I::value == int\_u8 but I::rvalue == const int\_u8\&
+\end{center}
so copying the value when the call "f(p)" returns is avoided.
In that case, it is a low-level implementation issue that makes rvalue
@@ -233,8 +286,48 @@
With I being image2d$<$int\_u8$>$, we have :
+\begin{center}
I::value == int\_u8 but I::lvalue == int\_u8\&
+\end{center}
+
+\section{Domain}
+The site set contains the sites which compose the image. Sites are based on a
+grid so the image depends on that grid as well.
+It means that an image 2D can only be defined by sites based on a 2D grid.
+Likewise, an image2d will always have its bouding box defined by a box2d.
+
+Being defined on a grid means that the image can be defined anywhere.
+For instance, defining a 2D image with a box2d starting from point (-20, -20)
+ to (-3, 5) is completely valid.
+
+The following example shows that the definition domain and the site set are
+exactly equivalent.
+
+\begin{lstlisting}[frame=single]
+ box2d b(-2,3, 3,-5); // Define a box2d from (-2,3) to (3,-5).
+ image2d<int> ima(b); // Define the domain of the image.
+
+ cout << b << std::endl; // Display b
+
+ cout << ima.domain() << std::endl; // Display b too
+\end{lstlisting}
+
+
+\section{Border and extension}
+// FIXME: COMPLETELY WRONG!!!
+// FIXME: Tell that the user can disable the border/extension: foo(ima | ima.domain())
+An image has a virtual border which is defined thanks to its domain. The
+ border is virtual since the image can have an extended domain as well.
+That one is optional, it defines sites outside the virtual border which is
+useful in algorithms when working with sites being part of the domain but close
+to the borders. The extended domain can be defined thanks to a function, an
+image or a site set.
+//FIXME ADD FIGURE
+
+\section{Morphed images}
+//FIXME: Write it!
+// Pas concrete, light, how to concrete
\section{Sample code}
In order to create a 2D image, you have two possibilites:
@@ -248,32 +341,24 @@
The empty image has no data and its definition domain is still unset. We do
not know yet the number of sites it contains. However, it is really useful to
have such an "empty image" because it is a placeholder for the result of some
-processing, or another image.
-
-Trying to access the site value from an empty image leads to an error at
-run-time.
-
+processing, or another image. Trying to access the site value from an empty
+image leads to an error at run-time.
-\begin{lstlisting}[frame=single]
- box2d b(2,3);
- image2d<int> ima(b); // Define the domain of the image.
-
- cout << b << std::endl; // Display b
-
- cout << ima.domain() << std::endl; // Display b too
-\end{lstlisting}
+The following example illustrates how to map data to a site throughout the
+image.
\begin{lstlisting}[frame=single]
box2d b(2,3);
image2d<int> ima(b);
point2d p(1, 2);
- ima.at(1,2) = 9; // The value is returned by reference
- // and can be changed.
+ // Associate '9' as value for the site/point2d (1,2).
+ // The value is returned by reference and can be changed.
+ ima.at(1,2) = 9;
cout << ima(p) << std::endl; // prints 9
ima(p) = 2; // The value is returned by reference
- // and can be changed.
+ // and can be changed as well.
cout << ima(p) << std::endl; // prints 2
\end{lstlisting}
@@ -287,7 +372,7 @@
std::cout << (imga.has(p) ? "true" : "false") << std::endl;
\end{lstlisting}
-Since the notion of point is independent from the image it applies on, we can
+Since the notion of site is independent from the image it applies on, we can
form expressions where p is used on several images:
\begin{lstlisting}[frame=single]
// At index (9, 9), both values change.
@@ -298,7 +383,7 @@
\end{lstlisting}
-Images do not actually store the data in the class. This is a pointer
+Images do not actually store the data in the class. Images store a pointer
to an allocated space which can be shared with other objects. Once an image is
assigned to another one, the two images share the same data so they have the
same ID and point to the same memory space.
@@ -338,7 +423,7 @@
In the Olena library, all image types behave like image2d:
\begin{itemize}
-\item An "empty" image actually is a mathematical variable.
+\item An "empty" image is actually a mathematical variable.
$\rightarrow$ just think in a mathemetical way when dealing with images;
@@ -357,7 +442,7 @@
-\subsection{Interface}
+\section{Interface}
\begin{tabular}{|l|l|l|l|p{4cm}|}
\hline
@@ -381,19 +466,16 @@
\end{tabular}
-
-\newpage
-\section{Neighborhood}
-
-
-
+\clearpage
\newpage
-\section{Window}
+\chapter{Window and Neighborhood}
-\chapter{Sites and psites}
+\clearpage
+\newpage
+\chapter{Sites, psites and dpoints}
\section{Need for site}
@@ -432,7 +514,7 @@
Let's have a small example. Define a function returning a value for a given
point:
-
+\clearpage
\begin{lstlisting}[frame=single]
unsigned my_values(const point2d& p)
{
@@ -471,13 +553,10 @@
+-+-+
\end{lstlisting}
-However, in memory, since it is based on a p\_array, values are stored in a
+However, in memory, since it is based on a p\_array, sites are stored in a
vector.
-The site x is the point (3, 7). The image values are stored in a
-vector where the index is the offset of the cell from the beginning of the
-vector. The site x thus corresponds to the cell 1.
-
+The site x is the point (3, 7) which corresponds to the cell 1 in the p\_array.
\begin{lstlisting}[frame=single]
arr[] = 0 1 2 3 4
@@ -486,9 +565,10 @@
+-+-+-+-+-+
\end{lstlisting}
-Obviously, from the site coordinates, we cannot access the associated data in
-constant-time. That's why we need a different mechanism in order to access
-this data: the psites.
+Obviously, we cannot check in constant time whether the site x, point2d here,
+is part of that image or not: knowing the point coordinates is not enough.
+That's why we need a different mechanism in order to access this information:
+the psites.
Here we have:
@@ -520,14 +600,18 @@
How it works: a psite inherits from internal::site\_impl$<$site$>$ which is
specialized for every site type; for instance, internal::site\_impl$<$point2d$>$
owns the method "coord row() const" which is defined as
-"return exact(this)->to\_site().row()"
+"return exact(this)-$>$to\_site().row()"
+\section{Need for dpoint}
+//FIXME
+\clearpage
+\newpage
\chapter{Iterators}
Each container object in Olena like site sets or images have iterators.
The iteration mechanism for images is directly derived from the mechanism
-for site set.
+for site sets.
There are usually three kinds:
\begin{itemize}
@@ -552,7 +636,7 @@
As you may have noticed, according to the data type, the word "iter" is prefixed
by the usual name variable used for that data type. Sites variables are usually
-called 'p' so the proper iterator is "piter".\\
+called 'p' so the proper iterator is "piter". (See the foreword)\\
An iterator has the following interface: \\
@@ -589,19 +673,32 @@
passed as parameter. These macros can be used with any container like images or
site sets.
-\begin{lstlisting}[frame=single]
- image2d<int> ima(box2d(2, 3));
+Here follow an example with the implemantions of the most basic routines which use the for\_all
+loop: fill and paste.
- mln_piter(box2d) p(ima.domain());
+\begin{lstlisting}[frame=single]
+template <typename I>
+void fill(I& ima, mln_value(I) v)
+{
+ mln_piter(I) p(ima.domain());
for_all(p)
- std::cout << p << std::endl;
-
- mln_viter(image2d<int>) v(ima.destination());
- for_all(v)
- std::cout << v << std::endl;
+ ima(p) = v;
+}
\end{lstlisting}
+\begin{lstlisting}[frame=single]
+template <typename I, typename J>
+void paste(const I& data, J& dest)
+{
+ mln_piter(I) p(data.domain());
+ for_all(p)
+ dest(p) = data(p);
+}
+\end{lstlisting}
+
+\clearpage
+\newpage
\chapter{Basic operations}
//FIXME : illustrer
@@ -620,8 +717,7 @@
\hline
\end{tabular} \\
-
-\section{Examples}
+\section{Fill}
First, create an image:
\begin{lstlisting}[frame=single]
image2d<char> imga(0, 0, 20, 20);
@@ -645,6 +741,7 @@
strictly map their C++ name; so oln::level::fill is defined in the file
"oln/level/fill.hh".
+\subsection*{Note}
Most algorithms in Olena are constructed following the classical scheme: "output
algo(input)", where the input image is only read. However some few algorithms
take an input image in order to modify it. To enforce this particular feature,
@@ -652,9 +749,10 @@
modified "inplace". The algorithm call shall be "level::fill(inplace(ima),
val)". When forgetting the "inplace(..)" statement it does not compile.
+
+\section{Paste}
We then define below a second image to play with. As you can see this image has
-data for the sites (5, 5) to (14, 14) (so it has 100 sites). The definition
-domain of a 2D image can start from any sites, even a negative one.
+data for the sites (5, 5) to (14, 14) (so it has 100 sites).
\begin{lstlisting}[frame=single]
image1d<char> imgb(5, 5, 14, 14);
@@ -677,6 +775,7 @@
//FIXME : ajouter des zolies zimages again.
+\subsection*{Note}
With this simple example we can see that images defined on different domains (or
set of sites) can interoperate. The set of sites of an image is defined and
can be accessed and printed. The following code:
@@ -701,37 +800,13 @@
(whose values are to be pasted) is a subset of the destination image.
-\begin{figure}[ht!]
- \begin{lstlisting}[frame=single]
-template <typename I>
-void fill(I& ima, mln_value(I) v)
-{
- mln_piter(I) p(ima.domain());
- for_all(p)
- ima(p) = v;
-}
- \end{lstlisting}
- \caption{Implementation of the fill routine.\label{fig:fill_impl}}
-\end{figure}
-
-
-\begin{figure}[ht!]
- \begin{lstlisting}[frame=single]
-template <typename I, typename J>
-void paste(const I& data, J& dest)
-{
- mln_piter(I) p(data.domain());
- for_all(p)
- dest(p) = data(p);
-}
- \end{lstlisting}
- \caption{Implementation of the paste routine.\label{fig:paste_impl}}
-\end{figure}
+\section{Blobs}
+//FIXME: write it!
\newpage
\section{Working with parts of an image}
-Sometime it may be interesting to work only on some part of the image or to
+Sometime it may be interesting to work only on some parts of the image or to
extract only a sub set of that image. Olena enables that thoughout out the
operator '$|$'.
@@ -751,14 +826,14 @@
A Sub Domain can be a site set, an image or any value returned by this
operator.
For a given site, Function\_p2v returns a Value and Function\_p2b returns a
-boolean. These functions. are actually a sort of predicate. You can easily get
-of function of function\_p2v kind thanks to pw::value(Image). It returns the
+boolean. These functions. are actually a sort of predicate. A common
+function\_p2v is pw::value(Image). It returns the
point to value function used in the given image. C functions can also be used as
predicate by passing the function pointer.
You can easily get a function\_p2b by comparing the value returned
by a function\_p2v to another Value.
-The following sample code illustrates this feature.
+The following sample codes illustrate this feature.
In order to use C functions as predicate, they must have one of the following
prototype if you work on 2D images:
@@ -773,7 +848,7 @@
Of course, you just need to change the point type if you use another image
type. For instance, you would use point3d with 3D images.
The returned value type V for function\_p2v depends on the image value type.
-With image2d<int>, V would be int.
+With image2d$<$int$>$, V would be int.
In this section, all along the examples, the image "ima" will refer to the
following declaration:
@@ -826,7 +901,7 @@
// Get the sub site set containing only the sites
// part of component 2.
- mln_VAR(lab_2, lab_2b.domain(1));
+ mln_VAR(lab_2, lab_2b.domain(true));
// Fill the sites of component 2 with red.
fill(lab_2, color::red);
@@ -861,9 +936,82 @@
...
}
\end{lstlisting}
+%
+%
+\medskip
+%
+%
+\subsection*{Important note}
+When writing:
+
+\begin{lstlisting}[frame=single]
+ ima | sub_D
+\end{lstlisting}
+
+sub\_D must be included in ima.domain().
+
+Let's have an image, \textit{imab}, like this:
+\begin{lstlisting}[frame=single]
+0 1 0
+1 1 1
+\end{lstlisting}
+
+Extract a sub image from \textit{imab} with sites having their value set to 1.
+\begin{lstlisting}[frame=single]
+mln_VAR(imab1, imab | (pw::value(imab) == 1u));
+\end{lstlisting}
+
+Then, \textit{imab1} looks like:
+\begin{lstlisting}[frame=single]
+ 1
+1 1 1
+\end{lstlisting}
+
+Now, if we want to extract a sub image it may fail, depending on the site set
+used:
+\begin{lstlisting}[frame=single]
+box2d b1(1,0, 1, 2);
+mln_VAR(imac, imab1 | b1);
+
+// Print:
+// 1 1 1
+debug::prinln(imac);
+
+box2d b2(0,0, 1, 1);
+// Will fail at runtime.
+// ima.domain().has((0,0)) is false.
+mln_VAR(imad, imab1 | b2);
+debug::prinln(imad);
+\end{lstlisting}
+
+If you do not want this constraint, you may want to use an alternative
+operator:
+\begin{lstlisting}[frame=single]
+ ima / sub_D
+\end{lstlisting}
+
+In that case there is no restriction on the domain at all and the following example will work.
+\begin{lstlisting}[frame=single]
+box2d b2(0,0, 1, 1);
+
+mln_VAR(imad, imab1 / b2);
+
+// Print
+// 1
+// 1 1
+debug::prinln(imad);
+\end{lstlisting}
+With this operator, an intersection is applied on the image domain and the
+site set.
+
+\newpage
+\clearpage
\chapter{Graphes and images}
+
+//FIXME: REWRITE
+
\section{Description}
Olena enables the possibility of using graphes with images.
Graphes can help you to handle directly parts of an image and represent their
1
0
---
ChangeLog | 81 ++++++++
milena/mln/core/site_set/p_edges.hh | 262 ++++++++++++++++++++++++++
milena/mln/util/internal/graph_edge_psite.hh | 126 ++++++++++++
milena/tests/core/site_set/Makefile.am | 2 +
milena/tests/core/site_set/p_edges.cc | 93 +++++++++
5 files changed, 564 insertions(+), 0 deletions(-)
create mode 100644 milena/mln/core/site_set/p_edges.hh
create mode 100644 milena/mln/util/internal/graph_edge_psite.hh
create mode 100644 milena/tests/core/site_set/p_edges.cc
diff --git a/ChangeLog b/ChangeLog
index 0353d7e..e4e58c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,84 @@
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add p_edges.
+
+ * milena/mln/core/site_set/p_edges.hh:
+ The site set p_edges.
+
+ * milena/mln/util/internal/graph_edge_psite.hh:
+ The associated psite.
+
+ * milena/tests/core/site_set/Makefile.am,
+ * milena/tests/core/site_set/p_edges.cc:
+ Add a basic test.
+
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Refactor graph_vertex_psite.
+
+ * milena/mln/util/internal/graph_vertex_psite.hh:
+ Refactor this class...
+ * milena/mln/util/internal/graph_psite_base.hh:
+ ... here.
+
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix util::graph<G>::is_subgraph_of().
+
+ * milena/mln/util/graph.hh: here.
+
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add missing methods to vertex and edge.
+
+ * milena/mln/util/internal/graph_edge.hh:
+ Add change_graph().
+ * milena/mln/util/internal/graph_vertex.hh:
+ Add invalidate().
+
+
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add p_vertices.
+
+ * milena/mln/core/site_set/p_vertices.hh:
+ The site set p_vertices.
+
+ * milena/mln/util/internal/graph_vertex_psite.hh:
+ The psite associated to p_vertices.
+
+ * milena/tests/core/site_set/p_vertices.cc,
+ * milena/tests/core/site_set/Makefile.am:
+ Add a small test.
+
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add a missing method to graph_vertex_iter.
+
+ * milena/mln/util/internal/graph_vertex_iter.hh:
+ Add a missing update_graph() method.
+
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix invalid compilation of graph_vertex.
+
+ * milena/mln/util/internal/graph_vertex.hh:
+ Remove useless const and a wrong precondition.
+
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix missing methods in graph_base.
+
+ * milena/mln/util/internal/graph_base.hh:
+ Add new has() overload for convenience.
+
+2008-10-03 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Update p_graph_piter.
+
+ * milena/mln/core/site_set/p_graph_piter.hh:
+ update in order to make it work with the new graph structure.
+
2008-09-30 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update reconstruction algorithms in theo's sandbox.
diff --git a/milena/mln/core/site_set/p_edges.hh b/milena/mln/core/site_set/p_edges.hh
new file mode 100644
index 0000000..3c94998
--- /dev/null
+++ b/milena/mln/core/site_set/p_edges.hh
@@ -0,0 +1,262 @@
+ // 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.
+ // reasons why the executable file might be covered by the GNU General
+ // Public License.
+
+#ifndef MLN_CORE_SITE_SET_P_EDGES_HH
+# define MLN_CORE_SITE_SET_P_EDGES_HH
+
+ /// \file mln/core/site_set/p_edges.hh
+ /// \brief Definition of a site set based on graph edges.
+
+# include <mln/core/internal/site_set_base.hh>
+# include <mln/core/site_set/p_graph_piter.hh>
+# include <mln/util/internal/graph_edge_psite.hh>
+# include <mln/util/graph.hh>
+
+
+namespace mln
+{
+ // Forward declaration.
+ template <typename G, typename F> struct p_edges;
+
+ namespace trait
+ {
+ template <typename G, typename F>
+ struct site_set_< p_edges<G, F> >
+ {
+ // FIXME: I don't know what to use yet!
+ typedef trait::site_set::nsites::known nsites;
+ typedef trait::site_set::bbox::unknown bbox;
+ typedef trait::site_set::contents::fixed contents;
+ typedef trait::site_set::arity::unique arity;
+ };
+ } // end of namespace mln::trait
+
+
+ template <typename G, typename F>
+ class p_edges
+ : public internal::site_set_base_< typename F::result, p_edges<G, F> >
+ {
+ typedef util::edge<G> edge_t;
+
+ typedef p_edges<G, F> self_;
+ typedef internal::site_set_base_< typename F::result, self_ > super_;
+
+ typedef G graph_t;
+
+ public:
+ /// \brief Construct a graph edge psite set from a graph and a function.
+ ///
+ /// \param gr The graph upon which the graph edge psite set is built.
+ /// \param f the function mapping edges and sites.
+ p_edges(const graph_t& gr, const F& f);
+
+ /// Associated types.
+ /// \{
+ /// Element associated type.
+ typedef mln_site(super_) element;
+ /// Point_Site associated type.
+ typedef internal::edge_psite<G, F> psite;
+
+ /// Forward Site_Iterator associated type.
+ typedef p_graph_piter< self_, mln_edge_fwd_iter(G) > fwd_piter;
+
+ /// Backward Site_Iterator associated type.
+ typedef p_graph_piter< self_, mln_edge_bkd_iter(G) > bkd_piter;
+
+ /// Site_Iterator associated type.
+ typedef fwd_piter piter;
+ /// \}
+
+ /// \brief Return The number of points (sites) of the set, i.e.,
+ /// the number of \em edges.
+ size_t nsites() const;
+
+ /// Return The number of edges in the graph.
+ std::size_t nedges() const;
+
+ /// Is this site set valid?
+ bool is_valid() const;
+ /// Invalidate this site set.
+ void invalidate();
+
+ /// Does this site set has site \a p?
+ bool has(const psite& p) const;
+
+ /// Does this site set has edge \a e?
+ template <typename G2>
+ bool has(const util::edge<G2>& e) const;
+
+ // FIXME: Dummy.
+ std::size_t memory_size() const;
+
+ /// Accessors.
+ /// \{
+ /// Return the graph associated to this site set
+ const graph_t& g() const;
+ /// Return the mapping function.
+ F function() const;
+ /// \}
+
+ private:
+ mlc_const(graph_t)* g_;
+ F f_;
+ };
+
+
+ /// \brief Comparison between two mln::p_edges's.
+ ///
+ /// Two mln::p_edges's are considered equal if they share the
+ /// same graph.
+ template <typename G, typename F>
+ bool
+ operator==(const p_edges<G, F>& lhs, const p_edges<G, F>& rhs);
+
+
+ /// \brief Inclusion of a mln::p_edges in another one.
+ ///
+ /// \todo Refine this later, when we are able to express subgraph
+ /// relations.
+ template <typename G, typename F>
+ bool
+ operator<=(const p_edges<G, F>& lhs, const p_edges<G, F>& rhs);
+
+} // end of mln
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ template <typename G, typename F>
+ inline
+ p_edges<G, F>::p_edges(const graph_t& g, const F& f)
+ : g_ (&g), f_(f)
+ {
+ }
+
+ template <typename G, typename F>
+ inline
+ size_t
+ p_edges<G, F>::nsites() const
+ {
+ return nedges();
+ }
+
+ template <typename G, typename F>
+ inline
+ std::size_t
+ p_edges<G, F>::nedges() const
+ {
+ return this->g_->e_nmax();
+ }
+
+ template <typename G, typename F>
+ inline
+ bool
+ p_edges<G, F>::is_valid() const
+ {
+ return g_ != 0;
+ }
+
+ template <typename G, typename F>
+ inline
+ void
+ p_edges<G, F>::invalidate()
+ {
+ g_ = 0;
+ }
+
+ template <typename G, typename F>
+ inline
+ bool
+ p_edges<G, F>::has(const psite& p) const
+ {
+ mln_precondition(is_valid());
+ return has(p.e());
+ }
+
+ template <typename G, typename F>
+ template <typename G2>
+ inline
+ bool
+ p_edges<G, F>::has(const util::edge<G2>& e) const
+ {
+ mln_precondition(is_valid());
+ return e.g()->is_subgraph_of(*g_) && g_->has(e) && e.is_valid();
+ }
+
+ template <typename G, typename F>
+ inline
+ std::size_t
+ p_edges<G, F>::memory_size() const
+ {
+ // FIXME: Dummy; implement (see other site sets).
+ abort();
+ return 0;
+ }
+
+ template <typename G, typename F>
+ inline
+ const typename p_edges<G, F>::graph_t&
+ p_edges<G, F>::g() const
+ {
+ mln_precondition(is_valid());
+ return *g_;
+ }
+
+ template <typename G, typename F>
+ inline
+ F
+ p_edges<G, F>::function() const
+ {
+ return f_;
+ }
+
+ template <typename G, typename F>
+ bool
+ operator==(const p_edges<G, F>& lhs, const p_edges<G, F>& rhs)
+ {
+ /* FIXME: We should not rely on pointer equality here, as graph
+ will soon become shells using (shared) tracked pointers to
+ actual data. So, delegate the equality test to the graphs
+ themselves. */
+ return (*lhs.g_) == (*rhs.g_);
+ }
+
+ template <typename G, typename F>
+ bool
+ operator<=(const p_edges<G, F>& lhs, const p_edges<G, F>& rhs)
+ {
+ return lhs == rhs;
+ }
+
+} // end of mln
+
+# endif // ! MLN_INCLUDE_ONLY
+
+#endif // MLN_CORE_SITE_SET_P_EDGES_HH
diff --git a/milena/mln/util/internal/graph_edge_psite.hh b/milena/mln/util/internal/graph_edge_psite.hh
new file mode 100644
index 0000000..5e00d18
--- /dev/null
+++ b/milena/mln/util/internal/graph_edge_psite.hh
@@ -0,0 +1,126 @@
+// 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.
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_UTIL_INTERNAL_GRAPH_EDGE_PSITE_HH
+# define MLN_UTIL_INTERNAL_GRAPH_EDGE_PSITE_HH
+
+# include <mln/core/concept/pseudo_site.hh>
+# include <mln/util/internal/graph_psite_base.hh>
+
+namespace mln
+{
+
+ template <typename G, typename F> class p_edges;
+
+} // end of namespace mln
+
+/// \file mln/util/internal/edge_psite.hh
+/// \brief Implementation of p_edges psite.
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ template <typename G, typename F>
+ class edge_psite :
+ public graph_psite_base<util::edge<G>, typename F::result,
+ p_edges<G, F>,
+ edge_psite<G, F> >
+ {
+ typedef edge_psite<G, F> self_;
+ typedef p_edges<G, F> target_t;
+ typedef graph_psite_base<util::edge<G>, typename F::result, target_t, self_> super_;
+ typedef util::edge<G> edge_t;
+
+ public:
+ /// Associated Types
+ /// \{
+ /// Site type, the return type of the mapping function \p F here.
+ typedef typename F::result site;
+ /// \}
+
+ /// Constructors
+ /// \{
+ edge_psite();
+ edge_psite(const target_t& t);
+ /// \}
+
+ /// Accessors
+ /// \{
+ /// Return the underlying edge.
+ const edge_t& e() const;
+ /// \}
+
+ protected:
+ /// The underlying edge (inherited).
+ using super_::v_;
+ };
+
+ } // end of namespace internal
+
+} // end of namespace mln
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ template <typename G, typename F>
+ inline
+ edge_psite<G, F>::edge_psite()
+ {
+ }
+
+ template <typename G, typename F>
+ inline
+ edge_psite<G, F>::edge_psite(const target_t& t)
+ {
+ this->change_target(t);
+ }
+
+ template <typename G, typename F>
+ inline
+ const typename edge_psite<G, F>::edge_t&
+ edge_psite<G, F>::e() const
+ {
+ return v_;
+ }
+
+ } // end of namespace internal
+
+} // end of namespace mln
+
+# endif // !MLN_INCLUDE_ONLY
+
+#endif // !MLN_UTIL_INTERNAL_GRAPH_EDGE_PSITE_HH
+
diff --git a/milena/tests/core/site_set/Makefile.am b/milena/tests/core/site_set/Makefile.am
index d1b2cf6..1b23c79 100644
--- a/milena/tests/core/site_set/Makefile.am
+++ b/milena/tests/core/site_set/Makefile.am
@@ -5,6 +5,7 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
p_array \
## p_bgraph \
+ p_edges \
p_image \
p_priority_queue \
p_queue \
@@ -22,5 +23,6 @@ p_queue_fast_SOURCES = p_queue_fast.cc
p_set_SOURCES = p_set.cc
pset_if_SOURCES = pset_if.cc
p_vertices_SOURCES = p_vertices.cc
+p_edges_SOURCES = p_edges.cc
TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/core/site_set/p_edges.cc b/milena/tests/core/site_set/p_edges.cc
new file mode 100644
index 0000000..9ab01a1
--- /dev/null
+++ b/milena/tests/core/site_set/p_edges.cc
@@ -0,0 +1,93 @@
+// Copyright (C) 2008 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.
+
+/*! \file tests/core/site_set/p_edges.cc
+ *
+ * \brief Tests on mln::p_edges.
+ */
+
+#include <mln/util/graph.hh>
+#include <mln/core/alias/point2d.hh>
+#include <mln/core/site_set/p_edges.hh>
+
+// Function mapping an edge to a specific site.
+template <typename G>
+struct my_fun
+{
+ typedef mln::point2d result;
+
+ const result& operator()(const mln::util::edge<G>& v) const
+ {
+ static mln::point2d res(0, 0);
+ res.row() = v.id();
+ return res;
+ }
+};
+
+int main()
+{
+ using namespace mln;
+
+ // Create a graph.
+ util::graph g;
+ g.add_vertex (); // 0
+ g.add_vertex (); // 1
+ g.add_vertex (); // 2
+ g.add_vertex (); // 3
+ g.add_vertex (); // 4
+ g.add_vertex (); // 5
+ g.add_edge (0, 1);
+ g.add_edge (0, 2);
+ g.add_edge (3, 4);
+ g.add_edge (4, 5);
+ g.add_edge (5, 4);
+ g.add_edge (1, 0);
+ g.add_edge (5, 3);
+ g.add_edge (2, 1);
+
+ typedef p_edges<util::graph, my_fun<util::graph> > p_edges;
+ p_edges pv(g, my_fun<util::graph>());
+
+ // Forward iterator
+ {
+ mln_fwd_piter_(p_edges) p(pv);
+ unsigned i = 0;
+ for_all(p)
+ mln_assertion(p.p_hook_().e().id() == i++);
+ mln_assertion(i == g.e_nmax());
+ }
+ // Backward iterator
+ {
+ mln_bkd_piter_(p_edges) p(pv);
+ unsigned i = g.e_nmax() - 1;
+ for_all(p)
+ mln_assertion(p.p_hook_().e().id() == i--);
+ mln_assertion(i == UINT_MAX);
+ }
+
+ return 0;
+}
--
1.5.6.5
2
1