forked from kristinasabaroedin/fmripreprocessing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smooth_epi.m
45 lines (37 loc) · 1.33 KB
/
smooth_epi.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function [] = smooth_epi(epifile,kernel,N)
% smooth_epi(epifile,kernel,N)
%
% This function will perform spatial smoothing of an input fMRI timeseries.
%
% -------
% INPUTS:
% -------
%
% epifile - a string containing the full path and filename of a 4D input
% EPI file. The images should have been co-registered to the T1.
% That is, they should be in T1 space; e.g.,
% '/path/to/epi/4d.nii'
%
% kernel - scalar value defining the size of the smoothing kernel in mm.
%
% N - Lenth of time series (no of volumes in EPI 4D file).
%
% -------
% OUTPUTS:
% -------
%
% smoothed files will be output with the prefix 's'.
%
% =========================================================================
%-----------------------------------------------------------------------
% Job configuration created by cfg_util (rev $Rev: 3944 $)
%-----------------------------------------------------------------------
spm_jobman('initcfg')
for i = 1:N
matlabbatch{1}.spm.spatial.smooth.data{i,1} = [epifile,',',num2str(i)];
end
matlabbatch{1}.spm.spatial.smooth.fwhm = repmat(kernel,1,3); % define smoothing kernel based on input kernel value
matlabbatch{1}.spm.spatial.smooth.dtype = 0;
matlabbatch{1}.spm.spatial.smooth.im = 0;
matlabbatch{1}.spm.spatial.smooth.prefix = 's';
spm_jobman('run',matlabbatch);