Dear SPM experts,
I have some problem selecting multiple sessions of functional images for slice timing when I try to run my preprocessing batch scripts.
The main analysis script is as follows:
if preprocess == 1
disp('------Preprocessing started------');
for subj = subjList
disp(strcat('Subject: ',subj));
clear matlabbatch;
cd(dataDir);
cd(char(strcat(dataDir,subj)));
funFiles = {};
for i = 1: length(runList)
funFiles{i} = spm_select('ExtFPList',fullfile(dataDir,subj,runList{i}),'^.*\.nii$', Inf);
end;
funFiles = funFiles';
preprocessing_aug_job(subj,mainDir,funFiles);
end;
disp('------Preprocessing ended------');
end;
While the preprocessing_aug_job script is as follows:
function [matlabbatch] = preprocessing_aug_job(subj,mainDir,funFiles)
spm('defaults','fmri');
spm_jobman('initcfg');
clear matlabbatch
matlabbatch{1}.spm.temporal.st.scans = {cellstr(funFiles)};
matlabbatch{1}.spm.temporal.st.nslices = 36;
matlabbatch{1}.spm.temporal.st.tr = 2;
matlabbatch{1}.spm.temporal.st.ta = 1.94444444444444;
matlabbatch{1}.spm.temporal.st.so = [2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35];
matlabbatch{1}.spm.temporal.st.refslice = 36;
matlabbatch{1}.spm.temporal.st.prefix = 'a';
matlabbatch{2}.spm.spatial.realign.estwrite.data{1}(1) = cfg_dep('Slice Timing: Slice Timing Corr. Images (Sess 1)', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','files'));
matlabbatch{2}.spm.spatial.realign.estwrite.data{2}(1) = cfg_dep('Slice Timing: Slice Timing Corr. Images (Sess 2)', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{2}, '.','files'));
matlabbatch{2}.spm.spatial.realign.estwrite.data{3}(1) = cfg_dep('Slice Timing: Slice Timing Corr. Images (Sess 3)', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{3}, '.','files'));
matlabbatch{2}.spm.spatial.realign.estwrite.data{4}(1) = cfg_dep('Slice Timing: Slice Timing Corr. Images (Sess 4)', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{4}, '.','files'));
... (omit realignment, coregister, segment, normalization and smooth here)
spm_jobman('run',matlabbatch);
end
When I try to run the first part of code, and call the function 'preprocessing_aug_job' there, the following errors come out:
Item 'Session', field 'val': Number of matching files (0) less than required (1).
Error using spm_jobman>fill_run_job (line 472)
No executable modules, but still unresolved dependencies or incomplete module inputs.
Error in spm_jobman (line 247)
sts = fill_run_job('run', cjob, varargin{3:end});
Error in preprocessing_aug_job (line 116)
spm_jobman('run',matlabbatch);
Error in main_analysis_script (line 54)
preprocessing_aug_job(subj,mainDir,funFiles);
I think it could be some problem when selecting the multiple sessions of functional images (4 sessions here), but after debugging and reading related scripts all these days, I still feel I need help from you.
Thanks in advance!
Kind regards,
Feng
|