42
Buttons in SPM5 Buttons in SPM5 Seán O’Sullivan, ION Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies Methods for Dummies 16 16 th th Jan 2008 Jan 2008

Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Embed Size (px)

Citation preview

Page 1: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Buttons in SPM5Buttons in SPM5

Seán O’Sullivan, ION Seán O’Sullivan, ION Alice Jones, Dept of PsychologyAlice Jones, Dept of Psychology

Methods for DummiesMethods for Dummies1616thth Jan 2008 Jan 2008

Page 2: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

SPM5 – WTF?SPM5 – WTF? Ladles and jellyspoons,Ladles and jellyspoons,

I come before youI come before youto stand behind youto stand behind youand tell you somethingand tell you somethingI know nothing about.I know nothing about.

Next Thursday,Next Thursday,the day after Friday,the day after Friday,there will be a ladies' meetingthere will be a ladies' meetingfor men only.for men only.  Wear your best clothes,Wear your best clothes,if you haven't any,if you haven't any,and if you can come,and if you can come,please stay home. please stay home. 

Admission is free,Admission is free,you can pay at the door. you can pay at the door. We'll give you a seat,We'll give you a seat,so you can sit on the floor. so you can sit on the floor. 

It makes no differenceIt makes no differencewhere you sit,where you sit,the kid in the gallerythe kid in the galleryis sure to spit.is sure to spit.

Page 3: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Introducing the SPM5 User Introducing the SPM5 User InterfaceInterface

Spatial Pre-processing in fMRISpatial Pre-processing in fMRI Model designModel design 11stst and 2 and 2ndnd Level Analysis Level Analysis Help in SPM5Help in SPM5

TopicsTopics

Page 4: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

SPM5 User Interface

Page 5: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Preprocessing

Analysis

Inference

Page 6: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

SPM5 User Interface

Page 7: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Current List of Jobs

SPM5 User Interface

Page 8: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Current List of Jobs

Options available for currently

highlighted object

Current value of /information about

highlightedobject

Save/Loadas .mat files or

XML (“load-xml”,“savexml”)

Info about the meaning of current item

SPM5 User Interface

Page 9: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

1.1. RealignmentRealignment

2.2. CoregistratioCoregistrationn

3.3. SegmentatioSegmentationn

4.4. NormalizeNormalize

5.5. SmoothingSmoothing

Spatial Pre-processing

Page 10: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Data are available from Data are available from http://http://

www.fil.ion.ucl.ac.uk/spm/datawww.fil.ion.ucl.ac.uk/spm/data//

Create a new directory for dataCreate a new directory for data Create a subdirectory “jobs”Create a subdirectory “jobs”

Open MATLABOpen MATLAB Get into the correct working Get into the correct working

directorydirectory Type “SPM fmri”Type “SPM fmri”

If you’re using SPM for the first If you’re using SPM for the first time, make sure you “Set time, make sure you “Set Path”, under File in MATLAB. Path”, under File in MATLAB. Enter the path to your SPM Enter the path to your SPM folder and select the “Add with folder and select the “Add with Subfolders” option Subfolders” option

Analysing with SPM5

Page 11: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Click on Click on “Realign” from “Realign” from drop-down menudrop-down menu

Realignment

Page 12: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Select “New Select “New Realign:Estimate Realign:Estimate and Reslice”and Reslice”

Realignment

Open “Realign:Estimate and Reslice” option

Highlight Data and select “New Sesson”

Highlight “Session”

Select “Specify Files”

Page 13: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Realignment Choose all of the Choose all of the

functional images functional images in the directoryin the directory i.e. images i.e. images

beginning beginning ‘fM000*.img’‘fM000*.img’

Page 14: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Realignment

Save job file as e.g. Save job file as e.g. “realign.mat” in “realign.mat” in your jobs directoryyour jobs directory

Press “RUN”

Page 15: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Realignment

etc

Mean image for use in coregistration

