Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to SPM Batching

Similar presentations


Presentation on theme: "Introduction to SPM Batching"— Presentation transcript:

1 Introduction to SPM Batching
from acquisition to publication… Guillaume Flandin Wellcome Trust Centre for Neuroimaging University College London MATLAB for Cognitive Neuroscience ICN, May 2009

2 Statistical Inference
Image time-series Spatial filter Design matrix Statistical Parametric Map Realignment Smoothing General Linear Model Statistical Inference RFT Normalisation p <0.05 Anatomical reference Parameter estimates

3 Installing SPM using SVN
FIL & ICN only SPM repository your SPM working copy SPM Install Subversion: on Windows Online instructions: Repository URLs: SPM5: svn://bread.fil.ion.ucl.ac.uk/spm/branches/spm5 SPM8: svn://bread.fil.ion.ucl.ac.uk/spm/trunk TBR: svn://bread.fil.ion.ucl.ac.uk/tools/TBR/trunk Import_Archive: svn://bread.fil.ion.ucl.ac.uk/tools/Import_Archive

4 TortoiseSVN: Checkout

5 TortoiseSVN: Update Case 1: your SPM files needed to be updated.
Case 2: your SPM files are up-to-date.

6 Remove older SPM versions from the path (or use spm_rmpath)
MATLAB path Add Folder (and not with Subfolders) Remove older SPM versions from the path (or use spm_rmpath)

7 Batching SPM{2,5,8} SPM Extensions webpage:
SPM99, SPM2 [1] [2] Call SPM functions directly [1,2]: spm_realign spm_slice_timing spm_normalise spm_write_sn spm_smooth spm_fmri_spm_ui spm_spm spm_FcUtil spm_contrasts Requires knowledge about input/output arguments of main SPM functions and about the SPM.mat structure. SPM5 Job Manager: “jobs” structure. Virtual files. SPM8 Batch Editor: “matlabbatch” structure. Dependencies.

8 SPM “jobs” Batch mode: (“matlabbatch” for SPM8) Goal: create a .mat file containing a Matlab structure ‘jobs’ similar to the one created using the GUI. Tip: you only need to specify parameters that you would enter in the interface, the others will be automatically imported when executed.  The jobs structure will mimic the interface.

9 Useful SPM functions: Select files: spm_select.m [files,dirs] = spm_select(‘FPList',dir,filt) ex.: f = spm_select(‘FPList',‘C:\data\exp’,‘^fM.*\.img$’); Job manager: spm_jobman.m spm_jobman(‘initcfg’); % initialise SPM batch mode spm_jobman(‘run’,jobs); % execute a job spm_jobman(‘interactive’,jobs); % display a job in the GUI % jobs can be a Matlab variable or .mat/.m filename Overall structure of a batch script: spm(‘defaults’,‘fmri’); spm_jobman(‘initcfg’); clear jobs % fill in jobs structure save(‘My_Batch.mat’,‘jobs’); spm_jobman(‘run’,jobs); See also: fullfile cellstr editfilenames*

10 Data organisation Should be as generic as possible to ease batch script writing.

11 A potention pipeline for preprocessing with SPM:
Anatomical image Realign Coregister Segment Raw functional images Update *.hdr mean.{img,hdr} rp_*.txt Update *.hdr m*/c1*/c2*.{img,hdr} *_seg_sn.mat *_seg_inv_sn.mat Normalize: Write Group mean wm*. {img,hdr} Smooth Normalize: Write sw*.{img,hdr} w*.{img,hdr}

12 Workflow for SPM8 Batch Editor
Subject directory Subject directory Functional data Functional data Structural data Structural data Experimental design Experimental design Change directory Realignment Coregistration Segmentation Normalisation Normalisation Smoothing Make directory Model Specification 1. Subject-independent data/analysis steps 2. Data flow (dependencies) Model Estimation 3. Subject-specific data

13

14 For more information… SPM5/8 script examples: SPM8 manual chapter 34: L. Kasper’s slides for SPM8:


Download ppt "Introduction to SPM Batching"

Similar presentations


Ads by Google