代码拉取完成,页面将自动刷新
%-----------------------------------------------------------------------
% Job saved on 12-Apr-2024 20:58:03 by cfg_util (rev $Rev: 6942 $)
% spm SPM - SPM12 (7219)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
%% init spm
spm('defaults', 'fmri')
spm_jobman('initcfg')
data_rootdir = '/Data/'
subjlist = dir(data_rootdir)
for subjidx = 3:length(subjlist)
subj = subjlist(subjidx).name
matlabbatch = PreprocAndFirstlevel(subj, data_rootdir);
spm_jobman('run', matlabbatch)
end
% 1st level analysis
function matlabbatch = PreprocAndFirstlevel(subj, data_rootdir)
matlabbatch{1}.cfg_basicio.file_dir.file_ops.cfg_named_file.name = 'first_level';
matlabbatch{1}.cfg_basicio.file_dir.file_ops.cfg_named_file.files = {
{[data_rootdir subj '/task.nii']}
{[data_rootdir subj '/t1.nii']}
}';
matlabbatch{2}.cfg_basicio.file_dir.dir_ops.cfg_named_dir.name = 'first_level';
matlabbatch{2}.cfg_basicio.file_dir.dir_ops.cfg_named_dir.dirs = {{[data_rootdir subj '/first_level']}};
matlabbatch{3}.spm.temporal.st.scans{1}(1) = cfg_dep('Named File Selector: first_level(1) - Files', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','files', '{}',{1}));
matlabbatch{3}.spm.temporal.st.nslices = 33;
matlabbatch{3}.spm.temporal.st.tr = 2;
matlabbatch{3}.spm.temporal.st.ta = 0;
matlabbatch{3}.spm.temporal.st.so = [0 1.03125 0.0625 1.09375 0.125 1.14844 0.1875 1.21094 0.24219 1.27344 0.30469 1.33594 0.36719 1.39062 0.42969 1.45312 0.48438 1.51562 0.54688 1.57812 0.60938 1.63281 0.67188 1.69531 0.72656 1.75781 0.78906 1.82031 0.85156 1.875 0.90625 1.9375 0.96875];
matlabbatch{3}.spm.temporal.st.refslice = 33;
matlabbatch{3}.spm.temporal.st.prefix = 'a';
matlabbatch{4}.spm.spatial.realign.estwrite.data{1}(1) = cfg_dep('Slice Timing: Slice Timing Corr. Images (Sess 1)', substruct('.','val', '{}',{3}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','files'));
matlabbatch{4}.spm.spatial.realign.estwrite.eoptions.quality = 0.9;
matlabbatch{4}.spm.spatial.realign.estwrite.eoptions.sep = 4;
matlabbatch{4}.spm.spatial.realign.estwrite.eoptions.fwhm = 5;
matlabbatch{4}.spm.spatial.realign.estwrite.eoptions.rtm = 0;
matlabbatch{4}.spm.spatial.realign.estwrite.eoptions.interp = 2;
matlabbatch{4}.spm.spatial.realign.estwrite.eoptions.wrap = [0 0 0];
matlabbatch{4}.spm.spatial.realign.estwrite.eoptions.weight = '';
matlabbatch{4}.spm.spatial.realign.estwrite.roptions.which = [2 1];
matlabbatch{4}.spm.spatial.realign.estwrite.roptions.interp = 4;
matlabbatch{4}.spm.spatial.realign.estwrite.roptions.wrap = [0 0 0];
matlabbatch{4}.spm.spatial.realign.estwrite.roptions.mask = 1;
matlabbatch{4}.spm.spatial.realign.estwrite.roptions.prefix = 'r';
matlabbatch{5}.spm.spatial.coreg.estimate.ref(1) = cfg_dep('Named File Selector: first_level(2) - Files', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','files', '{}',{2}));
matlabbatch{5}.spm.spatial.coreg.estimate.source(1) = cfg_dep('Realign: Estimate & Reslice: Mean Image', substruct('.','val', '{}',{4}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','rmean'));
matlabbatch{5}.spm.spatial.coreg.estimate.other = {''};
matlabbatch{5}.spm.spatial.coreg.estimate.eoptions.cost_fun = 'nmi';
matlabbatch{5}.spm.spatial.coreg.estimate.eoptions.sep = [4 2];
matlabbatch{5}.spm.spatial.coreg.estimate.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{5}.spm.spatial.coreg.estimate.eoptions.fwhm = [7 7];
matlabbatch{6}.spm.spatial.normalise.estwrite.subj.vol(1) = cfg_dep('Named File Selector: first_level(2) - Files', substruct('.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','files', '{}',{2}));
matlabbatch{6}.spm.spatial.normalise.estwrite.subj.resample(1) = cfg_dep('Realign: Estimate & Reslice: Resliced Images (Sess 1)', substruct('.','val', '{}',{4}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','sess', '()',{1}, '.','rfiles'));
matlabbatch{6}.spm.spatial.normalise.estwrite.eoptions.biasreg = 0.0001;
matlabbatch{6}.spm.spatial.normalise.estwrite.eoptions.biasfwhm = 60;
matlabbatch{6}.spm.spatial.normalise.estwrite.eoptions.tpm = {'/home/matlab/spm12/tpm/TPM.nii'};
matlabbatch{6}.spm.spatial.normalise.estwrite.eoptions.affreg = 'mni';
matlabbatch{6}.spm.spatial.normalise.estwrite.eoptions.reg = [0 0.001 0.5 0.05 0.2];
matlabbatch{6}.spm.spatial.normalise.estwrite.eoptions.fwhm = 0;
matlabbatch{6}.spm.spatial.normalise.estwrite.eoptions.samp = 3;
matlabbatch{6}.spm.spatial.normalise.estwrite.woptions.bb = [-78 -112 -70
78 76 85];
matlabbatch{6}.spm.spatial.normalise.estwrite.woptions.vox = [2 2 2];
matlabbatch{6}.spm.spatial.normalise.estwrite.woptions.interp = 4;
matlabbatch{6}.spm.spatial.normalise.estwrite.woptions.prefix = 'w';
matlabbatch{7}.spm.spatial.smooth.data(1) = cfg_dep('Normalise: Estimate & Write: Normalised Images (Subj 1)', substruct('.','val', '{}',{6}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('()',{1}, '.','files'));
matlabbatch{7}.spm.spatial.smooth.fwhm = [4 4 4];
matlabbatch{7}.spm.spatial.smooth.dtype = 0;
matlabbatch{7}.spm.spatial.smooth.im = 0;
matlabbatch{7}.spm.spatial.smooth.prefix = 's';
matlabbatch{8}.spm.stats.fmri_spec.dir(1) = cfg_dep('Named Directory Selector: first_level(1)', substruct('.','val', '{}',{2}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','dirs', '{}',{1}));
matlabbatch{8}.spm.stats.fmri_spec.timing.units = 'secs';
matlabbatch{8}.spm.stats.fmri_spec.timing.RT = 2;
matlabbatch{8}.spm.stats.fmri_spec.timing.fmri_t = 16;
matlabbatch{8}.spm.stats.fmri_spec.timing.fmri_t0 = 8;
matlabbatch{8}.spm.stats.fmri_spec.sess.scans(1) = cfg_dep('Smooth: Smoothed Images', substruct('.','val', '{}',{7}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','files'));
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(1).name = 'dynamic';
%%
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(1).onset = [28
50
94
116
182
226
270
314
358
402
446
512
534
600
644
666];
%%
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(1).duration = 6;
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(1).tmod = 0;
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(1).pmod = struct('name', {}, 'param', {}, 'poly', {});
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(1).orth = 1;
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(2).name = 'static';
%%
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(2).onset = [4
70
136
158
202
246
290
334
378
422
466
488
554
576
620
686];
%%
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(2).duration = 6;
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(2).tmod = 0;
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(2).pmod = struct('name', {}, 'param', {}, 'poly', {});
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(2).orth = 1;
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(3).name = 'rest';
%%
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(3).onset = [16
38
60
82
104
126
148
170
192
214
236
258
280
302
324
346
368
390
412
434
456
478
500
522
544
566
588
610
632
654
676
698];
%%
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(3).duration = 8;
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(3).tmod = 0;
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(3).pmod = struct('name', {}, 'param', {}, 'poly', {});
matlabbatch{8}.spm.stats.fmri_spec.sess.cond(3).orth = 1;
matlabbatch{8}.spm.stats.fmri_spec.sess.multi = {''};
matlabbatch{8}.spm.stats.fmri_spec.sess.regress = struct('name', {}, 'val', {});
matlabbatch{8}.spm.stats.fmri_spec.sess.multi_reg(1) = cfg_dep('Realign: Estimate & Reslice: Realignment Param File (Sess 1)', substruct('.','val', '{}',{4}, '.','val', '{}',{1}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','sess', '()',{1}, '.','rpfile'));
matlabbatch{8}.spm.stats.fmri_spec.sess.hpf = 128;
matlabbatch{8}.spm.stats.fmri_spec.fact = struct('name', {}, 'levels', {});
matlabbatch{8}.spm.stats.fmri_spec.bases.hrf.derivs = [0 0];
matlabbatch{8}.spm.stats.fmri_spec.volt = 1;
matlabbatch{8}.spm.stats.fmri_spec.global = 'None';
matlabbatch{8}.spm.stats.fmri_spec.mthresh = 0.8;
matlabbatch{8}.spm.stats.fmri_spec.mask = {''};
matlabbatch{8}.spm.stats.fmri_spec.cvi = 'AR(1)';
matlabbatch{9}.spm.stats.fmri_est.spmmat(1) = cfg_dep('fMRI model specification: SPM.mat File', substruct('.','val', '{}',{8}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','spmmat'));
matlabbatch{9}.spm.stats.fmri_est.write_residuals = 0;
matlabbatch{9}.spm.stats.fmri_est.method.Classical = 1;
matlabbatch{10}.spm.stats.con.spmmat(1) = cfg_dep('Model estimation: SPM.mat File', substruct('.','val', '{}',{9}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','spmmat'));
matlabbatch{10}.spm.stats.con.consess{1}.tcon.name = 'dynamic_gt_static';
matlabbatch{10}.spm.stats.con.consess{1}.tcon.weights = [1 -1 0 0 0 0 0 0 0];
matlabbatch{10}.spm.stats.con.consess{1}.tcon.sessrep = 'none';
matlabbatch{10}.spm.stats.con.consess{2}.tcon.name = 'dynamic_lt_static';
matlabbatch{10}.spm.stats.con.consess{2}.tcon.weights = [-1 1 0 0 0 0 0 0 0];
matlabbatch{10}.spm.stats.con.consess{2}.tcon.sessrep = 'none';
matlabbatch{10}.spm.stats.con.consess{3}.tcon.name = 'dynamic_gt_rest';
matlabbatch{10}.spm.stats.con.consess{3}.tcon.weights = [1 0 -1 0 0 0 0 0 0];
matlabbatch{10}.spm.stats.con.consess{3}.tcon.sessrep = 'none';
matlabbatch{10}.spm.stats.con.consess{4}.tcon.name = 'static_gt_rest';
matlabbatch{10}.spm.stats.con.consess{4}.tcon.weights = [0 1 -1 0 0 0 0 0 0];
matlabbatch{10}.spm.stats.con.consess{4}.tcon.sessrep = 'none';
matlabbatch{10}.spm.stats.con.consess{5}.tcon.name = 'Comprehensive_gt_rest';
matlabbatch{10}.spm.stats.con.consess{5}.tcon.weights = [1/2 1/2 -1 0 0 0 0 0 0];
matlabbatch{10}.spm.stats.con.consess{5}.tcon.sessrep = 'none';
matlabbatch{10}.spm.stats.con.delete = 0;
matlabbatch{11}.spm.stats.results.spmmat(1) = cfg_dep('Contrast Manager: SPM.mat File', substruct('.','val', '{}',{10}, '.','val', '{}',{1}, '.','val', '{}',{1}), substruct('.','spmmat'));
matlabbatch{11}.spm.stats.results.conspec.titlestr = '';
matlabbatch{11}.spm.stats.results.conspec.contrasts = Inf;
matlabbatch{11}.spm.stats.results.conspec.threshdesc = 'FDR';
matlabbatch{11}.spm.stats.results.conspec.thresh = 0.05;
matlabbatch{11}.spm.stats.results.conspec.extent = 0;
matlabbatch{11}.spm.stats.results.conspec.conjunction = 1;
matlabbatch{11}.spm.stats.results.conspec.mask.none = 1;
matlabbatch{11}.spm.stats.results.units = 1;
matlabbatch{11}.spm.stats.results.export{1}.ps = true;
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。