Add test for 3D images

This commit is contained in:
Juan Nunez-Iglesias
2016-07-16 21:03:42 -05:00
parent 966afc122a
commit 29e9bff5eb
+13
View File
@@ -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