Commit d472ddd8 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Change oln_ into mln_.

	* milena/morpho/erosion.hh: New.
	* milena/io: New.
	* milena/value/props.hh: New.
	* milena/border: New.

	* milena/test/main.cc,
	* milena/debug/println.hh,
	* milena/level/fill.hh,
	* milena/core/dpoints_qiter.hh,
	* milena/core/macros.hh,
	* milena/core/box_piter.hh,
	* milena/core/concept/image.hh,
	* milena/core/concept/genpoint.hh,
	* milena/core/concept/piter.hh,
	* milena/core/concept/point_set.hh,
	* milena/core/concept/window.hh,
	* milena/core/concept/box.hh,
	* milena/core/concept/point.hh,
	* milena/core/concept/dpoint.hh,
	* milena/core/internal/image_adaptor.hh,
	* milena/core/internal/image_base.hh,
	* milena/core/safe_image.hh,
	* milena/mlc/same_point.hh: Change oln_ into mln_.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@984 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 826ea0ea
2007-06-28 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Change oln_ into mln_.
* milena/morpho/erosion.hh: New.
* milena/io: New.
* milena/value/props.hh: New.
* milena/border: New.
* milena/test/main.cc,
* milena/debug/println.hh,
* milena/level/fill.hh,
* milena/core/dpoints_qiter.hh,
* milena/core/macros.hh,
* milena/core/box_piter.hh,
* milena/core/concept/image.hh,
* milena/core/concept/genpoint.hh,
* milena/core/concept/piter.hh,
* milena/core/concept/point_set.hh,
* milena/core/concept/window.hh,
* milena/core/concept/box.hh,
* milena/core/concept/point.hh,
* milena/core/concept/dpoint.hh,
* milena/core/internal/image_adaptor.hh,
* milena/core/internal/image_base.hh,
* milena/core/safe_image.hh,
* milena/mlc/same_point.hh: Change oln_ into mln_.
2007-06-28 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Introducing mini-olena (milena).
......
......@@ -17,8 +17,8 @@ namespace mln
typedef P psite;
typedef P point;
typedef oln_coord(P) coord;
typedef oln_dpoint(P) dpoint;
typedef mln_coord(P) coord;
typedef mln_dpoint(P) dpoint;
box_fwd_piter_(const box_<P>& b)
: b_(b)
......@@ -89,7 +89,7 @@ namespace mln
typedef P psite;
typedef P point;
typedef oln_coord(P) coord;
typedef mln_coord(P) coord;
box_bkd_piter_(const box_<P>& b)
: b_(b)
......
......@@ -33,7 +33,7 @@ namespace mln
template <typename E>
Box<E>::Box()
{
typedef oln_point(E) point;
typedef mln_point(E) point;
point (E::*m1)() const = & E::pmin;
m1 = 0;
point (E::*m2)() const = & E::pmax;
......
......@@ -42,8 +42,8 @@ namespace mln
template <typename E>
Dpoint<E>::Dpoint()
{
typedef oln_point(E) point;
typedef oln_coord(E) coord;
typedef mln_point(E) point;
typedef mln_coord(E) coord;
enum { dim = E::dim };
coord (E::*m)(unsigned i) const = & E::operator[];
m = 0;
......
......@@ -38,12 +38,12 @@ namespace mln
bool operator<(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
template <typename Pl, typename Pr>
oln_dpoint(Pl)
mln_dpoint(Pl)
operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
template <typename P>
oln_point(P)
operator+(const GenPoint<P>& lhs, const oln_dpoint(P)& rhs);
mln_point(P)
operator+(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs);
template <typename P>
std::ostream& operator<<(std::ostream& ostr, const GenPoint<P>& p);
......@@ -54,9 +54,9 @@ namespace mln
template <typename E>
GenPoint<E>::GenPoint()
{
typedef oln_point(E) point;
typedef oln_dpoint(E) dpoint;
typedef oln_coord(E) coord;
typedef mln_point(E) point;
typedef mln_dpoint(E) dpoint;
typedef mln_coord(E) coord;
const point* (E::*m1)() const = & E::pointer;
m1 = 0;
coord (E::*m2)(unsigned i) const = & E::operator[];
......@@ -92,12 +92,12 @@ namespace mln
template <typename Pl, typename Pr>
oln_dpoint(Pl)
mln_dpoint(Pl)
operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs)
{
const Pl& lhs_ = force_exact<Pl>(lhs);
const Pr& rhs_ = force_exact<Pr>(rhs);
oln_dpoint(Pl) tmp;
mln_dpoint(Pl) tmp;
for (unsigned i = 0; i < Pl::dim; ++i)
tmp[i] = lhs_[i] - rhs_[i];
return tmp;
......@@ -105,11 +105,11 @@ namespace mln
template <typename P>
oln_point(P)
operator+(const GenPoint<P>& lhs, const oln_dpoint(P)& rhs)
mln_point(P)
operator+(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs)
{
const P& lhs_ = force_exact<P>(lhs);
oln_point(P) tmp;
mln_point(P) tmp;
for (unsigned i = 0; i < P::dim; ++i)
tmp[i] = lhs_[i] + rhs[i];
return tmp;
......
......@@ -52,13 +52,13 @@ namespace mln
{
// provided by internal::image_base_:
typedef oln_pset(E) pset;
typedef oln_point(E) point;
typedef oln_psite(E) psite;
typedef mln_pset(E) pset;
typedef mln_point(E) point;
typedef mln_psite(E) psite;
typedef oln_piter(E) piter;
typedef oln_fwd_piter(E) fwd_piter;
typedef oln_bkd_piter(E) bkd_piter;
typedef mln_piter(E) piter;
typedef mln_fwd_piter(E) fwd_piter;
typedef mln_bkd_piter(E) bkd_piter;
bool (E::*m1)(const psite& p) const = & E::has;
m1 = 0;
......@@ -67,9 +67,9 @@ namespace mln
// to be provided in concrete image classes:
typedef oln_value(E) value;
typedef oln_rvalue(E) rvalue;
typedef oln_lvalue(E) lvalue;
typedef mln_value(E) value;
typedef mln_rvalue(E) rvalue;
typedef mln_lvalue(E) lvalue;
bool (E::*m3)() const = & E::has_data;
m3 = 0;
......
......@@ -31,8 +31,8 @@ namespace mln
template <typename E>
Piter<E>::Piter()
{
typedef oln_psite(E) psite;
typedef oln_point(E) point;
typedef mln_psite(E) psite;
typedef mln_point(E) point;
const point* (E::*m)() const = & E::pointer;
m = 0;
}
......
......@@ -20,10 +20,10 @@ namespace mln
template <typename P>
P& operator+=(Point<P>& lhs, const oln_dpoint(P)& rhs);
P& operator+=(Point<P>& lhs, const mln_dpoint(P)& rhs);
template <typename P>
P& operator-=(Point<P>& lhs, const oln_dpoint(P)& rhs);
P& operator-=(Point<P>& lhs, const mln_dpoint(P)& rhs);
......@@ -41,7 +41,7 @@ namespace mln
}
template <typename P>
P& operator+=(Point<P>& lhs, const oln_dpoint(P)& rhs)
P& operator+=(Point<P>& lhs, const mln_dpoint(P)& rhs)
{
for (unsigned i = 0; i < P::dim; ++i)
exact(lhs)[i] += rhs[i];
......@@ -49,7 +49,7 @@ namespace mln
}
template <typename P>
P& operator-=(Point<P>& lhs, const oln_dpoint(P)& rhs)
P& operator-=(Point<P>& lhs, const mln_dpoint(P)& rhs)
{
for (unsigned i = 0; i < P::dim; ++i)
exact(lhs)[i] -= rhs[i];
......
......@@ -35,11 +35,11 @@ namespace mln
template <typename E>
Point_Set<E>::Point_Set()
{
typedef oln_point(E) point;
typedef oln_psite(E) psite;
typedef oln_piter(E) piter;
typedef oln_fwd_piter(E) fwd_piter;
typedef oln_bkd_piter(E) bkd_piter;
typedef mln_point(E) point;
typedef mln_psite(E) psite;
typedef mln_piter(E) piter;
typedef mln_fwd_piter(E) fwd_piter;
typedef mln_bkd_piter(E) bkd_piter;
bool (E::*m1)(const psite& p) const = & E::has;
m1 = 0;
......
......@@ -30,9 +30,9 @@ namespace mln
template <typename E>
Window<E>::Window()
{
typedef oln_qiter(E) qiter;
typedef oln_fwd_qiter(E) fwd_qiter;
typedef oln_bkd_qiter(E) bkd_qiter;
typedef mln_qiter(E) qiter;
typedef mln_fwd_qiter(E) fwd_qiter;
typedef mln_bkd_qiter(E) bkd_qiter;
bool (E::*m1)() const = & E::is_empty;
m1 = 0;
......
......@@ -16,9 +16,9 @@ namespace mln
enum { dim = D::dim };
typedef D dpoint;
typedef oln_point(D) point;
typedef mln_point(D) point;
typedef point psite;
typedef oln_coord(D) coord;
typedef mln_coord(D) coord;
template <typename Dps, typename Pref>
dpoints_fwd_qiter(const Dps& dps,
......@@ -57,14 +57,14 @@ namespace mln
}
template <typename D>
dpoints_fwd_qiter<D>::operator point() const
dpoints_fwd_qiter<D>::operator mln_point(D)() const
{
assert(is_valid());
return p_;
}
template <typename D>
const oln_point(D)*
const mln_point(D)*
dpoints_fwd_qiter<D>::pointer() const
{
return & p_;
......@@ -109,7 +109,7 @@ namespace mln
}
template <typename D>
oln_coord(D)
mln_coord(D)
dpoints_fwd_qiter<D>::operator[](unsigned i) const
{
return p_[i];
......
......@@ -11,14 +11,14 @@ namespace mln
{
template <typename I, typename E>
struct image_adaptor_ : public internal::image_base_< oln_pset(I), E >
struct image_adaptor_ : public internal::image_base_< mln_pset(I), E >
{
typedef oln_psite(I) psite;
typedef oln_pset(I) pset;
typedef mln_psite(I) psite;
typedef mln_pset(I) pset;
typedef oln_value(I) value;
typedef oln_rvalue(I) rvalue;
typedef oln_lvalue(I) lvalue;
typedef mln_value(I) value;
typedef mln_rvalue(I) rvalue;
typedef mln_lvalue(I) lvalue;
bool has_data() const;
......@@ -51,21 +51,21 @@ namespace mln
}
template <typename I, typename E>
const oln_pset(I)&
const mln_pset(I)&
image_adaptor_<I,E>::domain() const
{
return adaptee_.domain();
}
template <typename I, typename E>
oln_rvalue(I)
mln_rvalue(I)
image_adaptor_<I,E>::operator()(const psite& p) const
{
return adaptee_(p);
}
template <typename I, typename E>
oln_lvalue(I)
mln_lvalue(I)
image_adaptor_<I,E>::operator()(const psite& p)
{
return adaptee_(p);
......
......@@ -14,11 +14,11 @@ namespace mln
struct image_base_ : public Image<E>
{
typedef S pset;
typedef oln_psite(S) psite;
typedef oln_point(S) point;
typedef mln_psite(S) psite;
typedef mln_point(S) point;
typedef oln_fwd_piter(S) fwd_piter;
typedef oln_bkd_piter(S) bkd_piter;
typedef mln_fwd_piter(S) fwd_piter;
typedef mln_bkd_piter(S) bkd_piter;
typedef fwd_piter piter;
bool has(const psite& p) const;
......@@ -47,7 +47,7 @@ namespace mln
}
template <typename S, typename E>
const box_<oln_point(S)>&
const box_<mln_point(S)>&
image_base_<S,E>::bbox() const
{
return exact(this)->domain().bbox();
......
......@@ -2,27 +2,27 @@
# define MLN_CORE_MACROS_HH
# define oln_point(T) typename T::point
# define oln_dpoint(T) typename T::dpoint
# define oln_psite(T) typename T::psite
# define oln_pset(T) typename T::pset
# define oln_box(T) typename T::box
# define oln_coord(T) typename T::coord
# define mln_point(T) typename T::point
# define mln_dpoint(T) typename T::dpoint
# define mln_psite(T) typename T::psite
# define mln_pset(T) typename T::pset
# define mln_box(T) typename T::box
# define mln_coord(T) typename T::coord
# define oln_piter(T) typename T::piter
# define oln_fwd_piter(T) typename T::fwd_piter
# define oln_bkd_piter(T) typename T::bkd_piter
# define mln_piter(T) typename T::piter
# define mln_fwd_piter(T) typename T::fwd_piter
# define mln_bkd_piter(T) typename T::bkd_piter
# define oln_qiter(T) typename T::qiter
# define oln_fwd_qiter(T) typename T::fwd_qiter
# define oln_bkd_qiter(T) typename T::bkd_qiter
# define mln_qiter(T) typename T::qiter
# define mln_fwd_qiter(T) typename T::fwd_qiter
# define mln_bkd_qiter(T) typename T::bkd_qiter
# define oln_niter(T) typename T::niter
# define oln_fwd_niter(T) typename T::fwd_niter
# define oln_bkd_niter(T) typename T::bkd_niter
# define mln_niter(T) typename T::niter
# define mln_fwd_niter(T) typename T::fwd_niter
# define mln_bkd_niter(T) typename T::bkd_niter
# define oln_value(T) typename T::value
# define oln_rvalue(T) typename T::rvalue
# define oln_lvalue(T) typename T::lvalue
# define mln_value(T) typename T::value
# define mln_rvalue(T) typename T::rvalue
# define mln_lvalue(T) typename T::lvalue
#endif // ! MLN_CORE_MACROS_HH
......@@ -15,8 +15,8 @@ namespace mln
safe_image(Image<I>& ima);
oln_rvalue(I) operator()(const oln_psite(I)& p) const;
oln_lvalue(I) operator()(const oln_psite(I)& p);
mln_rvalue(I) operator()(const mln_psite(I)& p) const;
mln_lvalue(I) operator()(const mln_psite(I)& p);
};
......@@ -36,20 +36,20 @@ namespace mln
}
template <typename I>
oln_rvalue(I)
safe_image<I>::operator()(const oln_psite(I)& p) const
mln_rvalue(I)
safe_image<I>::operator()(const mln_psite(I)& p) const
{
static oln_value(I) tmp;
static mln_value(I) tmp;
if (not this->owns_(p))
return tmp;
return this->adaptee_(p);
}
template <typename I>
oln_lvalue(I)
safe_image<I>::operator()(const oln_psite(I)& p)
mln_lvalue(I)
safe_image<I>::operator()(const mln_psite(I)& p)
{
static oln_value(I) tmp;
static mln_value(I) tmp;
if (not this->owns_(p))
return tmp;
return this->adaptee_(p);
......
......@@ -25,7 +25,7 @@ namespace mln
void println(const Image<I>& input_)
{
const I& input = exact(input_);
oln_piter(I) p(input.domain());
mln_piter(I) p(input.domain());
for_all(p)
std::cout << input(p) << ' ';
std::cout << std::endl;
......@@ -39,8 +39,8 @@ namespace mln
const I& input = exact(input_);
const W& win = exact(win_);
oln_piter(I) p(input.domain());
oln_qiter(W) q(win, p);
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
{
std::cout << input(p) << ':';
......
......@@ -11,16 +11,16 @@ namespace mln
{
template <typename I>
void fill(Image<I>& ima_, const oln_value(I)& value);
void fill(Image<I>& ima_, const mln_value(I)& value);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
void fill(Image<I>& ima_, const oln_value(I)& value)
void fill(Image<I>& ima_, const mln_value(I)& value)
{
I& ima = exact(ima_);
oln_piter(I) p(ima.domain());
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = value;
}
......
......@@ -12,7 +12,7 @@ namespace mln
{
template <typename T1, typename T2>
struct same_point : mlc::equal<oln_point(T2), oln_point(T2)>
struct same_point : mlc::equal<mln_point(T2), mln_point(T2)>
{
};
......
#ifndef MLN_MORPHO_EROSION_HH
# define MLN_MORPHO_EROSION_HH
# include <core/concept/image.hh>
# include <core/concept/window.hh>
// FIXME: # include <border/assign.hh>
# include <value/props.hh>
namespace mln
{
namespace morpho
{
template <typename I, typename W>
I erosion(const Image<I>& input, const Window<W>& win);
# ifndef MLN_INCLUDE_ONLY
namespace impl
{
template <typename I, typename W>
I erosion(const Image<I>& input_, const Window<W>& win_)
{
const I& input = exact(input_);
const W& win = exact(win_);
typedef mln_value(I) value;
I output(input.domain());
mln_piter(I) p(input.domain());
mln_qiter(W) q(win, p);
for_all(p)
{
value v = mln_max(value);
for_all(q) if (input.owns_(q))
{
if (input(q) < v)
v = input(q);
}
output(p) = v;
}
return output;
}
// ...
} // end of namespace mln::morpho::impl
// facade
template <typename I, typename W>
I erosion(const Image<I>& input, const Window<W>& win)
{
return impl::erosion(exact(input), exact(win));
}
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::morpho
} // end of namespace mln
#endif // ! MLN_MORPHO_EROSION_HH
......@@ -5,6 +5,8 @@
#include <core/window2d.hh>
#include <core/rectangle2d.hh>
#include <morpho/erosion.hh>
int main()
{
......@@ -26,6 +28,7 @@ int main()
std::cout << win << std::endl;
debug::println(ima, win);
morpho::erosion(ima, win);
rectangle2d rec(1, 2);
std::cout << rec << std::endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment