From 920c3efb832c46c07135e3b5f98682d37a49433b Mon Sep 17 00:00:00 2001 From: Jeremy Metz Date: Sat, 1 Feb 2014 16:17:53 +0000 Subject: [PATCH] Added new convex_hull_image qhull test --- skimage/morphology/tests/test_convex_hull.py | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/skimage/morphology/tests/test_convex_hull.py b/skimage/morphology/tests/test_convex_hull.py index ee3b6bfa..d319662e 100644 --- a/skimage/morphology/tests/test_convex_hull.py +++ b/skimage/morphology/tests/test_convex_hull.py @@ -32,6 +32,28 @@ def test_basic(): assert_array_equal(convex_hull_image(image), expected) +@skipif(not scipy_spatial) +def test_qhull_offset_example(): + nonzeros = (([1367, 1368, 1368, 1368, 1369, 1369, 1369, 1369, 1369, 1370, 1370, + 1370, 1370, 1370, 1370, 1370, 1371, 1371, 1371, 1371, 1371, 1371, + 1371, 1371, 1371, 1372, 1372, 1372, 1372, 1372, 1372, 1372, 1372, + 1372, 1373, 1373, 1373, 1373, 1373, 1373, 1373, 1373, 1373, 1374, + 1374, 1374, 1374, 1374, 1374, 1374, 1375, 1375, 1375, 1375, 1375, + 1376, 1376, 1376, 1377]), + ([151, 150, 151, 152, 149, 150, 151, 152, 153, 148, 149, 150, 151, + 152, 153, 154, 147, 148, 149, 150, 151, 152, 153, 154, 155, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 147, 148, 149, 150, 151, 152, 153, 148, 149, + 150, 151, 152, 149, 150, 151, 150])) + + image = np.zeros((1392, 1040), dtype=bool) + image[ nonzeros ] = True + + expected = image.copy() + + assert_array_equal(convex_hull_image(image), expected) + + @skipif(not scipy_spatial) def test_pathological_qhull_example(): image = np.array(