nibabel icon indicating copy to clipboard operation
nibabel copied to clipboard

Unable to save extra information to the 'extra' field of a nifti1 image

Open lxmedai opened this issue 8 months ago • 1 comments

I tried to put some extra information to the field 'extra' (which is just an empty dict by default) by using img_nii.extra = {'Test': 'See what happens'} # img_nii is my loaded nifti1 image.

This assignment worked perfectly fine. Then I tried to save it by calling: img_nii.to_filename('myTestFilename.nii.gz') , which also worked with no errors reported. But if I tried to load the nifti1 image again by calling img_nii_new = nib.load('myTestFilename.nii.gz'), what I got in the field 'extra' of img_nii_new was simply an empty dict. What should I do in order to save extra information there? I plan to save some numpy arrays to this 'extra' field. How can I solve this problem? Any suggestions?

lxmedai avatar Jun 07 '24 09:06 lxmedai