connected-components-3d
connected-components-3d copied to clipboard
`connected_components` fails on immutable arrays
import numpy as np
from cc3d import connected_components
x = np.ones(3)
x.flags.writeable = False
connected_components(x) # Fails with `ValueError: buffer source array is read-only`
I think fix is really easy, I'll try to fix it by myself
I figured it out, but the fix is not super easy. The problem is that adding trivial dimensions up to 3 creates a view and owndata is False. You can avoid this problem with using a 3D image e.g. np.ones([3,1,1]). I'll have to spend some time figuring out the right way to solve this.