Index: ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* oln/core/gen/regular_window.hh: Repair window splitting methods.
* oln/morpho/reconstruction.hh: Add front end for self-dual
reconstruction.
* oln/morpho/reconstruction_by_dilation.hh: Make it compile.
* oln/morpho/tags.hh: Add self-dual tag.
* oln/morpho/reconstruction_selfdual.hh: New. Self-dual reconstruction
implementation
* oln/morpho/reconstruction_by_erosion.hh: Make it compile.
* oln/morpho/stat.trash: Remove
* oln/canvas/reconstruction.hh: Add a missing method in the sequential
canvas. Minor fixes.
canvas/reconstruction.hh | 14 ++-
core/gen/regular_window.hh | 22 ++---
morpho/reconstruction.hh | 39 ++++++----
morpho/reconstruction_by_dilation.hh | 79 +++++++++++---------
morpho/reconstruction_by_erosion.hh | 80 +++++++++++----------
morpho/reconstruction_selfdual.hh | 132 +++++++++++++++++++++++++++++++++++
morpho/stat.trash | 122 --------------------------------
morpho/tags.hh | 13 +++
8 files changed, 279 insertions(+), 222 deletions(-)
Index: oln/core/gen/regular_window.hh
--- oln/core/gen/regular_window.hh (revision 189)
+++ oln/core/gen/regular_window.hh (working copy)
@@ -122,11 +122,11 @@
}
- self_type get_fwd_win() const
+ E get_fwd_win() const
{
- self_type out;
+ E out;
- for (unsigned i = 0; i < this->card(); ++i)
+ for (unsigned i = 0; i < card(); ++i)
{
const dpoint_type& dp = dp_[i];
@@ -143,12 +143,12 @@
}
- self_type get_fwd_win_p() // abstract::window<W>& win)
+ E get_fwd_win_p() const // abstract::window<W>& win)
{
- self_type out;
+ E out;
- for (unsigned i = 0; i < this->card(); ++i)
+ for (unsigned i = 0; i < card(); ++i)
{
const dpoint_type& dp = dp_[i];
@@ -171,9 +171,9 @@
}
- self_type get_bkd_win()
+ E get_bkd_win() const
{
- self_type out;
+ E out;
for (unsigned i = 0; i < card(); ++i)
{
@@ -192,13 +192,13 @@
}
- self_type get_bkd_win_p()
+ E get_bkd_win_p() const
{
- self_type out;
+ E out;
for (unsigned i = 0; i < card(); ++i)
{
- const dpoint_type& dp = this->win.get_dp()[i];
+ const dpoint_type& dp = get_dp()[i];
unsigned n;
for (n = 0; n < dim; ++n)
Index: oln/morpho/reconstruction.hh
--- oln/morpho/reconstruction.hh (revision 189)
+++ oln/morpho/reconstruction.hh (working copy)
@@ -30,6 +30,7 @@
# include <oln/morpho/reconstruction_by_dilation.hh>
# include <oln/morpho/reconstruction_by_erosion.hh>
+# include <oln/morpho/reconstruction_selfdual.hh>
namespace oln {
@@ -41,12 +42,12 @@
// Generic implementation of reconstruction (routine).
- template<typename Op, typename A, typename I1, typename I2>
+ template<typename I1, typename I2, typename A, typename Op>
oln_type_of(I1, concrete)
reconstruction_(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask)
{
- reconstruction<Op, A, I1, I2> tmp(marker, mask);
+ reconstruction<I1, I2, A, Op> tmp(marker, mask);
// tmp.entering(); FIXME: something like that ?
tmp.run();
// tmp.exiting(); FIXME: something like that ?
@@ -57,12 +58,12 @@
/// Generic reconstruction (facade).
- template<typename Op, typename I1, typename I2, typename A>
+ template<typename I1, typename I2, typename A, typename Op>
oln_type_of(I1, concrete)
- reconstruction(const tag::oper<Op>& oper_,
- const abstract::image_with_nbh<I1>& marker,
+ reconstruction(const abstract::image_with_nbh<I1>& marker,
const abstract::image<I2>& mask,
- const tag::algo<A>& algo_)
+ const tag::algo<A>& ,
+ const tag::oper<Op>& )
{
mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
precondition(marker.size() == mask.size());
@@ -70,13 +71,27 @@
entering("morpho::reconstruction");
oln_type_of(I1, concrete) output("output");
-// output = impl::reconstruction_(oper_, marker.exact(), mask.exact(), algo_);
+ output = impl::reconstruction_<I1, I2, A, Op>(marker.exact(),
+ mask.exact());
exiting("morpho::reconstruction");
return output;
}
+ // 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());
+
+ return reconstruction(marker, mask, tag::selfdual(), tag::none());
+ }
+
// by dilation
template<typename I1, typename I2, typename A>
@@ -88,7 +103,7 @@
mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
precondition(marker.size() == mask.size());
- return reconstruction(tag::by_dilation_type(), marker, mask, algo_);
+ return reconstruction(marker, mask, algo_, tag::by_dilation());
}
template<typename I1, typename I2>
@@ -99,8 +114,7 @@
mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
precondition(marker.size() == mask.size());
- return reconstruction(tag::by_dilation_type(), marker,
- mask, tag::hybrid_type());
+ return reconstruction(marker, mask, tag::hybrid(), tag::by_dilation());
}
// by erosion
@@ -114,7 +128,7 @@
mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
precondition(marker.size() == mask.size());
- return reconstruction(tag::by_erosion_type(), marker, mask, algo_);
+ return reconstruction(marker, mask, algo_, tag::by_erosion());
}
template<typename I1, typename I2>
@@ -125,8 +139,7 @@
mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
precondition(marker.size() == mask.size());
- return reconstruction(tag::by_erosion_type(), marker,
- mask, tag::hybrid_type());
+ return reconstruction(marker, mask, tag::hybrid(), tag::by_erosion());
}
} // end of namespace oln::morpho
Index: oln/morpho/stat.trash
--- oln/morpho/stat.trash (revision 189)
+++ oln/morpho/stat.trash (working copy)
@@ -1,122 +0,0 @@
-// Copyright (C) 2001, 2002, 2003, 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 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_MORPHO_STAT_HH
-# define OLENA_MORPHO_STAT_HH
-
-# include <mlc/cmp.hh>
-# include <ntg/bin.hh>
-# include <oln/core/abstract/image_entry.hh>
-# include <oln/core/abstract/window.hh>
-# include <oln/funobj/accum.hh>
-
-
-namespace oln {
-
- namespace morpho {
-
-
- /// Local min on a function.
-
- template <typename I, typename W>
- oln_type_of(I, value) min(const abstract::image<I>& input,
- const oln_type_of(I, point)& p,
- const abstract::window<W>& win)
- {
- mlc::eq<oln_type_of(I, grid), oln_wn_type_of(W, grid)>::ensure();
-
- oln_wn_type_of(W, fwd_iter) q(win);
- funobj::min_accumulator<oln_type_of(I, value)> minval;
-
- for_all_q_of_p (q, p)
- if (input.hold(q))
- minval(input[q]);
-
- return minval;
- }
-
-
- /// Local min on a set.
-
- template <typename I, typename W>
- bool min(const abstract::binary_image<I>& input,
- const oln_type_of(I, point)& p,
- const abstract::window<W>& win)
- {
- mlc::eq<oln_type_of(I, grid), oln_wn_type_of(W, grid)>::ensure();
-
- oln_wn_type_of(W, fwd_iter) q(win);
- for_all_q_of_p (q, p)
- if (input.hold(q) and not input[q])
- return false;
- return true;
- }
-
-
- /// Local max on a function.
-
- template <typename I, typename W>
- oln_type_of(I, value) max(const abstract::image<I>& input,
- const oln_type_of(I, point)& p,
- const abstract::window<W>& win)
- {
- mlc::eq<oln_type_of(I, grid), oln_wn_type_of(W, grid)>::ensure();
-
- oln_wn_type_of(W, fwd_iter) q(win);
- funobj::max_accumulator<oln_type_of(I, value)> maxval;
-
- for_all_q_of_p (q, p)
- if (input.hold(q))
- maxval(input[q]);
-
- return maxval;
- }
-
-
- /// Local max on a set.
-
- template <typename I, typename W>
- bool max(const abstract::binary_image<I>& input,
- const oln_type_of(I, point)& p,
- const abstract::window<W>& win)
- {
- mlc::eq<oln_type_of(I, grid), oln_wn_type_of(W, grid)>::ensure();
-
- oln_wn_type_of(W, fwd_iter) q(win);
- for_all_q_of_p (q, p)
- if (input.hold(q) and input[q])
- return true;
- return false;
- }
-
-
- } // end of namespace morpho
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_MORPHO_STAT_HH
Index: oln/morpho/reconstruction_by_dilation.hh
--- oln/morpho/reconstruction_by_dilation.hh (revision 189)
+++ oln/morpho/reconstruction_by_dilation.hh (working copy)
@@ -39,12 +39,12 @@
// Sequential version
template<typename I1, typename I2>
- struct reconstruction <tag::by_dilation_type, tag::sequential_type, I1, I2>
+ struct reconstruction <I1, I2, tag::sequential_type, tag::by_dilation_type>
: public canvas::sequential_reconstruction<I1, I2,
- reconstruction<tag::by_dilation_type, tag::sequential_type, I1, I2> >
+ reconstruction<I1, I2, tag::sequential_type, tag::by_dilation_type> >
{
- typedef reconstruction<tag::by_dilation_type,
- tag::sequential_type, I1,I2> self_type;
+ typedef reconstruction<I1, I2, tag::sequential_type,
+ tag::by_dilation_type> self_type;
typedef canvas::sequential_reconstruction<I1, I2, self_type> super_type;
reconstruction(const abstract::image_with_nbh<I1>& marker,
@@ -53,27 +53,32 @@
{
}
+ 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;
void impl_bkd_loop_body()
{
- this->output[this->bkd_p] = ntg::min(morpho::max(this->output,
- this->bkd_p,
- this->win_minus),
- this->mask[this->bkd_p]);
+
+ //FIXME: Shouldn't be .value()
+ output[bkd_p] = ntg::min(local_max(output, bkd_p, win_minus),
+ mask[bkd_p].value());
}
void impl_fwd_loop_body()
{
- this->output[this->fwd_p] = ntg::min(morpho::max(this->output,
- this->fwd_p,
- this->win_plus),
- this->mask[this->fwd_p]);
+ output[fwd_p] = ntg::min(local_max(output, fwd_p, win_plus),
+ mask[fwd_p].value());
}
// FIXME: unused...
void impl_preconditions()
{
- precondition(level::is_greater_or_equal(this->mask, this->marker));
+ precondition(level::is_greater_or_equal(mask, marker));
}
};
@@ -82,15 +87,27 @@
// Hybrid version
template<typename I1, typename I2>
- struct reconstruction <tag::by_dilation_type, tag::hybrid_type, I1, I2>
+ struct reconstruction <I1, I2, tag::hybrid_type, tag::by_dilation_type>
: public canvas::hybrid_reconstruction<I1, I2,
- reconstruction<tag::by_dilation_type, tag::hybrid_type, I1, I2> >
+ reconstruction<I1, I2, tag::hybrid_type, tag::by_dilation_type> >
{
- typedef reconstruction<tag::by_dilation_type,
- tag::hybrid_type, I1,I2> self_type;
+ typedef reconstruction<I1, I2, tag::hybrid_type,
+ tag::by_dilation_type> self_type;
typedef canvas::hybrid_reconstruction<I1, I2,
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)
@@ -101,42 +118,34 @@
void impl_bkd_loop_body()
{
- this->output[this->bkd_p] = ntg::min(morpho::max(this->work,
- this->bkd_p,
- this->win_minus),
- this->mask[this->bkd_p]);
+ output[bkd_p] = min(local_max(work, bkd_p, win_minus),
+ mask[bkd_p].value());
}
void impl_fwd_loop_body()
{
- this->output[this->fwd_p] = ntg::min(morpho::max(this->work,
- this->fwd_p,
- this->win_plus),
- this->mask[this->fwd_p]);
+ output[fwd_p] = min(local_max(work, fwd_p, win_plus),
+ mask[fwd_p].value());
}
void impl_fifo_loop_body()
{
- if ((this->output[this->q] < this->output[this->p]) &&
- (this->mask[this->q] != this->output[this->q]))
+ if ((output[q] < output[p]) && (mask[q] != output[q]))
{
- this->output[this->q] = ntg::min(this->output[this->p],
- this->mask[this->q]);
- this->fifo.push(this->q);
+ output[q] = min(output[p].value(), mask[q].value());
+ fifo.push(q);
}
}
bool impl_exist_init()
{
- return this->output.hold(this->q) &&
- (this->output[this->q] < this->output[this->bkd_p]) &&
- (this->output[this->q] < this->mask[this->q]);
+ return output.hold(q) && (output[q] < output[bkd_p]) &&
+ (output[q] < mask[q]);
}
- //FIXME: unused...
void impl_preconditions()
{
- precondition(level::is_greater_or_equal(this->mask, this->marker));
+ precondition(level::is_greater_or_equal(mask, marker));
}
};
Index: oln/morpho/tags.hh
--- oln/morpho/tags.hh (revision 189)
+++ oln/morpho/tags.hh (working copy)
@@ -148,6 +148,7 @@
struct by_dilation_type : public oper< by_dilation_type > {};
struct by_erosion_type : public oper< by_erosion_type > {};
+ struct none_type : public oper< none_type > {};
// Facades.
inline const by_dilation_type& by_dilation()
@@ -162,6 +163,11 @@
return tag;
}
+ inline const none_type& none()
+ {
+ static const none_type tag = none_type();
+ return tag;
+ }
// Tags for common canvas.
@@ -170,6 +176,7 @@
struct sequential_type : public algo< sequential_type > {};
struct hybrid_type : public algo< hybrid_type > {};
struct parallel_type : public algo< parallel_type > {};
+ struct selfdual_type : public algo< selfdual_type > {};
struct unionfind_type : public algo< unionfind_type > {};
// Facades.
@@ -191,6 +198,12 @@
return tag;
}
+ inline const selfdual_type& selfdual()
+ {
+ static const selfdual_type tag = selfdual_type();
+ return tag;
+ }
+
inline const unionfind_type& unionfind()
{
static const unionfind_type tag = unionfind_type();
Index: oln/morpho/reconstruction_selfdual.hh
--- oln/morpho/reconstruction_selfdual.hh (revision 0)
+++ oln/morpho/reconstruction_selfdual.hh (revision 0)
@@ -0,0 +1,132 @@
+// 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.
+
+#ifndef OLENA_MORPHO_RECONSTRUCTION_SELF_DUAL_HH
+# define OLENA_MORPHO_RECONSTRUCTION_SELF_DUAL_HH
+
+# include <oln/canvas/reconstruction.hh>
+# include <oln/morpho/tags.hh>
+
+namespace oln {
+
+
+ namespace morpho {
+
+
+ namespace impl {
+
+
+ template<typename I1, typename I2>
+ struct reconstruction <I1, I2, tag::selfdual_type, tag::none_type>
+ : public canvas::hybrid_reconstruction<I1, I2,
+ 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,
+ 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::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;
+
+
+ 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());
+ else
+ output[bkd_p] = ntg::max(local_min(work, bkd_p, win_minus),
+ 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());
+ else
+ output[fwd_p] = ntg::max(local_min(work, fwd_p, win_plus),
+ mask[fwd_p].value());
+ }
+
+ void impl_fifo_loop_body()
+ {
+ if (output[q] < mask[p])
+ {
+ if (output[q] < output[p] && mask[q] != output[q])
+ {
+ output[q] = ntg::min(output[p].value(), mask[q].value());
+ fifo.push(q);
+ }
+ }
+ else
+ if (output[q] > output[p] && mask[q] != output[q])
+ {
+ output[q] = ntg::max(output[p].value(), mask[q].value());
+ fifo.push(q);
+ }
+ }
+
+ bool impl_exist_init()
+ {
+ return output.hold(q) &&
+ ((output[q] < output[bkd_p] && output[q] < mask[q]) ||
+ (output[q] > output[bkd_p] && output[q] > mask[q]));
+ }
+
+ void impl_preconditions()
+ {
+ }
+
+ };
+
+ }
+
+ }
+
+}
+
+
+#endif // ! OLENA_MORPHO_RECONSTRUCTION_BY_DILATION_HH
Index: oln/morpho/reconstruction_by_erosion.hh
--- oln/morpho/reconstruction_by_erosion.hh (revision 189)
+++ oln/morpho/reconstruction_by_erosion.hh (working copy)
@@ -40,42 +40,45 @@
// Sequential version
template<typename I1, typename I2>
- struct reconstruction <tag::by_erosion_type, tag::sequential_type, I1, I2>
+ struct reconstruction <I1, I2, tag::sequential_type, tag::by_erosion_type>
: public canvas::sequential_reconstruction<I1, I2,
- reconstruction<tag::by_erosion_type,
- tag::sequential_type, I1, I2> >
+ reconstruction<I1, I2, tag::sequential_type,
+ tag::by_erosion_type> >
{
- typedef reconstruction<tag::by_erosion_type,
- tag::sequential_type, I1, I2> self_type;
+ typedef reconstruction<I1, I2, tag::sequential_type,
+ tag::by_erosion_type> self_type;
typedef canvas::sequential_reconstruction<I1, I2, self_type> super_type;
reconstruction(const abstract::image_with_nbh<I1>& marker,
- const abstract::image<I2>& mask) :
+ 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;
void impl_bkd_loop_body()
{
- this->output[this->bkd_p] = ntg::max(morpho::min(this->output,
- this->bkd_p,
- this->win_minus),
- this->mask[this->bkd_p]);
+ output[bkd_p] = ntg::max(local_min(output, bkd_p, win_minus),
+ mask[bkd_p].value());
}
void impl_fwd_loop_body()
{
- this->output[this->fwd_p] = ntg::max(morpho::min(this->output,
- this->fwd_p,
- this->win_plus),
- this->mask[this->fwd_p]);
+ output[fwd_p] = ntg::max(local_min(output, fwd_p, win_plus),
+ mask[fwd_p].value());
}
// FIXME: unused...
void impl_preconditions()
{
- precondition(level::is_greater_or_equal(this->marker, this->mask));
+ precondition(level::is_greater_or_equal(marker, mask));
}
};
@@ -83,12 +86,12 @@
// Hybrid version
template<typename I1, typename I2>
- struct reconstruction <tag::by_erosion_type, tag::hybrid_type, I1, I2>
+ struct reconstruction <I1, I2, tag::hybrid_type, tag::by_erosion_type>
: public canvas::hybrid_reconstruction<I1, I2,
- reconstruction<tag::by_erosion_type, tag::hybrid_type, I1, I2> >
+ reconstruction<I1, I2, tag::hybrid_type, tag::by_erosion_type> >
{
- typedef reconstruction<tag::by_erosion_type,
- tag::hybrid_type, I1,I2> self_type;
+ typedef reconstruction<I1, I2, tag::hybrid_type,
+ tag::by_erosion_type> self_type;
typedef canvas::hybrid_reconstruction<I1, I2,
self_type> super_type;
@@ -98,44 +101,49 @@
{
}
+ 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;
+
void impl_bkd_loop_body()
{
- this->output[this->bkd_p] = ntg::max(morpho::min(this->work,
- this->bkd_p,
- this->win_minus),
- this->mask[this->bkd_p]);
+ output[bkd_p] = ntg::max(local_min(work, bkd_p, win_minus),
+ mask[bkd_p].value());
}
void impl_fwd_loop_body()
{
- this->output[this->fwd_p] = ntg::max(morpho::min(this->work,
- this->fwd_p,
- this->win_plus),
- this->mask[this->fwd_p]);
+ output[fwd_p] = ntg::max(local_min(work, fwd_p, win_plus),
+ mask[fwd_p].value());
}
void impl_fifo_loop_body()
{
- if ((this->output[this->q] > this->output[this->p]) &&
- (this->mask[this->q] != this->output[this->q]))
+ if ((output[q] > output[p]) && (mask[q] != output[q]))
{
- this->output[this->q] = ntg::min(this->output[this->p],
- this->mask[this->q]);
- this->fifo.push(this->q);
+ output[q] = ntg::min(output[p].value(), mask[q].value());
+ fifo.push(q);
}
}
bool impl_exist_init()
{
- return this->output.hold(this->q) &&
- (this->output[this->q] > this->output[this->bkd_p]) &&
- (this->output[this->q] > this->mask[this->q]);
+ return output.hold(q) && (output[q] > output[bkd_p]) &&
+ (output[q] > mask[q]);
}
// FIXME: unused...
void impl_preconditions()
{
- precondition(level::is_greater_or_equal(this->marker, this->mask));
+ precondition(level::is_greater_or_equal(marker, mask));
}
};
Index: oln/canvas/reconstruction.hh
--- oln/canvas/reconstruction.hh (revision 189)
+++ oln/canvas/reconstruction.hh (working copy)
@@ -144,15 +144,12 @@
~hybrid_reconstruction()
{
- mlc_check_method_impl(E, void, exist_init, , );
+ mlc_check_method_impl(E, bool, exist_init, , );
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, bkd_piter) bkd_p;
- oln_type_of(I1, fwd_piter) fwd_p;
-
oln_type_of(I1, point) p;
oln_type_of(I1, point) q;
@@ -164,6 +161,9 @@
box<const I1> marker;
box<const I2> mask;
+ oln_type_of(I1, bkd_piter) bkd_p;
+ oln_type_of(I1, fwd_piter) fwd_p;
+
std::queue<oln_type_of(I1, point) > fifo;
};
@@ -185,11 +185,15 @@
win_minus = marker.nbh_get().get_win().get_bkd_win_p();
}
- bool impl_is_stable()
+ bool impl_is_stable() const
{
return level::is_equal(work, output);
}
+ void impl_re_loop()
+ {
+ work = clone(output);
+ }
oln_type_of(I1, concrete) get_output()
{