Hi, I noticed that the NIfTI file generated by Export to SPM8 it is a 4 dimensions Matrix even if I averaged the time window. So for this reason the matlab function niftiread cannot read it.
I don’t know why but in a previously exported file this does not happen.
Comparing these files I realized that one has 3 dimensions [145 182 136] with the fields Description, TimeUnits, and SpatialDimension empty, ‘none’, and 0 respectively, the other one has 4 dimensions [145 182 136 1] with the fields Description, TimeUnits, and SpatialDimension equal to ‘Written with Brainstorm’, ‘Millisecond’, and 2.
May I ask why did it change?
I don’t see when this could have changed recently, see the updates of the past 2 years:
https://github.com/brainstorm-tools/brainstorm3/commits/master/toolbox/io/out_mri_nii.m
A while ago, this function was updated to support multiple time frames in the .nii files (this is still a file with a form of temporal dimension you export here, even if it is averaged in time). This is supported in the NIfTI-1 specification (2005):
https://nifti.nimh.nih.gov/nifti-1/
If Matlab function niftiread cannot read these volumes, I encourage you to:
- Report this bug to the Mathworks so they can fix it in a future release
- Use the reading function from any other free Matlab toolbox instead (Brainstorm, SPM, FieldTrip…). Example : https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/io/in_mri_nii.m
I will follow your advice, thanks!