dMRI files in MATLAB

Hi all,

I have worked on diffusion .nii file using DIPY library for the past few months. Is there any way I could access the each 3D image in the .nii file using MATLAB?

Thanking you,

Ashwin

With spm12 (use the ‘,n’ where n is the 1-indexed volume to load)

fnm = ‘img.nii,1’
hdr = spm_vol(fnm);
img = spm_read_vols(hdr);

With nii_tool from dicm2nii

fnm = ‘img.nii’
nii = nii_tool(‘load’, fnm);

You could also try Jimmy Shen’s NIfTI tools or variants available on Github.