Problem with The matlabbatch SPM preprocessing

56 views (last 30 days)
Hey.
I am curently working on an FMRi project with SPM.
I have recived the following code for the preprosesing stage:
for sub=subjects
%sub = num2str(sub). The are olredy strings
if any(sub == "07")
DIR = End_dir_Normal;
dirT1= dir_sbj7_32COIL;
elseif any(sub == "48")
DIR = dir_sbj48;
dirT1= End_dir_Normal_32COIL;
elseif any(sub == "50")
DIR = dir_sbj50;
dirT1= End_dir_Normal_32COIL;
elseif any(sub == "52")
DIR = dir_sbj52;
dirT1= End_dir_Normal_32COIL;
else
DIR= End_dir_Normal;
dirT1= End_dir_Normal_32COIL;
matlabbatch{1}.spm.spatial.realign.estwrite.data = {
{
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00001-00001-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00002-00002-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00003-00003-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00004-00004-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00005-00005-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00006-00006-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00007-00007-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00008-00008-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00009-00009-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00010-00010-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00011-00011-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00012-00012-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00013-00013-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00014-00014-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00015-00015-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00016-00016-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00017-00017-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00018-00018-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00019-00019-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00020-00020-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00021-00021-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00022-00022-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00023-00023-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00024-00024-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00025-00025-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00026-00026-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00027-00027-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00028-00028-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00029-00029-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00030-00030-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00031-00031-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00032-00032-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00033-00033-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00034-00034-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00035-00035-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00036-00036-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00037-00037-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00038-00038-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00039-00039-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00040-00040-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00041-00041-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00042-00042-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00043-00043-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00044-00044-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00045-00045-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00046-00046-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00047-00047-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00048-00048-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00049-00049-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00050-00050-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00051-00051-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00052-00052-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00053-00053-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00054-00054-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00055-00055-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00056-00056-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00057-00057-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00058-00058-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00059-00059-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00060-00060-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00061-00061-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00062-00062-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00063-00063-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00064-00064-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00065-00065-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00066-00066-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00067-00067-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00068-00068-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00069-00069-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00070-00070-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00071-00071-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00072-00072-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00073-00073-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00074-00074-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00075-00075-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00076-00076-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00077-00077-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00078-00078-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00079-00079-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00080-00080-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00081-00081-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00082-00082-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00083-00083-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00084-00084-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00085-00085-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00086-00086-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00087-00087-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00088-00088-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00089-00089-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00090-00090-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00091-00091-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00092-00092-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00093-00093-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00094-00094-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00095-00095-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00096-00096-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00097-00097-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00098-00098-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00099-00099-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00100-00100-1.nii,1']
['E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' DIR '\00101-00101-1.nii,1']
}
}';
%%
matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.quality = 0.9;
matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.sep = 4;
matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.fwhm = 5;
matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.rtm = 1;
matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.interp = 2;
matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.wrap = [0 0 0];
matlabbatch{1}.spm.spatial.realign.estwrite.eoptions.weight = '';
matlabbatch{1}.spm.spatial.realign.estwrite.roptions.which = [2 1];
matlabbatch{1}.spm.spatial.realign.estwrite.roptions.interp = 4;
matlabbatch{1}.spm.spatial.realign.estwrite.roptions.wrap = [0 0 0];
matlabbatch{1}.spm.spatial.realign.estwrite.roptions.mask = 1;
matlabbatch{1}.spm.spatial.realign.estwrite.roptions.prefix = 'r';
matlabbatch{2}.spm.temporal.st.scans{1}(1) = cfg_dep('Realign: Estimate & Reslice: Resliced Images (Sess 1)', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','sess', '()',{1}, '.','rfiles'));
matlabbatch{2}.spm.temporal.st.nslices = 72;
matlabbatch{2}.spm.temporal.st.tr = 2000;
matlabbatch{2}.spm.temporal.st.ta = 1972.222222;
matlabbatch{2}.spm.temporal.st.so = [72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2 72 70 68 66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2];
matlabbatch{2}.spm.temporal.st.refslice = 72;
matlabbatch{2}.spm.temporal.st.prefix = 'a';
matlabbatch{3}.spm.spatial.coreg.estwrite.ref(1) = cfg_dep('Realign: Estimate & Reslice: Mean Image', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','rmean'));
matlabbatch{3}.spm.spatial.coreg.estwrite.source = {'E:\CNlabDrive\Shir Berebbi\Learning MRI\NILIALL\' sub '\' dirT1 '\00001-00160-1.nii'};
matlabbatch{3}.spm.spatial.coreg.estwrite.other = {''};
matlabbatch{3}.spm.spatial.coreg.estwrite.eoptions.cost_fun = 'nmi';
matlabbatch{3}.spm.spatial.coreg.estwrite.eoptions.sep = [4 2];
matlabbatch{3}.spm.spatial.coreg.estwrite.eoptions.tol = [0.02 0.02 0.02 0.001 0.001 0.001 0.01 0.01 0.01 0.001 0.001 0.001];
matlabbatch{3}.spm.spatial.coreg.estwrite.eoptions.fwhm = [7 7];
matlabbatch{3}.spm.spatial.coreg.estwrite.roptions.interp = 4;
matlabbatch{3}.spm.spatial.coreg.estwrite.roptions.wrap = [0 0 0];
matlabbatch{3}.spm.spatial.coreg.estwrite.roptions.mask = 0;
matlabbatch{3}.spm.spatial.coreg.estwrite.roptions.prefix = 'r';
matlabbatch{4}.spm.spatial.preproc.channel.vols(1) = cfg_dep('Coregister: Estimate & Reslice: Coregistered Images', substruct('.','val', '{}',{3}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','cfiles'));
matlabbatch{4}.spm.spatial.preproc.channel.biasreg = 0.001;
matlabbatch{4}.spm.spatial.preproc.channel.biasfwhm = 60;
matlabbatch{4}.spm.spatial.preproc.channel.write = [0 1];
matlabbatch{4}.spm.spatial.preproc.tissue(1).tpm = {'C:\Users\user\Downloads\spm12\spm12\tpm\TPM.nii,1'};
matlabbatch{4}.spm.spatial.preproc.tissue(1).ngaus = 1;
matlabbatch{4}.spm.spatial.preproc.tissue(1).native = [1 0];
matlabbatch{4}.spm.spatial.preproc.tissue(1).warped = [0 0];
matlabbatch{4}.spm.spatial.preproc.tissue(2).tpm = {'C:\Users\user\Downloads\spm12\spm12\tpm\TPM.nii,2'};
matlabbatch{4}.spm.spatial.preproc.tissue(2).ngaus = 1;
matlabbatch{4}.spm.spatial.preproc.tissue(2).native = [1 0];
matlabbatch{4}.spm.spatial.preproc.tissue(2).warped = [0 0];
matlabbatch{4}.spm.spatial.preproc.tissue(3).tpm = {'C:\Users\user\Downloads\spm12\spm12\tpm\TPM.nii,3'};
matlabbatch{4}.spm.spatial.preproc.tissue(3).ngaus = 2;
matlabbatch{4}.spm.spatial.preproc.tissue(3).native = [1 0];
matlabbatch{4}.spm.spatial.preproc.tissue(3).warped = [0 0];
matlabbatch{4}.spm.spatial.preproc.tissue(4).tpm = {'C:\Users\user\Downloads\spm12\spm12\tpm\TPM.nii,4'};
matlabbatch{4}.spm.spatial.preproc.tissue(4).ngaus = 3;
matlabbatch{4}.spm.spatial.preproc.tissue(4).native = [1 0];
matlabbatch{4}.spm.spatial.preproc.tissue(4).warped = [0 0];
matlabbatch{4}.spm.spatial.preproc.tissue(5).tpm = {'C:\Users\user\Downloads\spm12\spm12\tpm\TPM.nii,5'};
matlabbatch{4}.spm.spatial.preproc.tissue(5).ngaus = 4;
matlabbatch{4}.spm.spatial.preproc.tissue(5).native = [1 0];
matlabbatch{4}.spm.spatial.preproc.tissue(5).warped = [0 0];
matlabbatch{4}.spm.spatial.preproc.tissue(6).tpm = {'C:\Users\user\Downloads\spm12\spm12\tpm\TPM.nii,6'};
matlabbatch{4}.spm.spatial.preproc.tissue(6).ngaus = 2;
matlabbatch{4}.spm.spatial.preproc.tissue(6).native = [0 0];
matlabbatch{4}.spm.spatial.preproc.tissue(6).warped = [0 0];
matlabbatch{4}.spm.spatial.preproc.warp.mrf = 1;
matlabbatch{4}.spm.spatial.preproc.warp.cleanup = 1;
matlabbatch{4}.spm.spatial.preproc.warp.reg = [0 0.001 0.5 0.05 0.2];
matlabbatch{4}.spm.spatial.preproc.warp.affreg = 'mni';
matlabbatch{4}.spm.spatial.preproc.warp.fwhm = 0;
matlabbatch{4}.spm.spatial.preproc.warp.samp = 3;
matlabbatch{4}.spm.spatial.preproc.warp.write = [0 1];
matlabbatch{4}.spm.spatial.preproc.warp.vox = NaN;
matlabbatch{4}.spm.spatial.preproc.warp.bb = [NaN NaN NaN
NaN NaN NaN];
matlabbatch{5}.spm.spatial.normalise.write.subj.def(1) = cfg_dep('Segment: Forward Deformations', substruct('.','val', '{}',{4}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','fordef', '()',{':'}));
matlabbatch{5}.spm.spatial.normalise.write.subj.resample(1) = cfg_dep('Slice Timing: Slice Timing Corr. Images (Sess 1)', substruct('.','val', '{}',{2}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','files'));
matlabbatch{5}.spm.spatial.normalise.write.woptions.bb = [-78 -112 -70
78 76 85];
matlabbatch{5}.spm.spatial.normalise.write.woptions.vox = [2 2 2];
matlabbatch{5}.spm.spatial.normalise.write.woptions.interp = 4;
matlabbatch{5}.spm.spatial.normalise.write.woptions.prefix = 'w';
matlabbatch{6}.spm.spatial.smooth.data(1) = cfg_dep('Normalise: Write: Normalised Images (Subj 1)', substruct('.','val', '{}',{5}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','files'));
matlabbatch{6}.spm.spatial.smooth.fwhm = [6 6 6];
matlabbatch{6}.spm.spatial.smooth.dtype = 0;
matlabbatch{6}.spm.spatial.smooth.im = 0;
matlabbatch{6}.spm.spatial.smooth.prefix = 's';
spm_jobman('run', matlabbatch);
end
end
However, when I run this I get an error mesage: Item 'Session', field 'val': Value must be either empty, a cellstr or a cfg_dep object.
Item 'Source Image', field 'val': Value must be either empty, a cellstr or a cfg_dep object.
Error using spm_jobman>fill_run_job
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});
I dont really understend what is the problem or how to fix it.
if you have encountered this problem before i'll to glad to have your input on the topic. Any help will be appreciated.

Answers (1)

Varun
Varun on 27 Dec 2023
Hi Shulamit,
It looks like there is an issue with the specification of inputs in your SPM batch script. The error message indicates that there is a problem with the 'Session' and 'Source Image' fields.
The error message indicates that the 'Session' field should be either empty, a cellstr, or a cfg_dep object. In your script, it seems like you are using an incorrect reference to the 'Realign: Estimate & Reslice: Resliced Images (Sess 1)' output.
Check if the output from the realignment step is correctly specified. The reference should be in the format:
substruct('.','val', '{}',{RunIndex}, '.','val', '{}',{SessionIndex}, '.','val', '{}',{BatchIndex})
For example:
matlabbatch{2}.spm.temporal.st.scans{1}(1) = cfg_dep('Realign: Estimate & Reslice: Resliced Images (Sess 1)', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','rfiles'));
Make sure the reference to the realigned images is correct.
Similar to the 'Session' field, the 'Source Image' field might be causing an issue. Check if the reference to the mean image is correct. It should be in a similar format.
For example:
matlabbatch{3}.spm.spatial.coreg.estwrite.ref(1) = cfg_dep('Realign: Estimate & Reslice: Mean Image', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','rmean'));
Verify that the reference to the mean image is accurate.
Make sure that the dependencies are correctly specified, and there are no typos or errors in referencing the outputs of the previous steps.
Please look at the following previous MATLAB Answers posts to learn more:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!