J'ai ajouté ce test pour qu'on n'oublie pas que bcp d'algos sont
cassés avec des image<type_builtin>, notamment à cause de arith.
J'ai aussi ajouté
https://www.lrde.epita.fr/cgi-bin/twiki/view/Projects/BugMorphoAlgorithmsWi…
Index: olena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* tests/morpho/tests/builtin_types: New test.
Index: olena/tests/morpho/tests/reconstruction
--- olena/tests/morpho/tests/reconstruction Mon, 28 Jul 2003 16:23:13 +0200 palma_g
(oln/e/34_reconstruc 1.10 640)
+++ olena/tests/morpho/tests/reconstruction Wed, 08 Oct 2003 10:23:32 +0200 burrus_n
(oln/e/34_reconstruc 1.10 640)
@@ -1,3 +1,5 @@
+// -*- c++ -*-
+
#include <oln/basics2d.hh>
#include <oln/morpho/opening.hh>
Index: olena/tests/morpho/tests/builtin_types
--- olena/tests/morpho/tests/builtin_types Wed, 08 Oct 2003 11:14:24 +0200 burrus_n ()
+++ olena/tests/morpho/tests/builtin_types Wed, 08 Oct 2003 11:04:03 +0200 burrus_n
(oln/v/30_builtin_ty 644)
@@ -0,0 +1,128 @@
+// -*- c++ -*-
+
+// FIXME: this test should work before any serious release.
+// XFAIL
+
+#include <oln/basics2d.hh>
+
+#include <oln/morpho/opening.hh>
+#include <oln/morpho/geodesic_dilation.hh>
+#include <oln/morpho/geodesic_erosion.hh>
+#include <oln/morpho/reconstruction.hh>
+#include <oln/morpho/extrema.hh>
+#include <oln/level/fill.hh>
+#include <ntg/all.hh>
+#include "check.hh"
+#include "data.hh"
+
+using namespace oln;
+using namespace oln::level;
+using namespace ntg;
+
+#define OK_OR_FAIL \
+ std::cout << "OK" << std::endl; \
+ else \
+ { \
+ std::cout << "FAIL" << std::endl; \
+ fail = true; \
+ }
+
+bool
+check()
+{
+ bool fail = false;
+
+ image2d<unsigned> lena_uint = load(rdata("lena128.pgm"));
+ image2d<signed> lena_sint = load(rdata("lena128.pgm"));
+ image2d<unsigned> lena_open = morpho::fast::opening(lena_uint, win_c4p());
+ image2d<ntg::bin> minima_map(lena_uint.size());
+ image2d<int_u8> max_map(lena_uint.size());
+
+ level::fill (minima_map, false);
+ level::fill (max_map, 255);
+ minima_map(10,10) = true;
+ minima_map(100,100) = true;
+
+ // test regional minima
+ {
+ std::cout << "regional minima sequential ... " << std::flush;
+ if (level::is_equal(morpho::sure::regional_minima(lena_uint, neighb_c4()),
+ morpho::sequential::regional_minima(lena_uint, neighb_c4())))
+ OK_OR_FAIL;
+
+ std::cout << "regional minima hybrid ... " << std::flush;
+ if (level::is_equal(morpho::sure::regional_minima(lena_uint, neighb_c4()),
+ morpho::hybrid::regional_minima(lena_uint, neighb_c4())))
+ OK_OR_FAIL;
+ }
+
+ // test minima imposition
+ {
+ std::cout << "minima impos sequential ... " << std::flush;
+ if (level::is_equal(morpho::sure::minima_imposition(lena_uint,
+ minima_map, neighb_c4()),
+ morpho::sequential::minima_imposition(lena_uint,
+ minima_map,
+ neighb_c4())))
+ OK_OR_FAIL;
+
+ std::cout << "minima impos hybrid ... " << std::flush;
+ if (level::is_equal(morpho::sure::minima_imposition(lena_uint,
+ minima_map, neighb_c4()),
+ morpho::hybrid::minima_imposition(lena_uint,
+ minima_map,
+ neighb_c4())))
+ OK_OR_FAIL;
+ }
+
+ // test geodesic erosion and geodesic dilation
+ {
+ std::cout << "geodesic erosion ... " << std::flush;
+ if (level::is_equal(morpho::geodesic_erosion(lena_uint, lena_open, neighb_c4()),
+ morpho::sure::geodesic_erosion(lena_uint, lena_open,
+ neighb_c4())))
+ OK_OR_FAIL;
+
+ std::cout << "geodesic dilation ... " << std::flush;
+ if (level::is_equal(morpho::geodesic_dilation(lena_open, lena_uint, neighb_c4()),
+ morpho::sure::geodesic_dilation(lena_open,
+ lena_uint, neighb_c4())))
+ OK_OR_FAIL;
+ }
+
+
+
+ {
+ std::cout << "sequential G.R. erosion ... " << std::flush;
+ if (level::is_equal(morpho::sequential::geodesic_reconstruction_erosion
+ (max_map, lena_open, neighb_c4()),
+ morpho::sure::geodesic_reconstruction_erosion
+ (max_map, lena_open, neighb_c4())))
+ OK_OR_FAIL;
+
+ std::cout << "hybrid G.R. erosion ... " << std::flush;
+ if (level::is_equal(morpho::hybrid::geodesic_reconstruction_erosion
+ (max_map, lena_open, neighb_c4()),
+ morpho::sure::geodesic_reconstruction_erosion
+ (max_map, lena_open, neighb_c4())))
+ OK_OR_FAIL;
+ }
+
+ {
+ std::cout << "sequential G.R. dilation ... " << std::flush;
+ if (level::is_equal(morpho::sequential::geodesic_reconstruction_dilation
+ (lena_open, lena_uint, neighb_c4()),
+ morpho::sure::geodesic_reconstruction_dilation
+ (lena_open, lena_uint, neighb_c4())))
+ OK_OR_FAIL;
+
+ std::cout << "hybrid G.R. dilation ... " << std::flush;
+ if (level::is_equal(morpho::hybrid::geodesic_reconstruction_dilation
+ (lena_open, lena_uint, neighb_c4()),
+ morpho::sure::geodesic_reconstruction_dilation
+ (lena_open, lena_uint, neighb_c4())))
+ OK_OR_FAIL;
+ }
+
+ return fail;
+}