From 24e24615c52d5464da9973591c94aa0347466057 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Mon, 16 Dec 2024 10:37:15 -0500 Subject: [PATCH] fix private import to work across scikit-image versions --- .../src/cucim/skimage/morphology/_skeletonize.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/python/cucim/src/cucim/skimage/morphology/_skeletonize.py b/python/cucim/src/cucim/skimage/morphology/_skeletonize.py index 6193a17d..4652d8a8 100644 --- a/python/cucim/src/cucim/skimage/morphology/_skeletonize.py +++ b/python/cucim/src/cucim/skimage/morphology/_skeletonize.py @@ -253,12 +253,15 @@ def medial_axis(image, mask=None, return_distance=False, *, rng=None): """ try: from skimage.morphology._skeletonize_cy import _skeletonize_loop - except ImportError as e: - warnings.warn( - "Could not find required private skimage Cython function:\n" - "\tskimage.morphology._skeletonize_cy._skeletonize_loop\n" - ) - raise e + except ImportError: + try: + from skimage.morphology._skeletonize import _skeletonize_loop + except ImportError as e: + warnings.warn( + "Could not find required private skimage Cython function:\n" + "\tskimage.morphology._skeletonize_cy._skeletonize_loop\n" + ) + raise e if mask is None: # masked_image is modified in-place later so make a copy of the input