From d32834d7885343ce3a71f223319b26bec5a4a593 Mon Sep 17 00:00:00 2001 From: csowers Date: Tue, 15 Aug 2023 13:53:19 -0700 Subject: [PATCH] np.array fix --- src/toffy/image_stitching.py | 7 ++++++- tests/image_stitching_test.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/toffy/image_stitching.py b/src/toffy/image_stitching.py index 17eeec20..7f176c9b 100644 --- a/src/toffy/image_stitching.py +++ b/src/toffy/image_stitching.py @@ -243,7 +243,12 @@ def rescale_image(img_data, scale, save_path=None): # rescale data while preserving values data_type = img_data.dtype rescaled_data = transform.rescale( - img_data, scale, mode="constant", preserve_range=True, order=0, anti_aliasing=False + np.array(img_data), + scale, + mode="constant", + preserve_range=True, + order=0, + anti_aliasing=False, ) rescaled_data = rescaled_data.astype(data_type) diff --git a/tests/image_stitching_test.py b/tests/image_stitching_test.py index 6004ac5d..e2b9cbb4 100644 --- a/tests/image_stitching_test.py +++ b/tests/image_stitching_test.py @@ -303,7 +303,7 @@ def test_fix_image_resolutions(mocked_print): with tempfile.TemporaryDirectory() as tmpdir: channel_list = ["Au", "CD3", "CD4", "CD8", "CD11c"] fov_list = ["fov-1-scan-1", "fov-2-scan-1", "fov-3-scan-1", "fov-4-scan-1"] - test_utils._write_tifs(tmpdir, fov_list, channel_list, (10, 10), "", False, int) + test_utils._write_tifs(tmpdir, fov_list, channel_list, (10, 10), "", False, "uint32") # test no fovs changes resolution_data = pd.DataFrame(