Diff for "BatchRenderRfx" - MRC CBU Imaging Wiki
location: Diff for "BatchRenderRfx"
Differences between revisions 13 and 14
Revision 13 as of 2008-03-12 13:24:46
Size: 8621
Editor: pc0302
Comment:
Revision 14 as of 2008-03-12 13:26:23
Size: 8621
Editor: pc0302
Comment:
Deletions are marked like this. Additions are marked like this.
Line 28: Line 28:
Style=1; % Rendering Style: NaN=old, 1=normal, <1=brighter}}} Style=1; % Rendering Style: NaN=old, 1=normal, <1=brighter
Line 32: Line 32:
dis=8; % distance among clusters (mm) dis=8; % distance among clusters (mm)}}}
Line 34: Line 34:
 1. {{{  2. {{{
Line 51: Line 51:
 1. {{{  3. {{{
Line 65: Line 65:
 1. {{{  4. {{{

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

  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
    
    % for results table
    num=3;    % number of maxima per cluster
    dis=8;    % distance among clusters (mm)
  4. %%%%%%% 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
    
    %--------------------------------------------------------------------
    %- xSPM is a structure for the parameters
  5. 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

CbuImaging: BatchRenderRfx (last edited 2013-03-07 21:24:07 by localhost)