Hi Jérôme,
> I have a dataset of n *.hdr/*.img nifti images that I want to convert
> into one single 4D .nii file.
> Is there an utility doing this kind of conversion?
With SPM5, under the "TASKS" menu in the top-right of the graphics
window, you can find "Tools -> 3D to 4D", which might meet your needs.
If you need more flexibility (e.g. you don't want int16 output), you
could load the 3D volumes using spm_vol and spm_read_vols, and create
a new 4D nii with SPM5's nifti class. "help nifti" is unusually
unhelpful, but the secret here is to instead type
help nifti/Contents
With a 4-element dat.dim, you should be able to adapt the example to
do what you want.
Lastly, if you have access to the FSL toolbox
(http://www.fmrib.ox.ac.uk/fsl/) the following should do what you want:
# in (T)CSH:
setenv FSLOUTPUTTYPE NIFTI
# in (BA)SH:
export FSLOUTPUTTYPE=NIFTI
avwmerge -t n4d.nii a3d1.hdr a3d2.hdr ... a3dN.hdr
Best,
Ged.
|