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