help - Error in 3dAFNItoNIFT conversion

I converted a BRIK and HEAD file to nifti using 3dAFNItoNIFTI. The resulting .nii file is more than 4 dimensions and can’t be read by some standard softwares, resulting in errors such as “Input data has incompatible dimensionality: Expected dimension is 4D and you provided a 5D image”. Is there a way to restrict the dimensions in the conversion or modify the header so it is 4D (x, y, z and time), perhaps with nifti_tool?
I tried “nifti_tool -mod_hdr -overwrite -infile 025_prob_trial_reg.nii -mod_field dim ‘4 64 64 1’” to overwrite the file with 4 dimensions, but that resulted in “** found 4 of 8 modify values”

With nifti_tool -disp_hdr -infiles 025_prob_trial_reg.niii I can see there are 8 dimensions.

If it is helpful, nifti_tool -check_hdr -infiles 025_prob_trial_reg.nii results in
'header IS GOOD for file 025_prob_trial_reg.nii"
and nifti_tool -check_nim -infiles 002_prob_trial_reg.nii results in
“nifti_image IS GOOD for file 025_prob_trial_reg.nii”

See this previous thread for suggestions.,89081,89081#msg-89081

Hi Daisy,

Adding extra details to Daniel’s thread…

Just to be clear, the NIFTI standard reserves the 4th
dimension for time. So a dataset of beta weights or
t-stats should be stored in 5 dimensions.

If this is not a time series dataset, then the problem
is with the reading software, and it might be good to
make them aware of it.

Regarding nifti_tool, your command has only specified
3 of the 4 dimension values, and a full 8 are required
(the first number should be the number of dimensions,
then actual dimension values, and anything beyond the
number of dimensions can be 0 or 1). For example,
if there were 20 volumes (these are just slices?), then
the command might be:

nifti_tool -mod_hdr -overwrite -infile 025_prob_trial_reg.nii -mod_field dim ‘4 64 64 1 20 1 1 1’

But 3dTcat is a more simple way to turn it into a
proper 3D+time dataset.

  • rick

Thank you for all your responses and clarifications!

3dTcat solution worked well.