Hi Claire,

The MATLAB code below should work. It makes use of SPM's NIFTI reading and writing functions. You just need to change the "my_file" variable to provide the file name of your 4D NIFTI image.



my_file = '/path/to/example.nii';

[path base ext] = fileparts(my_file);

V = spm_vol(my_file);

Vout = V(1);

for x=1:numel(V)                                       
    Vout.fname = [path filesep base sprintf('%.5d',x) ext];
    spm_write_vol(Vout, spm_read_vols(V(x)));              
end                  





I hope this helps,

Rich.

On 23 July 2012 10:02, Kiyotaka Nemoto <[log in to unmask]> wrote:
Hi Claire,

If you use FSL, fslsplit is the tool to convert from 4D analyze files to 3D.
Other way is to use mricro. Under "File --> Save as ..." you see 4D -> 3D.

Hope this helps,

Kiyotaka

2012/7/23 Claire (Jung Eun) Han <[log in to unmask]>:
> Dear experts,
>
> How could I convert 4D analyze files to 3D? If you have matlab commands to
> do it, I would really appreciate if you could send me the script.
>
> Thanks,
> Claire



--
Kiyotaka Nemoto, M.D., Ph.D.
Assistant Professor
Department of Psychiatry
Division of Clinical Medicine, Faculty of Medicine
University of Tsukuba
1-1-1Tennodai Tsukuba, Ibaraki 305-8575, Japan
E-mail: [log in to unmask]



--
Richard Masterton, PhD
Brain Research Institute,
Florey Neuroscience Institutes (Austin campus)
Melbourne Brain Centre
245 Burgundy Street
Heidelberg, Victoria, 3084, Australia.
Telephone:  (+61 3) 9035-7126