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 · 1 comment · May be fixed by #1098
Open

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

AntoineTheb opened this issue Nov 9, 2023 · 1 comment · May be fixed by #1098

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)

@EmmaRenauld
Copy link
Contributor

Self-reminder...
Pour hackaton: voir avec moi les tests que j'avais commencé à faire dans ma branche ici. Pourrait peut-être aider à tester des choses.
https://github.com/EmmaRenauld/scilpy/tree/streamline_and_mask_tests

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

Successfully merging a pull request may close this issue.

4 participants