From cd13361b1109ff5932b34a8dbb0e8e84abbc8db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Mon, 10 Mar 2014 08:21:50 -0400 Subject: [PATCH] Add test case for 4D images --- skimage/feature/tests/test_peak.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/skimage/feature/tests/test_peak.py b/skimage/feature/tests/test_peak.py index 5e03018b..98242a4d 100644 --- a/skimage/feature/tests/test_peak.py +++ b/skimage/feature/tests/test_peak.py @@ -279,6 +279,18 @@ def test_3D(): [[5, 5, 5], [15, 15, 15]]) +def test_4D(): + image = np.zeros((30, 30, 30, 30)) + image[15, 15, 15, 15] = 1 + image[5, 5, 5, 5] = 1 + assert_equal(peak.peak_local_max(image), [[15, 15, 15, 15]]) + assert_equal(peak.peak_local_max(image, min_distance=6), [[15, 15, 15, 15]]) + assert_equal(peak.peak_local_max(image, exclude_border=False), + [[5, 5, 5, 5], [15, 15, 15, 15]]) + assert_equal(peak.peak_local_max(image, min_distance=5), + [[5, 5, 5, 5], [15, 15, 15, 15]]) + + if __name__ == '__main__': from numpy import testing testing.run_module_suite()