From 5427e35892102fc4033b789e19b5945fad8f7dfb Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Sat, 27 Apr 2024 10:46:52 -0400 Subject: [PATCH] Since SciPy 1.8 it is recommended to use KDTree instead of cKDTree --- python/cucim/src/cucim/skimage/_shared/coord.py | 6 +++--- python/cucim/src/cucim/skimage/feature/corner.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/cucim/src/cucim/skimage/_shared/coord.py b/python/cucim/src/cucim/skimage/_shared/coord.py index f95ddd2aa..9d5e45a7a 100644 --- a/python/cucim/src/cucim/skimage/_shared/coord.py +++ b/python/cucim/src/cucim/skimage/_shared/coord.py @@ -1,9 +1,9 @@ import cupy as cp import numpy as np -from scipy.spatial import cKDTree, distance +from scipy.spatial import KDTree, distance -# TODO: avoid host/device transfers (currently needed for cKDTree) +# TODO: avoid host/device transfers (currently needed for KDTree) def _ensure_spacing(coord, spacing, p_norm, max_out): """Returns a subset of coord where a minimum spacing is guaranteed. @@ -30,7 +30,7 @@ def _ensure_spacing(coord, spacing, p_norm, max_out): """ # Use KDtree to find the peaks that are too close to each other - tree = cKDTree(coord) + tree = KDTree(coord) indices = tree.query_ball_point(coord, r=spacing, p=p_norm) rejected_peaks_indices = set() diff --git a/python/cucim/src/cucim/skimage/feature/corner.py b/python/cucim/src/cucim/skimage/feature/corner.py index a58120bde..1eb7f1d5c 100644 --- a/python/cucim/src/cucim/skimage/feature/corner.py +++ b/python/cucim/src/cucim/skimage/feature/corner.py @@ -4,7 +4,7 @@ import cupy as cp import numpy as np -from scipy import spatial # TODO: use cuSpatial if cKDTree becomes available +from scipy import spatial # TODO: use cuSpatial if KDTree becomes available import cucim.skimage._vendored.ndimage as ndi from cucim.skimage.util import img_as_float @@ -1370,7 +1370,7 @@ def corner_peaks( coords = cp.asnumpy(coords) # Use KDtree to find the peaks that are too close to each other - tree = spatial.cKDTree(coords) + tree = spatial.KDTree(coords) rejected_peaks_indices = set() for idx, point in enumerate(coords):