https://svn.lrde.epita.fr/svn/oln/prototypes/proto-1.0
ChangeLog | 14 +++++++++++
oln/morpho/tags.hh | 39 +++++++++++++++++++++++++++++++++
tests/morpho/tests/dilation | 26 +++++++++-------------
tests/morpho/tests/elementary_dilation | 12 +++++-----
tests/morpho/tests/elementary_erosion | 13 +++++------
tests/morpho/tests/erosion | 5 ----
tests/morpho/tests/reconstruction | 20 ++++++++++------
tests/utils/tests/clone | 3 +-
8 files changed, 92 insertions(+), 40 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* oln/morpho/tags.hh (by_dilation, by_erosion)
(sequential, hybrid, parallel, union-find): New facades.
* tests/morpho/tests/reconstruction (check): Use them.
* tests/morpho/tests/erosion (check): Catch up with current
implementation of erosion.
* tests/morpho/tests/dilation: Aesthetic changes.
* tests/morpho/tests/elementary_dilation,
* tests/morpho/tests/elementary_erosion: Likewise.
Catch up with image_with_nbh definition.
* tests/utils/tests/clone (check): Call oln::clone, not
oln::utils::clone.
2005-05-16 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/tests/utils/tests/clone
--- olena/tests/utils/tests/clone (revision 187)
+++ olena/tests/utils/tests/clone (working copy)
@@ -1,3 +1,4 @@
+ // -*- C++ -*-
#include "data.hh"
#include <ntg/all.hh>
@@ -17,7 +18,7 @@
ima1 = oln::io::read(rdata("lena.pgm"));
ima2 = oln::io::read(rdata("lena.pgm"));
- ima_copy = oln::utils::clone(ima1);
+ ima_copy = oln::clone(ima1);
oln::level::fill(ima1, 0);
if (oln::level::is_equal(ima2, ima_copy))
Index: olena/tests/morpho/tests/reconstruction
--- olena/tests/morpho/tests/reconstruction (revision 187)
+++ olena/tests/morpho/tests/reconstruction (working copy)
@@ -35,23 +35,27 @@
marker = io::read(rdata("marker.pbm"));
mask = io::read(rdata("mask.pbm"));
- res_dil_hyb = morpho::reconstruction(tag::by_dilation(),
+ res_dil_hyb =
+ morpho::reconstruction(morpho::tag::by_dilation(),
join(marker, neighb_c4()),
mask,
- tag::hybrid());
- res_dil_seq = morpho::reconstruction(tag::by_dilation(),
+ morpho::tag::hybrid());
+ res_dil_seq =
+ morpho::reconstruction(morpho::tag::by_dilation(),
join(marker, neighb_c4()),
mask,
- tag::sequential());
+ morpho::tag::sequential());
- res_ero_hyb = morpho::reconstruction(tag::by_erosion(),
+ res_ero_hyb =
+ morpho::reconstruction(morpho::tag::by_erosion(),
utils::invert(join(marker, neighb_c4())),
utils::invert(mask),
- tag::hybrid());
- res_ero_seq = morpho::reconstruction(tag::by_erosion(),
+ morpho::tag::hybrid());
+ res_ero_seq =
+ morpho::reconstruction(morpho::tag::by_erosion(),
utils::invert(join(marker, neighb_c4())),
utils::invert(mask),
- tag::sequential());
+ morpho::tag::sequential());
if (utils::md5(res_dil_hyb) != key)
return true;
Index: olena/tests/morpho/tests/dilation
--- olena/tests/morpho/tests/dilation (revision 187)
+++ olena/tests/morpho/tests/dilation (working copy)
@@ -8,27 +8,23 @@
#include <oln/level/compare.hh>
#include <ntg/all.hh>
+using namespace oln;
+
bool check()
{
- oln::utils::key::value_type data_key[16] =
+ // MD5 sum of object.pbm's erosion result.
+ // FIXME: Update this sum.
+ utils::key::value_type data_key[16] =
{0xbf, 0x67, 0x3, 0xa1, 0x2d, 0x6c, 0xac, 0xe9,
0xf3, 0x7c, 0x19, 0x4c, 0x3a, 0x3b, 0x4d, 0xaa};
+ utils::key key(data_key);
- oln::utils::key key(data_key);
-
- typedef oln::image2d<ntg::bin> im_type;
+ typedef image2d<ntg::bin> im_type;
im_type ima;
- ima = oln::io::read(rdata("16x16.pbm"));
+ ima = io::read(rdata("16x16.pbm"));
- std::cout << oln::utils::md5(oln::morpho::dilation(ima, oln::win_c8p())) <<
std::endl;
- if (oln::utils::md5(oln::morpho::dilation(ima, oln::win_c8p())) == key)
- {
- std::cout << "OK" << std::endl;
- return false;
- }
- else
- {
- std::cout << "FAIL" << std::endl;
+ if (utils::md5(morpho::dilation(ima, win_c8p())) != key)
return true;
- }
+
+ return false;
}
Index: olena/tests/morpho/tests/elementary_erosion
--- olena/tests/morpho/tests/elementary_erosion (revision 187)
+++ olena/tests/morpho/tests/elementary_erosion (working copy)
@@ -8,20 +8,21 @@
#include <oln/level/compare.hh>
#include <ntg/all.hh>
+using namespace oln;
+
bool check()
{
// MD5 sum of object.pbm's elementary erosion result.
// FIXME: Replace this fake with the actual result.
- oln::utils::key::value_type data_key[16] =
+ utils::key::value_type data_key[16] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- oln::utils::key key(data_key);
-
- typedef oln::image2d<ntg::bin> im_type;
+ utils::key key(data_key);
+ typedef image2d<ntg::bin> im_type;
im_type ima;
- ima = oln::io::read(rdata("16x16.pbm"));
+ ima = io::read(rdata("16x16.pbm"));
- if (oln::utils::md5(oln::morpho::elementary_erosion(ima) != key)
+ if (utils::md5(morpho::elementary_erosion(join(ima, neighb_c4()))) != key)
return true;
return false;
Index: olena/tests/morpho/tests/elementary_dilation
--- olena/tests/morpho/tests/elementary_dilation (revision 187)
+++ olena/tests/morpho/tests/elementary_dilation (working copy)
@@ -8,20 +8,22 @@
#include <oln/level/compare.hh>
#include <ntg/all.hh>
+using namespace oln;
+
bool check()
{
// MD5 sum of object.pbm's elementary dilation result.
// FIXME: Replace this fake with the actual result.
- oln::utils::key::value_type data_key[16] =
+ utils::key::value_type data_key[16] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- oln::utils::key key(data_key);
+ utils::key key(data_key);
- typedef oln::image2d<ntg::bin> im_type;
+ typedef image2d<ntg::bin> im_type;
im_type ima;
- ima = oln::io::read(rdata("16x16.pbm"));
+ ima = io::read(rdata("16x16.pbm"));
- if (oln::utils::md5(oln::morpho::elementary_dilation(ima) != key)
+ if (utils::md5(morpho::elementary_dilation(join(ima, neighb_c4()))) != key)
return true;
return false;
Index: olena/tests/morpho/tests/erosion
--- olena/tests/morpho/tests/erosion (revision 187)
+++ olena/tests/morpho/tests/erosion (working copy)
@@ -23,11 +23,6 @@
im_type ima;
ima = io::read(rdata("16x16.pbm"));
- // Classical procedure.
- if (utils::md5(morpho::proc::erosion(ima, win_c8p())) != key)
- return true;
-
- // Facade to object-algorithm.
if (utils::md5(morpho::erosion(ima, win_c8p())) != key)
return true;
Index: olena/oln/morpho/tags.hh
--- olena/oln/morpho/tags.hh (revision 187)
+++ olena/oln/morpho/tags.hh (working copy)
@@ -149,6 +149,19 @@
struct by_dilation_type : public oper< by_dilation_type > {};
struct by_erosion_type : public oper< by_erosion_type > {};
+ // Facades.
+ inline const by_dilation_type& by_dilation()
+ {
+ static const by_dilation_type tag = by_dilation_type();
+ return tag;
+ }
+
+ inline const by_erosion_type& by_erosion()
+ {
+ static const by_erosion_type tag = by_erosion_type();
+ return tag;
+ }
+
// Tags for common canvas.
@@ -159,6 +172,32 @@
struct parallel_type : public algo< parallel_type > {};
struct unionfind_type : public algo< unionfind_type > {};
+ // Facades.
+ inline const sequential_type& sequential()
+ {
+ static const sequential_type tag = sequential_type();
+ return tag;
+ }
+
+ inline const hybrid_type& hybrid()
+ {
+ static const hybrid_type tag = hybrid_type();
+ return tag;
+ }
+
+ inline const parallel_type& parallel()
+ {
+ static const parallel_type tag = parallel_type();
+ return tag;
+ }
+
+ inline const unionfind_type& unionfind()
+ {
+ static const unionfind_type tag = unionfind_type();
+ return tag;
+ }
+
+
} // end of namespace oln::morpho::tag