-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Hi Ultrack team,
first I want to say my thanks for the awesome software.
On Ultrack version 0.6.3, calling ultrack.utils.edge.labels_to_contours(...) with NumPy label stacks on a machine/ JupyterHub cluter where CuPy is available (or when inputs originate from Dask with GPU meta data) causes Ultrack to choose the CuPy array backend internally. The function subsequently calls scikit-image/SciPy CPU-only morphology routines, which attempt to coerce a cupy.ndarray to NumPy and fail with:
TypeError: Implicit conversion to a NumPy array is not allowed. Please use .get() to construct a NumPy array explicitly.
It occurs despite calling compute() on a dask.array or creating a fresh sample Numpy.ndarray. This error is quite persistent and the only round away solution I found is to put the following before labels_to_contours:
import ultrack.utils.edge as edge
edge.xp = np
I wanted to bring this bug to your attention to know if there is a better way to circumvent this problem and understand what is the cause behind it.