Skip to content

Commit

Permalink
Since SciPy 1.8 it is recommended to use KDTree instead of cKDTree
Browse files Browse the repository at this point in the history
  • Loading branch information
grlee77 committed Apr 27, 2024
1 parent edd1da3 commit 5427e35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions python/cucim/src/cucim/skimage/_shared/coord.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions python/cucim/src/cucim/skimage/feature/corner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 5427e35

Please sign in to comment.