Header files modified with orientation info

Page 16: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Coregistration

Click on Click on “Coregister”“Coregister”

Page 17: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Coregistration Click on “New Coreg:Estimate”

Double-click on “Coreg:Estimate”

Highlight “Reference Image” select mean fMRI scan meanfM00223_004.img from realignment

Highlight “Source Image” select structural image sM00223_002.img

SAVE as ‘coreg.mat’

Press “RUN”

Page 18: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Effects:Effects: SPM implements a SPM implements a

coregistration coregistration between structural between structural and functional data and functional data that maximises that maximises mutual informationmutual information

SPM changes SPM changes header of source header of source file i.e. file i.e. sM00223_002.hdrsM00223_002.hdr

Coregistration

Page 19: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Useful to check Useful to check registration of ref registration of ref and source images and source images at this pointat this point

Click “Check Reg” Click “Check Reg” buttonbutton Select your source Select your source

and ref images as and ref images as beforebefore

Navigate images Navigate images and inspect and inspect anatomical anatomical correspondencecorrespondence

Coregistration

Page 20: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Segmentation

Click on Click on “Segment”“Segment”

Page 21: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Segmentation Highlight Data field

“Specify Files” select the subject’s registered structural image sM00223_002.img

SAVE as segment.mat

RUN

Page 22: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Effects:Effects: SPM creates grey and SPM creates grey and

white matter images and a white matter images and a bias-field corrected bias-field corrected structural imagestructural image

View with Check RegView with Check Reg Grey matter image is Grey matter image is

c1sM00223_002.imgc1sM00223_002.img White matter image is White matter image is

c2sM00223_002.imgc2sM00223_002.img Check reg against original Check reg against original

structural sM00223_002.imgstructural sM00223_002.img

Segmentation

SPM also writes spatial normalisation and inverse spatial normalisation parameters to files in structural directory:

sM00223_002_seg_sn.mat sM00223_002_seg_inv_sn.mat

THESE CAN BE USED TO NORMALISE FUNCTIONAL DATA

Grey matterimage

Originalstructural image

Page 23: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Click on Click on “Normalize”“Normalize”

Normalize

Page 24: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Select “Normalise:Write”Select “Normalise:Write” Allows previously Allows previously

determined warps to be determined warps to be applied to a series of imagesapplied to a series of images

Normalize

Highlight “Data”

Select new “Subject” Open “Subject” and highlight “Parameter File” Select sM00223_002_seg_sn.mat from Segmentation step

Highlight “Images to Write” “Specify Files” Use filter to select all realigned functional images Type ^r.* in SPM file selector and click “Filt” Right-click “Select all” Done

Page 25: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Open “Writing Options”Open “Writing Options” Click “Voxel sizes”, then Click “Voxel sizes”, then

“Specifiy Values” “Specifiy Values” Change values to [3 3 3]Change values to [3 3 3] This writes images at a This writes images at a

resolution closer to that resolution closer to that at which they were at which they were acquiredacquired

Normalize

SAVE as “normalise.mat

RUN

Page 26: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Effects:Effects: SPM writes SPM writes

spatially spatially normalised files normalised files to the functional to the functional data directorydata directory

Normalised files Normalised files have the prefix have the prefix “w”“w”

Normalize

Page 27: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Smooth

Click on “Smooth”Click on “Smooth”

Page 28: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Open “Smooth”Open “Smooth”

Smooth

Select “Images to Smooth” select the spatially normalised files “wrfM00*.img”

Highlight “FWHM” “Specify Values” Change [8 8 8] to [6 6 6] Data will be smoothed by 6mm in each direction

SAVE as smooth.mat

RUN

Page 29: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

EffectsEffects See rightSee right

Normalised functional Normalised functional image above image above wrfM00223_004.imgwrfM00223_004.img

Smoothed image Smoothed image below below swrf00223_004.imgswrf00223_004.img

Note:Note: SPM5 Manual says SPM5 Manual says

