Dear SPMlist
We 've got stuck with 2nd level analysis. We batched our SPM 1st- and 2nd
level procedures in one script and as far as I can see at least the 1st
level analysis brings out reasonable results.
But something with our second level batch parts seems to be quite wrong.
From the manual I personally can't read out any further information (and
transfer this to our batch) about how to deal with t and f contrasts on
second level in case of choosing hrf + time and dispersion derivatives on
first level or even if I handled them right on first level.
I would appreciate any advice you could give and would be very grateful for
your comments.
Below you can see the parts of the batch script defining and handling the
contrasts.
Thanks,
Friederike.
% contrasts first level: hrf + time/dispersion derivatives
% 2 factors, each 2 levels: cue (rem or for) and valence (neg or ntr)
jobs{1}.stats{1}.con.consess{1}.tcon.name = char('rem_g_for');
jobs{1}.stats{1}.con.consess{1}.tcon.convec = [-1 0 0 -1 0 0 1 0 0 1 0 0];
jobs{1}.stats{1}.con.consess{2}.tcon.name = char('for_g_rem');
jobs{1}.stats{1}.con.consess{2}.tcon.convec = [1 0 0 1 0 0 -1 0 0 -1 0 0];
jobs{1}.stats{1}.con.consess{3}.tcon.name = char('neg_g_ntr');
jobs{1}.stats{1}.con.consess{3}.tcon.convec = [-1 0 0 1 0 0 -1 0 0 1 0 0];
jobs{1}.stats{1}.con.consess{4}.tcon.name = char('ntr_g_neg');
jobs{1}.stats{1}.con.consess{4}.tcon.convec = [1 0 0 -1 0 0 1 0 0 -1 0 0];
jobs{1}.stats{1}.con.consess{5}.tcon.name = char('neg_for_g_ntr_for');
jobs{1}.stats{1}.con.consess{5}.tcon.convec = [-1 0 0 1 0 0 0 0 0 0 0 0];
jobs{1}.stats{1}.con.consess{6}.tcon.name = char('ntr_for_g_neg_for');
jobs{1}.stats{1}.con.consess{6}.tcon.convec = [1 0 0 -1 0 0 0 0 0 0 0 0];
jobs{1}.stats{1}.con.consess{7}.tcon.name = char('neg_rem_g_ntr_rem');
jobs{1}.stats{1}.con.consess{7}.tcon.convec = [0 0 0 0 0 0 -1 0 0 1 0 0];
jobs{1}.stats{1}.con.consess{8}.tcon.name = char('ntr_rem_g_neg_rem');
jobs{1}.stats{1}.con.consess{8}.tcon.convec = [0 0 0 0 0 0 1 0 0 -1 0 0];
jobs{1}.stats{1}.con.consess{9}.tcon.name = char('ntr_for_g_ntr_rem');
jobs{1}.stats{1}.con.consess{9}.tcon.convec = [1 0 0 0 0 0 -1 0 0 0 0 0];
jobs{1}.stats{1}.con.consess{10}.tcon.name = char('ntr_rem_g_ntr_for');
jobs{1}.stats{1}.con.consess{10}.tcon.convec = [-1 0 0 0 0 0 1 0 0 0 0 0];
jobs{1}.stats{1}.con.consess{11}.tcon.name = char('neg_for_g_neg_rem');
jobs{1}.stats{1}.con.consess{11}.tcon.convec = [0 0 0 1 0 0 0 0 0 -1 0 0];
jobs{1}.stats{1}.con.consess{12}.tcon.name = char('neg_rem_g_neg_for');
jobs{1}.stats{1}.con.consess{12}.tcon.convec = [0 0 0 -1 0 0 0 0 0 1 0 0];
% how to include correct/readable fcon? single lines for basis (1 0 0),
% temporal derivative (0 1 0) und dispersion derivative (0 0 1), like
% in spm face group batch?
%================================%
% 2nd level batch % sascha 20.06.08
%================================%
nCON = 12;
clear CONTRAST
clear CONTRASTimg
clear jobs
dir_group = ['C:\Daten\Difo_fMRT\data_cv\group\'];
%alt:'C:\Daten\Difo_fMRT\data_cv\' stats_name '\group\'
% set lables
CONTRAST{1} = 'rem_g_for';
CONTRAST{2} = 'for_g_rem';
CONTRAST{3} = 'neg_g_ntr';
CONTRAST{4} = 'ntr_g_neg';
CONTRAST{5} = 'neg_for_g_ntr_for';
CONTRAST{6} = 'ntr_for_g_neg_for';
CONTRAST{7} = 'neg_rem_g_ntr_rem'
CONTRAST{8} = 'ntr_rem_g_neg_rem'
CONTRAST{9} = 'ntr_for_g_ntr_rem'
CONTRAST{10} = 'ntr_rem_g_ntr_for'
CONTRAST{11} = 'neg_for_g_neg_rem'
CONTRAST{12} = 'neg_rem_g_neg_for'
for i = 1:nCON CONTRAST{i} = [CONTRAST{i}]; end;
% contrast images - be careful, needs to correspond to 1st level contrast images
for i = 1:nCON CONTRASTimg{i} = ['con_' num2str(i, '%04u') '.img']; end;
for u=1:nCON %loop over contrasts
jobs{1}.util{1}.md.basedir{1} = char([dir_group]);
jobs{1}.util{1}.md.name = char([CONTRAST{u}]);
for s = 1:length(subjects)
jobs{2}.stats{1}.factorial_design.des.t1.scans{s,1} =
char([fullfile( dir_results, sprintf('VP%02d', subjects(s)),'res',
[CONTRASTimg{u},',1'] )] );
end;
jobs{2}.stats{1}.factorial_design.cov = struct([]);
jobs{2}.stats{1}.factorial_design.masking.tm.tm_none =
reshape(double([[]]),[0,0]);
jobs{2}.stats{1}.factorial_design.masking.im =
reshape(double([1]),[1,1]);
jobs{2}.stats{1}.factorial_design.masking.em{1} = char(['']);
jobs{2}.stats{1}.factorial_design.globalc.g_omit =
reshape(double([[]]),[0,0]);
jobs{2}.stats{1}.factorial_design.globalm.gmsca.gmsca_no =
reshape(double([[]]),[0,0]);
jobs{2}.stats{1}.factorial_design.globalm.glonorm =
reshape(double([1]),[1,1]);
jobs{2}.stats{1}.factorial_design.dir{1} =
char([dir_group CONTRAST{u} '/']);
jobs{3}.stats{1}.fmri_est.spmmat{1} =
char([dir_group CONTRAST{u} '/SPM.mat']);
jobs{3}.stats{1}.fmri_est.method.Classical =
reshape(double([1]),[1,1]);
jobs{4}.stats{1}.con.spmmat{1} =
char([dir_group CONTRAST{u} '/SPM.mat']);
jobs{4}.stats{1}.con.consess{1}.tcon.name =
char([CONTRAST{u}]);
jobs{4}.stats{1}.con.consess{1}.tcon.convec =
reshape(double([1]),[1,1]);
jobs{4}.stats{1}.con.consess{2}.tcon.name = char(['-'
CONTRAST{u}]);
jobs{4}.stats{1}.con.consess{2}.tcon.convec =
reshape(double([-1]),[1,1]);
%how to include job for writing out f-con image?
%eval(['save ' dir_jobs 'stats_2nd_' stats_name '_tmp' jobs']);
spm_jobman('run',jobs);
end
|