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
July 2005
- 4 participants
- 41 discussions
Index: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* tests/morpho/tests/reconstruction: Add tests for the selfdual
reconstruction.
* oln/morpho/reconstruction.hh: Uncomment parts related to the
selfdual reconstruction.
* oln/morpho/reconstruction_selfdual.hh: Selfdual reconstruction now
use neighborhood in place of windows.
oln/morpho/reconstruction.hh | 20 ++---
oln/morpho/reconstruction_selfdual.hh | 118 +++++++++++++++++++++++++---------
tests/morpho/tests/reconstruction | 20 +++++
3 files changed, 117 insertions(+), 41 deletions(-)
Index: oln/morpho/reconstruction.hh
--- oln/morpho/reconstruction.hh (revision 262)
+++ oln/morpho/reconstruction.hh (working copy)
@@ -30,7 +30,7 @@
# include <oln/morpho/reconstruction_by_dilation.hh>
# include <oln/morpho/reconstruction_by_erosion.hh>
-// # include <oln/morpho/reconstruction_selfdual.hh>
+# include <oln/morpho/reconstruction_selfdual.hh>
namespace oln {
@@ -83,16 +83,16 @@
// self dual
-// template <typename I1, typename I2>
-// oln_type_of(I1, concrete)
-// reconstruction_selfdual(const abstract::image_with_nbh<I1>& marker,
-// const abstract::image<I2>& mask)
-// {
-// mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
-// precondition(marker.size() == mask.size());
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ reconstruction_selfdual(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ precondition(marker.size() == mask.size());
-// return reconstruction(marker, mask, tag::selfdual(), tag::none());
-// }
+ return reconstruction(marker, mask, tag::selfdual(), tag::none());
+ }
// by dilation
Index: oln/morpho/reconstruction_selfdual.hh
--- oln/morpho/reconstruction_selfdual.hh (revision 262)
+++ oln/morpho/reconstruction_selfdual.hh (working copy)
@@ -30,6 +30,8 @@
# include <oln/canvas/reconstruction.hh>
# include <oln/morpho/tags.hh>
+# include <oln/morpho/local.hh>
+# include <oln/funobj/arith.hh>
//FIXME: Adapt ...
@@ -44,12 +46,12 @@
template<typename I1, typename I2>
struct reconstruction <I1, I2, tag::selfdual_type, tag::none_type>
- : public canvas::hybrid_reconstruction<I1, I2,
+ : public canvas::reconstruction<I1, I2, tag::hybrid_type,
reconstruction<I1, I2, tag::selfdual_type, tag::none_type> >
{
typedef reconstruction<I1, I2, tag::selfdual_type,
tag::none_type> self_type;
- typedef canvas::hybrid_reconstruction<I1, I2,
+ typedef canvas::reconstruction<I1, I2, tag::hybrid_type,
self_type> super_type;
reconstruction(const abstract::image_with_nbh<I1>& marker,
@@ -60,65 +62,123 @@
using super_type::mask;
using super_type::marker;
- using super_type::work;
using super_type::output;
using super_type::fwd_p;
using super_type::bkd_p;
- using super_type::win_plus;
- using super_type::win_minus;
using super_type::p;
- using super_type::q;
+ using super_type::n;
using super_type::fifo;
+ /// Local image "or-value" for dilation on sets
+ /// (based on the point and its backward neighborhood).
+
+ oln_type_of(I1, value) bkd_or()
+ {
+ if (output[bkd_p])
+ return true;
+ p = bkd_p;
+ for_all_n_of_p(n, p)
+ if (p.bkd_less(n) and output.hold(n) and output[n])
+ return true;
+
+ return false;
+ }
+
+
+ /// Local image "or-value" for dilation on sets
+ /// (based on the point and its forward neighborhood).
+
+ oln_type_of(I1, value) fwd_or()
+ {
+ if (output[fwd_p])
+ return true;
+ p = fwd_p;
+ for_all_n_of_p(n, p)
+ if (p.fwd_less(n) and output.hold(n) and output[n])
+ return true;
+
+ return false;
+ }
+
+
+
+ /// Local image "and-value" for erosion on sets
+ /// (based on the point and its backward neighborhood).
+
+ oln_type_of(I1, value) bkd_and()
+ {
+ if (not output[bkd_p])
+ return false;
+ p = bkd_p;
+ for_all_n_of_p(n, p)
+ if (p.bkd_less(n) and output.hold(n) and not output[n])
+ return false;
+
+ return true;
+ }
+
+
+ /// Local image "and-value" for erosion on sets
+ /// (based on the point and its forward neighborhood).
+
+ oln_type_of(I1, value) fwd_and()
+ {
+ if (not output[fwd_p])
+ return false;
+ p = fwd_p;
+ for_all_n_of_p(n, p)
+ if (p.fwd_less(n) and output.hold(n) and not output[n])
+ return false;
+
+ return true;
+ }
+
+
void impl_bkd_loop_body()
{
// FIXME: Shouldn't be .value() !
- if (work[bkd_p] < mask[bkd_p])
- output[bkd_p] = ntg::min(local_max(work, bkd_p, win_minus),
- mask[bkd_p].value());
+ if (output[bkd_p] < mask[bkd_p])
+ output[bkd_p] = f_min_alt(bkd_or(), mask[bkd_p].value());
else
- output[bkd_p] = ntg::max(local_min(work, bkd_p, win_minus),
- mask[bkd_p].value());
+ output[bkd_p] = f_max_alt(bkd_and(), mask[bkd_p].value());
}
void impl_fwd_loop_body()
{
// FIXME: Shouldn't be .value() !
- if (work[fwd_p] < mask[fwd_p])
- output[fwd_p] = ntg::min(local_max(work, fwd_p, win_plus),
- mask[fwd_p].value());
+ if (output[fwd_p] < mask[fwd_p])
+ output[fwd_p] = f_min_alt(fwd_or(), mask[fwd_p].value());
else
- output[fwd_p] = ntg::max(local_min(work, fwd_p, win_plus),
- mask[fwd_p].value());
+ output[fwd_p] = f_max_alt(fwd_and(), mask[fwd_p].value());
}
void impl_fifo_loop_body()
{
- if (output[q] < mask[p])
+ if (output[n] < mask[p])
{
- if (output[q] < output[p] && mask[q] != output[q])
+ if (output[n] < output[p] && mask[n] != output[n])
{
- output[q] = ntg::min(output[p].value(), mask[q].value());
- fifo.push(q);
+ output[n] = f_min_alt(output[p].value(), mask[n].value());
+ fifo.push(n);
}
}
else
- if (output[q] > output[p] && mask[q] != output[q])
+ if (output[n] > output[p] && mask[n] != output[n])
{
- output[q] = ntg::max(output[p].value(), mask[q].value());
- fifo.push(q);
+ output[n] = f_max_alt(output[p].value(), mask[n].value());
+ fifo.push(n);
}
}
- bool impl_exist_init()
+ bool impl_test_fifo_push()
{
- return output.hold(q) &&
- ((output[q] < output[bkd_p] && output[q] < mask[q]) ||
- (output[q] > output[bkd_p] && output[q] > mask[q]));
+ return output.hold(n) &&
+ ((output[n] < output[bkd_p] && output[n] < mask[n]) ||
+ (output[n] > output[bkd_p] && output[n] > mask[n]));
}
- void impl_preconditions()
+ void impl_preconditions() const
{
}
Index: tests/morpho/tests/reconstruction
--- tests/morpho/tests/reconstruction (revision 262)
+++ tests/morpho/tests/reconstruction (working copy)
@@ -28,6 +28,8 @@
image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_ero_hyb;
image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_ero_seq;
image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_ero_par;
+ image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_selfdual;
+ image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_selfdual_invert;
utils::key::value_type data_key[16] =
{ 0xd1, 0x5c, 0x13, 0xd8, 0xe0, 0xa8, 0x58, 0x7d,
@@ -73,6 +75,14 @@
morpho::tag::parallel(),
morpho::tag::by_erosion());
+ res_selfdual =
+ morpho::reconstruction_selfdual(join(marker, neighb_c4()),
+ mask);
+
+ res_selfdual_invert =
+ morpho::reconstruction_selfdual(join(marker_c, neighb_c4()),
+ level::invert(mask));
+
if (utils::md5(res_dil_hyb) != key)
return true;
@@ -81,12 +91,18 @@
return true;
if (!level::is_equal(res_ero_hyb, res_ero_seq))
return true;
- if (!level::is_equal(res_dil_hyb, level::invert(res_ero_seq)))
- return true;
if (!level::is_equal(res_dil_hyb, res_dil_par))
return true;
if (!level::is_equal(res_ero_hyb, res_ero_par))
return true;
+ if (!level::is_equal(res_selfdual, level::invert(res_selfdual_invert)))
+ return true;
+ if (!level::is_equal(res_dil_hyb, level::invert(res_ero_seq)))
+ return true;
+ if (!level::is_equal(res_dil_hyb, res_selfdual))
+ return true;
return false;
}
+
+
1
0
Index: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* tests/morpho/tests/reconstruction: Add parallel reconstruction tests.
* oln/morpho/reconstruction_by_dilation.hh: Add `by dilation' version
of the parallel reconstruction.
* oln/morpho/reconstruction_by_erosion.hh: Add `by erosion' version
of the parallel reconstruction..
* oln/canvas/reconstruction.hh: Add parallel reconstruction canvas.
* oln/canvas/forth.hh: New. Forward loop canvas. Both with and without
convergence versions.
* oln/canvas/backandforth.hh: back_and_force_until_convergence now
inherits from until_convergence.
* oln/canvas/until_convergence.hh: New. `until convergence' canvas.
oln/canvas/backandforth.hh | 55 ++---------
oln/canvas/forth.hh | 144 +++++++++++++++++++++++++++++++
oln/canvas/reconstruction.hh | 85 +++++++++++++++++-
oln/canvas/until_convergence.hh | 122 ++++++++++++++++++++++++++
oln/morpho/reconstruction_by_dilation.hh | 128 +++++++++++++++++++--------
oln/morpho/reconstruction_by_erosion.hh | 122 ++++++++++++++++++--------
tests/morpho/tests/reconstruction | 19 ++++
7 files changed, 558 insertions(+), 117 deletions(-)
Index: oln/canvas/backandforth.hh
--- oln/canvas/backandforth.hh (revision 261)
+++ oln/canvas/backandforth.hh (working copy)
@@ -28,8 +28,7 @@
#ifndef OLENA_CANVAS_BACKANDFORTH_HH
# define OLENA_CANVAS_BACKANDFORTH_HH
-# include <mlc/any.hh>
-# include <mlc/contract.hh>
+# include <oln/canvas/until_convergence.hh>
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/piter.hh>
@@ -37,20 +36,14 @@
namespace oln {
- namespace canvas
- {
+ namespace canvas {
+
template <typename I, typename E>
- struct back_and_forth_until_convergence : public mlc::any<E>
+ struct back_and_forth_until_convergence : public until_convergence<E>
{
// Abstract methods.
- // Initialize 'work'.
- void init()
- {
- this->exact().impl_init();
- }
-
// Do something like 'work -> output'.
void bkd_loop_body()
{
@@ -63,25 +56,10 @@
this->exact().impl_fwd_loop_body();
}
- // Check stability from input, output, and work.
- bool is_stable() const
- {
- return this->exact().impl_is_stable();
- }
-
- // Do something like 'work := output'.
- void re_loop()
- {
- return this->exact().impl_re_loop();
- }
-
// Concrete method.
- void run()
- {
- bool stability;
- init();
- for (;;)
+ void impl_loop_body()
{
+
// back
for_all_p (bkd_p)
bkd_loop_body();
@@ -90,14 +68,6 @@
for_all_p (fwd_p)
fwd_loop_body();
- // stability check
- stability = is_stable();
- if (stability)
- return;
-
- // prepare a new loop iteration
- re_loop();
- }
}
@@ -117,11 +87,8 @@
// Check for impls..
~back_and_forth_until_convergence()
{
- mlc_check_method_impl(E, void, init, , );
mlc_check_method_impl(E, void, bkd_loop_body, , );
mlc_check_method_impl(E, void, fwd_loop_body, , );
- mlc_check_method_impl(E, bool, is_stable, , const);
- mlc_check_method_impl(E, void, re_loop, , );
}
};
Index: oln/canvas/forth.hh
--- oln/canvas/forth.hh (revision 0)
+++ oln/canvas/forth.hh (revision 0)
@@ -0,0 +1,144 @@
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330, 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 OLENA_CANVAS_FORTH_HH
+# define OLENA_CANVAS_FORTH_HH
+
+# include <oln/canvas/until_convergence.hh>
+# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/piter.hh>
+
+
+namespace oln {
+
+
+ namespace canvas {
+
+
+ template <typename I, typename E>
+ struct forth_until_convergence : public until_convergence<E>
+ {
+ // Abstract methods.
+
+ // Do something like 'work -> output'.
+ void fwd_loop_body()
+ {
+ this->exact().impl_fwd_loop_body();
+ }
+
+ // Concrete method.
+ void impl_loop_body()
+ {
+
+ // back
+ for_all_p (fwd_p)
+ fwd_loop_body();
+ }
+
+
+ protected:
+
+ // Ctor.
+ forth_until_convergence(const abstract::image<I>& input) :
+ fwd_p(input.size())
+ {
+ }
+
+ // Attributes.
+ oln_type_of(I, fwd_piter) fwd_p;
+
+ // Check for impls..
+ ~forth_until_convergence()
+ {
+ mlc_check_method_impl(E, void, fwd_loop_body, , );
+ }
+
+ };
+
+
+ template <typename I, typename E>
+ struct forth : public mlc::any<E>
+ {
+ // Abstract methods.
+
+ void init()
+ {
+ this->exact().impl_init();
+ }
+
+ void preconditions()
+ {
+ this->exact().impl_preconditions();
+ }
+
+ // Do something like 'work -> output'.
+ void fwd_loop_body()
+ {
+ this->exact().impl_fwd_loop_body();
+ }
+
+ // Concrete method.
+ void run()
+ {
+ preconditions();
+ init();
+
+ // forth
+ for_all_p (fwd_p)
+ fwd_loop_body();
+
+ }
+
+
+ protected:
+
+ // Ctor.
+ forth(const abstract::image<I>& input) :
+ fwd_p(input.size())
+ {
+ }
+
+ // Attributes.
+ oln_type_of(I, fwd_piter) fwd_p;
+
+ // Check for impls..
+ ~forth()
+ {
+ mlc_check_method_impl(E, void, init, , );
+ mlc_check_method_impl(E, void, fwd_loop_body, , );
+ mlc_check_method_impl(E, void, preconditions, , );
+ }
+
+ };
+
+ } // end of namespace oln::canvas
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CANVAS_FORTH_HH
Index: oln/morpho/reconstruction_by_dilation.hh
--- oln/morpho/reconstruction_by_dilation.hh (revision 261)
+++ oln/morpho/reconstruction_by_dilation.hh (working copy)
@@ -55,13 +55,6 @@
using super_type::p;
- reconstruction_by_dilation(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask) :
- super_type(marker, mask)
- {
- }
-
-
/// Local image "or-value" for dilation on sets
/// (based on the point and its backward neighborhood).
@@ -107,13 +100,66 @@
output[fwd_p] = f_min_alt(mask[fwd_p].value(), fwd_or());
}
- void impl_preconditions()
+ reconstruction_by_dilation(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {
+ }
+
+ };
+
+ // Hybrid version
+
+ template<typename I1, typename I2>
+ struct reconstruction <I1, I2, tag::hybrid_type, tag::by_dilation_type>
+ : public reconstruction_by_dilation<I1, I2, tag::hybrid_type,
+ reconstruction<I1, I2, tag::hybrid_type, tag::by_dilation_type> >
+ {
+ typedef reconstruction<I1, I2, tag::hybrid_type,
+ tag::by_dilation_type> self_type;
+ typedef reconstruction_by_dilation<I1, I2, tag::hybrid_type,
+ self_type> super_type;
+
+ using super_type::mask;
+ using super_type::marker;
+ using super_type::output;
+ using super_type::bkd_p;
+ using super_type::n;
+ using super_type::p;
+ using super_type::fifo;
+
+
+ void impl_preconditions() const
{
precondition(level::is_greater_or_equal(mask, marker));
}
+ void impl_fifo_loop_body()
+ {
+ if ((output[n] < output[p]) and (mask[n] != output[n]))
+ {
+ // FIXME: The calls to value_box<>::value are needed to
+ // have f_min_alt compile. Try to get rid of it.
+ output[n] = f_max_alt(output[p].value(), mask[n].value());
+ fifo.push(n);
+ }
+ }
+
+ bool impl_test_fifo_push()
+ {
+ return output[n] < output[bkd_p] and output[n] < mask[n];
+ }
+
+
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {
+ }
+
};
+
// Sequential version
template<typename I1, typename I2>
@@ -127,58 +173,68 @@
typedef reconstruction_by_dilation<I1, I2, tag::sequential_type,
self_type> super_type;
+ using super_type::mask;
+ using super_type::marker;
+
+ void impl_preconditions() const
+ {
+ precondition(level::is_greater_or_equal(mask, marker));
+ }
+
+
reconstruction(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask) :
super_type(marker, mask)
{
}
+
};
- // Hybrid version
+ // Parallel version
template<typename I1, typename I2>
- struct reconstruction <I1, I2, tag::hybrid_type, tag::by_dilation_type>
- : public reconstruction_by_dilation<I1, I2, tag::hybrid_type,
- reconstruction<I1, I2, tag::hybrid_type, tag::by_dilation_type> >
+ struct reconstruction<I1, I2, tag::parallel_type, tag::by_dilation_type>
+ : public canvas::reconstruction<I1, I2, tag::parallel_type,
+ reconstruction<I1, I2, tag::parallel_type, tag::by_dilation_type> >
{
- typedef reconstruction<I1, I2, tag::hybrid_type,
+ typedef reconstruction<I1, I2, tag::parallel_type,
tag::by_dilation_type> self_type;
- typedef reconstruction_by_dilation<I1, I2, tag::hybrid_type,
+ typedef canvas::reconstruction<I1, I2, tag::parallel_type,
self_type> super_type;
- reconstruction(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask) :
- super_type(marker, mask)
- {
- }
-
using super_type::mask;
+ using super_type::marker;
+ using super_type::save;
using super_type::output;
- using super_type::bkd_p;
- using super_type::n;
- using super_type::p;
- using super_type::fifo;
+ using super_type::fwd_p;
- void impl_fifo_loop_body()
- {
- if ((output[n] < output[p]) and (mask[n] != output[n]))
+ void impl_preconditions() const
{
- // FIXME: The calls to value_box<>::value are needed to
- // have f_min_alt compile. Try to get rid of it.
- output[n] = f_max_alt(output[p].value(), mask[n].value());
- fifo.push(n);
+ precondition(level::is_greater_or_equal(mask, marker));
}
+
+ void impl_fwd_loop_body()
+ {
+ // dilation step
+ if (not output[fwd_p])
+ output[fwd_p] = local_or_value(join(save, marker.nbh_get()),
+ fwd_p);
+
+ // minimum between mask and output
+ output[fwd_p] = f_min_alt(output[fwd_p].value(), mask[fwd_p].value());
}
- bool impl_test_fifo_push()
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
{
- return output[n] < output[bkd_p] and output[n] < mask[n];
}
};
+
}
}
Index: oln/canvas/until_convergence.hh
--- oln/canvas/until_convergence.hh (revision 0)
+++ oln/canvas/until_convergence.hh (revision 0)
@@ -0,0 +1,122 @@
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330, 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 OLENA_CANVAS_UNTIL_CONVERGENCE_HH
+# define OLENA_CANVAS_UNTIL_CONVERGENCE_HH
+
+# include <mlc/any.hh>
+# include <mlc/contract.hh>
+
+namespace oln {
+
+
+ namespace canvas {
+
+
+ template <typename E>
+ struct until_convergence : public mlc::any<E>
+ {
+ // Abstract methods.
+
+ // Initialize 'work'.
+ void init()
+ {
+ this->exact().impl_init();
+ }
+
+ void preconditions() const
+ {
+ this->exact().impl_preconditions();
+ }
+
+ // Do something like 'work -> output'.
+ void loop_body()
+ {
+ this->exact().impl_loop_body();
+ }
+
+ // Check stability from input, output, and work.
+ bool is_stable() const
+ {
+ return this->exact().impl_is_stable();
+ }
+
+ // Do something like 'work := output'.
+ void re_loop()
+ {
+ return this->exact().impl_re_loop();
+ }
+
+ // Concrete method.
+ void run()
+ {
+ bool stability;
+ preconditions();
+ init();
+ for (;;)
+ {
+ loop_body();
+
+ // stability check
+ stability = is_stable();
+ if (stability)
+ return;
+
+ // prepare a new loop iteration
+ re_loop();
+ }
+ }
+
+
+ protected:
+
+ // Ctor.
+ until_convergence()
+ {
+ }
+
+ // Check for impls..
+ ~until_convergence()
+ {
+ mlc_check_method_impl(E, void, init, , );
+ mlc_check_method_impl(E, void, preconditions, , const);
+ mlc_check_method_impl(E, void, loop_body, , );
+ mlc_check_method_impl(E, bool, is_stable, , const);
+ mlc_check_method_impl(E, void, re_loop, , );
+ }
+
+
+ };
+
+
+ } // end of namespace oln::canvas
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CANVAS_UNTIL_CONVERGENCE_HH
Index: tests/morpho/tests/reconstruction
--- tests/morpho/tests/reconstruction (revision 261)
+++ tests/morpho/tests/reconstruction (working copy)
@@ -24,8 +24,10 @@
image2d<ntg::bin> mask;
image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_dil_hyb;
image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_dil_seq;
+ image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_dil_par;
image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_ero_hyb;
image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_ero_seq;
+ image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_ero_par;
utils::key::value_type data_key[16] =
{ 0xd1, 0x5c, 0x13, 0xd8, 0xe0, 0xa8, 0x58, 0x7d,
@@ -46,7 +48,14 @@
morpho::tag::sequential(),
morpho::tag::by_dilation());
+ res_dil_par =
+ morpho::reconstruction(join(marker, neighb_c4()),
+ mask,
+ morpho::tag::parallel(),
+ morpho::tag::by_dilation());
+
image2d<ntg::bin> marker_c(level::invert(marker));
+
res_ero_hyb =
morpho::reconstruction(join(marker_c, neighb_c4()),
level::invert(mask),
@@ -58,6 +67,12 @@
morpho::tag::sequential(),
morpho::tag::by_erosion());
+ res_ero_par =
+ morpho::reconstruction(join(marker_c, neighb_c4()),
+ level::invert(mask),
+ morpho::tag::parallel(),
+ morpho::tag::by_erosion());
+
if (utils::md5(res_dil_hyb) != key)
return true;
@@ -68,6 +83,10 @@
return true;
if (!level::is_equal(res_dil_hyb, level::invert(res_ero_seq)))
return true;
+ if (!level::is_equal(res_dil_hyb, res_dil_par))
+ return true;
+ if (!level::is_equal(res_ero_hyb, res_ero_par))
+ return true;
return false;
}
Index: oln/morpho/reconstruction_by_erosion.hh
--- oln/morpho/reconstruction_by_erosion.hh (revision 261)
+++ oln/morpho/reconstruction_by_erosion.hh (working copy)
@@ -55,13 +55,6 @@
using super_type::p;
- reconstruction_by_erosion(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask) :
- super_type(marker, mask)
- {
- }
-
-
/// Local image "and-value" for erosion on sets
/// (based on the point and its backward neighborhood).
@@ -107,13 +100,66 @@
output[fwd_p] = f_max_alt(mask[fwd_p].value(), fwd_and());
}
- void impl_preconditions()
+ reconstruction_by_erosion(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {
+ }
+
+ };
+
+
+ // Hybrid version
+
+ template<typename I1, typename I2>
+ struct reconstruction <I1, I2, tag::hybrid_type, tag::by_erosion_type>
+ : public reconstruction_by_erosion<I1, I2, tag::hybrid_type,
+ reconstruction<I1, I2, tag::hybrid_type, tag::by_erosion_type> >
+ {
+ typedef reconstruction<I1, I2, tag::hybrid_type,
+ tag::by_erosion_type> self_type;
+ typedef reconstruction_by_erosion<I1, I2, tag::hybrid_type,
+ self_type> super_type;
+
+ using super_type::mask;
+ using super_type::marker;
+ using super_type::output;
+ using super_type::bkd_p;
+ using super_type::n;
+ using super_type::p;
+ using super_type::fifo;
+
+
+ void impl_fifo_loop_body()
+ {
+ if ((output[n] > output[p]) and (mask[n] != output[n]))
+ {
+ // FIXME: The calls to value_box<>::value are needed to
+ // have f_min_alt compile. Try to get rid of it.
+ output[n] = f_min_alt(output[p].value(), mask[n].value());
+ fifo.push(n);
+ }
+ }
+
+ void impl_preconditions() const
{
precondition(level::is_greater_or_equal(marker, mask));
}
+ bool impl_test_fifo_push()
+ {
+ return output[n] > output[bkd_p] and output[n] > mask[n];
+ }
+
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {
+ }
+
};
+
// Sequential version
template<typename I1, typename I2>
@@ -126,6 +172,13 @@
tag::by_erosion_type> self_type;
typedef reconstruction_by_erosion<I1, I2, tag::sequential_type,
self_type> super_type;
+ using super_type::mask;
+ using super_type::marker;
+
+ void impl_preconditions() const
+ {
+ precondition(level::is_greater_or_equal(marker, mask));
+ }
reconstruction(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask) :
@@ -135,46 +188,45 @@
};
- // Hybrid version
+ // Parallel version
template<typename I1, typename I2>
- struct reconstruction <I1, I2, tag::hybrid_type, tag::by_erosion_type>
- : public reconstruction_by_erosion<I1, I2, tag::hybrid_type,
- reconstruction<I1, I2, tag::hybrid_type, tag::by_erosion_type> >
+ struct reconstruction<I1, I2, tag::parallel_type, tag::by_erosion_type>
+ : public canvas::reconstruction<I1, I2, tag::parallel_type,
+ reconstruction<I1, I2, tag::parallel_type, tag::by_erosion_type> >
{
- typedef reconstruction<I1, I2, tag::hybrid_type,
+ typedef reconstruction<I1, I2, tag::parallel_type,
tag::by_erosion_type> self_type;
- typedef reconstruction_by_erosion<I1, I2, tag::hybrid_type,
+ typedef canvas::reconstruction<I1, I2, tag::parallel_type,
self_type> super_type;
- reconstruction(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask) :
- super_type(marker, mask)
- {
- }
-
using super_type::mask;
+ using super_type::marker;
+ using super_type::save;
using super_type::output;
- using super_type::bkd_p;
- using super_type::n;
- using super_type::p;
- using super_type::fifo;
+ using super_type::fwd_p;
- void impl_fifo_loop_body()
- {
- if ((output[n] > output[p]) and (mask[n] != output[n]))
+ void impl_preconditions() const
{
- // FIXME: The calls to value_box<>::value are needed to
- // have f_min_alt compile. Try to get rid of it.
- output[n] = f_min_alt(output[p].value(), mask[n].value());
- fifo.push(n);
+ precondition(level::is_greater_or_equal(marker, mask));
}
+
+ void impl_fwd_loop_body()
+ {
+ // erosion step
+ if (output[fwd_p])
+ output[fwd_p] = local_and_value(join(save, marker.nbh_get()),
+ fwd_p);
+
+ // maximum between mask and output
+ output[fwd_p] = f_max_alt(output[fwd_p].value(), mask[fwd_p].value());
}
- bool impl_test_fifo_push()
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
{
- return output[n] > output[bkd_p] and output[n] > mask[n];
}
};
Index: oln/canvas/reconstruction.hh
--- oln/canvas/reconstruction.hh (revision 261)
+++ oln/canvas/reconstruction.hh (working copy)
@@ -30,6 +30,7 @@
# include <queue>
+# include <oln/canvas/forth.hh>
# include <oln/canvas/backandforth.hh>
# include <oln/level/compare.hh>
# include <oln/utils/clone.hh>
@@ -65,6 +66,8 @@
typedef oln_nbh_type_of(nbh_type, window) window_type;
typedef oln_type_of(I1, concrete) output_type;
+ // Abstract methods.
+
bool test_fifo_push()
{
p = bkd_p;
@@ -75,7 +78,8 @@
return false;
}
- void preconditions()
+
+ void preconditions() const
{
this->exact().impl_preconditions();
}
@@ -95,6 +99,8 @@
this->exact().impl_fifo_loop_body();
}
+ // Concrete methods.
+
void init()
{
// FIXME: We can't use `output = clone(marker)' directly here,
@@ -153,6 +159,7 @@
~reconstruction()
{
mlc_check_method_impl(E, bool, test_fifo_push, , );
+ mlc_check_method_impl(E, void, preconditions, , const);
mlc_check_method_impl(E, void, bkd_loop_body, , );
mlc_check_method_impl(E, void, fwd_loop_body, , );
mlc_check_method_impl(E, void, fifo_loop_body, , );
@@ -175,7 +182,6 @@
-
template <typename I1, typename I2, typename E>
struct reconstruction<I1, I2, morpho::tag::sequential_type, E> :
public back_and_forth_until_convergence<I1, E>
@@ -185,6 +191,8 @@
typedef oln_nbh_type_of(nbh_type, window) window_type;
typedef oln_type_of(I1, concrete) output_type;
+ // Concrete methods.
+
void impl_init()
{
// FIXME: We can't use `output = clone(marker)' directly here,
@@ -218,6 +226,8 @@
return output.unbox();
}
+ protected:
+
reconstruction(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask) :
super_type(marker),
@@ -237,6 +247,77 @@
};
+
+ template <typename I1, typename I2, typename E>
+ struct reconstruction<I1, I2, morpho::tag::parallel_type, E> :
+ public forth_until_convergence<I1, E>
+ {
+ typedef forth_until_convergence<I1, E> super_type;
+ typedef oln_type_of(I1, neighb) nbh_type;
+ typedef oln_nbh_type_of(nbh_type, window) window_type;
+ typedef oln_type_of(I1, concrete) output_type;
+
+ // Abstract methods.
+
+ void fwd_loop_body()
+ {
+ this->exact().impl_fwd_loop_body();
+ }
+
+ // Concrete methods.
+
+ void impl_init()
+ {
+ // FIXME: We can't use `output = clone(marker)' directly here,
+ // because box's op=(const abstract::image<II>& rhs) would be
+ // called, which is empty (see oln/core/box.hh).
+ output_type output_tmp(clone(marker));
+ output = output_tmp;
+ // FIXME: We can't use `save = clone(marker)' directly here,
+ // because box's op=(const abstract::image<II>& rhs) would be
+ // called, which is empty (see oln/core/box.hh).
+ output_type save_tmp(clone(marker));
+ save = save_tmp;
+
+ }
+
+
+ bool impl_is_stable() const
+ {
+ return level::is_equal(save, output);
+ }
+
+ void impl_re_loop()
+ {
+ // FIXME: We can't use `save = clone(output)' directly here,
+ // because box's op=(const abstract::image<II>& rhs) would be
+ // called, which is empty (see oln/core/box.hh).
+ save.unbox() = clone(output);
+ }
+
+ oln_type_of(I1, concrete) get_output()
+ {
+ return output.unbox();
+ }
+
+ protected:
+
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker),
+ marker(marker.exact()),
+ mask(mask.exact())
+ {
+ }
+
+ box<oln_type_of(I1, concrete)> save;
+ box<oln_type_of(I1, concrete)> output;
+ box<const I1> marker;
+ box<const I2> mask;
+
+ };
+
+
}
1
0
25 Jul '05
Index: ChangeLog
from Christophe Berger <christophe(a)lrde.epita.fr>
* olena/oln/appli/astro/clean.hh: No ntg use anymore.
* olena/oln/appli/astro/tree_statistics.hh: Fix missing include.
* olena/oln/appli/astro/graphical_interface/interface.pro: Define to
know if sanity or makefile is building app.
* olena/oln/appli/astro/graphical_interface/image_viewer.hh: prevent
sanity.
* olena/oln/appli/astro/graphical_interface/qtincludes.hh: Likewise.
* olena/oln/appli/astro/graphical_interface/utils.hh: Likewise.
* olena/oln/appli/astro/graphical_interface/filterinterface.hh:
Likewise and fix attribute bug.
clean.hh | 41 ++++++++++++++++++++++++------
graphical_interface/filterinterface.hh | 45 ++++++++++++++++++++-------------
graphical_interface/image_viewer.hh | 10 ++++---
graphical_interface/interface.pro | 2 +
graphical_interface/qtincludes.hh | 18 +++++++------
graphical_interface/utils.hh | 9 ++++--
tree_statistics.hh | 1
7 files changed, 87 insertions(+), 39 deletions(-)
Index: olena/oln/appli/astro/graphical_interface/filterinterface.hh
--- olena/oln/appli/astro/graphical_interface/filterinterface.hh (revision 260)
+++ olena/oln/appli/astro/graphical_interface/filterinterface.hh (working copy)
@@ -25,6 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
+#ifdef _COMPILE_WITH_QT
#ifndef _FILTERINTERFACE_HH_
# define _FILTERINTERFACE_HH_
# include <string>
@@ -76,14 +77,13 @@
mt_.set_area_max(value_area_max->value());
mt_.set_level(value_level->value());
mt_.set_height(value_height->value());
- mt_.set_circle(value_circle->value() / 100);
- mt_.set_tower(value_tower->value() / 100);
-
- std::string out = "attributes value changed.";// area("
-// + Utils::int2string(value_area->value())
-// + "), point_value("
-// + Utils::int2string(value_level->value())
-// + ")";
+ float value_to_set = value_circle->value();
+ value_to_set /= 100;
+ mt_.set_circle(value_to_set);
+ value_to_set = value_tower->value();
+ value_to_set /= 100;
+ mt_.set_tower(value_to_set);
+ std::string out = "attributes value changed.";
this->text_state->setText(out.c_str());
}
@@ -109,6 +109,16 @@
display_out_.reload(tmp_);
this->text_state->setText("");
display_out_.show();
+#ifndef NDEBUG
+ std::cerr << "Attribute flags:" << std::endl
+ << " * Area: " << mt_.area_tag_ << " from " << mt_.get_area_min() << " to "
+ << mt_.get_area_max() << std::endl
+ << " * Level: " << mt_.level_tag_ << " value: " << mt_.get_level() << std::endl
+ << " * Height: " << mt_.height_tag_ << " value: " << mt_.get_height() << std::endl
+ << " * Circle: " << mt_.circle_tag_ << " value: " << mt_.get_circle() << std::endl
+ << " * Center: " << mt_.center_p_tag_ << std::endl
+ << " * Tower: " << mt_.tour_tag_ << " value: " << mt_.get_tower() << std::endl;
+#endif
}
virtual void DisplayInputImage()
@@ -212,3 +222,4 @@
};
#endif // !_FILTERINTERFACE_HH_
+#endif // !_COMPILE_WITH_QT
Index: olena/oln/appli/astro/clean.hh
--- olena/oln/appli/astro/clean.hh (revision 260)
+++ olena/oln/appli/astro/clean.hh (working copy)
@@ -41,8 +41,6 @@
# include <vector>
-
-
#define get_aux_data(IT1ER, AT1T1R) this->aux_data_[IT1ER].call(&T1::AT1T1R##_get)
#define set_aux_data(IT1ER, AT1T1R, VAL) this->aux_data_[IT1ER].call(&T1::AT1T1R##_set, VAL)
@@ -114,32 +112,61 @@
{
area_min_ = nb;
}
+ unsigned get_area_min() const
+ {
+ return area_min_;
+ }
void set_tower(float nb)
{
tour_ = nb;
}
+ float get_tower() const
+ {
+ return tour_;
+ }
+
void set_circle(float nb)
{
circle_ = nb;
}
+ float get_circle() const
+ {
+ return circle_;
+ }
+
void set_area_max(unsigned nb)
{
area_max_ = nb;
}
+ unsigned get_area_max() const
+ {
+ return area_max_;
+ }
+
void set_level(unsigned nb)
{
level_ = nb;
}
+ unsigned get_level() const
+ {
+ return level_;
+ }
+
void set_height(unsigned nb)
{
height_ = nb;
}
+ unsigned get_height() const
+ {
+ return height_;
+ }
+
// attributes to compute the output
bool level_attr(const point_type& p)
@@ -282,20 +309,20 @@
{
unsigned tmp = get_aux_data(*c, height) +
this->input[*c].value() - this->input[*p].value();
- set_aux_data(*p, height, ntg::max(tmp, get_aux_data(*p, height)));
+ set_aux_data(*p, height, std::max(tmp, get_aux_data(*p, height)));
}
if (tour_tag_)
set_aux_data(*p, int_volume, get_aux_data(*p, int_volume) +
get_aux_data(*c, int_volume));
if (circle_tag_)
{
- set_aux_data(*p, row_min, ntg::min(get_aux_data(*p, row_min),
+ set_aux_data(*p, row_min, std::min(get_aux_data(*p, row_min),
get_aux_data(*c, row_min)));
- set_aux_data(*p, row_max, ntg::max(get_aux_data(*p, row_max),
+ set_aux_data(*p, row_max, std::max(get_aux_data(*p, row_max),
get_aux_data(*c, row_max)));
- set_aux_data(*p, col_min, ntg::min(get_aux_data(*p, col_min),
+ set_aux_data(*p, col_min, std::min(get_aux_data(*p, col_min),
get_aux_data(*c, col_min)));
- set_aux_data(*p, col_max, ntg::max(get_aux_data(*p, col_max),
+ set_aux_data(*p, col_max, std::max(get_aux_data(*p, col_max),
get_aux_data(*c, col_max)));
}
if (center_p_tag_)
Index: olena/oln/appli/astro/graphical_interface/interface.pro
--- olena/oln/appli/astro/graphical_interface/interface.pro (revision 260)
+++ olena/oln/appli/astro/graphical_interface/interface.pro (working copy)
@@ -3,6 +3,8 @@
CONFIG += warn_off release qt
+DEFINES += _COMPILE_WITH_QT
+
INCLUDEPATH += . ../../../../../olena ../../../../../metalic ../../../../../integre
SOURCES += main.cc
Index: olena/oln/appli/astro/graphical_interface/image_viewer.hh
--- olena/oln/appli/astro/graphical_interface/image_viewer.hh (revision 260)
+++ olena/oln/appli/astro/graphical_interface/image_viewer.hh (working copy)
@@ -25,6 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
+#ifdef _COMPILE_WITH_QT
#ifndef _IMAGE_VIEWER_HH_
# define _IMAGE_VIEWER_HH_
# include "qtincludes.hh"
@@ -145,3 +146,4 @@
};
#endif // !_IMAGE_VIEWER_HH_
+#endif // !_COMPILE_WITH_QT
Index: olena/oln/appli/astro/graphical_interface/utils.hh
--- olena/oln/appli/astro/graphical_interface/utils.hh (revision 260)
+++ olena/oln/appli/astro/graphical_interface/utils.hh (working copy)
@@ -25,8 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
+#ifdef _COMPILE_WITH_QT
#ifndef _UTILS_HH_
# define _UTILS_HH_
+# include <string>
// FIXME: #include something here!
@@ -50,3 +52,4 @@
}
#endif // !_UTILS_HH_
+#endif // !_COMPILE_WITH_QT
Index: olena/oln/appli/astro/graphical_interface/qtincludes.hh
--- olena/oln/appli/astro/graphical_interface/qtincludes.hh (revision 260)
+++ olena/oln/appli/astro/graphical_interface/qtincludes.hh (working copy)
@@ -25,6 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
+#ifdef _COMPILE_WITH_QT
#include <qapplication.h>
#include <qpushbutton.h>
#include <qlabel.h>
@@ -33,3 +34,4 @@
#include <qslider.h>
#include <qcheckbox.h>
#include <qspinbox.h>
+#endif // !_COMPILE_WITH_QT
Index: olena/oln/appli/astro/tree_statistics.hh
--- olena/oln/appli/astro/tree_statistics.hh (revision 260)
+++ olena/oln/appli/astro/tree_statistics.hh (working copy)
@@ -39,6 +39,7 @@
# include <oln/basics.hh>
# include <queue>
+# include <fstream>
namespace oln {
1
0
proto-1.0 260: Fix many "include"s and update basic operator overloading.
by Thierry GERAUD 25 Jul '05
by Thierry GERAUD 25 Jul '05
25 Jul '05
2005-07-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Fix many "include"s and update basic operator overloading.
* oln/ops/macro.hh: New file.
* oln/funobj/invert.hh (oln/basics.hh): Fix to pass make check.
(FIXME): New negative commentary about this file.
* oln/core/abstract/point.hh (operator_eq): Add commented code
that will be later useful.
* oln/core/abstract/size.hh (operator_eq): Likewise.
* oln/core/coord.hh (operator==): Replace by...
(operator_eq): ...this.
* oln/core/2d/dpoint2d.hh (operator+): Replace by...
(operator_plus): ...this.
* oln/core/2d/point2d.hh (operator_eq): New proc.
* oln/core/2d/size2d.hh (operator_eq): Likewise.
* oln/core/pw/macros.hh (oln_pw_decl_binary): Update to rely
on static overloading.
(oln_pw_decl_binary_with_lit): Remove because obsolete.
(oln_pw_decl_binary_explicit): Likewise.
(oln_pw_decl_binary_with_lit_explicit): Likewise.
* oln/core/pw/arith.hh: Update.
* oln/core/pw/logic.hh: Update.
* oln/core/pw/cmp.hh: Update.
* oln/core/gen/regular_window.hh (get_fwd_win): Fix call to
card().
(get_fwd_win_p, get_bkd_win, get_bkd_win_p): Likewise.
* oln/utils/buffer.hxx (ntg): Remove dependance.
* oln/utils/buffer.hh (ntg): Likewise.
* oln/utils/overload.hh: Update.
* oln/ops/cmp.hh: Update.
* oln/makefile.src: Update.
* oln/morpho/lower_completion.hh: Fix include.
* oln/appli/astro/graphical_interface/utils.hh (std): Add
namespace qualification.
(FIXME): New comment!
* oln/io/pnm_bin.hh: Fix include.
* oln/level/arith.hh: Fix include.
1
0
2005-07-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
* mlc/flogic.hh: New file.
* mlc/fcmp.hh (fun): New namespace to put functions in.
* mlc/makefile.src: Update.
1
0
proto-1.0 258: Repair morphological reconstructions (hybrid and sequential)
by Damien Thivolle 22 Jul '05
by Damien Thivolle 22 Jul '05
22 Jul '05
Je fais le reconstruction auto-duale demain.
Index: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* tests/morpho/tests/reconstruction: Re-enable reconstruction tests.
* oln/core/abstract/point.hh: Fix omitted parenthesis.
* oln/morpho/reconstruction_canvas.inctrash: Remove.
* oln/morpho/reconstruction.trash: Remove.
* oln/morpho/reconstruction_by_dilation.hh: Replace windows by
neighborhoods.
* oln/canvas/reconstruction.hh: Likewise.
* oln/morpho/reconstruction_by_erosion.hh: Likewise.
* oln/morpho/reconstruction.hh: Disable self-dual reconstruction for
now.
* oln/morpho/reconstruction_selfdual.hh: Add a reminder.
oln/canvas/reconstruction.hh | 106 ++++++-------
oln/core/abstract/point.hh | 4
oln/morpho/reconstruction.hh | 22 +-
oln/morpho/reconstruction.trash | 227 ----------------------------
oln/morpho/reconstruction_by_dilation.hh | 154 ++++++++++---------
oln/morpho/reconstruction_by_erosion.hh | 138 +++++++++--------
oln/morpho/reconstruction_canvas.inctrash | 238 ------------------------------
oln/morpho/reconstruction_selfdual.hh | 2
tests/morpho/tests/reconstruction | 45 ++---
9 files changed, 254 insertions(+), 682 deletions(-)
Index: oln/morpho/reconstruction.hh
--- oln/morpho/reconstruction.hh (revision 257)
+++ oln/morpho/reconstruction.hh (working copy)
@@ -30,7 +30,7 @@
# include <oln/morpho/reconstruction_by_dilation.hh>
# include <oln/morpho/reconstruction_by_erosion.hh>
-# include <oln/morpho/reconstruction_selfdual.hh>
+// # include <oln/morpho/reconstruction_selfdual.hh>
namespace oln {
@@ -49,7 +49,9 @@
{
reconstruction<I1, I2, A, Op> tmp(marker, mask);
// tmp.entering(); FIXME: something like that ?
+
tmp.run();
+
// tmp.exiting(); FIXME: something like that ?
return tmp.get_output();
}
@@ -81,16 +83,16 @@
// self dual
- template <typename I1, typename I2>
- oln_type_of(I1, concrete)
- reconstruction_selfdual(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask)
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- precondition(marker.size() == mask.size());
+// template <typename I1, typename I2>
+// oln_type_of(I1, concrete)
+// reconstruction_selfdual(const abstract::image_with_nbh<I1>& marker,
+// const abstract::image<I2>& mask)
+// {
+// mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+// precondition(marker.size() == mask.size());
- return reconstruction(marker, mask, tag::selfdual(), tag::none());
- }
+// return reconstruction(marker, mask, tag::selfdual(), tag::none());
+// }
// by dilation
Index: oln/morpho/reconstruction_selfdual.hh
--- oln/morpho/reconstruction_selfdual.hh (revision 257)
+++ oln/morpho/reconstruction_selfdual.hh (working copy)
@@ -31,6 +31,8 @@
# include <oln/canvas/reconstruction.hh>
# include <oln/morpho/tags.hh>
+
+//FIXME: Adapt ...
namespace oln {
Index: oln/morpho/reconstruction_by_dilation.hh
--- oln/morpho/reconstruction_by_dilation.hh (revision 257)
+++ oln/morpho/reconstruction_by_dilation.hh (working copy)
@@ -30,6 +30,7 @@
# include <oln/canvas/reconstruction.hh>
# include <oln/morpho/tags.hh>
+# include <oln/morpho/local.hh>
# include <oln/funobj/arith.hh>
namespace oln {
@@ -38,47 +39,74 @@
namespace impl {
- // Sequential version
- template<typename I1, typename I2>
- struct reconstruction <I1, I2, tag::sequential_type, tag::by_dilation_type>
- : public canvas::sequential_reconstruction<I1, I2,
- reconstruction<I1, I2, tag::sequential_type, tag::by_dilation_type> >
+
+ template <typename I1, typename I2, typename A, typename E>
+ struct reconstruction_by_dilation
+ : public canvas::reconstruction<I1, I2, A, E>
{
- typedef reconstruction<I1, I2, tag::sequential_type,
- tag::by_dilation_type> self_type;
- typedef canvas::sequential_reconstruction<I1, I2, self_type> super_type;
+ typedef canvas::reconstruction<I1, I2, A, E> super_type;
- reconstruction(const abstract::image_with_nbh<I1>& marker,
+ using super_type::mask;
+ using super_type::marker;
+ using super_type::output;
+ using super_type::bkd_p;
+ using super_type::fwd_p;
+ using super_type::n;
+ using super_type::p;
+
+
+ reconstruction_by_dilation(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask) :
super_type(marker, mask)
{
}
- using super_type::marker;
- using super_type::mask;
- using super_type::output;
- using super_type::fwd_p;
- using super_type::bkd_p;
- using super_type::win_plus;
- using super_type::win_minus;
+
+ /// Local image "and-value" for dilation on sets
+ /// (based on the point and its backward neighborhood).
+
+ oln_type_of(I1, value) bkd_or()
+ {
+ if (output[bkd_p])
+ return true;
+ p = bkd_p;
+ for_all_n_of_p(n, p)
+ if (p.bkd_less(n) and output.hold(n) and output[n])
+ return true;
+
+ return false;
+ }
+
+
+ /// Local image "and-value" for dilation on sets
+ /// (based on the point and its forward neighborhood).
+
+ oln_type_of(I1, value) fwd_or()
+ {
+ if (output[fwd_p])
+ return true;
+ p = fwd_p;
+ for_all_n_of_p(n, p)
+ if (p.fwd_less(n) and output.hold(n) and output[n])
+ return true;
+
+ return false;
+ }
void impl_bkd_loop_body()
{
// FIXME: The call to value_box<>::value is needed to have
- // f_min_alt compile. Try to get rid of it.
- output[bkd_p] = f_min_alt(mask[bkd_p].value(),
- local_max(output, bkd_p, win_minus));
+ // f_max_alt compile. Try to get rid of it.
+ output[bkd_p] = f_min_alt(mask[bkd_p].value(), bkd_or());
}
void impl_fwd_loop_body()
{
// FIXME: The call to value_box<>::value is needed to have
- // f_min_alt compile. Try to get rid of it.
- output[fwd_p] = f_min_alt(mask[fwd_p].value(),
- local_max(output, fwd_p, win_plus));
+ // f_max_alt compile. Try to get rid of it.
+ output[fwd_p] = f_min_alt(mask[fwd_p].value(), fwd_or());
}
- // FIXME: unused...
void impl_preconditions()
{
precondition(level::is_greater_or_equal(mask, marker));
@@ -86,75 +114,67 @@
};
-
- // Hybrid version
+ // Sequential version
template<typename I1, typename I2>
- struct reconstruction <I1, I2, tag::hybrid_type, tag::by_dilation_type>
- : public canvas::hybrid_reconstruction<I1, I2,
- reconstruction<I1, I2, tag::hybrid_type, tag::by_dilation_type> >
+ struct reconstruction <I1, I2, tag::sequential_type, tag::by_dilation_type>
+ : public reconstruction_by_dilation<I1, I2, tag::sequential_type,
+ reconstruction<I1, I2, tag::sequential_type,
+ tag::by_dilation_type> >
{
- typedef reconstruction<I1, I2, tag::hybrid_type,
+ typedef reconstruction<I1, I2, tag::sequential_type,
tag::by_dilation_type> self_type;
- typedef canvas::hybrid_reconstruction<I1, I2,
+ typedef reconstruction_by_dilation<I1, I2, tag::sequential_type,
self_type> super_type;
- using super_type::mask;
- using super_type::marker;
- using super_type::work;
- using super_type::output;
- using super_type::fwd_p;
- using super_type::bkd_p;
- using super_type::win_plus;
- using super_type::win_minus;
- using super_type::p;
- using super_type::q;
- using super_type::fifo;
-
reconstruction(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask) :
super_type(marker, mask)
{
}
+ };
+ // Hybrid version
- void impl_bkd_loop_body()
+ template<typename I1, typename I2>
+ struct reconstruction <I1, I2, tag::hybrid_type, tag::by_dilation_type>
+ : public reconstruction_by_dilation<I1, I2, tag::hybrid_type,
+ reconstruction<I1, I2, tag::hybrid_type, tag::by_dilation_type> >
{
- // FIXME: The call to value_box<>::value is needed to have
- // f_min_alt compile. Try to get rid of it.
- output[bkd_p] = f_min_alt(mask[bkd_p].value(),
- local_max(work, bkd_p, win_minus));
- }
+ typedef reconstruction<I1, I2, tag::hybrid_type,
+ tag::by_dilation_type> self_type;
+ typedef reconstruction_by_dilation<I1, I2, tag::hybrid_type,
+ self_type> super_type;
- void impl_fwd_loop_body()
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
{
- // FIXME: The call to value_box<>::value is needed to have
- // f_min_alt compile. Try to get rid of it.
- output[fwd_p] = f_min_alt(mask[fwd_p].value(),
- local_max(work, fwd_p, win_plus));
}
+ using super_type::mask;
+ using super_type::output;
+ using super_type::bkd_p;
+ using super_type::n;
+ using super_type::p;
+ using super_type::fifo;
+
+
void impl_fifo_loop_body()
{
- if ((output[q] < output[p]) && (mask[q] != output[q]))
+ if ((output[n] < output[p]) and (mask[n] != output[n]))
{
// FIXME: The calls to value_box<>::value are needed to
// have f_min_alt compile. Try to get rid of it.
- output[q] = f_min_alt(output[p].value(), mask[q].value());
- fifo.push(q);
+ output[n] = f_max_alt(output[p].value(), mask[n].value());
+ fifo.push(n);
}
}
- bool impl_exist_init()
+ bool impl_test_fifo_push()
{
- return output.hold(q) && (output[q] < output[bkd_p]) &&
- (output[q] < mask[q]);
- }
-
- void impl_preconditions()
- {
- precondition(level::is_greater_or_equal(mask, marker));
+ return output[n] < output[bkd_p] and output[n] < mask[n];
}
};
Index: tests/morpho/tests/reconstruction
--- tests/morpho/tests/reconstruction (revision 257)
+++ tests/morpho/tests/reconstruction (working copy)
@@ -40,13 +40,11 @@
mask,
morpho::tag::hybrid(),
morpho::tag::by_dilation());
- // FIXME: The sequential reconstruction is broken, and the test
- // doesn't terminate if we compute res_dil_seq.
-// res_dil_seq =
-// morpho::reconstruction(join(marker, neighb_c4()),
-// mask,
-// morpho::tag::sequential(),
-// morpho::tag::by_dilation());
+ res_dil_seq =
+ morpho::reconstruction(join(marker, neighb_c4()),
+ mask,
+ morpho::tag::sequential(),
+ morpho::tag::by_dilation());
image2d<ntg::bin> marker_c(level::invert(marker));
res_ero_hyb =
@@ -54,29 +52,22 @@
level::invert(mask),
morpho::tag::hybrid(),
morpho::tag::by_erosion());
- // FIXME: Likewise.
-// res_ero_seq =
-// morpho::reconstruction(join(marker_c, neighb_c4()),
-// level::invert(mask),
-// morpho::tag::sequential(),
-// morpho::tag::by_erosion());
-
- // FIXME: Debug.
- std::cerr << utils::md5(res_dil_hyb) << std::endl;
- io::write(res_dil_hyb, "/tmp/res_dil_hyb.pbm");
-// std::cerr << utils::md5(res_dil_seq) << std::endl;
- std::cerr << utils::md5(res_ero_hyb) << std::endl;
-// std::cerr << utils::md5(res_ero_seq) << std::endl;
+ res_ero_seq =
+ morpho::reconstruction(join(marker_c, neighb_c4()),
+ level::invert(mask),
+ morpho::tag::sequential(),
+ morpho::tag::by_erosion());
if (utils::md5(res_dil_hyb) != key)
return true;
- // FIXME: Likewise.
-// if (!level::is_equal(res_dil_hyb, res_dil_seq))
-// return true;
-// if (!level::is_equal(res_ero_hyb, res_ero_seq))
-// return true;
-// if (!level::is_equal(res_dil_hyb, level::invert(res_ero_seq)))
-// return true;
+
+
+ if (!level::is_equal(res_dil_hyb, res_dil_seq))
+ return true;
+ if (!level::is_equal(res_ero_hyb, res_ero_seq))
+ return true;
+ if (!level::is_equal(res_dil_hyb, level::invert(res_ero_seq)))
+ return true;
return false;
}
Index: oln/morpho/reconstruction.trash
--- oln/morpho/reconstruction.trash (revision 257)
+++ oln/morpho/reconstruction.trash (working copy)
@@ -1,227 +0,0 @@
-// Copyright (C) 2001, 2002, 2004, 2005 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, 59 Temple Place - Suite 330, Boston,
-// MA 02111-1307, USA.
-//
-// As a special exception, you may use this filek 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 OLENA_MORPHO_RECONSTRUCTION_HH
-# define OLENA_MORPHO_RECONSTRUCTION_HH
-
-# include <queue>
-
-# include <mlc/cmp.hh>
-# include <mlc/contract.hh>
-
-# include <oln/convert/nbh_to_se.hh>
-
-# include <oln/core/abstract/image_operator.hh>
-# include <oln/core/abstract/neighborhood.hh>
-
-# include <oln/level/compare.hh>
-
-# include <oln/morpho/splitse.hh>
-# include <oln/morpho/stat.hh>
-
-# include <oln/utils/clone.hh>
-
-namespace oln {
-
-
- namespace tag {
-
- template <typename Op> struct oper {};
-
- struct by_dilation : public oper< by_dilation > {};
- struct by_erosion : public oper< by_erosion > {};
-
-
- template <typename A> struct algo {};
-
- struct sequential : public algo< sequential > {};
- struct hybrid : public algo< hybrid > {};
-
- } // end of namespace oln::morpho::tag
-
-
-
- namespace morpho {
- template <typename I1, typename I2> struct reconstruction_ret;
- } // end of namespace oln::morpho
-
- // super_type
-
- template <typename I1, typename I2>
- struct set_super_type< morpho::reconstruction_ret<I1, I2> >
- {
- typedef oln_type_of(I1, concrete) output_type;
-
- typedef morpho::reconstruction_ret<I1,I2> self_type;
- typedef abstract::image_binary_operator<output_type, I1, I2, self_type > ret;
- };
-
- namespace morpho {
-
- // Reconstruction as a 'classical' procedure returning an image (do not
- // use it; prefer morpho::reconstruction).
-
- namespace proc {
-
- // FIXME: ...
-
- } // end of namespace oln::morpho::proc
-
-
- template <typename I1, typename I2>
- struct reconstruction_ret :
- // FIXME: oln_super_of_
- public oln::internal::get_super_type< reconstruction_ret<I1,I2> >::ret
- {
- typedef reconstruction_ret<I1, I2> self_type;
- typedef typename oln::internal::get_super_type<self_type>::ret super_type;
-
- box<const I1> marker;
- box<const I2> mask;
-
- reconstruction_ret(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask) :
- super_type(marker, mask),
- marker(marker),
- mask(mask)
- {
- }
-
- const oln_type_of(I1, neighb)& impl_nbh_get() const
- {
- return marker.nbh_get();
- }
-
- };
-
- } // end of namespace morpho
-
-} // end of namespace oln
-
-# include <oln/morpho/reconstruction_canvas.inc>
-
-namespace oln {
-
- namespace morpho {
-
- namespace impl {
-
- template<typename Op, typename A, typename I1, typename I2>
- struct generic_reconstruction;
-
- } // end of namespace impl
-
- } // end of namespace morpho
-
-} // end of namespace oln
-
-# include <oln/morpho/reconstruction_by_dilation.inc>
-# include <oln/morpho/reconstruction_by_erosion.inc>
-
-namespace oln {
-
- namespace morpho {
-
- namespace impl {
-
- // Generic implementation of reconstruction (routine).
-
- template<typename Op, typename A, typename I1, typename I2>
- reconstruction_ret<I1,I2>
- reconstruction(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask)
- {
- generic_reconstruction<Op, A, I1, I2> tmp(marker, mask);
- tmp.run();
- return tmp;
- }
-
- } // end of namespace impl
-
- /// Generic reconstruction (facade).
-
- template<typename Op, typename I1, typename I2, typename A>
- reconstruction_ret<I1,I2>
- reconstruction(const tag::oper<Op>& oper_,
- const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask,
- const tag::algo<A>& algo_)
- {
- return impl::reconstruction<Op,A>(marker.exact(), mask.exact());
- }
-
- // by dilation
-
- template<typename I1, typename I2, typename A>
- reconstruction_ret<I1,I2>
- reconstruction_by_dilation(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask,
- const tag::algo<A>& algo_)
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- precondition(marker.size() == mask.size());
- return reconstruction(tag::by_dilation(), marker, mask, algo_);
- }
-
- template<typename I1, typename I2>
- reconstruction_ret<I1,I2>
- reconstruction_by_dilation(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask)
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- precondition(marker.size() == mask.size());
- return reconstruction(tag::by_dilation(), marker, mask, tag::hybrid());
- }
-
- // by erosion
-
- template<typename I1, typename I2, typename A>
- reconstruction_ret<I1,I2>
- reconstruction_by_erosion(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask,
- const tag::algo<A>& algo_)
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- precondition(marker.size() == mask.size());
- return reconstruction(tag::by_erosion(), marker, mask, algo_);
- }
-
- template<typename I1, typename I2>
- reconstruction_ret<I1,I2>
- reconstruction_by_erosion(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask)
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- precondition(marker.size() == mask.size());
- return reconstruction(tag::by_erosion(), marker, mask, tag::hybrid());
- }
-
- } // end of namespace oln::morpho
-
-} // end of namespace oln
-
-#endif // ! OLENA_MORPHO_RECONSTRUCTION_HH
Index: oln/core/abstract/point.hh
--- oln/core/abstract/point.hh (revision 257)
+++ oln/core/abstract/point.hh (working copy)
@@ -139,7 +139,7 @@
/// Anteriority w.r.t. to a bkd image browsing.
bool bkd_less(const exact_type& rhs) const
{
- return not *this == rhs and not this->fwd_less(rhs);
+ return not (*this == rhs and not this->fwd_less(rhs));
}
/*! \brief Test difference of two points. Nota bene: this method
Index: oln/morpho/reconstruction_by_erosion.hh
--- oln/morpho/reconstruction_by_erosion.hh (revision 257)
+++ oln/morpho/reconstruction_by_erosion.hh (working copy)
@@ -30,6 +30,7 @@
# include <oln/canvas/reconstruction.hh>
# include <oln/morpho/tags.hh>
+# include <oln/morpho/local.hh>
# include <oln/funobj/arith.hh>
namespace oln {
@@ -38,49 +39,74 @@
namespace impl {
- // Sequential version
- template<typename I1, typename I2>
- struct reconstruction <I1, I2, tag::sequential_type, tag::by_erosion_type>
- : public canvas::sequential_reconstruction<I1, I2,
- reconstruction<I1, I2, tag::sequential_type,
- tag::by_erosion_type> >
+ template <typename I1, typename I2, typename A, typename E>
+ struct reconstruction_by_erosion
+ : public canvas::reconstruction<I1, I2, A, E>
{
- typedef reconstruction<I1, I2, tag::sequential_type,
- tag::by_erosion_type> self_type;
- typedef canvas::sequential_reconstruction<I1, I2, self_type> super_type;
+ typedef canvas::reconstruction<I1, I2, A, E> super_type;
- reconstruction(const abstract::image_with_nbh<I1>& marker,
+ using super_type::mask;
+ using super_type::marker;
+ using super_type::output;
+ using super_type::bkd_p;
+ using super_type::fwd_p;
+ using super_type::n;
+ using super_type::p;
+
+
+ reconstruction_by_erosion(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask) :
super_type(marker, mask)
{
}
- using super_type::marker;
- using super_type::mask;
- using super_type::output;
- using super_type::fwd_p;
- using super_type::bkd_p;
- using super_type::win_plus;
- using super_type::win_minus;
+
+ /// Local image "and-value" for erosion on sets
+ /// (based on the point and its backward neighborhood).
+
+ oln_type_of(I1, value) bkd_and()
+ {
+ if (not output[bkd_p])
+ return false;
+ p = bkd_p;
+ for_all_n_of_p(n, p)
+ if (p.bkd_less(n) and output.hold(n) and not output[n])
+ return false;
+
+ return true;
+ }
+
+
+ /// Local image "and-value" for erosion on sets
+ /// (based on the point and its forward neighborhood).
+
+ oln_type_of(I1, value) fwd_and()
+ {
+ if (not output[fwd_p])
+ return false;
+ p = fwd_p;
+ for_all_n_of_p(n, p)
+ if (p.fwd_less(n) and output.hold(n) and not output[n])
+ return false;
+
+ return true;
+ }
void impl_bkd_loop_body()
{
// FIXME: The call to value_box<>::value is needed to have
// f_max_alt compile. Try to get rid of it.
- output[bkd_p] = f_max_alt(mask[bkd_p].value(),
- local_min(output, bkd_p, win_minus));
+ output[bkd_p] = f_max_alt(mask[bkd_p].value(), bkd_and());
}
void impl_fwd_loop_body()
{
// FIXME: The call to value_box<>::value is needed to have
// f_max_alt compile. Try to get rid of it.
- output[fwd_p] = f_max_alt(mask[fwd_p].value(),
- local_min(output, fwd_p, win_plus));
+ output[fwd_p] = f_max_alt(mask[fwd_p].value(), fwd_and());
}
- // FIXME: unused...
void impl_preconditions()
{
precondition(level::is_greater_or_equal(marker, mask));
@@ -88,16 +114,37 @@
};
+ // Sequential version
+
+ template<typename I1, typename I2>
+ struct reconstruction <I1, I2, tag::sequential_type, tag::by_erosion_type>
+ : public reconstruction_by_erosion<I1, I2, tag::sequential_type,
+ reconstruction<I1, I2, tag::sequential_type,
+ tag::by_erosion_type> >
+ {
+ typedef reconstruction<I1, I2, tag::sequential_type,
+ tag::by_erosion_type> self_type;
+ typedef reconstruction_by_erosion<I1, I2, tag::sequential_type,
+ self_type> super_type;
+
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {
+ }
+ };
+
+
// Hybrid version
template<typename I1, typename I2>
struct reconstruction <I1, I2, tag::hybrid_type, tag::by_erosion_type>
- : public canvas::hybrid_reconstruction<I1, I2,
+ : public reconstruction_by_erosion<I1, I2, tag::hybrid_type,
reconstruction<I1, I2, tag::hybrid_type, tag::by_erosion_type> >
{
typedef reconstruction<I1, I2, tag::hybrid_type,
tag::by_erosion_type> self_type;
- typedef canvas::hybrid_reconstruction<I1, I2,
+ typedef reconstruction_by_erosion<I1, I2, tag::hybrid_type,
self_type> super_type;
reconstruction(const abstract::image_with_nbh<I1>& marker,
@@ -107,54 +154,27 @@
}
using super_type::mask;
- using super_type::marker;
- using super_type::work;
using super_type::output;
- using super_type::fwd_p;
using super_type::bkd_p;
- using super_type::win_plus;
- using super_type::win_minus;
+ using super_type::n;
using super_type::p;
- using super_type::q;
using super_type::fifo;
- void impl_bkd_loop_body()
- {
- // FIXME: The call to value_box<>::value is needed to have
- // f_max_alt compile. Try to get rid of it.
- output[bkd_p] = f_max_alt(mask[bkd_p].value(),
- local_min(work, bkd_p, win_minus));
- }
-
- void impl_fwd_loop_body()
- {
- // FIXME: The call to value_box<>::value is needed to have
- // f_max_alt compile. Try to get rid of it.
- output[fwd_p] = f_max_alt(mask[fwd_p].value(),
- local_min(work, fwd_p, win_plus));
- }
void impl_fifo_loop_body()
{
- if ((output[q] > output[p]) && (mask[q] != output[q]))
+ if ((output[n] > output[p]) and (mask[n] != output[n]))
{
// FIXME: The calls to value_box<>::value are needed to
// have f_min_alt compile. Try to get rid of it.
- output[q] = f_min_alt(output[p].value(), mask[q].value());
- fifo.push(q);
- }
+ output[n] = f_min_alt(output[p].value(), mask[n].value());
+ fifo.push(n);
}
-
- bool impl_exist_init()
- {
- return output.hold(q) && (output[q] > output[bkd_p]) &&
- (output[q] > mask[q]);
}
- // FIXME: unused...
- void impl_preconditions()
+ bool impl_test_fifo_push()
{
- precondition(level::is_greater_or_equal(marker, mask));
+ return output[n] > output[bkd_p] and output[n] > mask[n];
}
};
Index: oln/canvas/reconstruction.hh
--- oln/canvas/reconstruction.hh (revision 257)
+++ oln/canvas/reconstruction.hh (working copy)
@@ -33,6 +33,7 @@
# include <oln/canvas/backandforth.hh>
# include <oln/level/compare.hh>
# include <oln/utils/clone.hh>
+# include <oln/morpho/tags.hh>
namespace oln {
@@ -49,25 +50,35 @@
namespace canvas {
+ // fwd decl
+
+ template <typename I1, typename I2, typename A, typename E>
+ struct reconstruction;
+
template <typename I1, typename I2, typename E>
- struct hybrid_reconstruction : public mlc::any<E>
+ struct reconstruction<I1, I2, morpho::tag::hybrid_type, E>
+ : public mlc::any<E>
{
typedef oln_type_of(I1, neighb) nbh_type;
+ typedef oln_type_of(I1, point) point_type;
typedef oln_nbh_type_of(nbh_type, window) window_type;
typedef oln_type_of(I1, concrete) output_type;
- bool exist_init()
+ bool test_fifo_push()
{
- for (unsigned i = 0; i < win_minus.card(); ++i)
- {
- q = win_minus.get_dp()[i] + (oln_type_of(I1, point))bkd_p;
- if (this->exact().impl_exist_init())
+ p = bkd_p;
+ for_all_n_of_p(n, bkd_p)
+ if (p.bkd_less(n) and output.hold(n) and this->exact().impl_test_fifo_push())
return true;
- }
+
return false;
}
+ void preconditions()
+ {
+ this->exact().impl_preconditions();
+ }
void fwd_loop_body()
{
@@ -86,20 +97,16 @@
void init()
{
- output_type output_tmp(marker.size());
- output = output_tmp;
- // FIXME: We can't use `work = clone(marker)' directly here,
+ // FIXME: We can't use `output = clone(marker)' directly here,
// because box's op=(const abstract::image<II>& rhs) would be
// called, which is empty (see oln/core/box.hh).
- output_type work_tmp(clone(marker));
- work = work_tmp;
-
- win_plus = marker.nbh_get().get_win().get_fwd_win_p();
- win_minus = marker.nbh_get().get_win().get_bkd_win_p();
+ output_type output_tmp(clone(marker));
+ output = output_tmp;
}
void run()
{
+ preconditions();
init();
for_all_p (fwd_p)
@@ -108,7 +115,7 @@
for_all_p (bkd_p)
{
bkd_loop_body();
- if (exist_init())
+ if (test_fifo_push())
fifo.push(bkd_p);
}
@@ -118,12 +125,9 @@
p = fifo.front();
fifo.pop();
- window_type win = marker.nbh_get().get_win();
- for (unsigned i = 0; i < win.card(); ++i)
+ for_all_n_of_p(n, p)
{
- q = win.get_dp()[i] + p;
-
- if (output.hold(q))
+ if (output.hold(n))
fifo_loop_body();
}
}
@@ -136,43 +140,44 @@
protected:
- hybrid_reconstruction(const abstract::image_with_nbh<I1>& marker,
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask) :
marker(marker.exact()),
mask(mask.exact()),
bkd_p(marker.size()),
- fwd_p(marker.size())
+ fwd_p(marker.size()),
+ n(marker)
{
}
- ~hybrid_reconstruction()
+ ~reconstruction()
{
- mlc_check_method_impl(E, bool, exist_init, , );
+ mlc_check_method_impl(E, bool, test_fifo_push, , );
mlc_check_method_impl(E, void, bkd_loop_body, , );
mlc_check_method_impl(E, void, fwd_loop_body, , );
mlc_check_method_impl(E, void, fifo_loop_body, , );
}
- oln_type_of(I1, point) p;
- oln_type_of(I1, point) q;
-
- window_type win_plus;
- window_type win_minus;
-
- box<oln_type_of(I1, concrete)> work;
- box<oln_type_of(I1, concrete)> output;
box<const I1> marker;
box<const I2> mask;
oln_type_of(I1, bkd_piter) bkd_p;
oln_type_of(I1, fwd_piter) fwd_p;
+ oln_type_of(I1, point) p;
+ oln_type_of(I1, niter) n;
+
+ box<oln_type_of(I1, concrete)> output;
+
std::queue<oln_type_of(I1, point) > fifo;
};
+
+
+
template <typename I1, typename I2, typename E>
- struct sequential_reconstruction :
+ struct reconstruction<I1, I2, morpho::tag::sequential_type, E> :
public back_and_forth_until_convergence<I1, E>
{
typedef back_and_forth_until_convergence<I1, E> super_type;
@@ -187,28 +192,25 @@
// called, which is empty (see oln/core/box.hh).
output_type output_tmp(clone(marker));
output = output_tmp;
- // FIXME: We can't use `work = clone(marker)' directly here,
+ // FIXME: We can't use `save = clone(marker)' directly here,
// because box's op=(const abstract::image<II>& rhs) would be
// called, which is empty (see oln/core/box.hh).
- output_type work_tmp(clone(marker));
- work = work_tmp;
+ output_type save_tmp(clone(marker));
+ save = save_tmp;
- win_plus = marker.nbh_get().get_win().get_fwd_win_p();
- win_minus = marker.nbh_get().get_win().get_bkd_win_p();
}
bool impl_is_stable() const
{
- return level::is_equal(work, output);
+ return level::is_equal(save, output);
}
void impl_re_loop()
{
- // FIXME: We can't use `output = clone(marker)' directly here,
+ // FIXME: We can't use `save = clone(output)' directly here,
// because box's op=(const abstract::image<II>& rhs) would be
// called, which is empty (see oln/core/box.hh).
- output_type work_tmp(clone(marker));
- work = work_tmp;
+ save.unbox() = clone(output);
}
oln_type_of(I1, concrete) get_output()
@@ -216,21 +218,21 @@
return output.unbox();
}
- sequential_reconstruction(const abstract::image_with_nbh<I1>& marker,
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask) :
super_type(marker),
marker(marker.exact()),
- mask(mask.exact())
+ mask(mask.exact()),
+ n(marker)
{
}
- oln_nbh_type_of(nbh_type, window) win_plus;
- oln_nbh_type_of(nbh_type, window) win_minus;
-
- box<oln_type_of(I1, concrete)> work;
+ box<oln_type_of(I1, concrete)> save;
box<oln_type_of(I1, concrete)> output;
box<const I1> marker;
box<const I2> mask;
+ oln_type_of(I1, point) p;
+ oln_type_of(I1, niter) n;
};
Index: oln/morpho/reconstruction_canvas.inctrash
--- oln/morpho/reconstruction_canvas.inctrash (revision 257)
+++ oln/morpho/reconstruction_canvas.inctrash (working copy)
@@ -1,238 +0,0 @@
-// Copyright (C) 2005 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, 59 Temple Place - Suite 330, Boston,
-// MA 02111-1307, USA.
-//
-// As a special exception, you may use this filek 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.
-
-
-namespace oln {
-
- namespace morpho {
-
- namespace impl {
-
- template <typename I1, typename I2, typename A, typename E>
- struct generic_reconstruction_canvas;
-
- template <typename I1, typename I2, typename E>
- struct generic_reconstruction_canvas<I1, I2, tag::sequential, E> :
- public reconstruction_ret<I1, I2>
- {
- typedef reconstruction_ret<I1, I2> super_type;
- typedef oln_type_of(I1, neighb) nbh_type;
- typedef oln_type_of(I1, concrete) output_type;
-
- E& exact__()
- {
- return *(E*)(void*)(this);
- }
-
- void bkd_loop_body()
- {
- this->exact__().impl_bkd_loop_body();
- }
- void fwd_loop_body()
- {
- this->exact__().impl_fwd_loop_body();
- }
-
- void preconditions()
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- precondition(this->marker.size() == this->mask.size());
- this->exact__().impl_preconditions();
- }
-
- void init()
- {
- // no call to impl_init here because this canvas can't be generalized yet.
- this->output = utils::clone(this->marker);
- this->work = utils::clone(this->marker);
-
- win_plus = get_plus_win_p(convert::nbh_to_cse(this->marker.nbh_get()));
- win_minus = get_minus_win_p(convert::nbh_to_cse(this->marker.nbh_get()));
- }
-
- bool is_stable()
- {
- // same explanation as above
- return level::is_equal(this->work, this->output);
- }
-
- void impl_run()
- {
- this->preconditions();
- this->init();
- for (;;)
- {
- for_all_p (fwd_p)
- this->fwd_loop_body();
- for_all_p (bkd_p)
- this->bkd_loop_body();
- if (this->is_stable())
- return;
- work = utils::clone(this->output);
- }
- }
-
- protected:
-
- generic_reconstruction_canvas(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask) :
- super_type(marker, mask),
- bkd_p(marker.size()),
- fwd_p(marker.size())
- {
- }
-
-
- oln_type_of(I1, bkd_piter) bkd_p;
- oln_type_of(I1, fwd_piter) fwd_p;
-
- oln_nbh_type_of(nbh_type, window) win_plus;
- oln_nbh_type_of(nbh_type, window) win_minus;
-
- box<oln_type_of(I1, concrete)> work;
- };
-
- template <typename I1, typename I2, typename E>
- struct generic_reconstruction_canvas<I1, I2, tag::hybrid, E> :
- public reconstruction_ret<I1, I2>
- {
- typedef reconstruction_ret<I1, I2> super_type;
- typedef oln_type_of(I1, neighb) nbh_type;
- typedef oln_nbh_type_of(nbh_type, window) window_type;
- typedef oln_type_of(I1, concrete) output_type;
-
- E& exact__()
- {
- return *(E*)(void*)(this);
- }
-
-
- bool exist_init()
- {
- for (unsigned i = 0; i < win_minus.card(); ++i)
- {
- q = win_minus.get_dp()[i] + (oln_type_of(I1, point))bkd_p;
- if (this->exact__().impl_exist_init())
- return true;
- }
- return false;
- }
-
- void bkd_loop_body()
- {
- this->exact__().impl_bkd_loop_body();
- }
- void fwd_loop_body()
- {
- this->exact__().impl_fwd_loop_body();
- }
-
- void fifo_loop_body()
- {
- this->exact__().impl_fifo_loop_body();
- }
-
- void preconditions()
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- precondition(this->marker.size() == this->mask.size());
- this->exact__().impl_preconditions();
- }
-
- void init()
- {
- output_type tmp(this->marker.size());
-
- this->output = tmp;
- this->work = utils::clone(this->marker);
-
- win_plus = get_plus_win_p(convert::nbh_to_cse(this->marker.nbh_get()));
- win_minus = get_minus_win_p(convert::nbh_to_cse(this->marker.nbh_get()));
- }
-
- void impl_run()
- {
- this->preconditions();
- this->init();
-
- for_all_p (fwd_p)
- this->fwd_loop_body();
-
- for_all_p (bkd_p)
- {
- bkd_loop_body();
- if (exist_init())
- fifo.push(bkd_p);
- }
- // Propagation Step
- while (!fifo.empty())
- {
- p = fifo.front();
- fifo.pop();
-
- window_type win = convert::nbh_to_se(this->marker.nbh_get());
- for (unsigned i = 0; i < win.card(); ++i)
- {
- q = win.get_dp()[i] + p;
-
- if (this->output.hold(q))
- fifo_loop_body();
- }
- }
- }
-
- protected:
-
- generic_reconstruction_canvas(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask) :
- super_type(marker, mask),
- bkd_p(marker.size()),
- fwd_p(marker.size())
- {
- }
-
-
- oln_type_of(I1, bkd_piter) bkd_p;
- oln_type_of(I1, fwd_piter) fwd_p;
-
- oln_type_of(I1, point) p;
- oln_type_of(I1, point) q;
-
- window_type win_plus;
- window_type win_minus;
-
- box<oln_type_of(I1, concrete)> work;
-
- std::queue<oln_type_of(I1, point) > fifo;
-
- };
-
- } // end of namespace impl
-
- } // end of namespace morpho
-
-} // end of namespace oln
1
0
proto-1.0 257: Prepare overloading mechanism and introduction of function objects in mlc.
by Thierry GERAUD 22 Jul '05
by Thierry GERAUD 22 Jul '05
22 Jul '05
2005-07-22 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Prepare overloading mechanism and introduction of function
objects in mlc.
* mlc/fcmp.hh: New file.
* mlc/afun.hh: New file.
* mlc/overload.hh: New file.
* mlc/traits.hh: Remove dead contents.
1
0
Ce mini-patch ajoute la possibilité de choisir les tests qui seront
exécutés par la règle `check' de Make dans les sous répertoires de
olena/tests, integre/tests et metalic/tests.
En fait, contrib/runtest autorise depuis toujours (?) la possibilité
de sélectionner les tests, c'est juste que les
tests/check/Makefile.runtest ne les utilisaient pas.
Pour s'en servir, il suffit de renseigner la variable TESTS de Make.
Exemple : pour lancer uniquement les tests sur la fermeture et
l'ouverture morphologiques dans le répertoire olena/tests/morpho :
brasilia ~/src/oln/_build % cd olena/tests/morpho
brasilia ...oln/_build/olena/tests/morpho % make check TESTS='closing opening'
make check-local
make[1]: Entering directory `/home/levill_r/src/oln-proto-1.0/_build/olena/tests/morpho'
TOP_SRCDIR=../../../.. SRCDIR=../../../../olena/tests/morpho \
TOP_BUILDDIR=../../.. \
LDFLAGS=" " \
CPPFLAGS="-DHAVE_CONFIG_H -I../../../../olena/tests/check -I../../../../metalic/tests/check -I../../../../metalic -I../../../metalic -I../../../../integre -I../../../integre -I../../../../olena -I../../../olena -I../../.. -I../../../../olena/tests/morpho -I." \
CXXFLAGS=" -g -Wall -pedantic -Werror " \
LDADD="../check/libolncheck.a -lz " \
/bin/sh ../../../../contrib/runtests closing opening
PASS: closing
PASS: opening
========================================
No failures.
make[1]: Leaving directory `/home/levill_r/src/oln-proto-1.0/_build/olena/tests/morpho'
Très pratique quand vous voulez lancer un seul test, et qu'il
commence par une lettre de la fin de l'alphabet. :)
integre/ChangeLog | 5 +++++
integre/tests/check/Makefile.flags | 2 +-
integre/tests/check/Makefile.runtests | 3 ++-
metalic/ChangeLog | 5 +++++
metalic/tests/check/Makefile.flags | 2 +-
metalic/tests/check/Makefile.runtests | 3 ++-
olena/ChangeLog | 5 +++++
olena/tests/check/Makefile.flags | 2 +-
olena/tests/check/Makefile.runtests | 3 ++-
9 files changed, 24 insertions(+), 6 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* tests/check/Makefile.runtests (check-runtests): Pass $(TEST) as
argument to contrib/runtest.
2005-07-21 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/tests/check/Makefile.runtests
--- olena/tests/check/Makefile.runtests (révision 254)
+++ olena/tests/check/Makefile.runtests (copie de travail)
@@ -1,3 +1,4 @@
+## -*- Makefile -*-
include ../check/Makefile.flags
EXTRA_DIST = tests
@@ -15,7 +16,7 @@
CPPFLAGS="$(CPPFLAGS_RUNTESTS)" \
CXXFLAGS="$(CXXFLAGS_RUNTESTS)" \
LDADD="$(LDADD_RUNTESTS)" \
- $(SHELL) $(top_srcdir)/contrib/runtests
+ $(SHELL) $(top_srcdir)/contrib/runtests $(TESTS)
distclean-runtests:
rm -rf runs
Index: olena/tests/check/Makefile.flags
--- olena/tests/check/Makefile.flags (révision 254)
+++ olena/tests/check/Makefile.flags (copie de travail)
@@ -1,4 +1,4 @@
-# -*- Makefile -*-
+## -*- Makefile -*-
AM_CXXFLAGS = \
$(CXXFLAGS_DEBUG) \
Index: integre/ChangeLog
--- integre/ChangeLog (révision 254)
+++ integre/ChangeLog (copie de travail)
@@ -1,3 +1,8 @@
+2005-07-21 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * tests/check/Makefile.runtests (check-runtests): Pass $(TEST) as
+ argument to contrib/runtest.
+
2005-07-19 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Force ntg to use its proper operators when a third part also
Index: integre/tests/check/Makefile.runtests
--- integre/tests/check/Makefile.runtests (révision 254)
+++ integre/tests/check/Makefile.runtests (copie de travail)
@@ -1,3 +1,4 @@
+## -*- Makefile -*-
include ../check/Makefile.flags
EXTRA_DIST = tests
@@ -14,7 +15,7 @@
CPPFLAGS="$(CPPFLAGS_RUNTESTS)" \
CXXFLAGS="$(CXXFLAGS_RUNTESTS)" \
LDADD="$(LDADD_RUNTESTS)" \
- $(SHELL) $(top_srcdir)/contrib/runtests
+ $(SHELL) $(top_srcdir)/contrib/runtests $(TESTS)
distclean-runtests:
rm -rf runs
Index: integre/tests/check/Makefile.flags
--- integre/tests/check/Makefile.flags (révision 254)
+++ integre/tests/check/Makefile.flags (copie de travail)
@@ -1,4 +1,4 @@
-# -*- Makefile -*-
+## -*- Makefile -*-
AM_CXXFLAGS = $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_STRICT_ERRORS)
AM_CPPFLAGS = -I$(top_srcdir)/metalic/tests/check
Index: metalic/ChangeLog
--- metalic/ChangeLog (révision 254)
+++ metalic/ChangeLog (copie de travail)
@@ -1,3 +1,8 @@
+2005-07-21 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * tests/check/Makefile.runtests (check-runtests): Pass $(TEST) as
+ argument to contrib/runtest.
+
2005-04-30 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
* mlc/cmp.hh (mlc_eq, mlc_neq): Remove parenthesis.
Index: metalic/tests/check/Makefile.runtests
--- metalic/tests/check/Makefile.runtests (révision 254)
+++ metalic/tests/check/Makefile.runtests (copie de travail)
@@ -1,3 +1,4 @@
+## -*- Makefile -*-
include ../check/Makefile.flags
EXTRA_DIST = tests
@@ -15,7 +16,7 @@
CPPFLAGS="$(CPPFLAGS_RUNTESTS)" \
CXXFLAGS="$(CXXFLAGS_RUNTESTS)" \
LDADD="$(LDADD_RUNTESTS)" \
- $(SHELL) $(top_srcdir)/contrib/runtests
+ $(SHELL) $(top_srcdir)/contrib/runtesst $(TESTS)
distclean-runtests:
rm -rf runs
Index: metalic/tests/check/Makefile.flags
--- metalic/tests/check/Makefile.flags (révision 254)
+++ metalic/tests/check/Makefile.flags (copie de travail)
@@ -1,4 +1,4 @@
-# -*- Makefile -*-
+## -*- Makefile -*-
AM_CXXFLAGS = $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_STRICT_ERRORS)
AM_CPPFLAGS = -I$(top_srcdir)/metalic/tests/check
1
0
21 Jul '05
J'ai dû introduire deux fonctors dans oln/funobj : f_::min_alt_ et
f_::max_alt_, qui sont comme f_::min_ et f_::max_, mais en plus
laxiste : ils peuvent avoir des arguments de types différents.
Je ne sais pas si c'est un bonne chose, mais c'était nécessaire pour
faire compiler le code de reconstruction_by_dilation et
reconstruction_by_erosion (qui utilisaient ntg::min et ntg::max) ;
passer à f_::min_ et f_::max_ ne suffisait pas.
Par exemple, le test de la reconstruction posait problème dans
olena/oln/morpho/reconstruction_by_dilation.hh ici :
output[bkd_p] = f_min(mask[bkd_p].value(),
local_max(output, bkd_p, win_minus));
les arguments de f_min ayant deux types différents (ntg::bin et bool,
dans le cas du test, je crois).
Ça traduit peut-être un problème au niveau des reconstructions et/ou
de local_min/local_max (qui devrait bientôt disparaître).
ChangeLog | 30 +++++++++++
img/mask.pbm | 0
oln/canvas/reconstruction.hh | 30 +++++++++--
oln/core/box.hh | 3 +
oln/core/gen/regular_window.hh | 8 +--
oln/funobj/arith.hh | 64 +++++++++++++++++++++++++
oln/morpho/reconstruction_by_dilation.hh | 31 +++++++-----
oln/morpho/reconstruction_by_erosion.hh | 29 +++++++----
tests/morpho/tests/local | 7 +-
tests/morpho/tests/reconstruction | 78 +++++++++++++++++--------------
tests/morpho/tests/stat | 19 -------
11 files changed, 213 insertions(+), 86 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Partially fix the morphological reconstructions.
* oln/funobj/arith.hh (min_alt_, max_alt_): New operators.
(f_min_type_alt, f_max_type_alt): New objects.
(f_min_alt, f_max_alt): New static objects.
* oln/morpho/reconstruction_by_dilation.hh
(impl_bkd_loop_body, impl_fwd_loop_body, impl_bkd_loop_body)
(impl_fwd_loop_body, impl_fifo_loop_body)
* oln/morpho/reconstruction_by_erosion.hh
(impl_bkd_loop_body, impl_fwd_loop_body, impl_bkd_loop_body)
(impl_fwd_loop_body, impl_fifo_loop_body): Use them.
* oln/canvas/reconstruction.hh (hybrid_reconstruction::init)
(sequential_reconstruction::impl_init)
(sequential_reconstruction::impl_re_loop):
Work around box's operator= limits.
* oln/core/box.hh (operator=(const abstract::image<II>&)): Abort
on call.
* oln/core/gen/regular_window.hh (get_fwd_win, get_fwd_win_p)
(get_bkd_win, get_bkd_win_p): Fix calls to std::vector::size.
* tests/morpho/tests/reconstruction: Update test.
Disable tests on sequential recontruction, since it doesn't work
yet.
* tests/morpho/tests/local: Rename as...
* tests/morpho/tests/stat: ...this.
Update test.
* img/mask.pbm, img/mask.pbm: Invert these images.
Index: olena/tests/morpho/tests/reconstruction
--- olena/tests/morpho/tests/reconstruction (révision 253)
+++ olena/tests/morpho/tests/reconstruction (copie de travail)
@@ -9,62 +9,74 @@
#include <oln/morpho/reconstruction.hh>
#include <oln/io/read_image.hh>
-#include <oln/io/write_image.hh>
#include <oln/level/compare.hh>
#include <oln/utils/md5.hh>
-#include <oln/utils/invert.hh>
+#include <oln/level/invert.hh>
+
+// FIXME: Debug.
+#include <oln/io/write_image.hh>
bool check()
{
using namespace oln;
image2d<ntg::bin> marker;
image2d<ntg::bin> mask;
- image2d<ntg::bin> res_dil_hyb;
- image2d<ntg::bin> res_dil_seq;
- image2d<ntg::bin> res_ero_hyb;
- image2d<ntg::bin> res_ero_seq;
+ image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_dil_hyb;
+ image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_dil_seq;
+ image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_ero_hyb;
+ image_with_nbh<image2d<ntg::bin>, neighborhood2d> res_ero_seq;
utils::key::value_type data_key[16] =
- {
- 0x36, 0xa6, 0x2e, 0x7e, 0xbf, 0x21, 0xf6, 0x2b,
- 0xbf, 0x57, 0x58, 0xdc, 0x9d, 0x72, 0x41, 0x8f
- };
+ { 0xd1, 0x5c, 0x13, 0xd8, 0xe0, 0xa8, 0x58, 0x7d,
+ 0xc8, 0xc, 0x6c, 0xc9, 0x78, 0xca, 0x37, 0xc6 };
utils::key key(data_key);
marker = io::read(rdata("marker.pbm"));
mask = io::read(rdata("mask.pbm"));
res_dil_hyb =
- morpho::reconstruction(morpho::tag::by_dilation(),
- join(marker, neighb_c4()),
+ morpho::reconstruction(join(marker, neighb_c4()),
mask,
- morpho::tag::hybrid());
- res_dil_seq =
- morpho::reconstruction(morpho::tag::by_dilation(),
- join(marker, neighb_c4()),
- mask,
- morpho::tag::sequential());
+ morpho::tag::hybrid(),
+ morpho::tag::by_dilation());
+ // FIXME: The sequential reconstruction is broken, and the test
+ // doesn't terminate if we compute res_dil_seq.
+// res_dil_seq =
+// morpho::reconstruction(join(marker, neighb_c4()),
+// mask,
+// morpho::tag::sequential(),
+// morpho::tag::by_dilation());
+ image2d<ntg::bin> marker_c(level::invert(marker));
res_ero_hyb =
- morpho::reconstruction(morpho::tag::by_erosion(),
- utils::invert(join(marker, neighb_c4())),
- utils::invert(mask),
- morpho::tag::hybrid());
- res_ero_seq =
- morpho::reconstruction(morpho::tag::by_erosion(),
- utils::invert(join(marker, neighb_c4())),
- utils::invert(mask),
- morpho::tag::sequential());
+ morpho::reconstruction(join(marker_c, neighb_c4()),
+ level::invert(mask),
+ morpho::tag::hybrid(),
+ morpho::tag::by_erosion());
+ // FIXME: Likewise.
+// res_ero_seq =
+// morpho::reconstruction(join(marker_c, neighb_c4()),
+// level::invert(mask),
+// morpho::tag::sequential(),
+// morpho::tag::by_erosion());
+
+ // FIXME: Debug.
+ std::cerr << utils::md5(res_dil_hyb) << std::endl;
+ io::write(res_dil_hyb, "/tmp/res_dil_hyb.pbm");
+// std::cerr << utils::md5(res_dil_seq) << std::endl;
+ std::cerr << utils::md5(res_ero_hyb) << std::endl;
+// std::cerr << utils::md5(res_ero_seq) << std::endl;
if (utils::md5(res_dil_hyb) != key)
return true;
- if (!level::is_equal(res_dil_hyb, res_dil_seq))
- return true;
- if (!level::is_equal(res_ero_hyb, res_ero_seq))
- return true;
- if (!level::is_equal(res_dil_hyb, utils::invert(res_ero_seq)))
- return true;
+ // FIXME: Likewise.
+// if (!level::is_equal(res_dil_hyb, res_dil_seq))
+// return true;
+// if (!level::is_equal(res_ero_hyb, res_ero_seq))
+// return true;
+// if (!level::is_equal(res_dil_hyb, level::invert(res_ero_seq)))
+// return true;
return false;
}
Index: olena/tests/morpho/tests/local
--- olena/tests/morpho/tests/local (révision 253)
+++ olena/tests/morpho/tests/local (copie de travail)
@@ -1,8 +1,9 @@
+ // -*- C++ -*-
#include <ntg/all.hh>
#include <oln/basics2d.hh>
#include <oln/level/fill.hh>
#include <oln/fancy/iota.hh>
-#include <oln/morpho/stat.hh>
+#include <oln/morpho/local.hh>
#include "check.hh"
#include "data.hh"
@@ -12,8 +13,8 @@
oln::window2d w2 = oln::win_c8p();
oln::image2d<ntg::int_u8> im(10, 10);
oln::fancy::iota(im);
- if (oln::morpho::max(im, oln::point2d(5, 5), w2) != 67 ||
- oln::morpho::min(im, oln::point2d(5, 5), w2) != 45)
+ if (oln::morpho::win_sup_value(im, oln::point2d(5, 5), w2) != 67 ||
+ oln::morpho::win_inf_value(im, oln::point2d(5, 5), w2) != 45)
return true;
return false;
}
Index: olena/tests/morpho/tests/stat
--- olena/tests/morpho/tests/stat (révision 253)
+++ olena/tests/morpho/tests/stat (copie de travail)
@@ -1,19 +0,0 @@
-#include <ntg/all.hh>
-#include <oln/basics2d.hh>
-#include <oln/level/fill.hh>
-#include <oln/fancy/iota.hh>
-#include <oln/morpho/stat.hh>
-
-#include "check.hh"
-#include "data.hh"
-
-bool check()
-{
- oln::window2d w2 = oln::win_c8p();
- oln::image2d<ntg::int_u8> im(10, 10);
- oln::fancy::iota(im);
- if (oln::morpho::max(im, oln::point2d(5, 5), w2) != 67 ||
- oln::morpho::min(im, oln::point2d(5, 5), w2) != 45)
- return true;
- return false;
-}
Index: olena/oln/funobj/arith.hh
--- olena/oln/funobj/arith.hh (révision 253)
+++ olena/oln/funobj/arith.hh (copie de travail)
@@ -165,6 +165,70 @@
typedef f_::binary1_meta<f_::max_> f_max_type;
static f_max_type f_max;
+
+
+
+ /*--------------------------------------------------------------.
+ | Min and max operators allowing arguments of different types. |
+ `--------------------------------------------------------------*/
+
+ namespace f_ {
+ template <typename L, typename R> struct min_alt_;
+ template <typename L, typename R> struct max_alt_;
+ } // end of namespace oln::f_
+
+ template <typename L, typename R>
+ struct set_super_type < f_::min_alt_<L, R> > { typedef f_::abstract::binary< f_::min_alt_<L, R> > ret; };
+
+ template <typename L, typename R>
+ struct set_super_type < f_::max_alt_<L, R> > { typedef f_::abstract::binary< f_::max_alt_<L, R> > ret; };
+
+ template <typename L, typename R>
+ struct set_props < category::fun2, f_::min_alt_<L, R> >
+ {
+ typedef L res_type;
+ typedef L left_type;
+ typedef R right_type;
+ };
+
+ template <typename L, typename R>
+ struct set_props < category::fun2, f_::max_alt_<L, R> >
+ {
+ typedef L res_type;
+ typedef L left_type;
+ typedef R right_type;
+ };
+
+
+ namespace f_
+ {
+
+ template <typename L, typename R>
+ struct min_alt_ : public oln_super2_of_(f_::min_alt_<L, R>)
+ {
+ const L impl_binop(const L& left, const R& right) const
+ {
+ return left < right ? left : L (right);
+ }
+ };
+
+ template <typename L, typename R>
+ struct max_alt_ : public oln_super2_of_(f_::max_alt_<L, R>)
+ {
+ const L impl_binop(const L& left, const R& right) const
+ {
+ return right < left ? left : L (right);
+ }
+ };
+
+ } // end of namespace oln::f_
+
+ typedef f_::binary_meta<f_::min_alt_> f_min_type_alt;
+ static f_min_type_alt f_min_alt;
+
+ typedef f_::binary_meta<f_::max_alt_> f_max_type_alt;
+ static f_max_type_alt f_max_alt;
+
} // end of namespace oln
Index: olena/oln/core/box.hh
--- olena/oln/core/box.hh (révision 253)
+++ olena/oln/core/box.hh (copie de travail)
@@ -29,6 +29,8 @@
#ifndef OLENA_CORE_BOX_HH
# define OLENA_CORE_BOX_HH
+# include <cstdlib>
+
# include <mlc/bool.hh>
# include <oln/core/abstract/image_entry.hh>
@@ -133,6 +135,7 @@
{
// FIXME: Does not work with g++-3.4.
// mlc::false_type::ensure();
+ abort();
}
// FIXME: add versions for I2 (neq I) to produce explicit errors
Index: olena/oln/core/gen/regular_window.hh
--- olena/oln/core/gen/regular_window.hh (révision 253)
+++ olena/oln/core/gen/regular_window.hh (copie de travail)
@@ -137,7 +137,7 @@
{
E out;
- for (unsigned i = 0; i < this->dp_.card(); ++i)
+ for (unsigned i = 0; i < this->dp_.size(); ++i)
{
const dpoint_type& dp = dp_[i];
@@ -159,7 +159,7 @@
E out;
- for (unsigned i = 0; i < this->dp_.card(); ++i)
+ for (unsigned i = 0; i < this->dp_.size(); ++i)
{
const dpoint_type& dp = dp_[i];
@@ -186,7 +186,7 @@
{
E out;
- for (unsigned i = 0; i < this->dp_.card(); ++i)
+ for (unsigned i = 0; i < this->dp_.size(); ++i)
{
const dpoint_type& dp = dp_[i];
@@ -207,7 +207,7 @@
{
E out;
- for (unsigned i = 0; i < this->dp_.card(); ++i)
+ for (unsigned i = 0; i < this->dp_.size(); ++i)
{
const dpoint_type& dp = get_dp()[i];
Index: olena/oln/morpho/reconstruction_by_dilation.hh
--- olena/oln/morpho/reconstruction_by_dilation.hh (révision 253)
+++ olena/oln/morpho/reconstruction_by_dilation.hh (copie de travail)
@@ -30,6 +30,7 @@
# include <oln/canvas/reconstruction.hh>
# include <oln/morpho/tags.hh>
+# include <oln/funobj/arith.hh>
namespace oln {
@@ -63,16 +64,18 @@
void impl_bkd_loop_body()
{
-
- //FIXME: Shouldn't be .value()
- output[bkd_p] = ntg::min(local_max(output, bkd_p, win_minus),
- mask[bkd_p].value());
+ // FIXME: The call to value_box<>::value is needed to have
+ // f_min_alt compile. Try to get rid of it.
+ output[bkd_p] = f_min_alt(mask[bkd_p].value(),
+ local_max(output, bkd_p, win_minus));
}
void impl_fwd_loop_body()
{
- output[fwd_p] = ntg::min(local_max(output, fwd_p, win_plus),
- mask[fwd_p].value());
+ // FIXME: The call to value_box<>::value is needed to have
+ // f_min_alt compile. Try to get rid of it.
+ output[fwd_p] = f_min_alt(mask[fwd_p].value(),
+ local_max(output, fwd_p, win_plus));
}
// FIXME: unused...
@@ -118,21 +121,27 @@
void impl_bkd_loop_body()
{
- output[bkd_p] = min(local_max(work, bkd_p, win_minus),
- mask[bkd_p].value());
+ // FIXME: The call to value_box<>::value is needed to have
+ // f_min_alt compile. Try to get rid of it.
+ output[bkd_p] = f_min_alt(mask[bkd_p].value(),
+ local_max(work, bkd_p, win_minus));
}
void impl_fwd_loop_body()
{
- output[fwd_p] = min(local_max(work, fwd_p, win_plus),
- mask[fwd_p].value());
+ // FIXME: The call to value_box<>::value is needed to have
+ // f_min_alt compile. Try to get rid of it.
+ output[fwd_p] = f_min_alt(mask[fwd_p].value(),
+ local_max(work, fwd_p, win_plus));
}
void impl_fifo_loop_body()
{
if ((output[q] < output[p]) && (mask[q] != output[q]))
{
- output[q] = min(output[p].value(), mask[q].value());
+ // FIXME: The calls to value_box<>::value are needed to
+ // have f_min_alt compile. Try to get rid of it.
+ output[q] = f_min_alt(output[p].value(), mask[q].value());
fifo.push(q);
}
}
Index: olena/oln/morpho/reconstruction_by_erosion.hh
--- olena/oln/morpho/reconstruction_by_erosion.hh (révision 253)
+++ olena/oln/morpho/reconstruction_by_erosion.hh (copie de travail)
@@ -30,6 +30,7 @@
# include <oln/canvas/reconstruction.hh>
# include <oln/morpho/tags.hh>
+# include <oln/funobj/arith.hh>
namespace oln {
@@ -65,14 +66,18 @@
void impl_bkd_loop_body()
{
- output[bkd_p] = ntg::max(local_min(output, bkd_p, win_minus),
- mask[bkd_p].value());
+ // FIXME: The call to value_box<>::value is needed to have
+ // f_max_alt compile. Try to get rid of it.
+ output[bkd_p] = f_max_alt(mask[bkd_p].value(),
+ local_min(output, bkd_p, win_minus));
}
void impl_fwd_loop_body()
{
- output[fwd_p] = ntg::max(local_min(output, fwd_p, win_plus),
- mask[fwd_p].value());
+ // FIXME: The call to value_box<>::value is needed to have
+ // f_max_alt compile. Try to get rid of it.
+ output[fwd_p] = f_max_alt(mask[fwd_p].value(),
+ local_min(output, fwd_p, win_plus));
}
// FIXME: unused...
@@ -115,21 +120,27 @@
void impl_bkd_loop_body()
{
- output[bkd_p] = ntg::max(local_min(work, bkd_p, win_minus),
- mask[bkd_p].value());
+ // FIXME: The call to value_box<>::value is needed to have
+ // f_max_alt compile. Try to get rid of it.
+ output[bkd_p] = f_max_alt(mask[bkd_p].value(),
+ local_min(work, bkd_p, win_minus));
}
void impl_fwd_loop_body()
{
- output[fwd_p] = ntg::max(local_min(work, fwd_p, win_plus),
- mask[fwd_p].value());
+ // FIXME: The call to value_box<>::value is needed to have
+ // f_max_alt compile. Try to get rid of it.
+ output[fwd_p] = f_max_alt(mask[fwd_p].value(),
+ local_min(work, fwd_p, win_plus));
}
void impl_fifo_loop_body()
{
if ((output[q] > output[p]) && (mask[q] != output[q]))
{
- output[q] = ntg::min(output[p].value(), mask[q].value());
+ // FIXME: The calls to value_box<>::value are needed to
+ // have f_min_alt compile. Try to get rid of it.
+ output[q] = f_min_alt(output[p].value(), mask[q].value());
fifo.push(q);
}
}
Index: olena/oln/canvas/reconstruction.hh
--- olena/oln/canvas/reconstruction.hh (révision 253)
+++ olena/oln/canvas/reconstruction.hh (copie de travail)
@@ -86,10 +86,13 @@
void init()
{
- output_type tmp(marker.size());
-
- output = tmp;
- work = clone(marker);
+ output_type output_tmp(marker.size());
+ output = output_tmp;
+ // FIXME: We can't use `work = clone(marker)' directly here,
+ // because box's op=(const abstract::image<II>& rhs) would be
+ // called, which is empty (see oln/core/box.hh).
+ output_type work_tmp(clone(marker));
+ work = work_tmp;
win_plus = marker.nbh_get().get_win().get_fwd_win_p();
win_minus = marker.nbh_get().get_win().get_bkd_win_p();
@@ -175,11 +178,20 @@
typedef back_and_forth_until_convergence<I1, E> super_type;
typedef oln_type_of(I1, neighb) nbh_type;
typedef oln_nbh_type_of(nbh_type, window) window_type;
+ typedef oln_type_of(I1, concrete) output_type;
void impl_init()
{
- output = clone(marker);
- work = clone(marker);
+ // FIXME: We can't use `output = clone(marker)' directly here,
+ // because box's op=(const abstract::image<II>& rhs) would be
+ // called, which is empty (see oln/core/box.hh).
+ output_type output_tmp(clone(marker));
+ output = output_tmp;
+ // FIXME: We can't use `work = clone(marker)' directly here,
+ // because box's op=(const abstract::image<II>& rhs) would be
+ // called, which is empty (see oln/core/box.hh).
+ output_type work_tmp(clone(marker));
+ work = work_tmp;
win_plus = marker.nbh_get().get_win().get_fwd_win_p();
win_minus = marker.nbh_get().get_win().get_bkd_win_p();
@@ -192,7 +204,11 @@
void impl_re_loop()
{
- work = clone(output);
+ // FIXME: We can't use `output = clone(marker)' directly here,
+ // because box's op=(const abstract::image<II>& rhs) would be
+ // called, which is empty (see oln/core/box.hh).
+ output_type work_tmp(clone(marker));
+ work = work_tmp;
}
oln_type_of(I1, concrete) get_output()
Index: olena/img/marker.pbm
Ne peut afficher : fichier considéré comme binaire.
svn:mime-type = application/octet-stream
Index: olena/img/mask.pbm
Ne peut afficher : fichier considéré comme binaire.
svn:mime-type = application/octet-stream
1
0
ChangeLog | 13 +++++++++++++
tests/core/tests/setget | 1 +
tests/morpho/tests/closing | 6 +++---
tests/morpho/tests/dilation | 6 +++---
tests/morpho/tests/elementary_dilation | 7 +++----
tests/morpho/tests/elementary_erosion | 8 ++++----
tests/morpho/tests/erosion | 6 +++---
tests/morpho/tests/hit_or_miss | 4 ++--
tests/morpho/tests/hit_or_miss_closing | 8 ++++----
tests/morpho/tests/opening | 6 +++---
10 files changed, 39 insertions(+), 26 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix some Olena tests.
* tests/core/tests/setget
(oln::set_props<category::image, dummy_image>::image_rawness_type):
New typedef.
* tests/morpho/tests/elementary_dilation,
* tests/morpho/tests/elementary_erosion,
* tests/morpho/tests/dilation, tests/morpho/tests/erosion,
* tests/morpho/tests/closing, tests/morpho/tests/opening:
* tests/morpho/tests/hit_or_miss_closing: Update MD5 sums.
2005-07-19 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/tests/morpho/tests/hit_or_miss
--- olena/tests/morpho/tests/hit_or_miss (révision 253)
+++ olena/tests/morpho/tests/hit_or_miss (copie de travail)
@@ -12,8 +12,8 @@
bool check()
{
utils::key::value_type data_key[16] =
- { 0x11, 0x78, 0x96, 0x7f, 0x20, 0xab, 0xb1, 0xad,
- 0x3c, 0x39, 0xef, 0x56, 0xf0, 0x12, 0x59, 0x1 } ;
+ { 0x81, 0xc1, 0x7, 0x12, 0x13, 0x17, 0x30, 0x58,
+ 0xfe, 0xd, 0x50, 0x5d, 0x7b, 0x5f, 0x36, 0x63 };
utils::key key(data_key);
image2d<ntg::bin> ima;
Index: olena/tests/morpho/tests/elementary_dilation
--- olena/tests/morpho/tests/elementary_dilation (révision 253)
+++ olena/tests/morpho/tests/elementary_dilation (copie de travail)
@@ -12,11 +12,10 @@
bool check()
{
- // MD5 sum of object.pbm's elementary dilation result.
- // FIXME: Replace this fake with the actual result.
+ // MD5 sum of 16x16.pbm's elementary dilation result.
utils::key::value_type data_key[16] =
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ { 0x1e, 0x6d, 0x61, 0x22, 0xd1, 0x79, 0x76, 0x73,
+ 0xe0, 0xf2, 0xf3, 0xc, 0xc4, 0x7b, 0x8d, 0x95 };
utils::key key(data_key);
typedef image2d<ntg::bin> im_type;
Index: olena/tests/morpho/tests/hit_or_miss_closing
--- olena/tests/morpho/tests/hit_or_miss_closing (révision 253)
+++ olena/tests/morpho/tests/hit_or_miss_closing (copie de travail)
@@ -12,13 +12,13 @@
bool check()
{
utils::key::value_type data_key_hom_closing[16] =
- { 0x9d, 0x9d, 0xbb, 0xd7, 0x6b, 0x5, 0x38, 0x29,
- 0x69, 0x6e, 0x30, 0xd4, 0x30, 0x99, 0x13, 0x29 };
+ { 0xcb, 0x26, 0x85, 0x11, 0x46, 0xe9, 0x2f, 0x4e,
+ 0xba, 0xcd, 0xf1, 0xba, 0xa1, 0x60, 0xce, 0xac };
utils::key key_hom_closing(data_key_hom_closing);
utils::key::value_type data_key_hom_closing_bg[16] =
- { 0xfa, 0x7, 0x26, 0x34, 0x16, 0x36, 0xc, 0xf4,
- 0x5e, 0x19, 0x53, 0xa2, 0x89, 0x1e, 0xdb, 0xae };
+ { 0xe1, 0x8c, 0x75, 0x26, 0xee, 0x60, 0x13, 0xc2,
+ 0x22, 0xb1, 0xaa, 0x2e, 0xc1, 0x7a, 0x67, 0xa };
utils::key key_hom_closing_bg(data_key_hom_closing_bg);
image2d<ntg::bin> ima;
Index: olena/tests/morpho/tests/closing
--- olena/tests/morpho/tests/closing (révision 253)
+++ olena/tests/morpho/tests/closing (copie de travail)
@@ -12,10 +12,10 @@
bool check()
{
- // MD5 sum of object.pbm's closing result.
+ // MD5 sum of 16x16.pbm's closing result.
utils::key::value_type data_key[16] =
- { 0xb, 0xec, 0x55, 0x93, 0x1c, 0x3, 0xee, 0xed,
- 0x1e, 0xc5, 0x6a, 0x45, 0xa2, 0x95, 0xe3, 0xad };
+ { 0x58, 0xc2, 0xef, 0xd1, 0xe3, 0xda, 0x37, 0xcd,
+ 0x5d, 0xa9, 0x82, 0x95, 0xe5, 0xcb, 0xf8, 0xf9 };
utils::key key(data_key);
typedef image2d<ntg::bin> im_type;
Index: olena/tests/morpho/tests/opening
--- olena/tests/morpho/tests/opening (révision 253)
+++ olena/tests/morpho/tests/opening (copie de travail)
@@ -12,10 +12,10 @@
bool check()
{
- // MD5 sum of object.pbm's opening result.
+ // MD5 sum of 16x16.pbm's opening result.
utils::key::value_type data_key[16] =
- { 0x21, 0x52, 0x1b, 0x70, 0x84, 0x7f, 0xed, 0x96,
- 0xa9, 0x83, 0x80, 0x57, 0x48, 0xa4, 0x26, 0x80 };
+ { 0xdc, 0xac, 0x1d, 0xe2, 0xfb, 0x7e, 0x5, 0x4,
+ 0xf0, 0xfd, 0xcb, 0xc9, 0xbc, 0xc5, 0xc5, 0x49 };
utils::key key(data_key);
typedef image2d<ntg::bin> im_type;
Index: olena/tests/morpho/tests/dilation
--- olena/tests/morpho/tests/dilation (révision 253)
+++ olena/tests/morpho/tests/dilation (copie de travail)
@@ -12,10 +12,10 @@
bool check()
{
- // MD5 sum of object.pbm's erosion result.
+ // MD5 sum of 16x16.pbm's erosion result.
utils::key::value_type data_key[16] =
- { 0x38, 0x56, 0x92, 0x53, 0xca, 0xd1, 0x32, 0x3e,
- 0x99, 0xf4, 0xe7, 0x59, 0x3, 0x54, 0x2c, 0x54 };
+ { 0x55, 0x3f, 0xe8, 0x39, 0x41, 0x6c, 0x56, 0x20,
+ 0xd0, 0xa4, 0x97, 0xe3, 0xa5, 0xe8, 0xef, 0x92 };
utils::key key(data_key);
typedef image2d<ntg::bin> im_type;
Index: olena/tests/morpho/tests/elementary_erosion
--- olena/tests/morpho/tests/elementary_erosion (révision 253)
+++ olena/tests/morpho/tests/elementary_erosion (copie de travail)
@@ -12,12 +12,12 @@
bool check()
{
- // MD5 sum of object.pbm's elementary erosion result.
- // FIXME: Replace this fake with the actual result.
+ // MD5 sum of 16x16.pbm's elementary erosion result.
utils::key::value_type data_key[16] =
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ { 0xd0, 0x58, 0x50, 0x5f, 0x3b, 0xe6, 0xda, 0x80,
+ 0xec, 0x2b, 0x7f, 0xa9, 0x6, 0xef, 0xf0, 0xac };
utils::key key(data_key);
+
typedef image2d<ntg::bin> im_type;
im_type ima;
ima = io::read(rdata("16x16.pbm"));
Index: olena/tests/morpho/tests/erosion
--- olena/tests/morpho/tests/erosion (révision 253)
+++ olena/tests/morpho/tests/erosion (copie de travail)
@@ -12,10 +12,10 @@
bool check()
{
- // MD5 sum of object.pbm's erosion result.
+ // MD5 sum of 16x16.pbm's erosion result.
utils::key::value_type data_key[16] =
- { 0x30, 0x23, 0x4d, 0xe5, 0xd6, 0x28, 0xeb, 0x8b,
- 0x18, 0x82, 0x43, 0x4b, 0xfc, 0x3f, 0x21, 0xc2 };
+ { 0x36, 0xe0, 0xb2, 0xd1, 0x0, 0xd5, 0x20, 0x2e,
+ 0xce, 0xf0, 0xec, 0xcc, 0x3d, 0x19, 0x4c, 0xea };
utils::key key(data_key);
typedef image2d<ntg::bin> im_type;
Index: olena/tests/core/tests/setget
--- olena/tests/core/tests/setget (révision 253)
+++ olena/tests/core/tests/setget (copie de travail)
@@ -17,6 +17,7 @@
{
typedef mlc::no_type grid_type;
typedef mlc::no_type concrete_type;
+ typedef mlc::no_type image_rawness_type;
typedef mlc::no_type image_dimension_type;
typedef int size_type;
1
0