“smoothing step is “smoothing step is unnecessary if you unnecessary if you are only interested in are only interested in Bayesian analysis of Bayesian analysis of your functional data”your functional data”

Smooth

Page 30: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

fM00223_004.imgfM00223_004.img RealignRealign rfM00223_004.imgrfM00223_004.img CoregisterCoregister SegmentSegment NormaliseNormalise wrfM00223_004.imgwrfM00223_004.img SmoothSmooth swrfM00223_004.imgswrfM00223_004.img

Overview

Page 31: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

First Level AnalysisFirst Level Analysis 3 STAGES3 STAGES

1.1. Specification of GLM design matrix, Specification of GLM design matrix, fMRI data files and filtering.fMRI data files and filtering.

2. Estimation of GLM parameters 2. Estimation of GLM parameters

3. Interrogation of results using contrast 3. Interrogation of results using contrast vectors to product Statistical vectors to product Statistical Parametric Maps or Posterior Parametric Maps or Posterior Probability Maps. Probability Maps.

Page 32: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Starting 1Starting 1stst level analyses level analyses

Model Model specification, specification, review and review and estimation boxestimation box

Specify 1Specify 1stst-level-level

Page 33: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Building a Design MatrixBuilding a Design Matrix fMRI Model SpecificationfMRI Model Specification

DirectoryDirectory specify files specify files (ie. where you want the .mat file to be (ie. where you want the .mat file to be

written)written)

Timing ParametersTiming Parameters Unit for design Unit for design scans or seconds scans or seconds Interscan Interval Interscan Interval TR TR (ie. time taken between (ie. time taken between

acquisitions)acquisitions)

Data & DesignData & Design Subject/SessionSubject/Session

Scans Scans load sw. files load sw. files ConditionsConditions

Page 34: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Data & DesignData & Design

Subject/SessionSubject/Session

Load sw. files

Add number of conditions required

Name of condition

Time of onsets (remember scan/seconds)

Duration(remember scan/seconds)

Also here:

Regressors

Covariates

Masks etc

Page 35: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

OutputOutput

Page 36: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

EstimationEstimation

Model parameters can be estimated Model parameters can be estimated using classical (Restricted Maximum using classical (Restricted Maximum Likelihood) or Bayesian algorithmsLikelihood) or Bayesian algorithms

• Select Estimate

from the panel on the right and select SPM.mat file you have just created.

Page 37: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

ResultsResults

Define contrasts

Page 38: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Second Level AnalysesSecond Level AnalysesSecond level analyses allow you to make populations inferences from your data.

As in first level, you will;

Configure design matrix

Describe General Linear Model

Specify data to be used (.con images)

Include other parameters relevant to your study (covariates, global normalisation options, grand mean scaling options, masking and thresholds etc)

As for first-level: design and data configuration is followed by ‘ESTIMATE’ and building contrast maps in ‘RESULTS’

Page 39: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

HELP! In SPM5HELP! In SPM5 There are a few ways to There are a few ways to

access help in SPM5access help in SPM5

The Help button on the GUI

This brings up a helpful display where clicking on a button brings up information about that function.

Page 40: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Help can also be obtained from Help can also be obtained from clicking the ? buttonclicking the ? button

HELP! In SPM5HELP! In SPM5

Page 41: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Many options Many options automatically automatically provide a brief provide a brief explanation of explanation of whatwhat they they might be used might be used for or for or whenwhen to to select themselect them

HELP! In SPM5HELP! In SPM5

Page 42: Buttons in SPM5 Seán O’Sullivan, ION Alice Jones, Dept of Psychology Alice Jones, Dept of Psychology Methods for Dummies 16 th Jan 2008

Sources of plagiarismSources of plagiarism

Alice Grogan, Carolyn McGettigan Alice Grogan, Carolyn McGettigan Buttons in SPM5Buttons in SPM5

SPM5 Manual - The FIL Methods Group