This is a basic script for group statistical analysis of source estimation results in SPM8. It uses previously computed source estimation results as input to the SPM8 function batch_spm_anova. You can visualise the results as "glass brains" using the Results function in the SPM8 GUI, or display them on a standard cortical surface using the Render->Display utility.
% to be run in SPM 8 EEG % runs group statistics on files in "imgfiles", using batch_spm_anova.m % output written into directory "outdir" (RFX) % OH, Feb 2010 addpath /imaging/local/meg_misc; % for meg_batch_anova % root directory for previously computed source stimation results pathstem = '/YourDataPath/'; % output root directory for results out_dir_stem = '/YourResultDirectory'; %% Specify data information for each subject subjects{1} = {'meg10_0007', '101206'}; subjects{2} = {'meg10_0008', '101224'}; subjects{3} = {'meg10_0009', '101231'}; nr_ss = length(subjects); %% Define contrasts (depends on how you named output of source estimation) clear contrasts; contrasts{1} = {'Mmacespm8_block1_raw_ssstf_raw_1_t100_200_f_7.nii', 'Mmacespm8_block1_raw_ssstf_raw_1_t100_200_f_8.nii', 'CON7vsCON8'}; % Condition 7 vs Condition 8 contrasts{2} = {'Mmacespm8_block1_raw_ssstf_raw_1_t100_200_f_1.nii', 'Mmacespm8_block1_raw_ssstf_raw_1_t100_200_f_2.nii', 'CON1vsCON2'}; % Condition 1 vs Condition 2 nr_contrasts = length( contrasts ); %% Compute Contrasts for cc = 1:nr_contrasts, % contrast by contrast clear imgfiles; for ss = 1:nr_ss, % subject by subject nr_conds = length( contrasts{cc} ); for con = 1:nr_conds-1, % condition by condition imgfiles{1}{ss}(con,:) = fullfile( pathstem, subjects{ss}{1}, subjects{ss}{2}, contrasts{cc}{con} ); % define full filename end; end; S = spm_get_defaults; % get SPM default analysis parameters S.imgfiles = imgfiles; % files for this contrast S.outdir = fullfile( out_dir_stem, contrasts{cc}{nr_conds} ); % output directory for this contrast fprintf(1, '%s\n', S.outdir); batch_spm_anova( S ); % run SPM random effects analysis end;