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

Bug in uncompress from scilpy/tractograms/uncompress.pyx #805

Open
AntoineTheb opened this issue Nov 9, 2023 · 0 comments
Open

Bug in uncompress from scilpy/tractograms/uncompress.pyx #805

AntoineTheb opened this issue Nov 9, 2023 · 0 comments
Assignees
Labels

Comments

@AntoineTheb
Copy link
Contributor

AntoineTheb commented Nov 9, 2023

There is a bug in the uncompress function where more points_to_idx may be returned than there are points in the streamline.

Here is an example script to test

import os

from scilpy.io.streamlines import load_tractogram
from scilpy.tractograms.uncompress import uncompress

# Tests should be run locally so that you have the testing data loaded in your home directory
home = os.path.expanduser('~')
sft = load_tractogram(f'{home}/.scilpy/filtering/bundle_all_1mm.trk', 'same')

sft.to_vox()
sft.to_corner()

indices, points_to_idx = uncompress(sft.streamlines, return_mapping=True)
streamline_lengths, mapping_lengths = [len(s) for s in sft.streamlines], [len(m) for m in points_to_idx]

for s,m in zip(streamline_lengths, mapping_lengths):
    assert s == m, (s,m)

Should give you an error.

AssertionError: (130, 131)

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

No branches or pull requests

2 participants