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

Fixed bug that appeared when inputing uncompressed nifti file #2202

Merged
merged 1 commit into from
Mar 25, 2019

Conversation

charleygros
Copy link
Member

@charleygros charleygros commented Mar 25, 2019

This PR aims at fixing the bug reported here.

scipy.measurements.center_of_mass receives np.array as input.

The bug occurs when the input segmentation file is not compressed (ie .nii versus .nii.gz). In that case, the type of seg.data is <class 'numpy.core.memmap.memmap'>.

That's a known issue: #2148.

A solution is to cast np.array when calling seg.data.

To test:

cd example_data/t1
sct_label_vertebrae -i t1.nii.gz -s t1_seg.nii.gz -c t1

Fixes #2191.

@charleygros charleygros self-assigned this Mar 25, 2019
@charleygros charleygros added bug category: fixes an error in the code sct_label_vertebrae context: card:TO_REVIEW labels Mar 25, 2019
@jcohenadad jcohenadad changed the title Fixes bug with center_of_mass Fixed bug that appeared when inputing uncompressed nifti file Mar 25, 2019
@charleygros charleygros merged commit 0b3d3c5 into master Mar 25, 2019
@charleygros charleygros deleted the cg/2191-center-of-mass branch March 25, 2019 05:18
@jcohenadad jcohenadad added this to the v4.0.0 milestone Apr 5, 2019
jcohenadad pushed a commit that referenced this pull request Dec 18, 2019
Fixed bug that appeared when inputing uncompressed nifti file

Former-commit-id: 0b3d3c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug category: fixes an error in the code sct_label_vertebrae context:
Projects
None yet
Development

Successfully merging this pull request may close these issues.

set_label_vertebrae fails in version 4.0.0-beta.1
2 participants