smooth images prior to analysis Inputs subjroot - root directory containing session directories sesses - cell array containing session subdirectories filt - shell exp filter for selecting files fwhm - FWHM in mm for smoothing $Id: er_smooth.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $
0001 function er_smooth(subjroot, sesses, filt, fwhm) 0002 % smooth images prior to analysis 0003 % 0004 % Inputs 0005 % subjroot - root directory containing session directories 0006 % sesses - cell array containing session subdirectories 0007 % filt - shell exp filter for selecting files 0008 % fwhm - FWHM in mm for smoothing 0009 % 0010 % $Id: er_smooth.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $ 0011 0012 nsesses = length(sesses); 0013 0014 imgs = ''; 0015 for s = 1:nsesses 0016 dirn = fullfile(subjroot,sesses{s}); 0017 % get files in this directory 0018 imgs = strvcat(imgs, spm_get('files', dirn, filt)); 0019 end 0020 0021 % and this is just spm_smooth_ui pasted/edited 0022 P = imgs; 0023 n = size(P,1); 0024 0025 % implement the convolution 0026 %--------------------------------------------------------------------------- 0027 for i = 1:n 0028 Q = deblank(P(i,:)); 0029 [pth,nm,xt] = fileparts(deblank(Q)); 0030 U = fullfile(pth,['s' nm xt]); 0031 spm_smooth(Q,U,fwhm); 0032 end 0033 0034 0035 0036