Avoid nibabel crashes due to int64
arrays by explicitly passing dtype
/header
to Nifti1Image
#4433
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
nibabel will throw an error for instances of
Nifti1Image(data, affine)
when data is of typeint64 (and no header/dtype arguments are specified):
To avoid these errors, I did the following:
testing/
) for instances ofNifti1Image
(15 results)data
andaffine
were specified withoutheader
/dtype
(7 results)header
ordtype
, depending on context. (I usedheader
when simply convertingImage
objects toNifti1Image
objects, and useddtype
for a single dummy image usage.)Linked issues
Fixes #4420.
Fixes #4408. (The errors, at least!)
This PR doesn't do anything to heed nibabel's warning, though. (It is still possible to generate
int64
images using SCT.) However, I don't thinkint64
images are actually explicitly created anywhere by SCT? I think they only ever occur when a user passesint64
images as input. Given that, I think it's OK to close the underlying issue?