From 7f0c077a4349fb424fc03cf9921b2eb4c01d6493 Mon Sep 17 00:00:00 2001 From: Joshua Gould Date: Mon, 2 Sep 2024 01:09:18 -0400 Subject: [PATCH] Update for scikit-image>=0.20 (#215) --- ashlar/thumbnail.py | 5 ++--- ashlar/utils.py | 10 ++++++---- setup.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ashlar/thumbnail.py b/ashlar/thumbnail.py index 1103b8be..051d8d72 100644 --- a/ashlar/thumbnail.py +++ b/ashlar/thumbnail.py @@ -47,9 +47,8 @@ def calculate_image_offset(img1, img2, upsample_factor=1): ref, test, upsample_factor=upsample_factor, - normalization=None, - return_error=False, - ) + normalization=None + )[0] return shift diff --git a/ashlar/utils.py b/ashlar/utils.py index 62244387..0da0a732 100644 --- a/ashlar/utils.py +++ b/ashlar/utils.py @@ -2,6 +2,7 @@ import itertools import warnings import skimage +import skimage.restoration.uft import scipy.ndimage import numpy as np @@ -35,14 +36,15 @@ def window(img): def register(img1, img2, sigma, upsample=10): img1w = window(whiten(img1, sigma)) img2w = window(whiten(img2, sigma)) + shift = skimage.registration.phase_cross_correlation( img1w, img2w, upsample_factor=upsample, - normalization=None, - return_error=False, - ) - # At this point we may have a shift in the wrong quadrant since the FFT + normalization=None + )[0] + + # At this point we may have a shift in the wrong quadrant since the FFT # assumes the signal is periodic. We test all four possibilities and return # the shift that gives the highest direct correlation (sum of products). shape = np.array(img1.shape) diff --git a/setup.py b/setup.py index be0de3a2..6a7daafd 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'matplotlib>=3.1.2', 'networkx>=2.4', 'scipy>=1.4.1', - 'scikit-image>=0.19.2,<0.20', # The v1.0 API promises breaking changes. + 'scikit-image>=0.19.2', 'scikit-learn>=0.21.1', 'tifffile>=2023.3.15', 'zarr>=2.11.3',