https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Factor code for iterators on dpoints and update.
* oln/core/internal/dpoints_piter_impl.hh: New; copy of...
* oln/core/internal/dpoints_piter.hh: ...this.
* oln/debug/print_nbh.hh: Update.
* oln/core/gen/dpoints_piter.hh (dpoints_fwd_piter_): Overload.
Update inheritance.
(dpoints_bkd_piter_): Update.
(include): Update.
* oln/core/internal/image_selectors.hh (Image_mutability): Add
FIXME.
* oln/core/internal/op_image_plus_nbh.hh: Better commentary.
Minor fixes.
* oln/accumulator/and.hh (include): Remove max_value.hh.
(init): Use 'true'.
(operator()): Use 'and'.
* oln/accumulator/or.hh (include): Remove max_value.hh.
(ultimate): Remove.
(init): Use 'false'.
(operator()): Use 'or'.
* oln/core/concept/accumulator.hh: Add FIXME.
* oln/core/internal/max_value.hh (oln_min): Remove.
* oln/core/internal/min_value.hh: Add FIXME.
* oln/morpho/dilation.hh: Fix.
* oln/level/local.hh (local_): Update 'or on nbh' version.
(local_): Inactivate other optimized versions.
accumulator/and.hh | 6
accumulator/or.hh | 8 -
core/concept/accumulator.hh | 2
core/gen/dpoints_piter.hh | 222 ++++++++++--------------------------
core/internal/dpoints_piter_impl.hh | 166 ++++++++++----------------
core/internal/image_selectors.hh | 2
core/internal/max_value.hh | 1
core/internal/min_value.hh | 2
core/internal/op_image_plus_nbh.hh | 2
debug/print_nbh.hh | 4
level/local.hh | 29 ++--
morpho/dilation.hh | 3
12 files changed, 157 insertions(+), 290 deletions(-)
Index: oln/accumulator/and.hh
--- oln/accumulator/and.hh (revision 893)
+++ oln/accumulator/and.hh (working copy)
@@ -29,7 +29,6 @@
# define OLN_ACCUMULATOR_AND_HH
# include <oln/core/concept/accumulator.hh>
-# include <oln/core/internal/max_value.hh>
namespace oln
@@ -68,7 +67,7 @@
void
and_<T>::init() const
{
- this->val_ = oln_min(T);
+ this->val_ = true;
}
template <typename T>
@@ -82,8 +81,7 @@
void
and_<T>::operator()(const T& val) const
{
- if (val < this->val_)
- this->val_ = val;
+ this->val_ = this->val_ and val;
}
# endif // ! OLN_INCLUDE_ONLY
Index: oln/accumulator/or.hh
--- oln/accumulator/or.hh (revision 893)
+++ oln/accumulator/or.hh (working copy)
@@ -29,7 +29,6 @@
# define OLN_ACCUMULATOR_OR_HH
# include <oln/core/concept/accumulator.hh>
-# include <oln/core/internal/max_value.hh>
namespace oln
@@ -51,7 +50,6 @@
void operator()(const T& val) const;
- mutable T ultimate;
private:
mutable T val_;
};
@@ -69,8 +67,7 @@
void
or_<T>::init() const
{
- this->val_ = oln_min(T);
- this->ultimate = oln_max(T);
+ this->val_ = false;
}
template <typename T>
@@ -84,8 +81,7 @@
void
or_<T>::operator()(const T& val) const
{
- if (val < this->val_)
- this->val_ = val;
+ this->val_ = this->val_ or val;
}
# endif // ! OLN_INCLUDE_ONLY
Index: oln/debug/print_nbh.hh
--- oln/debug/print_nbh.hh (revision 893)
+++ oln/debug/print_nbh.hh (working copy)
@@ -55,7 +55,7 @@
const I& input, std::ostream& ostr)
{
oln_piter(I) p(input.points());
- oln_niter(I) n(p, input.nbhood());
+ oln_niter(I) n(p, input);
for_all(p)
{
ostr << input(p) << ": ";
@@ -74,7 +74,7 @@
const I& input, std::ostream& ostr)
{
oln_piter(I) p(input.points());
- oln_niter(I) n(p, input.nbhood());
+ oln_niter(I) n(p, input);
for_all(p)
{
ostr << input(p) << ": ";
Index: oln/core/concept/accumulator.hh
--- oln/core/concept/accumulator.hh (revision 893)
+++ oln/core/concept/accumulator.hh (working copy)
@@ -60,7 +60,7 @@
Accumulator<Exact>::init_with(const T& val) const
{
exact(this)->init();
- exact(this)->operator()(val);
+ exact(this)->operator()(val); // FIXME: Change to ->take(val)?
}
# endif // ! OLN_INCLUDE_ONLY
Index: oln/core/gen/dpoints_piter.hh
--- oln/core/gen/dpoints_piter.hh (revision 893)
+++ oln/core/gen/dpoints_piter.hh (working copy)
@@ -28,121 +28,105 @@
#ifndef OLN_CORE_GEN_DPOINTS_PITER_HH
# define OLN_CORE_GEN_DPOINTS_PITER_HH
-# include <oln/core/concept/iterator_on_points.hh>
-# include <oln/core/internal/dpoints_impl.hh>
+# include <oln/core/concept/window.hh>
+# include <oln/core/concept/neighborhood.hh>
+# include <oln/core/concept/image.hh>
+# include <oln/core/internal/dpoints_piter_impl.hh>
namespace oln
{
- /// Fwd decls.
+ // --------------------------- dpoints_fwd_piter_<P>
+
+
+
+ // Fwd decl.
template <typename P> class dpoints_fwd_piter_;
- template <typename P> class dpoints_bkd_piter_;
- // Super types.
+ // Super type.
template <typename P>
struct super_trait_< dpoints_fwd_piter_<P> >
{
typedef dpoints_fwd_piter_<P> current__;
typedef Iterator_on_Points<current__> ret;
};
- template <typename P>
- struct super_trait_< dpoints_bkd_piter_<P> >
- {
- typedef dpoints_bkd_piter_<P> current__;
- typedef Iterator_on_Points<current__> ret;
- };
- /// Virtual types.
+ // Virtual type.
template <typename P>
struct vtypes< dpoints_fwd_piter_<P> >
{
typedef P point;
};
- template <typename P>
- struct vtypes< dpoints_bkd_piter_<P> >
- {
- typedef P point;
- };
-
- namespace internal
- {
-
- /// Class to factor some code.
-
+ // Forward point iterator class on a set of dpoints.
template <typename P>
- class dpoints_piter_impl_ : private mlc::assert_< mlc_is_a(P, Point) >
+ class dpoints_fwd_piter_ : public Iterator_on_Points< dpoints_fwd_piter_<P>
>,
+ public internal::dpoints_fwd_piter_impl_<P>
{
public:
- dpoints_piter_impl_(const dpoints_piter_impl_&);
- void operator=(const dpoints_piter_impl_&);
-
- void impl_invalidate();
+ // FIXME: Strenghten sigs (Pl is either a Point or an Iterator_on_Points).
- bool impl_is_valid() const;
+ template <typename Pl, typename W>
+ dpoints_fwd_piter_(const Pl& p, const Window<W>& win);
- P impl_to_point() const;
+ template <typename Pl, typename I>
+ dpoints_fwd_piter_(const Pl& p, const Image_with_Nbh<I>& ima);
- const P* impl_point_adr() const;
+ template <typename Pl, typename N>
+ dpoints_fwd_piter_(const Pl& p, const Neighborhood<N>& nbh);
- protected:
+ }; // end of class oln::dpoints_fwd_piter_<P>
- const P* p_ref_;
- std::vector<typename P::dpoint> dps_;
- unsigned n_, i_;
- P p_;
- // Ctor.
- template <typename Pl>
- dpoints_piter_impl_(const Pl& ref,
- const internal::dpoints_impl_<typename P::dpoint>& data);
- void update_p_();
- };
+ // --------------------------- dpoints_bkd_piter_<P>
- } // end of namespace oln::internal
+ // Fwd decl.
+ template <typename P> class dpoints_bkd_piter_;
- /// Forward point iterator class on a set of dpoints.
+ // Super type.
template <typename P>
- class dpoints_fwd_piter_ : public Iterator_on_Points< dpoints_fwd_piter_<P>
>,
- public internal::dpoints_piter_impl_<P>
+ struct super_trait_< dpoints_bkd_piter_<P> >
{
- public:
-
- template <typename Pl, typename X>
- dpoints_fwd_piter_(const Pl& p, const X& win_or_nbh);
-
- void impl_start();
-
- void impl_next();
+ typedef dpoints_bkd_piter_<P> current__;
+ typedef Iterator_on_Points<current__> ret;
+ };
- }; // end of class oln::dpoints_fwd_piter_<P>
+ // Virtual type.
+ template <typename P>
+ struct vtypes< dpoints_bkd_piter_<P> >
+ {
+ typedef P point;
+ };
/// Backward point iterator class on a set of dpoints.
-
template <typename P>
class dpoints_bkd_piter_ : public Iterator_on_Points< dpoints_bkd_piter_<P>
>,
- public internal::dpoints_piter_impl_<P>
+ public internal::dpoints_bkd_piter_impl_<P>
{
public:
- template <typename Pl, typename X>
- dpoints_bkd_piter_(const Pl& p, const X& win_or_nbh);
+ // FIXME: Strenghten sigs (Pl is either a Point or an Iterator_on_Points).
+
+ template <typename Pl, typename W>
+ dpoints_bkd_piter_(const Pl& p, const Window<W>& win);
- void impl_start();
+ template <typename Pl, typename I>
+ dpoints_bkd_piter_(const Pl& p, const Image_with_Nbh<I>& ima);
- void impl_next();
+ template <typename Pl, typename N>
+ dpoints_bkd_piter_(const Pl& p, const Neighborhood<N>& nbh);
}; // end of class oln::dpoints_bkd_piter_<P>
@@ -150,128 +134,56 @@
# ifndef OLN_INCLUDE_ONLY
- namespace internal
- {
-
- template <typename Pl>
- const Pl* point_adr_(const Point<Pl>& p)
- {
- return exact(&p);
- }
-
- template <typename Pl>
- const typename Pl::point* point_adr_(const Iterator_on_Points<Pl>& p)
- {
- return p.point_adr();
- }
-
- template <typename P>
- template <typename Pl>
- dpoints_piter_impl_<P>::dpoints_piter_impl_(const Pl& ref,
- const internal::dpoints_impl_<typename P::dpoint>& data)
- {
- p_ref_ = point_adr_(ref);
- dps_ = data.dpoints();
- n_ = data.size();
- i_ = n_;
- postcondition(n_ != 0);
- }
-
- template <typename P>
- void
- dpoints_piter_impl_<P>::impl_invalidate()
- {
- i_ = n_;
- }
-
- template <typename P>
- bool
- dpoints_piter_impl_<P>::impl_is_valid() const
- {
- return i_ != n_;
- }
-
- template <typename P>
- P
- dpoints_piter_impl_<P>::impl_to_point() const
- {
- return p_;
- }
-
- template <typename P>
- const P*
- dpoints_piter_impl_<P>::impl_point_adr() const
- {
- return &p_;
- }
-
- template <typename P>
- void
- dpoints_piter_impl_<P>::update_p_()
- {
- p_ = *p_ref_+ dps_[i_];
- }
-
- } // end of namespace oln::internal
-
-
// fwd
template <typename P>
- template <typename Pl, typename X>
- dpoints_fwd_piter_<P>::dpoints_fwd_piter_(const Pl& p, const X&
win_or_nbh)
+ template <typename Pl, typename W>
+ dpoints_fwd_piter_<P>::dpoints_fwd_piter_(const Pl& p, const
Window<W>& win)
:
- internal::dpoints_piter_impl_<P>(p, exact(win_or_nbh))
+ internal::dpoints_fwd_piter_impl_<P>(p, exact(win))
{
}
template <typename P>
- void
- dpoints_fwd_piter_<P>::impl_start()
+ template <typename Pl, typename I>
+ dpoints_fwd_piter_<P>::dpoints_fwd_piter_(const Pl& p, const
Image_with_Nbh<I>& ima)
+ :
+ internal::dpoints_fwd_piter_impl_<P>(p, ima.nbhood())
{
- this->i_ = 0;
- this->update_p_();
}
template <typename P>
- void
- dpoints_fwd_piter_<P>::impl_next()
+ template <typename Pl, typename N>
+ dpoints_fwd_piter_<P>::dpoints_fwd_piter_(const Pl& p, const
Neighborhood<N>& nbh)
+ :
+ internal::dpoints_fwd_piter_impl_<P>(p, exact(nbh))
{
- if (++this->i_ = this->n_)
- return;
- this->update_p_();
}
-
// bkd
template <typename P>
- template <typename Pl, typename X>
- dpoints_bkd_piter_<P>::dpoints_bkd_piter_(const Pl& p, const X&
win_or_nbh)
+ template <typename Pl, typename W>
+ dpoints_bkd_piter_<P>::dpoints_bkd_piter_(const Pl& p, const
Window<W>& win)
:
- internal::dpoints_piter_impl_<P>(p, exact(win_or_nbh))
+ internal::dpoints_bkd_piter_impl_<P>(p, exact(win))
{
}
template <typename P>
- void
- dpoints_bkd_piter_<P>::impl_start()
+ template <typename Pl, typename I>
+ dpoints_bkd_piter_<P>::dpoints_bkd_piter_(const Pl& p, const
Image_with_Nbh<I>& ima)
+ :
+ internal::dpoints_bkd_piter_impl_<P>(p, ima.nbhood())
{
- this->i_ = this->n_ - 1;
- this->update_p_();
}
template <typename P>
- void
- dpoints_bkd_piter_<P>::impl_next()
- {
- if (this->i_ = 0)
+ template <typename Pl, typename N>
+ dpoints_bkd_piter_<P>::dpoints_bkd_piter_(const Pl& p, const
Neighborhood<N>& nbh)
+ :
+ internal::dpoints_bkd_piter_impl_<P>(p, exact(nbh))
{
- this->i_ = this->n_;
- return;
- }
- --this->i_;
- this->update_p_();
}
# endif
Index: oln/core/internal/max_value.hh
--- oln/core/internal/max_value.hh (revision 893)
+++ oln/core/internal/max_value.hh (working copy)
@@ -31,7 +31,6 @@
# include <limits>
#define oln_max(T) std::numeric_limits< T >::max() // FIXME std lib
-#define oln_min(T) std::numeric_limits< T >::min() // FIXME std lib
#endif // ! OLN_CORE_INTERNAL_MAX_VALUE_HH
Index: oln/core/internal/dpoints_piter_impl.hh
--- oln/core/internal/dpoints_piter_impl.hh (revision 892)
+++ oln/core/internal/dpoints_piter_impl.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLN_CORE_GEN_DPOINTS_PITER_HH
-# define OLN_CORE_GEN_DPOINTS_PITER_HH
+#ifndef OLN_CORE_INTERNAL_DPOINTS_PITER_IMPL_HH
+# define OLN_CORE_INTERNAL_DPOINTS_PITER_IMPL_HH
# include <oln/core/concept/iterator_on_points.hh>
# include <oln/core/internal/dpoints_impl.hh>
@@ -35,123 +35,79 @@
namespace oln
{
-
- /// Fwd decls.
- template <typename P> class dpoints_fwd_piter_;
- template <typename P> class dpoints_bkd_piter_;
-
-
- // Super types.
- template <typename P>
- struct super_trait_< dpoints_fwd_piter_<P> >
- {
- typedef dpoints_fwd_piter_<P> current__;
- typedef Iterator_on_Points<current__> ret;
- };
- template <typename P>
- struct super_trait_< dpoints_bkd_piter_<P> >
- {
- typedef dpoints_bkd_piter_<P> current__;
- typedef Iterator_on_Points<current__> ret;
- };
-
-
- /// Virtual types.
- template <typename P>
- struct vtypes< dpoints_fwd_piter_<P> >
- {
- typedef P point;
- };
- template <typename P>
- struct vtypes< dpoints_bkd_piter_<P> >
- {
- typedef P point;
- };
-
-
-
namespace internal
{
- /// Class to factor some code.
+ /// Classes to factor code for iterators based on vector of dpoints.
template <typename P>
- class dpoints_piter_impl_ : private mlc::assert_< mlc_is_a(P, Point) >
+ class dpoints_piter_impl_ : private mlc::assert_< mlc_is_a(P, Point) > //
FIXME: Add err msg.
{
public:
-
- dpoints_piter_impl_(const dpoints_piter_impl_&);
- void operator=(const dpoints_piter_impl_&);
+ // dpoints_piter_impl_(const dpoints_piter_impl_&);
void impl_invalidate();
-
bool impl_is_valid() const;
P impl_to_point() const;
-
const P* impl_point_adr() const;
protected:
- const P* p_ref_;
- std::vector<typename P::dpoint> dps_;
- unsigned n_, i_;
- P p_;
-
- // Ctor.
template <typename Pl>
- dpoints_piter_impl_(const Pl& ref,
- const internal::dpoints_impl_<typename P::dpoint>& data);
+ dpoints_piter_impl_(const Pl& p_ref,
+ const std::vector<typename P::dpoint>& dps);
void update_p_();
- };
-
- } // end of namespace oln::internal
+ const P* p_ref_;
+ const std::vector<typename P::dpoint>& dps_;
+ unsigned n_, i_;
+ P p_;
+ };
- /// Forward point iterator class on a set of dpoints.
+ // fwd
template <typename P>
- class dpoints_fwd_piter_ : public Iterator_on_Points< dpoints_fwd_piter_<P>
>,
- public internal::dpoints_piter_impl_<P>
+ class dpoints_fwd_piter_impl_ : public dpoints_piter_impl_<P>
{
public:
- template <typename Pl, typename X>
- dpoints_fwd_piter_(const Pl& p, const X& win_or_nbh);
-
void impl_start();
-
void impl_next();
- }; // end of class oln::dpoints_fwd_piter_<P>
+ protected:
+ template <typename Pl>
+ dpoints_fwd_piter_impl_(const Pl& p_ref,
+ const dpoints_impl_<typename P::dpoint>& data);
+ };
- /// Backward point iterator class on a set of dpoints.
+ // bkd
template <typename P>
- class dpoints_bkd_piter_ : public Iterator_on_Points< dpoints_bkd_piter_<P>
>,
- public internal::dpoints_piter_impl_<P>
+ class dpoints_bkd_piter_impl_ : public dpoints_piter_impl_<P>
{
public:
- template <typename Pl, typename X>
- dpoints_bkd_piter_(const Pl& p, const X& win_or_nbh);
-
void impl_start();
-
void impl_next();
- }; // end of class oln::dpoints_bkd_piter_<P>
+ protected:
+
+ template <typename Pl>
+ dpoints_bkd_piter_impl_(const Pl& p_ref,
+ const dpoints_impl_<typename P::dpoint>& data);
+ };
# ifndef OLN_INCLUDE_ONLY
- namespace internal
- {
+
+ // point_adr_
template <typename Pl>
const Pl* point_adr_(const Point<Pl>& p)
@@ -165,69 +121,70 @@
return p.point_adr();
}
+
+ // dpoints_piter_impl_<P>
+
template <typename P>
template <typename Pl>
- dpoints_piter_impl_<P>::dpoints_piter_impl_(const Pl& ref,
- const internal::dpoints_impl_<typename P::dpoint>& data)
+ dpoints_piter_impl_<P>::dpoints_piter_impl_(const Pl& p_ref,
+ const std::vector<typename P::dpoint>& dps)
+ : p_ref_(point_adr_(p_ref)),
+ dps_(dps),
+ n_(dps.size()),
+ i_(n_)
{
- p_ref_ = point_adr_(ref);
- dps_ = data.dpoints();
- n_ = data.size();
- i_ = n_;
- postcondition(n_ != 0);
+ precondition(dps.size() != 0);
}
template <typename P>
void
dpoints_piter_impl_<P>::impl_invalidate()
{
- i_ = n_;
+ this->i_ = this->n_;
}
template <typename P>
bool
dpoints_piter_impl_<P>::impl_is_valid() const
{
- return i_ != n_;
+ return this->i_ != this->n_;
}
template <typename P>
P
dpoints_piter_impl_<P>::impl_to_point() const
{
- return p_;
+ return this->p_;
}
template <typename P>
const P*
dpoints_piter_impl_<P>::impl_point_adr() const
{
- return &p_;
+ return &(this->p_);
}
template <typename P>
void
dpoints_piter_impl_<P>::update_p_()
{
- p_ = *p_ref_+ dps_[i_];
+ this->p_ = *(this->p_ref_) + this->dps_[i_];
}
- } // end of namespace oln::internal
-
- // fwd
+ // dpoints_fwd_piter_impl_<P>
template <typename P>
- template <typename Pl, typename X>
- dpoints_fwd_piter_<P>::dpoints_fwd_piter_(const Pl& p, const X&
win_or_nbh)
- :
- internal::dpoints_piter_impl_<P>(p, exact(win_or_nbh))
+ template <typename Pl>
+ dpoints_fwd_piter_impl_<P>::dpoints_fwd_piter_impl_(const Pl& p_ref,
+ const dpoints_impl_<typename P::dpoint>& data)
+ : dpoints_piter_impl_<P>(p_ref, data.dpoints())
{
}
template <typename P>
void
- dpoints_fwd_piter_<P>::impl_start()
+ dpoints_fwd_piter_impl_<P>::impl_start()
{
this->i_ = 0;
this->update_p_();
@@ -235,7 +192,7 @@
template <typename P>
void
- dpoints_fwd_piter_<P>::impl_next()
+ dpoints_fwd_piter_impl_<P>::impl_next()
{
if (++this->i_ = this->n_)
return;
@@ -243,19 +200,19 @@
}
- // bkd
+ // dpoints_bkd_piter_impl_<P>
template <typename P>
- template <typename Pl, typename X>
- dpoints_bkd_piter_<P>::dpoints_bkd_piter_(const Pl& p, const X&
win_or_nbh)
- :
- internal::dpoints_piter_impl_<P>(p, exact(win_or_nbh))
+ template <typename Pl>
+ dpoints_bkd_piter_impl_<P>::dpoints_bkd_piter_impl_(const Pl& p_ref,
+ const dpoints_impl_<typename P::dpoint>& data)
+ : dpoints_piter_impl_<P>(p_ref, data.dpoints())
{
}
template <typename P>
void
- dpoints_bkd_piter_<P>::impl_start()
+ dpoints_bkd_piter_impl_<P>::impl_start()
{
this->i_ = this->n_ - 1;
this->update_p_();
@@ -263,7 +220,7 @@
template <typename P>
void
- dpoints_bkd_piter_<P>::impl_next()
+ dpoints_bkd_piter_impl_<P>::impl_next()
{
if (this->i_ = 0)
{
@@ -271,12 +228,13 @@
return;
}
--this->i_;
- this->update_p_();
}
-# endif
+# endif // ! OLN_INCLUDE_ONLY
+
+ } // end of namespace oln::internal
} // end of namespace oln
-#endif // ! OLN_CORE_GEN_DPOINTS_PITER_HH
+#endif // ! OLN_CORE_INTERNAL_DPOINTS_PITER_IMPL_HH
Index: oln/core/internal/image_selectors.hh
--- oln/core/internal/image_selectors.hh (revision 893)
+++ oln/core/internal/image_selectors.hh (working copy)
@@ -56,7 +56,7 @@
struct case_< Image_mutability, Exact, 2 >
:
where_< mlc::and_< stc_type_is_found(lvalue),
- stc_type_is_found(index) > >
+ stc_type_is_found(index) > > // FIXME: Wrong!
{
typedef Fast_Image<Exact> ret;
};
Index: oln/core/internal/op_image_plus_nbh.hh
--- oln/core/internal/op_image_plus_nbh.hh (revision 893)
+++ oln/core/internal/op_image_plus_nbh.hh (working copy)
@@ -79,7 +79,7 @@
namespace internal
{
- /// Implementation class the result of "Image I + Neighborhood N".
+ /// Implementation class for the result of "Image I + Neighborhood N".
template <typename I, typename N>
class current
Index: oln/core/internal/min_value.hh
--- oln/core/internal/min_value.hh (revision 893)
+++ oln/core/internal/min_value.hh (working copy)
@@ -30,6 +30,6 @@
# include <limits>
-# define oln_min(T) std::numeric_limits< T >::min()
+# define oln_min(T) std::numeric_limits< T >::min() // FIXME std lib
# endif // ! OLN_CORE_INTERNAL_MIN_VALUE_HH
Index: oln/morpho/dilation.hh
--- oln/morpho/dilation.hh (revision 893)
+++ oln/morpho/dilation.hh (working copy)
@@ -54,8 +54,7 @@
template <typename I, typename W>
oln_plain(I)
- elementary_dilation_(const Image<I>& input,
- const Window<W>& win)
+ dilation_(const Image<I>& input, const Window<W>& win)
{
border::fill(input, oln_min(oln_value(I)));
accumulator::max_<oln_value(I)> max;
Index: oln/level/local.hh
--- oln/level/local.hh (revision 893)
+++ oln/level/local.hh (working copy)
@@ -68,8 +68,7 @@
const oln_point(I)& p)
{
f.init_with(input(p));
- oln_niter(I) n(p, input.nbhood()); // FIXME: 2nd arg should be
- // 'input'!
+ oln_niter(I) n(p, input);
for_all(n)
f(input(n));
return f.value();
@@ -97,27 +96,32 @@
// Optimised version for OR operator with neighborhood.
- template <typename A, typename I>
- typename A::result
- local_(const ::oln::accumulator::or_< oln_value(I) > f,
+ template <typename B, typename I>
+ B
+ local_(const accumulator::or_<B>& f,
const Binary_Image<I>& input,
const oln_point(I)& p)
{
f.init_with(input(p));
- oln_niter(I) n(p, input.nbhood()); // FIXME: 2nd arg should be
- // 'input'!
+ if (f.value() = true)
+ return true;
+ oln_niter(I) n(p, input);
for_all(n)
- if (f(input(n)) = f.ultimate)
- return (f.ultimate);
+ {
+ f(input(n)); // FIXME: Change to f.take(input(n))?
+ if (f.value() = true)
+ return true;
+ }
return f.value();
}
+ /*
// Optimised version for OR operator with window.
template <typename A, typename I, typename W>
typename A::result
- local_(const ::oln::accumulator::or_< oln_value(I) > f,
+ local_(const accumulator::or_<oln_value(I)>& f,
const Binary_Image<I>& input,
const oln_point(I)& p,
const Window<W>& win)
@@ -142,8 +146,7 @@
const oln_point(I)& p)
{
f.init_with(input(p));
- oln_niter(I) n(p, input.nbhood()); // FIXME: 2nd arg should be
- // 'input'!
+ oln_niter(I) n(p, input);
for_all(n)
if (f(input(n)) = f.ultimate)
return (f.ultimate);
@@ -168,6 +171,8 @@
return f.value();
}
+ */
+
} // end of namespace oln::level::impl