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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions skan/csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class Skeleton:
`keep_images` is True. This is useful for visualization.
"""
def __init__(self, skeleton_image, *, spacing=1, source_image=None,
_buffer_size_offset=None, keep_images=True,
_buffer_size_offset=None, keep_images=True,
unique_junctions=True):
graph, coords, degrees = skeleton_to_csgraph(skeleton_image,
spacing=spacing,
Expand Down Expand Up @@ -608,8 +608,8 @@ def skeleton_to_csgraph(skel, *, spacing=1, value_is_height=False,
pixel_indices = np.concatenate(([[0.] * ndim],
np.transpose(np.nonzero(skel))), axis=0)
skelint = np.zeros(skel.shape, dtype=int)
skelint[tuple(pixel_indices.T.astype(int))] = \
np.arange(pixel_indices.shape[0])
skelint[tuple(pixel_indices[1:].T.astype(int))] = \
np.arange(pixel_indices.shape[0])[1:]

degree_kernel = np.ones((3,) * ndim)
degree_kernel[(1,) * ndim] = 0 # remove centre pixel
Expand Down