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

Don't write into the location of the dummy pixel_indices coordinate #107

Merged
merged 1 commit into from
Mar 29, 2021

Conversation

GenevieveBuckley
Copy link
Collaborator

@jni and I talked about how pixel_indices in csr.py always contains a dummy "coordinate" [0, 0], regardless of whether that pixel coordinate is part of the skeleton or not.

@jni says it's supposed to be there in pixel_indices for padding, so you can directly index into it using the pixell id number. This doesn't hold if you use the default unique_junctions=True kwarg, but will be the case if unique_junctions=False.

Anyway, we shouldn't be using this dummy coordinate to write into arrays. Currently skan is overwriting a zero value with another zero, which doesn't matter much. It is confusing when you start to poke around into how we could make this work in a distributed context.

@GenevieveBuckley
Copy link
Collaborator Author

GenevieveBuckley commented Mar 29, 2021

Tiny demo of what you get out of pixel_indices for some basic examples

Coordinate [0,0] is True in skeleton array

skel = np.array([
    [1, 1, 0],
    [1, 0, 0],
    [0, 0, 0]])

>>> pixel_indices
array([[0., 0.],  # dummy coordinate, should not be used for anything
       [0., 0.],  # repeats!
       [0., 1.],
       [1., 0.]])

Coordinate [0,0] is False in skeleton array

skel = np.array([
    [0, 1, 1],
    [0, 0, 1],
    [0, 0, 0]])

>>> pixel_indices
array([[0., 0.],  # dummy coordinate, should not be used for anything
       [0., 1.],
       [0., 2.],
       [1., 2.]])

EDIT: this is before any unique_junctions computation on the indices

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.453% when pulling 2113671 on GenevieveBuckley:skip-padding-coord into dcf54da on jni:master.

@jni
Copy link
Owner

jni commented Mar 29, 2021

@GenevieveBuckley Will review later today, but see also #93 for more context.

@jni jni merged commit 9f34ae7 into jni:master Mar 29, 2021
@jni
Copy link
Owner

jni commented Mar 29, 2021

... where by "later" I meant "in exactly one minute" 😂

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

Successfully merging this pull request may close these issues.

3 participants