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
May 2008
- 11 participants
- 115 discussions
Re: [Olena-patches] [Olena] #7: Miscellaneous tasks related to the Olena 1.0 release process
by Olena 02 May '08
by Olena 02 May '08
02 May '08
#7: Miscellaneous tasks related to the Olena 1.0 release process
-----------------------+----------------------------------------------------
Reporter: levill_r | Owner: levill_r
Type: task | Status: new
Priority: major | Milestone: Olena 1.0
Component: other | Version: 1.0
Resolution: | Keywords: release NEWS dates copyright headers sandbox
-----------------------+----------------------------------------------------
Changes (by levill_r):
* keywords: release NEWS dates copyright headers => release NEWS dates
copyright headers sandbox
* priority: trivial => major
Old description:
> To do before the release
> * update `NEWS` (see the similar task for Olena 0.10a/0.11: #8);
> * update `AUTHORS`;
> * ensure all copyright headers are sound (using Benoît Sigoure's
> `gplize.sh` script, or a variant of it);
> * use Vaucanson' `reheader` script to fix broken headers.
>
> Split this ticket in several parts if the tasks are either too big or too
> numerous.
New description:
To do before the release:
* move away any information about sandboxes (as they won't be
distributed):
* create a !ChangeLog in source:trunk/milena/sandbox, or several
!ChangeLogs in subdirectories;
* move information from source:trunk/milena/ChangeLog to this (these)
file(s);
* warn the Olena Team about these changes, and have them document
changes in the right place;
* update `NEWS` (see the similar task for Olena 0.10a/0.11: #8);
* update `AUTHORS`;
* ensure all copyright headers are sound (using Benoît Sigoure's
`gplize.sh` script, or a variant of it);
* use Vaucanson' `reheader` script to fix broken headers.
Split this ticket in several parts if the tasks are either too big or too
numerous.
Comment:
Mention the case of sandboxes.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/7#comment:8>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add adjaceny tests for mln::p_line_graph.
* mln/core/p_line_graph.hh
(mln::p_line_graph<P>::adjacent)
(mln::p_line_graph<P>::adjacent_or_equal):
New methods.
(mln::p_line_graph<P>::p_line_graph): Remove outdated FIXME.
* mln/core/p_graph.hh: Improve documentation.
(mln::p_graph<P>::p_graph): Remove outdated FIXME.
* tests/core/graph_image.cc, tests/core/line_graph_image.cc:
Exercise adjacency tests.
* tests/core/line_graph_elt_neighborhood.cc,
* tests/core/line_graph_elt_window.cc:
Typos in documentation.
* tests/core/graph_elt_neighborhood.cc,
* tests/core/graph_elt_window.cc:
Aesthetic changes.
mln/core/p_graph.hh | 22 ++++----
mln/core/p_line_graph.hh | 81 +++++++++++++++++++++++++++++-
tests/core/graph_elt_neighborhood.cc | 6 --
tests/core/graph_elt_window.cc | 6 --
tests/core/graph_image.cc | 29 +++++++++-
tests/core/line_graph_elt_neighborhood.cc | 9 +--
tests/core/line_graph_elt_window.cc | 9 +--
tests/core/line_graph_image.cc | 26 ++++++++-
8 files changed, 149 insertions(+), 39 deletions(-)
Index: mln/core/p_line_graph.hh
--- mln/core/p_line_graph.hh (revision 1911)
+++ mln/core/p_line_graph.hh (working copy)
@@ -89,6 +89,22 @@
bool has(const psite& p) const;
+ /// Adjacency tests.
+ /// \{
+ /// Return true if the psites \a lhs and \a rhs are adjacent.
+ /// (If \a lhs and \a rhs are equal, return false).
+ bool adjacent(const psite& lhs, const psite& rhs) const;
+ /// Return true if the edges \a lhs and \a rhs are adjacent.
+ /// (If \a lhs and \a rhs are equal, return false).
+ bool adjacent(const util::edge_id& lhs, const util::edge_id& rhs) const;
+
+ /// Return true if the psites \a lhs and \a rhs are adjacent, or equal.
+ bool adjacent_or_equal(const psite& lhs, const psite& rhs) const;
+ /// Return true if the edges \a lhs and \a rhs are adjacent, or equal
+ bool adjacent_or_equal(const util::edge_id& lhs,
+ const util::edge_id& rhs) const;
+ /// \}
+
// FIXME: Should be private.
util::tracked_ptr<graph> gr_;
// FIXME: (Roland) Is it really useful/needed?
@@ -125,10 +141,9 @@
template<typename P>
inline
p_line_graph<P>::p_line_graph (const util::graph<P>& gr)
+ // Create a deep, managed copy of GR.
: gr_ (new util::graph<P>(gr))
{
- // FIXME: Warning: if the underlying graph is updated later, this
- // won't be taken into account by this p_line_graph!
accu::bbox<P> a;
for (unsigned i = 0; i < nnodes(); ++i)
a.take(gr_->node_data(i));
@@ -179,6 +194,68 @@
(p.id() < gr_->nedges());
}
+ template <typename P>
+ inline
+ bool
+ p_line_graph<P>::adjacent(const psite& lhs, const psite& rhs) const
+ {
+ mln_assertion(&lhs.plg() == this && rhs.plg() == this);
+ return adjacent(lhs.id(), rhs.id());
+ }
+
+ /* FIXME: This could be more efficient, if the graph structure had a
+ richer interface. */
+ template <typename P>
+ inline
+ bool
+ p_line_graph<P>::adjacent(const util::edge_id& lhs,
+ const util::edge_id& rhs) const
+ {
+ mln_assertion(lhs < this->npoints());
+ mln_assertion(rhs < this->npoints());
+
+ // Ensure LHS and RHS are *not* equal.
+ if (lhs == rhs)
+ return false;
+
+ // Check whether LHS and RHS are adjacent (i.e., whether LHS and
+ // RHS share a common vertex.
+ /* FIXME: This is too low-level. Yet another service the graph
+ should provide. */
+ if (gr_->edge(lhs).n1() == gr_->edge(rhs).n1() ||
+ gr_->edge(lhs).n1() == gr_->edge(rhs).n2() ||
+ gr_->edge(lhs).n2() == gr_->edge(rhs).n1() ||
+ gr_->edge(lhs).n2() == gr_->edge(rhs).n2())
+ return true;
+
+ return false;
+ }
+
+ template <typename P>
+ inline
+ bool
+ p_line_graph<P>::adjacent_or_equal(const psite& lhs, const psite& rhs) const
+ {
+ mln_assertion(&lhs.pg() == this && rhs.pg() == this);
+ return adjacent_or_equal(lhs.id(), rhs.id());
+ }
+
+ template <typename P>
+ inline
+ bool
+ p_line_graph<P>::adjacent_or_equal(const util::edge_id& lhs,
+ const util::edge_id& rhs) const
+ {
+ mln_assertion(lhs < this->npoints());
+ mln_assertion(rhs < this->npoints());
+
+ // Check whether LHS and RHS are equal.
+ if (lhs == rhs)
+ return true;
+ // Check whether RHS and LHS are adjacent.
+ return adjacent(lhs, rhs);
+ }
+
template <typename P>
bool
Index: mln/core/p_graph.hh
--- mln/core/p_graph.hh (revision 1911)
+++ mln/core/p_graph.hh (working copy)
@@ -96,14 +96,16 @@
/// Adjacency tests.
/// \{
- /// Return true if the psites lhs and rhs are adjacent.
+ /// Return true if the psites \a lhs and \a rhs are adjacent.
+ /// (If \a lhs and \a rhs are equal, return false).
bool adjacent(const psite& lhs, const psite& rhs) const;
- /// Return true if the nodes lhs and rhs are adjacent.
+ /// Return true if the nodes \a lhs and \a rhs are adjacent.
+ /// (If \a lhs and \a rhs are equal, return false).
bool adjacent(const util::node_id& lhs, const util::node_id& rhs) const;
- /// Return true if the psites lhs and rhs are adjacent, or equal.
+ /// Return true if the psites \a lhs and \a rhs are adjacent, or equal.
bool adjacent_or_equal(const psite& lhs, const psite& rhs) const;
- /// Return true if the nodes lhs and rhs are adjacent, or equal
+ /// Return true if the nodes \a lhs and \a rhs are adjacent, or equal
bool adjacent_or_equal(const util::node_id& lhs,
const util::node_id& rhs) const;
/// \}
@@ -151,10 +153,9 @@
template<typename P>
inline
p_graph<P>::p_graph (const util::graph<P>& gr)
+ // Create a deep, managed copy of GR.
: gr_ (new util::graph<P>(gr))
{
- // FIXME: Warning: if the underlying graph is updated later, this
- // won't be taken into account by this p_graph!
accu::bbox<P> a;
for (unsigned i = 0; i < npoints(); ++i)
a.take(gr_->node_data(i));
@@ -258,7 +259,8 @@
// Ensure LHS and RHS are *not* equal.
if (rhs == lhs)
return false;
- // Check whether RHS and LHS are adjacent (i.e., whether RHS is
+
+ // Check whether LHS and RHS are adjacent (i.e., whether RHS is
// among the neighbors of LHS).
typedef std::vector<util::edge_id> edges_t;
const edges_t& lhs_neighbs = gr_->nodes()[lhs]->edges;
@@ -290,10 +292,10 @@
mln_assertion(rhs < this->npoints());
// Check whether LHS and RHS are equal.
- if (rhs == lhs)
+ if (lhs == rhs)
return true;
- // Check whether RHS and LHS are adjacent.
- return adjacent(rhs, lhs);
+ // Check whether LHS and RHS are adjacent.
+ return adjacent(lhs, rhs);
}
template <typename P>
Index: tests/core/graph_image.cc
--- tests/core/graph_image.cc (revision 1911)
+++ tests/core/graph_image.cc (working copy)
@@ -50,6 +50,19 @@
| Graph. |
`--------*/
+ /* The graph is as follows:
+
+ 0 1 2 3 4
+ .-----------
+ |
+ 0 | 0 2
+ 1 | \ / |
+ 2 | 1 |
+ 3 | \ |
+ 4 | 3-4
+
+ */
+
// Points associated to nodes.
std::vector<point2d> points;
points.push_back(make::point2d(0,0)); // Point associated to node 0.
@@ -70,12 +83,20 @@
g.add_edge(3, 4);
g.add_edge(4, 2);
- /*-------.
- | Graph. |
- `-------*/
+ g.print_debug(std::cout);
+
+ /*----------------------.
+ | Graph image support. |
+ `----------------------*/
p_graph<point2d> pg(g);
- g.print_debug(std::cout);
+
+ // Check adjacencies of vertex 1.
+ mln_assertion( pg.adjacent(1, 0));
+ mln_assertion(!pg.adjacent(1, 1));
+ mln_assertion( pg.adjacent(1, 2));
+ mln_assertion( pg.adjacent(1, 3));
+ mln_assertion(!pg.adjacent(1, 4));
/*-------------.
| Graph image. |
Index: tests/core/line_graph_image.cc
--- tests/core/line_graph_image.cc (revision 1911)
+++ tests/core/line_graph_image.cc (working copy)
@@ -50,6 +50,19 @@
| Graph. |
`--------*/
+ /* The graph and its corresponding line graph are as follows:
+
+ 0 1 2 3 4 0 1 2 3 4
+ .----------- .-----------
+ | |
+ 0 | 0 2 0 | * *
+ 1 | \ / | 1 | 0 1 |
+ 2 | 1 | 2 | * 4
+ 3 | \ | 3 | 2 |
+ 4 | 3-4 4 | *3*
+
+ */
+
// Points associated to nodes.
std::vector<point2d> points;
points.push_back(make::point2d(0,0)); // Point associated to node 0.
@@ -70,12 +83,19 @@
g.add_edge(3, 4);
g.add_edge(4, 2);
- /*-------.
- | Graph. |
- `-------*/
+ /*---------------------------.
+ | Line graph image support. |
+ `---------------------------*/
p_line_graph<point2d> plg(g);
+ // Check adjacencies of edge 1.
+ mln_assertion( plg.adjacent(1, 0));
+ mln_assertion(!plg.adjacent(1, 1));
+ mln_assertion( plg.adjacent(1, 2));
+ mln_assertion(!plg.adjacent(1, 3));
+ mln_assertion( plg.adjacent(1, 4));
+
/*-------------------.
| Line graph image. |
`-------------------*/
Index: tests/core/line_graph_elt_neighborhood.cc
--- tests/core/line_graph_elt_neighborhood.cc (revision 1911)
+++ tests/core/line_graph_elt_neighborhood.cc (working copy)
@@ -25,10 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/line_graph_elt_neighborhood.cc
- *
- * \brief Tests on mln::line_graph_elt_neighborhood.
- */
+/// \file tests/core/line_graph_elt_neighborhood.cc
+/// \brief Tests on mln::line_graph_elt_neighborhood.
#include <vector>
@@ -49,8 +47,7 @@
| Graph. |
`--------*/
- /* The graph is as follows and its corresponding line graph are as
- follows:
+ /* The graph and its corresponding line graph are as follows:
0 1 2 3 4 0 1 2 3 4
.----------- .-----------
Index: tests/core/line_graph_elt_window.cc
--- tests/core/line_graph_elt_window.cc (revision 1911)
+++ tests/core/line_graph_elt_window.cc (working copy)
@@ -25,10 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/line_graph_elt_window.cc
- *
- * \brief Tests on mln::line_graph_elt_window.
- */
+/// \file tests/core/line_graph_elt_window.cc
+/// \brief Tests on mln::line_graph_elt_window.
#include <vector>
@@ -49,8 +47,7 @@
| Graph. |
`--------*/
- /* The graph is as follows and its corresponding line graph are as
- follows:
+ /* The graph and its corresponding line graph are as follows:
0 1 2 3 4 0 1 2 3 4
.----------- .-----------
Index: tests/core/graph_elt_neighborhood.cc
--- tests/core/graph_elt_neighborhood.cc (revision 1911)
+++ tests/core/graph_elt_neighborhood.cc (working copy)
@@ -25,10 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/graph_elt_neighborhood.cc
- *
- * \brief Tests on mln::graph_elt_neighborhood.
- */
+/// \file tests/core/graph_elt_neighborhood.cc
+/// \brief Tests on mln::graph_elt_neighborhood.
#include <iostream>
Index: tests/core/graph_elt_window.cc
--- tests/core/graph_elt_window.cc (revision 1911)
+++ tests/core/graph_elt_window.cc (working copy)
@@ -25,10 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/graph_elt_window.cc
- *
- * \brief Tests on mln::graph_elt_window.
- */
+/// \file tests/core/graph_elt_window.cc
+/// \brief Tests on mln::graph_elt_window.
#include <iostream>
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Overhaul 1-D, 2-D and 3-D pixters.
* mln/core/macros.hh (mln_bkd_pixter_): New macro.
* mln/core/internal/pixel_iterator_base.hh
(mln::pixel_iterator_base_<I, E>::start)
(mln::pixel_iterator_base_<I, E>::invalidate)
(mln::pixel_iterator_base_<I, E>::is_valid):
Remove methods.
(mln::forward_pixel_iterator_base_<I, E>)
(mln::backward_pixel_iterator_base_<I, E>):
New classes.
* mln/core/pixter1d.hh
(mln::fwd_pixter1d<I>): Inherit from
mln::internal::forward_pixel_iterator_base_.
(mln::bkd_pixter1d<I>): New class.
* mln/core/pixter2d.hh
(mln::fwd_pixter2d<I>): Inherit from
mln::internal::forward_pixel_iterator_base_.
(mln::bkd_pixter2d<I>): Inherit from
mln::internal::backward_pixel_iterator_base_.
(mln::bkd_pixter2d<I>::start): Remove method.
(mln::fwd_pixter2d<I>::fwd_pixter2d)
(mln::bkd_pixter2d<I>::bkd_pixter2d):
Use initialization lists instead of assignments.
* mln/core/pixter3d.hh
(mln::fwd_pixter3d<I>): Inherit from
mln::internal::forward_pixel_iterator_base_.
(mln::bkd_pixter3d<I>): New class.
* mln/core/p_image2d_pixter.hh
(mln::p_image2d_fwd_pixter<P>): Inherit from
mln::internal::forward_pixel_iterator_base_.
(mln::p_image2d_bkd_pixter<P>): Inherit from
mln::internal::backward_pixel_iterator_base_.
* mln/core/image1d.hh (mln::trait::bkd_pixter< image1d<T> >::ret):
Set to bkd_pixter1d< const image1d<T> >.
* mln/core/image2d.hh: Add FIXMEs.
* mln/core/image3d.hh (mln::trait::bkd_pixter< image3d<T> >::ret):
Set to bkd_pixter3d< const image3d<T> >.
* tests/core/pixter1d.cc, tests/core/pixter2d.cc:
New tests.
* tests/core/image3d.cc: Rename as...
* tests/core/pixter3d.cc: ...this.
Exercise bkd_pixter3d.
* tests/core/Makefile.am (check_PROGRAMS): Remove image3d.
Add pixter1d, pixter2d and pixter3d.
(image3d_SOURCES): Remove.
(pixter1d_SOURCES, pixter2d_SOURCES, pixter3d_SOURCES): New.
mln/core/image1d.hh | 5 -
mln/core/image2d.hh | 2
mln/core/image3d.hh | 5 -
mln/core/internal/pixel_iterator_base.hh | 142 +++++++++++++++++++++++++------
mln/core/macros.hh | 2
mln/core/p_image2d_pixter.hh | 131 +++++++++++++++-------------
mln/core/pixter1d.hh | 81 +++++++++++++----
mln/core/pixter2d.hh | 88 ++++++++-----------
mln/core/pixter3d.hh | 118 +++++++++++++++++++++----
tests/core/Makefile.am | 8 +
tests/core/pixter1d.cc | 86 ++++++++++++++++++
tests/core/pixter2d.cc | 85 ++++++++++++++++++
tests/core/pixter3d.cc | 31 ++++--
13 files changed, 596 insertions(+), 188 deletions(-)
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 1910)
+++ mln/core/macros.hh (working copy)
@@ -286,6 +286,8 @@
# define mln_fwd_pixter_(I) mln::trait::fwd_pixter< I >::ret
# define mln_bkd_pixter(I) typename mln::trait::bkd_pixter< I >::ret
+# define mln_bkd_pixter_(I) mln::trait::bkd_pixter< I >::ret
+
# define mln_pixter(I) mln_fwd_pixter(I)
# define mln_pixter_(I) mln_fwd_pixter_(I)
Index: mln/core/internal/pixel_iterator_base.hh
--- mln/core/internal/pixel_iterator_base.hh (revision 1910)
+++ mln/core/internal/pixel_iterator_base.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,58 +28,102 @@
#ifndef MLN_CORE_INTERNAL_PIXEL_ITERATOR_BASE_HH
# define MLN_CORE_INTERNAL_PIXEL_ITERATOR_BASE_HH
-/*! \file mln/core/internal/pixel_iterator_base.hh
- *
- * \brief Base class to factor code for pixel iterator classes.
- */
+/// \file mln/core/internal/pixel_iterator_base.hh
+/// \brief Base classes factoring code for pixel iterator classes.
# include <mln/core/concept/pixel_iterator.hh>
# include <mln/core/internal/pixel_impl.hh>
# include <mln/core/trait/qlf_value.hh>
-
namespace mln
{
namespace internal
{
+ /*---------------------------------------.
+ | internal::pixel_iterator_base_<I, E>. |
+ `---------------------------------------*/
- /*! \internal A base class for pixel iterators.
- *
- */
+ /// \internal A base class for pixel iterators.
template <typename I, typename E>
class pixel_iterator_base_ : public Pixel_Iterator<E>,
public internal::pixel_impl_<I, E>
{
typedef internal::pixel_impl_<I, E> super_;
- public:
+ protected:
+ /// Constructor.
+ pixel_iterator_base_(I& image);
+ protected:
+ /// Beginning of the image.
+ mln_qlf_value(I)* boi_;
+ /// End of the image (past-the-end).
+ mln_qlf_value(I)* eoi_;
+ };
+
+
+ /*-----------------------------------------------.
+ | internal::forward_pixel_iterator_base_<I, E>. |
+ `-----------------------------------------------*/
+
+ /// \internal A base class for forward pixel iterators.
+ template <typename I, typename E>
+ class forward_pixel_iterator_base_ : public pixel_iterator_base_<I, E>
+ {
+ typedef pixel_iterator_base_<I, E> super_;
+
+ public:
+ /// Manipulation
+ /// \{
/// Start an iteration.
void start();
-
/// Invalidate the iterator.
void invalidate();
-
/// Test if the iterator is valid.
bool is_valid() const;
+ /// \}
protected:
+ /// Constructor.
+ forward_pixel_iterator_base_(I& image);
+ };
- /// Beginning of the image.
- mln_qlf_value(I)* boi_;
- /// End of the image (past-the-end).
- mln_qlf_value(I)* eoi_;
+ /*------------------------------------------------.
+ | internal::backward_pixel_iterator_base_<I, E>. |
+ `------------------------------------------------*/
+
+ /// \internal A base class for backward pixel iterators.
+ template <typename I, typename E>
+ class backward_pixel_iterator_base_ : public pixel_iterator_base_<I, E>
+ {
+ typedef pixel_iterator_base_<I, E> super_;
+
+ public:
+ /// Manipulation
+ /// \{
+ /// Start an iteration.
+ void start();
+ /// Invalidate the iterator.
+ void invalidate();
+ /// Test if the iterator is valid.
+ bool is_valid() const;
+ /// \}
+ protected:
/// Constructor.
- pixel_iterator_base_(I& image);
+ backward_pixel_iterator_base_(I& image);
};
#ifndef MLN_INCLUDE_ONLY
+ /*---------------------------------------.
+ | internal::pixel_iterator_base_<I, E>. |
+ `---------------------------------------*/
+
template <typename I, typename E>
inline
pixel_iterator_base_<I, E>::pixel_iterator_base_(I& image)
@@ -89,33 +133,79 @@
I& ima = this->image_;
boi_ = & ima( ima.domain().pmin() ) - 1;
eoi_ = & ima( ima.domain().pmax() ) + 1;
- invalidate();
+ exact(*this).invalidate();
+ }
+
+
+ /*-----------------------------------------------.
+ | internal::forward_pixel_iterator_base_<I, E>. |
+ `-----------------------------------------------*/
+
+ template <typename I, typename E>
+ inline
+ forward_pixel_iterator_base_<I, E>::forward_pixel_iterator_base_(I& image)
+ : super_(image)
+ {
+ }
+
+ template <typename I, typename E>
+ inline
+ void
+ forward_pixel_iterator_base_<I, E>::start()
+ {
+ this->value_ptr_ = this->boi_ + 1;
+ }
+
+ template <typename I, typename E>
+ inline
+ void
+ forward_pixel_iterator_base_<I, E>::invalidate()
+ {
+ this->value_ptr_ = this->eoi_;
+ }
+
+ template <typename I, typename E>
+ inline
+ bool
+ forward_pixel_iterator_base_<I, E>::is_valid() const
+ {
+ return this->value_ptr_ != this->eoi_;
+ }
+
+
+ /*------------------------------------------------.
+ | internal::backward_pixel_iterator_base_<I, E>. |
+ `------------------------------------------------*/
+
+ template <typename I, typename E>
+ inline
+ backward_pixel_iterator_base_<I, E>::backward_pixel_iterator_base_(I& image)
+ : super_(image)
+ {
}
- // FIXME: Remove cause dangerous when bkd!!!
template <typename I, typename E>
inline
void
- pixel_iterator_base_<I, E>::start()
+ backward_pixel_iterator_base_<I, E>::start()
{
- this->value_ptr_ = boi_ + 1;
+ this->value_ptr_ = this->eoi_ - 1;
}
template <typename I, typename E>
inline
void
- pixel_iterator_base_<I, E>::invalidate()
+ backward_pixel_iterator_base_<I, E>::invalidate()
{
- this->value_ptr_ = eoi_;
+ this->value_ptr_ = this->boi_;
}
- // FIXME: Remove casue not optimal!!!
template <typename I, typename E>
inline
bool
- pixel_iterator_base_<I, E>::is_valid() const
+ backward_pixel_iterator_base_<I, E>::is_valid() const
{
- return this->value_ptr_ != eoi_ && this->value_ptr_ != boi_;
+ return this->value_ptr_ != this->boi_;
}
#endif // ! MLN_INCLUDE_ONLY
Index: mln/core/pixter1d.hh
--- mln/core/pixter1d.hh (revision 1910)
+++ mln/core/pixter1d.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,51 +28,75 @@
#ifndef MLN_CORE_PIXTER1D_HH
# define MLN_CORE_PIXTER1D_HH
-/*! \file mln/core/pixter1d.hh
- *
- * \brief Pixel iterator class on a image 1d with border.
- */
+/// \file mln/core/pixter1d.hh
+/// \brief Pixel iterators on a 1-D image with border.
# include <mln/core/internal/pixel_iterator_base.hh>
# include <mln/core/point1d.hh>
# include <mln/geom/size1d.hh>
-
-
namespace mln
{
+ /*------------------.
+ | fwd_pixter1d<I>. |
+ `------------------*/
+
+ /// Forward pixel iterator on a 1-D image with border.
template <typename I>
- class fwd_pixter1d : public internal::pixel_iterator_base_< I, fwd_pixter1d<I> >
+ class fwd_pixter1d :
+ public internal::forward_pixel_iterator_base_< I, fwd_pixter1d<I> >
{
- typedef internal::pixel_iterator_base_< I, fwd_pixter1d<I> > super_;
+ typedef internal::forward_pixel_iterator_base_< I, fwd_pixter1d<I> > super_;
public:
-
/// Image type.
typedef I image;
- /*! \brief Constructor.
- *
- * \param[in] image Image to iterate over its pixels.
- */
+ /// \brief Constructor.
+ /// \param[in] image The image this pixel iterator is bound to.
fwd_pixter1d(I& image);
/// Go to the next pixel.
void next_();
-
};
- // FIXME: bkd_pixter1d
+ /*------------------.
+ | bkd_pixter1d<I>. |
+ `------------------*/
+
+ /// Backward pixel iterator on a 1-D image with border.
+ template <typename I>
+ class bkd_pixter1d :
+ public internal::backward_pixel_iterator_base_< I, bkd_pixter1d<I> >
+ {
+ typedef internal::backward_pixel_iterator_base_< I, bkd_pixter1d<I> > super_;
+
+ public:
+ /// Image type.
+ typedef I image;
+
+ /// \brief Constructor.
+ /// \param[in] image The image this pixel iterator is bound to.
+ bkd_pixter1d(I& image);
+
+ /// Go to the next pixel.
+ void next_();
+ };
+
#ifndef MLN_INCLUDE_ONLY
+ /*------------------.
+ | fwd_pixter1d<I>. |
+ `------------------*/
+
template <typename I>
inline
- fwd_pixter1d<I>::fwd_pixter1d(I& image) :
- super_(image)
+ fwd_pixter1d<I>::fwd_pixter1d(I& image)
+ : super_(image)
{
mln_precondition(image.has_data());
}
@@ -85,6 +109,27 @@
++this->value_ptr_;
}
+
+ /*------------------.
+ | bkd_pixter1d<I>. |
+ `------------------*/
+
+ template <typename I>
+ inline
+ bkd_pixter1d<I>::bkd_pixter1d(I& image)
+ : super_(image)
+ {
+ mln_precondition(image.has_data());
+ }
+
+ template <typename I>
+ inline
+ void
+ bkd_pixter1d<I>::next_()
+ {
+ --this->value_ptr_;
+ }
+
#endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: mln/core/pixter2d.hh
--- mln/core/pixter2d.hh (revision 1910)
+++ mln/core/pixter2d.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,102 +28,97 @@
#ifndef MLN_CORE_PIXTER2D_HH
# define MLN_CORE_PIXTER2D_HH
-/*! \file mln/core/pixter2d.hh
- *
- * \brief Pixel iterator class on a image 2d with border.
- */
+/// \file mln/core/pixter2d.hh
+/// \brief Pixel iterators on a 2-D image with border.
# include <mln/core/internal/pixel_iterator_base.hh>
# include <mln/core/point2d.hh>
# include <mln/geom/size2d.hh>
-
-
namespace mln
{
+ /*------------------.
+ | fwd_pixter2d<I>. |
+ `------------------*/
+
+ /// Forward pixel iterator on a 2-D image with border.
template <typename I>
- class fwd_pixter2d : public internal::pixel_iterator_base_< I, fwd_pixter2d<I> >
+ class fwd_pixter2d
+ : public internal::forward_pixel_iterator_base_< I, fwd_pixter2d<I> >
{
- typedef internal::pixel_iterator_base_< I, fwd_pixter2d<I> > super_;
+ typedef internal::forward_pixel_iterator_base_< I, fwd_pixter2d<I> > super_;
public:
-
/// Image type.
typedef I image;
- /*! \brief Constructor.
- *
- * \param[in] image Image to iterate over its pixels.
- */
+ /// \brief Constructor.
+ /// \param[in] image The image this pixel iterator is bound to.
fwd_pixter2d(I& image);
/// Go to the next pixel.
void next_();
private:
-
/// Twice the size of the image border.
unsigned border_x2_;
-
/// Row offset.
unsigned row_offset_;
-
/// End of the current row.
mln_qlf_value(I)* eor_;
};
+ /*------------------.
+ | bkd_pixter2d<I>. |
+ `------------------*/
+ /// Backward pixel iterator on a 2-D image with border.
template <typename I>
- class bkd_pixter2d : public internal::pixel_iterator_base_< I, bkd_pixter2d<I> >
+ class bkd_pixter2d
+ : public internal::backward_pixel_iterator_base_< I, bkd_pixter2d<I> >
{
- typedef internal::pixel_iterator_base_< I, bkd_pixter2d<I> > super_;
+ typedef internal::backward_pixel_iterator_base_< I, bkd_pixter2d<I> > super_;
public:
-
/// Image type.
typedef I image;
- /*! \brief Constructor.
- *
- * \param[in] image Image to iterate over its pixels.
- */
+ /// \brief Constructor.
+ /// \param[in] image The image this pixel iterator is bound to.
bkd_pixter2d(I& image);
/// Go to the next pixel.
void next_();
- void start();
-
private:
/// Twice the size of the image border.
unsigned border_x2_;
-
/// Row offset.
unsigned row_offset_;
-
/// Beginning of the current row.
mln_qlf_value(I)* bor_;
};
-
#ifndef MLN_INCLUDE_ONLY
- // Fwd.
+ /*------------------.
+ | fwd_pixter2d<I>. |
+ `------------------*/
template <typename I>
inline
- fwd_pixter2d<I>::fwd_pixter2d(I& image) :
- super_(image)
+ fwd_pixter2d<I>::fwd_pixter2d(I& image)
+ : super_(image),
+ border_x2_(2 * image.border()),
+ row_offset_(image.bbox().ncols() + border_x2_),
+ eor_(& image.at(geom::min_row(image), geom::max_col(image)) + 1)
{
mln_precondition(image.has_data());
- border_x2_ = 2 * image.border();
- row_offset_ = geom::max_col(image) - geom::min_col(image) + 1 + border_x2_;
- eor_ = & image.at(geom::min_row(image), geom::max_col(image)) + 1;
}
template <typename I>
@@ -139,17 +134,20 @@
}
}
- // Bkd.
+
+ /*------------------.
+ | fwd_pixter2d<I>. |
+ `------------------*/
template <typename I>
inline
- bkd_pixter2d<I>::bkd_pixter2d(I& image) :
- super_(image)
+ bkd_pixter2d<I>::bkd_pixter2d(I& image)
+ : super_(image),
+ border_x2_(2 * image.border()),
+ row_offset_(image.bbox().ncols() + border_x2_),
+ bor_(& image.at(geom::max_row(image), geom::min_col(image)) - 1)
{
mln_precondition(image.has_data());
- border_x2_ = 2 * image.border();
- row_offset_ = geom::max_col(image) - geom::min_col(image) + 1 + border_x2_;
- bor_ = & image.at(geom::max_row(image), geom::min_col(image)) - 1;
}
template <typename I>
@@ -165,14 +163,6 @@
}
}
- template <typename I>
- inline
- void
- bkd_pixter2d<I>::start()
- {
- this->value_ptr_ = this->eoi_ - 1;
- }
-
#endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: mln/core/pixter3d.hh
--- mln/core/pixter3d.hh (revision 1910)
+++ mln/core/pixter3d.hh (working copy)
@@ -28,70 +28,104 @@
#ifndef MLN_CORE_PIXTER3D_HH
# define MLN_CORE_PIXTER3D_HH
-/*! \file mln/core/pixter3d.hh
- *
- * \brief Pixel iterator class on a image 3d with border.
- */
+/// \file mln/core/pixter3d.hh
+/// \brief Pixel iterators on a 3-D image with border.
# include <mln/core/internal/pixel_iterator_base.hh>
# include <mln/core/point3d.hh>
# include <mln/geom/size3d.hh>
-
-
namespace mln
{
+ /*------------------.
+ | fwd_pixter3d<I>. |
+ `------------------*/
+
+ /// Forward pixel iterator on a 3-D image with border.
template <typename I>
class fwd_pixter3d
- : public internal::pixel_iterator_base_< I, fwd_pixter3d<I> >
+ : public internal::forward_pixel_iterator_base_< I, fwd_pixter3d<I> >
{
- typedef internal::pixel_iterator_base_< I, fwd_pixter3d<I> > super_;
+ typedef internal::forward_pixel_iterator_base_< I, fwd_pixter3d<I> > super_;
public:
-
/// Image type.
typedef I image;
- /*! \brief Constructor.
- *
- * \param[in] image Image to iterate over its pixels.
- */
+ /// \brief Constructor.
+ /// \param[in] image The image this pixel iterator is bound to.
fwd_pixter3d(I& image);
/// Go to the next pixel.
void next_();
private:
-
/// Twice the size of the image border.
const unsigned border_x2_;
-
/// Row offset.
const unsigned row_offset_;
-
/// End of the current row.
mln_qlf_value(I)* eor_;
/// Next slice offset.
const unsigned next_sli_offset_;
-
/// Next slice offset for row.
const unsigned next_srow_offset_;
-
/// Slice offset.
const unsigned sli_offset_;
-
/// End of the current slice.
mln_qlf_value(I)* eos_;
};
- // FIXME: bkd_pixter3d
+ /*------------------.
+ | bkd_pixter3d<I>. |
+ `------------------*/
+
+ /// Backward pixel iterator on a 3-D image with border.
+ template <typename I>
+ class bkd_pixter3d
+ : public internal::backward_pixel_iterator_base_< I, bkd_pixter3d<I> >
+ {
+ typedef internal::backward_pixel_iterator_base_< I, bkd_pixter3d<I> > super_;
+
+ public:
+ /// Image type.
+ typedef I image;
+
+ /// \brief Constructor.
+ /// \param[in] image The image this pixel iterator is bound to.
+ bkd_pixter3d(I& image);
+
+ /// Go to the next pixel.
+ void next_();
+
+ private:
+ /// Twice the size of the image border.
+ const unsigned border_x2_;
+ /// Row offset.
+ const unsigned row_offset_;
+ /// Beginning of the current row.
+ mln_qlf_value(I)* bor_;
+
+ /// Next slice offset.
+ const unsigned next_sli_offset_;
+ /// Next slice offset for row.
+ const unsigned next_srow_offset_;
+ /// Slice offset.
+ const unsigned sli_offset_;
+ /// Beginning of the current slice.
+ mln_qlf_value(I)* bos_;
+ };
#ifndef MLN_INCLUDE_ONLY
+ /*------------------.
+ | fwd_pixter3d<I>. |
+ `------------------*/
+
template <typename I>
inline
fwd_pixter3d<I>::fwd_pixter3d(I& image)
@@ -131,6 +165,50 @@
}
}
+
+ /*------------------.
+ | bkd_pixter3d<I>. |
+ `------------------*/
+
+ template <typename I>
+ inline
+ bkd_pixter3d<I>::bkd_pixter3d(I& image)
+ : super_(image),
+ border_x2_(2 * image.border()),
+ row_offset_(image.bbox().ncols() + border_x2_),
+ bor_(& image.at(geom::max_sli(image),
+ geom::max_row(image),
+ geom::min_col(image)) - 1),
+ next_sli_offset_(row_offset_ * border_x2_ + border_x2_),
+ next_srow_offset_(next_sli_offset_ + image.bbox().ncols()),
+ sli_offset_((image.bbox().ncols() + border_x2_) *
+ (image.bbox().nrows() + border_x2_)),
+ bos_(& image.at(geom::max_sli(image),
+ geom::min_row(image),
+ geom::min_col(image)) - 1)
+ {
+ mln_precondition(image.has_data());
+ }
+
+ template <typename I>
+ inline
+ void
+ bkd_pixter3d<I>::next_()
+ {
+ --this->value_ptr_;
+ if (this->value_ptr_ == bos_ && this->value_ptr_ != this->boi_)
+ {
+ this->value_ptr_ -= next_sli_offset_;
+ bos_ -= sli_offset_;
+ bor_ -= next_srow_offset_;
+ }
+ else if (this->value_ptr_ == bor_ && this->value_ptr_ != this->boi_)
+ {
+ this->value_ptr_ -= border_x2_;
+ bor_ -= row_offset_;
+ }
+ }
+
#endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: mln/core/p_image2d_pixter.hh
--- mln/core/p_image2d_pixter.hh (revision 1910)
+++ mln/core/p_image2d_pixter.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,49 +28,51 @@
#ifndef MLN_CORE_P_IMAGE2D_PIXTER_HH
# define MLN_CORE_P_IMAGE2D_PIXTER_HH
-/*! \file mln/core/p_image2d_pixter.hh
- *
- * \brief Pixel iterator class on a image 2d with border.
- */
+/// \file mln/core/p_image2d_pixter.hh
+/// \brief Pixel iterators on a mln::p_image2d.
# include <mln/core/internal/pixel_iterator_base.hh>
# include <mln/core/point2d.hh>
# include <mln/geom/size2d.hh>
-
-
namespace mln
{
+ /*--------------------------.
+ | p_image2d_fwd_pixter<P>. |
+ `--------------------------*/
+
template <typename P>
- class p_image2d_fwd_pixter : public internal::pixel_iterator_base_< typename p_image2d<P>::image_type, p_image2d_fwd_pixter<P> >
- {
- typedef internal::pixel_iterator_base_< typename p_image2d<P>::image_type, p_image2d_fwd_pixter<P> > super_;
+ class p_image2d_fwd_pixter
+ : public internal::forward_pixel_iterator_base_<
+ typename p_image2d<P>::image_type,
+ p_image2d_fwd_pixter<P>
+ >
+ {
+ typedef internal::forward_pixel_iterator_base_<
+ typename p_image2d<P>::image_type,
+ p_image2d_fwd_pixter<P>
+ > super_;
public:
-
/// Image type.
typedef typename p_image2d<P>::image_type image;
-
/// Point type.
typedef point2d point;
- /*! \brief Constructor.
- *
- * \param[in] image Image to iterate over its pixels.
- */
+ /// \brief Constructor.
+ /// \param[in] image The mln::p_image2d this pixel iterator is bound to.
p_image2d_fwd_pixter(p_image2d<P>& s);
- /// Reference of the corresponding point.
- const point to_point() const;
-
+ /// Start an iteration.
+ void start();
/// Go to the next pixel.
void next_();
- void start();
+ /// Reference of the corresponding point.
+ const point to_point() const;
private:
-
/// Row offset.
unsigned row_offset_;
/// End of the current row.
@@ -78,66 +80,74 @@
};
+ /*--------------------------.
+ | p_image2d_bkd_pixter<P>. |
+ `--------------------------*/
template <typename P>
- class p_image2d_bkd_pixter : public internal::pixel_iterator_base_< typename image2d<P>::image_type, p_image2d_bkd_pixter<P> >
- {
- typedef internal::pixel_iterator_base_< typename image2d<P>::image_type, p_image2d_bkd_pixter<P> > super_;
+ class p_image2d_bkd_pixter
+ : public internal::backward_pixel_iterator_base_<
+ typename image2d<P>::image_type,
+ p_image2d_bkd_pixter<P>
+ >
+ {
+ typedef internal::backward_pixel_iterator_base_<
+ typename image2d<P>::image_type,
+ p_image2d_bkd_pixter<P>
+ > super_;
public:
-
/// Image type.
typedef typename p_image2d<P>::image_type image;
-
/// Point type.
typedef point2d point;
- /*! \brief Constructor.
- *
- * \param[in] image Image to iterate over its pixels.
- */
+ /// \brief Constructor.
+ /// \param[in] image The mln::p_image2d this pixel iterator is bound to.
p_image2d_bkd_pixter(p_image2d<P>& s);
+ /// Start an iteration.
+ void start();
/// Go to the next pixel.
void next_();
- void start();
-
/// Reference of the corresponding point.
const point to_point() const;
private:
-
/// Row offset.
unsigned row_offset_;
-
/// Beginning of the current row.
mln_qlf_value(image)* bor_;
};
-
#ifndef MLN_INCLUDE_ONLY
- // Fwd.
+ /*--------------------------.
+ | p_image2d_fwd_pixter<P>. |
+ `--------------------------*/
template <typename P>
inline
- p_image2d_fwd_pixter<P>::p_image2d_fwd_pixter(p_image2d<P>& s) :
- super_(s.image_non_const())
+ p_image2d_fwd_pixter<P>::p_image2d_fwd_pixter(p_image2d<P>& s)
+ : super_(s.image_non_const())
{
mln_precondition(this->image_.has_data());
row_offset_ = geom::max_col(this->image_) - geom::min_col(this->image_) + 1;
- eor_ = & this->image_.at(geom::min_row(this->image_), geom::max_col(this->image_)) + 1;
+ eor_ = & this->image_.at(geom::min_row(this->image_),
+ geom::max_col(this->image_)) + 1;
}
template <typename P>
inline
- const typename p_image2d_fwd_pixter<P>::point
- p_image2d_fwd_pixter<P>::to_point() const
+ void
+ p_image2d_fwd_pixter<P>::start()
{
- return this->image_.point_at_offset(*this);
+ this->value_ptr_ = this->boi_ + 1;
+ while(this->is_valid() && !(*this->value_ptr_))
+ ++this->value_ptr_;
}
template <typename P>
@@ -150,35 +160,38 @@
++this->value_ptr_;
}
-
template <typename P>
inline
- void
- p_image2d_fwd_pixter<P>::start()
+ const typename p_image2d_fwd_pixter<P>::point
+ p_image2d_fwd_pixter<P>::to_point() const
{
- this->value_ptr_ = this->boi_ + 1;
- while(this->is_valid() && !(*this->value_ptr_))
- ++this->value_ptr_;
+ return this->image_.point_at_offset(*this);
}
- // Bkd.
+
+ /*--------------------------.
+ | p_image2d_bkd_pixter<P>. |
+ `--------------------------*/
template <typename P>
inline
- p_image2d_bkd_pixter<P>::p_image2d_bkd_pixter(p_image2d<P>& s) :
- super_(s.image_non_const())
+ p_image2d_bkd_pixter<P>::p_image2d_bkd_pixter(p_image2d<P>& s)
+ : super_(s.image_non_const())
{
mln_precondition(this->image_.has_data());
row_offset_ = geom::max_col(this->image_) - geom::min_col(this->image_) + 1;
- bor_ = & this->image_.at(geom::max_row(this->image_), geom::min_col(this->image_)) - 1;
+ bor_ = & this->image_.at(geom::max_row(this->image_),
+ geom::min_col(this->image_)) - 1;
}
template <typename P>
inline
- const typename p_image2d_bkd_pixter<P>::point
- p_image2d_bkd_pixter<P>::to_point() const
+ void
+ p_image2d_bkd_pixter<P>::start()
{
- return this->image_.point_at_offset(*this);
+ this->value_ptr_ = this->eoi_ - 1;
+ while(this->is_valid() && !(*this->value_ptr_))
+ --this->value_ptr_;
}
template <typename P>
@@ -193,12 +206,10 @@
template <typename P>
inline
- void
- p_image2d_bkd_pixter<P>::start()
+ const typename p_image2d_bkd_pixter<P>::point
+ p_image2d_bkd_pixter<P>::to_point() const
{
- this->value_ptr_ = this->eoi_ - 1;
- while(this->is_valid() && !(*this->value_ptr_))
- --this->value_ptr_;
+ return this->image_.point_at_offset(*this);
}
#endif // ! MLN_INCLUDE_ONLY
Index: mln/core/image1d.hh
--- mln/core/image1d.hh (revision 1910)
+++ mln/core/image1d.hh (working copy)
@@ -533,7 +533,7 @@
template <typename T>
struct bkd_pixter< image1d<T> >
{
- typedef mln::internal::fixme ret;
+ typedef bkd_pixter1d< const image1d<T> > ret;
};
// qixter
@@ -553,9 +553,12 @@
template <typename T, typename W>
struct bkd_qixter< image1d<T>, W >
{
+ // FIXME: Implement dpoints_bkd_pixter.
typedef mln::internal::fixme ret;
};
+ // FIXME: Nixters (see in image2d.hh)
+
} // end of namespace mln::trait
} // end of namespace mln
Index: mln/core/image2d.hh
--- mln/core/image2d.hh (revision 1910)
+++ mln/core/image2d.hh (working copy)
@@ -581,6 +581,7 @@
template <typename T, typename W>
struct bkd_qixter< image2d<T>, W >
{
+ // FIXME: Implement dpoints_bkd_pixter.
typedef mln::internal::fixme ret;
};
@@ -601,6 +602,7 @@
template <typename T, typename N>
struct bkd_nixter< image2d<T>, N >
{
+ // FIXME: Implement dpoints_bkd_pixter.
typedef mln::internal::fixme ret;
};
Index: mln/core/image3d.hh
--- mln/core/image3d.hh (revision 1910)
+++ mln/core/image3d.hh (working copy)
@@ -573,7 +573,7 @@
template <typename T>
struct bkd_pixter< image3d<T> >
{
- typedef mln::internal::fixme ret;
+ typedef bkd_pixter3d< const image3d<T> > ret;
};
// qixter
@@ -593,9 +593,12 @@
template <typename T, typename W>
struct bkd_qixter< image3d<T>, W >
{
+ // FIXME: Implement dpoints_bkd_pixter.
typedef mln::internal::fixme ret;
};
+ // FIXME: Nixters (see in image2d.hh)
+
} // end of namespace mln::trait
} // end of namespace mln
Index: tests/core/pixter1d.cc
--- tests/core/pixter1d.cc (revision 0)
+++ tests/core/pixter1d.cc (revision 0)
@@ -0,0 +1,86 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file tests/level/pixter1d.cc
+/// \brief Tests on 1-D image pixters.
+
+#include <mln/core/image1d.hh>
+
+#include <mln/debug/iota.hh>
+
+int main()
+{
+ using namespace mln;
+
+ {
+ box1d b(make::point1d(2), make::point1d(4));
+ image1d<int> ima(b, 2);
+
+ mln_pixter_(image1d<int>) p(ima);
+ for_all(p)
+ std::cout << p << std::endl;
+ }
+
+ {
+ box1d b(make::point1d(2), make::point1d(6));
+ image1d<int> ima(b, 1);
+
+ debug::iota(ima);
+
+ {
+ mln_fwd_piter_(image1d<int>) pi(ima.domain());
+ mln_fwd_pixter_(image1d<int>) p(ima);
+ pi.start();
+ p.start();
+ unsigned i = 0;
+ while (pi.is_valid())
+ {
+ mln_assertion(ima(pi) == p.val());
+ pi.next();
+ p.next();
+ ++i;
+ }
+ mln_assertion(i == b.npoints());
+ }
+
+ {
+ mln_bkd_piter_(image1d<int>) pi(ima.domain());
+ mln_bkd_pixter_(image1d<int>) p(ima);
+ pi.start();
+ p.start();
+ unsigned i = 0;
+ while (pi.is_valid())
+ {
+ mln_assertion(ima(pi) == p.val());
+ pi.next();
+ p.next();
+ ++i;
+ }
+ mln_assertion(i == b.npoints());
+ }
+ }
+}
Index: tests/core/pixter2d.cc
--- tests/core/pixter2d.cc (revision 0)
+++ tests/core/pixter2d.cc (revision 0)
@@ -0,0 +1,85 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file tests/level/pixter2d.cc
+/// \brief Tests on 2-D image pixters.
+
+#include <mln/core/image2d.hh>
+
+#include <mln/debug/iota.hh>
+
+int main()
+{
+ using namespace mln;
+
+ {
+ box2d b(make::point2d(2, 1), make::point2d(4, 3));
+ image2d<int> ima(b, 2);
+
+ mln_pixter_(image2d<int>) p(ima);
+ for_all(p)
+ std::cout << p << std::endl;
+ }
+
+ {
+ box2d b(make::point2d(2, 1), make::point2d(6, 3));
+ image2d<int> ima(b, 1);
+ debug::iota(ima);
+
+ {
+ mln_fwd_piter_(image2d<int>) pi(ima.domain());
+ mln_fwd_pixter_(image2d<int>) p(ima);
+ pi.start();
+ p.start();
+ unsigned i = 0;
+ while (pi.is_valid())
+ {
+ mln_assertion(ima(pi) == p.val());
+ pi.next();
+ p.next();
+ ++i;
+ }
+ mln_assertion(i == b.npoints());
+ }
+
+ {
+ mln_bkd_piter_(image2d<int>) pi(ima.domain());
+ mln_bkd_pixter_(image2d<int>) p(ima);
+ pi.start();
+ p.start();
+ unsigned i = 0;
+ while (pi.is_valid())
+ {
+ mln_assertion(ima(pi) == p.val());
+ pi.next();
+ p.next();
+ ++i;
+ }
+ mln_assertion(i == b.npoints());
+ }
+ }
+}
Index: tests/core/pixter3d.cc
--- tests/core/pixter3d.cc (revision 1910)
+++ tests/core/pixter3d.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,14 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/level/image3d.cc
- *
- * \brief Tests on Image3d pixter
- */
-
+/// \file tests/level/pixter3d.cc
+/// \brief Tests on 3-D image pixters.
#include <mln/core/image3d.hh>
-#include <mln/core/image2d.hh>
#include <mln/debug/iota.hh>
@@ -40,8 +36,6 @@
{
using namespace mln;
-
- // Working test
{
box3d b(make::point3d(1,2, 1), make::point3d(2,4, 3));
image3d<int> ima(b, 2);
@@ -51,10 +45,9 @@
std::cout << p << std::endl;
}
-
{
box3d b(make::point3d(1,2, 1), make::point3d(3,6, 3));
- image3d<int> ima(b, 0);
+ image3d<int> ima(b, 1);
debug::iota(ima);
@@ -73,5 +66,21 @@
}
mln_assertion(i == b.npoints());
}
+
+ {
+ mln_bkd_piter_(image3d<int>) pi(ima.domain());
+ mln_bkd_pixter_(image3d<int>) p(ima);
+ pi.start();
+ p.start();
+ unsigned i = 0;
+ while (pi.is_valid())
+ {
+ mln_assertion(ima(pi) == p.val());
+ pi.next();
+ p.next();
+ ++i;
+ }
+ mln_assertion(i == b.npoints());
+ }
}
}
Index: tests/core/Makefile.am
--- tests/core/Makefile.am (revision 1910)
+++ tests/core/Makefile.am (working copy)
@@ -8,7 +8,6 @@
exact \
h_vec \
initialize \
- image3d \
graph_elt_neighborhood \
graph_elt_window \
graph_image \
@@ -26,6 +25,9 @@
p_queue \
p_queue_fast \
p_runs \
+ pixter1d \
+ pixter2d \
+ pixter3d \
point_set_compatibility \
pset_array \
rle_image \
@@ -38,7 +40,6 @@
exact_SOURCES = exact.cc
h_vec_SOURCES = h_vec.cc
initialize_SOURCES = initialize.cc
-image3d_SOURCES = image3d.cc
graph_elt_neighborhood_SOURCES = graph_elt_neighborhood.cc
graph_elt_window_SOURCES = graph_elt_window.cc
graph_image_SOURCES = graph_image.cc
@@ -56,6 +57,9 @@
p_queue_SOURCES = p_priority_queue_fast.cc
p_queue_fast_SOURCES = p_priority_queue_fast.cc
p_runs_SOURCES = p_runs.cc
+pixter1d_SOURCES = pixter1d.cc
+pixter2d_SOURCES = pixter2d.cc
+pixter3d_SOURCES = pixter3d.cc
point_set_compatibility_SOURCES = point_set_compatibility.cc
pset_array_SOURCES = pset_array.cc
rle_image_SOURCES = rle_image.cc
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Attention � bien remplir les Makefile.am's lors de l'ajout de nouveaux
tests!
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix mln::fwd_pixter3d.
* mln/core/pixter3d.hh: s/slide/slice/.
Wrap long lines
(mln::fwd_pixter3d<I>::next_sli_offset_)
(mln::fwd_pixter3d<I>::next_srow_offset_):
Switch positions of members.
(mln::fwd_pixter3d<I>::fwd_pixter3d): Fix initializations of
members next_sli_offset_, next_srow_offset_ and eos_.
(mln::fwd_pixter3d<I>::next_): Catch up with these new definitions
of members.
* tests/core/image3d.cc: Check the number of iterations.
* tests/core/Makefile.am (image3d_SOURCES, pset_array_SOURCES):
New (missing variables).
mln/core/pixter3d.hh | 42 ++++++++++++++++++++++++------------------
tests/core/Makefile.am | 2 ++
tests/core/image3d.cc | 12 ++++++++----
3 files changed, 34 insertions(+), 22 deletions(-)
Index: mln/core/pixter3d.hh
--- mln/core/pixter3d.hh (revision 1909)
+++ mln/core/pixter3d.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -43,7 +43,8 @@
{
template <typename I>
- class fwd_pixter3d : public internal::pixel_iterator_base_< I, fwd_pixter3d<I> >
+ class fwd_pixter3d
+ : public internal::pixel_iterator_base_< I, fwd_pixter3d<I> >
{
typedef internal::pixel_iterator_base_< I, fwd_pixter3d<I> > super_;
@@ -72,16 +73,16 @@
/// End of the current row.
mln_qlf_value(I)* eor_;
- ///Next Slide offset for row.
- const unsigned next_srow_offset_;
-
- /// Next Slide offset.
+ /// Next slice offset.
const unsigned next_sli_offset_;
- /// Slide offset.
+ /// Next slice offset for row.
+ const unsigned next_srow_offset_;
+
+ /// Slice offset.
const unsigned sli_offset_;
- /// End of the current slide.
+ /// End of the current slice.
mln_qlf_value(I)* eos_;
};
@@ -97,11 +98,16 @@
: super_(image),
border_x2_ (2 * image.border()),
row_offset_ (image.bbox().ncols() + border_x2_),
- eor_ (& image.at(geom::min_sli(image), geom::min_row(image), geom::max_col(image)) + 1),
- next_srow_offset_ ((image.bbox().ncols() + border_x2_) * border_x2_ ),
- next_sli_offset_ (row_offset_ * border_x2_),
- sli_offset_ ((image.bbox().ncols() + border_x2_) * (image.bbox().nrows() + border_x2_)),
- eos_ (& image.at(geom::min_sli(image), geom::max_row(image) + 1, geom::min_col(image)))
+ eor_ (& image.at(geom::min_sli(image),
+ geom::min_row(image),
+ geom::max_col(image)) + 1),
+ next_sli_offset_ (row_offset_ * border_x2_ + border_x2_),
+ next_srow_offset_ (next_sli_offset_ + image.bbox().ncols()),
+ sli_offset_ ((image.bbox().ncols() + border_x2_) *
+ (image.bbox().nrows() + border_x2_)),
+ eos_ (& image.at(geom::min_sli(image),
+ geom::max_row(image),
+ geom::max_col(image)) + 1)
{
mln_precondition(image.has_data());
}
@@ -112,17 +118,17 @@
fwd_pixter3d<I>::next_()
{
++this->value_ptr_;
- if (this->value_ptr_ == eor_ && this->value_ptr_ != this->eoi_)
- {
- this->value_ptr_ += border_x2_;
- eor_ += row_offset_;
- }
if (this->value_ptr_ == eos_ && this->value_ptr_ != this->eoi_)
{
this->value_ptr_ += next_sli_offset_;
eos_ += sli_offset_;
eor_ += next_srow_offset_;
}
+ else if (this->value_ptr_ == eor_ && this->value_ptr_ != this->eoi_)
+ {
+ this->value_ptr_ += border_x2_;
+ eor_ += row_offset_;
+ }
}
#endif // ! MLN_INCLUDE_ONLY
Index: tests/core/image3d.cc
--- tests/core/image3d.cc (revision 1909)
+++ tests/core/image3d.cc (working copy)
@@ -56,18 +56,22 @@
box3d b(make::point3d(1,2, 1), make::point3d(3,6, 3));
image3d<int> ima(b, 0);
- mln_piter_(image3d<int>) pi(ima.domain());
- mln_pixter_(image3d<int>) p(ima);
-
debug::iota(ima);
+ {
+ mln_fwd_piter_(image3d<int>) pi(ima.domain());
+ mln_fwd_pixter_(image3d<int>) p(ima);
pi.start();
p.start();
+ unsigned i = 0;
while (pi.is_valid())
{
- assert(ima(pi) == p.val());
+ mln_assertion(ima(pi) == p.val());
pi.next();
p.next();
+ ++i;
+ }
+ mln_assertion(i == b.npoints());
}
}
}
Index: tests/core/Makefile.am
--- tests/core/Makefile.am (revision 1909)
+++ tests/core/Makefile.am (working copy)
@@ -38,6 +38,7 @@
exact_SOURCES = exact.cc
h_vec_SOURCES = h_vec.cc
initialize_SOURCES = initialize.cc
+image3d_SOURCES = image3d.cc
graph_elt_neighborhood_SOURCES = graph_elt_neighborhood.cc
graph_elt_window_SOURCES = graph_elt_window.cc
graph_image_SOURCES = graph_image.cc
@@ -56,6 +57,7 @@
p_queue_fast_SOURCES = p_priority_queue_fast.cc
p_runs_SOURCES = p_runs.cc
point_set_compatibility_SOURCES = point_set_compatibility.cc
+pset_array_SOURCES = pset_array.cc
rle_image_SOURCES = rle_image.cc
sparse_image_SOURCES = sparse_image.cc
t_image_SOURCES = t_image.cc
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Misc. clean-up in line graph-related entities.
* mln/core/line_graph_elt_window.hh: Don't insert the reference
piter itself into the set of window sites.
* mln/core/line_graph_window_piter.hh,
* mln/core/line_graph_elt_neighborhood.hh,
* tests/core/line_graph_image.cc:
Typo, aesthetics changes.
mln/core/line_graph_elt_neighborhood.hh | 9 ++++-----
mln/core/line_graph_elt_window.hh | 13 +++++++++----
tests/core/line_graph_image.cc | 2 +-
3 files changed, 14 insertions(+), 10 deletions(-)
Index: mln/core/line_graph_elt_window.hh
--- mln/core/line_graph_elt_window.hh (revision 1908)
+++ mln/core/line_graph_elt_window.hh (working copy)
@@ -40,6 +40,10 @@
- mln::line_graph_elt_window
- mln::line_graph_elt_neighborhood. */
+/* FIXME: Due to the poor interface of mln::p_line_graph and
+ mln::util::graph, we show to much implementation details here.
+ Enrich their interfaces to avoid that. */
+
# include <mln/core/concept/window.hh>
# include <mln/core/line_graph_psite.hh>
# include <mln/core/line_graph_window_piter.hh>
@@ -86,6 +90,7 @@
/// Services for iterators.
/// \{
+ /// Compute the set of sites for this window around \a piter.
template <typename Piter>
void compute_sites_(Point_Iterator<Piter>& piter) const;
/// \}
@@ -132,17 +137,17 @@
/* FIXME: Move this computation out of the window. In fact,
this should be a service of the graph, also proposed by the
p_line_graph. */
- // Add the reference piter itself.
- sites.insert(piter.p_ref().id());
// Ajacent edges connected through node 1.
- // FIXME: Far too low-level.
+ /* We don't need to explicitely insert the reference piter (edge
+ id) itself into SITES, since it is part of the set of edges
+ adjacent to NODE1 and NODE2, and will therefore be
+ automatically added. */
util::node_id id1 = piter.p_ref().first_id();
const util::node<P>& node1 = piter.plg().gr_->node(id1);
for (std::vector<util::edge_id>::const_iterator e =
node1.edges.begin(); e != node1.edges.end(); ++e)
sites.insert(*e);
// Ajacent edges connected through node 2.
- // FIXME: Likewise.
util::node_id id2 = piter.p_ref().second_id();
const util::node<P>& node2 = piter.plg().gr_->node(id2);
for (std::vector<util::edge_id>::const_iterator e =
Index: mln/core/line_graph_window_piter.hh
Index: mln/core/line_graph_elt_neighborhood.hh
--- mln/core/line_graph_elt_neighborhood.hh (revision 1908)
+++ mln/core/line_graph_elt_neighborhood.hh (working copy)
@@ -93,6 +93,7 @@
/// Services for iterators.
/// \{
+ /// Compute the set of sites for this neighborhood around \a piter.
template <typename Piter>
void compute_sites_(Point_Iterator<Piter>& piter) const;
/// \}
@@ -112,21 +113,19 @@
util::edge_id ref_edge_id = piter.p_ref().id();
sites_t& sites = piter.sites();
sites.clear();
- /* FIXME: Move this computation out of the window. In fact,
+ /* FIXME: Move this computation out of the neighborhood. In fact,
this should be a service of the graph, also proposed by the
p_line_graph. */
// Ajacent edges connected through node 1.
- // FIXME: Far too low-level.
util::node_id id1 = piter.p_ref().first_id();
const util::node<P>& node1 = piter.plg().gr_->node(id1);
for (std::vector<util::edge_id>::const_iterator e =
node1.edges.begin(); e != node1.edges.end(); ++e)
- /* We explicitely enforce that the reference piter edge id is
- not inserted into SITES. */
+ // We explicitly enforce that the reference piter edge id is
+ // *not* inserted into SITES.
if (*e != ref_edge_id)
sites.insert(*e);
// Ajacent edges connected through node 2.
- // FIXME: Likewise.
util::node_id id2 = piter.p_ref().second_id();
const util::node<P>& node2 = piter.plg().gr_->node(id2);
for (std::vector<util::edge_id>::const_iterator e =
Index: tests/core/line_graph_image.cc
--- tests/core/line_graph_image.cc (revision 1908)
+++ tests/core/line_graph_image.cc (working copy)
@@ -110,7 +110,7 @@
mln_qiter_(win_t) q(win, p);
for_all (p)
{
- std::cout << "neighbors of " << p << " (" << ima(p) << "), "
+ std::cout << "sites adjacent to " << p << " (" << ima(p) << "), "
<< "including the site itself:" << std::endl;
for_all (q)
std::cout << " " << q << " (level = " << ima(q) << ")"
1
0