BatchRenderRfx - MRC CBU Imaging Wiki

Revision 27 as of 2008-03-12 17:46:33

Clear message
location: BatchRenderRfx

Modified version Ferath's script to threshhold and print SPM5 results. The script prints glass brains and rendered activations as well as the first page of the results table. The lines in block (3) are the ones you need to (or are most likely to want to) change. Originally modified by DannyMitchell and subsequently by IanNimmoSmith.

  1. The program needs files attachment:cls_getRes.m and attachment:cls_getSPM2.m . For CBU people the following line should find them, otherwise you need to download them and point to their path. addpath /imaging/dm01/MoreTools/spm2Batch. Also, you should add a path to the custom spm_render_dm, which solves some of the issues of the default spm_render command addpath /imaging/dm01/MEG/aaMEG. Finally, if you are using AAL, you should add the path to its toolkit, e.g. addpath /imaging/av02/tools/aal

  2. Last updated 02/07 by DannyMitchell

  3. dataroot = ''; % path to data
    anadirs = {''}; % name of folder(s), in above directory, where analysis is (useful if you have used several models in analysis)
    cond_dir={''}; % cell array of folder names in outputdir, containing the SPMs for each contrast
    % %%(AVG) Alternatively, save the data from your 'aamod_firstlevel_contrasts.m' file onto a 'contrast_names.mat' file and do the following:
    % load contrast_names
    % cond_dir=cname; %cname is the array of contrast names and their directory names in your second level analysis folder
    
    outputfilesuffix='_RFX_Rendered.ps'
    %{set the following variable to 'yes' to do a 2-tailed test and show
    % rendered activations and deactivations (assumes that positive and negative
    % second level contrasts have already been calculated; Glass brains will
    % only show positive activations). Set it to 'no' to to a 1-tailed test
    % and only calculate positive activations. %}
    ShowDeactivations = 'no';
    Threshold=0.05; % p threshold
    ExtentThreshold=0; % minimum number of contiguous voxels
    addpath /imaging/dm01/MoreTools/spm2Batch %{the program needs files cls_getRes.m and cls_getSPM2.m. For CBU people this line will find them, otherwise you need to download them and point to their path.%}
    MCC='FDR'; % method for correcting for multiple comparisons : 'FWE','FDR', or 'none'
    Brain='/imaging/local/spm/spm5/rend/render_smooth_average.mat'%render_single_subj.mat' %render_smooth_average.mat'; % the brain on which you want to render the results
    Style=1; % Rendering Style: NaN=old, 1=normal, <1=brighter (0.75 = light, 0.5 = more, 0.25 = lots)
    
    % for results table
    num=3;    % number of maxima per cluster
    dis=8;    % distance among clusters (mm)

doaal = 0; % Label anatomical clusters with AAL? 1=yes 0=no

  1. %%%%%%% Do it:
    for  j = 1:size(anadirs,2)
        outputdir=anadirs{j};
    
    if exist(fullfile(dataroot,strcat(outputdir,outputfilesuffix)))==2
        delete(fullfile(dataroot,strcat(outputdir,outputfilesuffix)));
    end;
    
    spm_defaults;
    global defaults
    defaults.modality='FMRI';
    try q=defaults.units{3}; catch; defaults.units={'mm','mm','mm'}; end; % for some reason I had to add this line 15/01/07
  2. %- xSPM is a structure for the parameters
    
     
    xSPM = struct( ...
        'swd', '', ... % full path to SPM.mat file
        'Ic', [], ... % no of contrast (or contrasts for conjunction)
        'Im', [],... % no of contrast to mask with. Empty for no masking
        'pm', [],... % masking contrast uncorrected p
        'Ex', [],... % whether masking is inclusive or exclusive
        'title', '',... % if empty results in default contrast title
        'Mcp', MCC,... % Mutiple comp method: FWE|FDR|none
        'u', Threshold,... % threshold (corrected or uncorrected, as above)
        'k', ExtentThreshold); % extent threshold
    
    clear SPM