4D to 3D image conversion

 Dear Experts,

Im trying to convert 4D fmri images to 3D images using REST->Utilities->NIfTI .nii to NIfTI pairs, however, i face the following error:

Error using rest_spm_slice_vol
File too small.

Error in rest_spm_read_vols (line 34)
Y(:,:,p,i) = rest_spm_slice_vol(V(i),rest_spm_matrix([0 0 p]),V(i).dim(1:2),0);

Error in rest_ReadNiftiImage (line 110)
        Data = rest_spm_read_vols(V);
Error in rest_Nii2NiftiPairs (line 21)
[Data, Head] = rest_ReadNiftiImage(PI,'all');

Error in rest_Nii2NiftiPairs_gui>btnRun_Callback (line 199)

Error in gui_mainfcn (line 95)

Error in rest_Nii2NiftiPairs_gui (line 26)
    gui_mainfcn(gui_State, varargin{:});
Error while evaluating uicontrol Callback
I  really appreciate your help.

many thanks,


 There's a small bug in "rest_Nii2NiftiPairs.m", but you can fix it yourself. Open this function by MATLAB, then change line 23 to " i=1:size(Data,4)"