From b931f7e1f1425070f118ee37700b127134396ece Mon Sep 17 00:00:00 2001 From: Marvin Albert Date: Fri, 14 May 2021 11:29:26 +0200 Subject: [PATCH] affine_transform: increased shape of required input array slices. Modified tests to reflect this requirement. (#216) --- dask_image/ndinterp/__init__.py | 2 +- .../test_ndinterp/test_affine_transformation.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dask_image/ndinterp/__init__.py b/dask_image/ndinterp/__init__.py index 55493850..29938e0e 100644 --- a/dask_image/ndinterp/__init__.py +++ b/dask_image/ndinterp/__init__.py @@ -184,7 +184,7 @@ def affine_transform( rel_image_f[dim] = np.clip(rel_image_f[dim], 0, s - 1) rel_image_slice = tuple([slice(int(rel_image_i[dim]), - int(rel_image_f[dim]) + 1) + int(rel_image_f[dim]) + 2) for dim in range(n)]) rel_image = image[rel_image_slice] diff --git a/tests/test_dask_image/test_ndinterp/test_affine_transformation.py b/tests/test_dask_image/test_ndinterp/test_affine_transformation.py index 27a4cffb..e2679017 100644 --- a/tests/test_dask_image/test_ndinterp/test_affine_transformation.py +++ b/tests/test_dask_image/test_ndinterp/test_affine_transformation.py @@ -45,7 +45,8 @@ def validate_affine_transform(n=2, # define (random) transformation if matrix is None: - matrix = np.eye(n) + (np.random.random((n, n)) - 0.5) / 5. + # make sure to substantially deviate from unity matrix + matrix = np.eye(n) + (np.random.random((n, n)) - 0.5) * 5. if offset is None: offset = (np.random.random(n) - 0.5) / 5. * np.array(image.shape)