Add test case for 3D images

This commit is contained in:
Johannes Schönberger
2014-03-10 08:20:32 -04:00
parent c815bd6030
commit 438784cdda
+14 -1
View File
@@ -1,5 +1,6 @@
import numpy as np
from numpy.testing import assert_array_almost_equal as assert_close
from numpy.testing import (assert_array_almost_equal as assert_close,
assert_equal)
import scipy.ndimage
from skimage.feature import peak
@@ -266,6 +267,18 @@ def test_disk():
assert np.all(result)
def test_3D():
image = np.zeros((30, 30, 30))
image[15, 15, 15] = 1
image[5, 5, 5] = 1
assert_equal(peak.peak_local_max(image), [[15, 15, 15]])
assert_equal(peak.peak_local_max(image, min_distance=6), [[15, 15, 15]])
assert_equal(peak.peak_local_max(image, exclude_border=False),
[[5, 5, 5], [15, 15, 15]])
assert_equal(peak.peak_local_max(image, min_distance=5),
[[5, 5, 5], [15, 15, 15]])
if __name__ == '__main__':
from numpy import testing
testing.run_module_suite()