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

Degrees array size not matching Coordinates #174

Open
dzeego opened this issue May 19, 2022 · 1 comment
Open

Degrees array size not matching Coordinates #174

dzeego opened this issue May 19, 2022 · 1 comment

Comments

@dzeego
Copy link

dzeego commented May 19, 2022

Hi @jni !

Thanks a lot for such a great and versatile library!

I am having some trouble understanding the fact that skan is returning an array size for skan_obj.degrees < skan_obj.coordinates
Having inspected the images, everything appears to be correct except that!

Here is the error I am getting after launching this code line:
for xyz in skan_skeleton.coordinates[skan_skeleton.degrees == 1]: skeleton_bis[int(xyz[0])-2:int(xyz[0])+2, int(xyz[1])-2:int(xyz[1])+2, int(xyz[2])-2:int(xyz[2])+2] = 2

IndexError: boolean index did not match indexed array along dimension 0; dimension is 1986 but corresponding boolean dimension is 1985

Is there an explanation for this?
Many thanks again!

@jni
Copy link
Owner

jni commented May 26, 2022

Thanks for the report @dzeego!

You're running into an issue that I am trying hard to fix in the next version: the coordinates contain a "dummy" value of 0, 0, 0 at the first (0th) position in the array. This is so that each skeleton pixel can directly index its corresponding coordinate (since background is 0, pixels start at 1).

To work around the issue, for now, do skan_skeleton.coordinates[1:][skan_skeleton.degrees == 1].

Does that help?

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