From 29e9bff5ebd8b104f4347ea5cc2a91cce2cebafe Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Sat, 16 Jul 2016 21:03:42 -0500 Subject: [PATCH] Add test for 3D images --- skimage/feature/tests/test_corner.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/skimage/feature/tests/test_corner.py b/skimage/feature/tests/test_corner.py index 3535ab1a..261b8e92 100644 --- a/skimage/feature/tests/test_corner.py +++ b/skimage/feature/tests/test_corner.py @@ -61,6 +61,19 @@ def test_hessian_matrix(): [0, 0, 2, 0, 0]])) +def test_hessian_matrix_3d(): + cube = np.zeros((5, 5, 5)) + cube[2, 2, 2] = 4 + Hs = hessian_matrix(cube, sigma=0.1) + assert len(Hs) == 6, ("incorrect number of Hessian images (%i) for 3D" % + len(Hs)) + assert_almost_equal(Hs[2][:, 2, :], np.array([[0, 0, 0, 0, 0], + [0, 1, 0, -1, 0], + [0, 0, 0, 0, 0], + [0, -1, 0, 1, 0], + [0, 0, 0, 0, 0]])) + + def test_structure_tensor_eigvals(): square = np.zeros((5, 5)) square[2, 2] = 1