rpomponio / neuroHarmonize

Harmonization tools for multi-site neuroimaging analysis. Implemented as a python package. Harmonization of MRI, sMRI, dMRI, fMRI variables with support for NIFTI images. Complements the work in Neuroimage by Pomponio et al. (2019).
https://pypi.org/project/neuroHarmonize/
MIT License
82 stars 28 forks source link

Scaling issue #17

Closed yuhancui closed 2 years ago

yuhancui commented 2 years ago

When Nibabel reads in nifti data, it reads as float64 regardless of its actual type (but if you check the header, it’s the correct original type). When save output image, if directly use Nibabel data (float64) and header from input (int16), due to type conflict (float is larger), output will have scaling factor saved in header. To fix the issue, use: nifti_out = nib.Nifti1Image(np.round(nifti_out).astype(np.int16), affine, header)

rpomponio commented 2 years ago

@yuhancui Hi Yuhan, thanks for your contribution. Would you like me to merge this to the master branch?

yuhancui commented 2 years ago

Yes, please.

On 02/18/2022 16:58, Raymond Pomponio wrote:

@yuhancui Hi Yuhan, thanks for your contribution. Would you like me to merge this to the master branch?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>