diff --git a/skimage/transform/tests/test_warps.py b/skimage/transform/tests/test_warps.py index fcdd0a87..da4f0beb 100644 --- a/skimage/transform/tests/test_warps.py +++ b/skimage/transform/tests/test_warps.py @@ -55,6 +55,25 @@ def test_warp_matrix(): outx = warp(x, matrix, order=5) +def test_warp_nd(): + for dim in range(2, 8): + shape = dim * (5,) + + x = np.zeros(shape, dtype=np.double) + x_c = dim * (2,) + x[x_c] = 1 + refx = np.zeros(shape, dtype=np.double) + refx_c = dim * (1,) + refx[refx_c] = 1 + + coord_grid = dim * (np.arange(5),) + coords = np.array(np.meshgrid(*coord_grid)) + 1 + + outx = warp(x, coords, order=0, cval=0) + + assert_array_almost_equal(outx, refx) + + def test_warp_clip(): x = 2 * np.ones((5, 5), dtype=np.double) matrix = np.eye(3)