Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connected_components fails on immutable arrays #128

Open
vovaf709 opened this issue Jul 30, 2024 · 2 comments
Open

connected_components fails on immutable arrays #128

vovaf709 opened this issue Jul 30, 2024 · 2 comments

Comments

@vovaf709
Copy link

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`
@vovaf709
Copy link
Author

vovaf709 commented Jul 30, 2024

I think fix is really easy, I'll try to fix it by myself

@william-silversmith
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants