spmintroduction scott peltier fmri laboratory university of michigan slides adapted from t. nichols
TRANSCRIPT
SPMSPMIntroductionIntroduction
Scott PeltierScott Peltier
FMRI LaboratoryFMRI LaboratoryUniversity of MichiganUniversity of Michigan
Slides adapted from T. NicholsSlides adapted from T. Nichols
SPM!SPM!
Software to perform computation, Software to perform computation, manipulation and display of imaging datamanipulation and display of imaging data
SPM : OverviewSPM : Overview• Library of MATLAB and C functionsLibrary of MATLAB and C functions
• Graphical user interfaceGraphical user interface
• Four main components:Four main components:– PreprocessingPreprocessing– Model Specification & FittingModel Specification & Fitting– Inference & Results InterrogationInference & Results Interrogation– Supplemental ToolsSupplemental Tools
SPM: PreprocessingSPM: Preprocessing• Eliminate systematic variation before Eliminate systematic variation before
statistical modelingstatistical modeling
• Slice timingSlice timing– Adjust for variable acquisition time over slicesAdjust for variable acquisition time over slices– In UM processing stream, this is already doneIn UM processing stream, this is already done
• ““RealignRealign””mentment– Intrasubject registrationIntrasubject registration– Motion correctionMotion correction– Done in UM streamDone in UM stream
slice 1
slice 4
TR 2TR 3TR
time
SPM: PreprocessingSPM: Preprocessing• ““CoregisterCoregister””ationation
– Intrasubject, intermodality registrationIntrasubject, intermodality registration– Registration of MR imagesRegistration of MR images
with different TR/TEwith different TR/TE
• Spatial Spatial ““NormalizeNormalize””ationation– Intersubject registrationIntersubject registration– Register subject anatomy to atlas spaceRegister subject anatomy to atlas space
SPM SPM T1 templateT1 templateMNI spaceMNI space
SPM: PreprocessingSPM: Preprocessing• Spatial Spatial ““SmoothSmooth””inging
– Blur data into submission…Blur data into submission…• To satisfy random field theory assumptionsTo satisfy random field theory assumptions
• For intersubject analysesFor intersubject analyses
• ““SegmentSegment””ation into GM/WM/CSFation into GM/WM/CSF– Usually not directly usedUsually not directly used– Useful for structural studiesUseful for structural studies
Before Before convolutionconvolution
Convolved Convolved w/ circlew/ circle
Convolved Convolved w/ Gaussianw/ Gaussian
Adapted from SPM course slidesAdapted from SPM course slides
SPM: Model SpecificationSPM: Model Specification• ““Specify 1st-levelSpecify 1st-level””
– Specify the design, creating SPM.matSpecify the design, creating SPM.mat
• ““Specify 2nd-levelSpecify 2nd-level””– T-tests (One or two sample, paired)T-tests (One or two sample, paired)
– RegressionRegression
• ““ReviewReview””– Examine correlation of predictorsExamine correlation of predictors
– Power spectrum of experimental effectsPower spectrum of experimental effects
• ““EstimateEstimate””– Fit a specified model Fit a specified model
based on a SPM.mat filebased on a SPM.mat file
SPM: InferenceSPM: Inference• ““ ResultsResults”” button button
• First brings up First brings up ““Contrast ManagerContrast Manager””Can define single (t) Can define single (t)
or sets (F) of contrastsor sets (F) of contrasts
• Then displays MIPThen displays MIP– MIP = Maximum Intensity ProjectionMIP = Maximum Intensity Projection– Glass BrainGlass Brain– Can Can ““surfsurf”” by dragging cursor by dragging cursor
SPM: InferenceSPM: Inference• Interactive windowInteractive window
– p-valuesp-values• Correced for whole brain or subregionCorreced for whole brain or subregion
– Plotting of time coursesPlotting of time courses– ““OverlaysOverlays””
• Superimpose results on other imagesSuperimpose results on other images
– Current location and valueCurrent location and value
SPM: Miscellaneous ToolsSPM: Miscellaneous Tools
• ““DisplayDisplay””– Displays image Displays image
with orthogonal sectionswith orthogonal sections– Check intensity valuesCheck intensity values– Change originChange origin– Change world spaceChange world space
• i.e. Apply rotations/translationsi.e. Apply rotations/translations
SPM: Miscellaneous ToolsSPM: Miscellaneous Tools
• ““Check RegCheck Reg””– Display multiple imagesDisplay multiple images– Essential tool for assessing Essential tool for assessing
alignment of imagesalignment of images– All images are displayed in the All images are displayed in the
space of the first imagespace of the first image
SPM: Miscellaneous ToolsSPM: Miscellaneous Tools• ““ImCalcImCalc””
– Image calculatorImage calculator– Give one or more images, perform MATLAB Give one or more images, perform MATLAB
arithmetic and write out resultarithmetic and write out result
• ““UtilsUtils””– Change directoryChange directory
• Results are written to current directory!Results are written to current directory!
– Delete files, etc.Delete files, etc.
SPM8 Batch EditorSPM8 Batch Editor
• Allows jobs to be saved, Allows jobs to be saved,
re-loaded, changedre-loaded, changed
• Helps remove Helps remove ““Oops!Oops!”” factor factor
• Multiple steps can be loaded, Multiple steps can be loaded,
run at oncerun at once
SPM: PerspectiveSPM: Perspective• SPM tries to be a single solution for all fMRI SPM tries to be a single solution for all fMRI
processing and analysis, but there can be no processing and analysis, but there can be no such thing!such thing!– FMRI is a rapidly evolving field where each FMRI is a rapidly evolving field where each
dataset has huge number of observations!dataset has huge number of observations!
• DonDon’’t let SPM be a black box!t let SPM be a black box!• Understand what each component doesUnderstand what each component does• Understand how to get at the dataUnderstand how to get at the data
– e.g. using e.g. using ‘‘DisplayDisplay’’, , ‘‘Check RegCheck Reg’’
ResourcesResources
• SPMSPMwebweb site: site: http://www.fil.ion.ucl.ac.uk/spm/http://www.fil.ion.ucl.ac.uk/spm/• Introduction to SPM Introduction to SPM
• SPM code download: SPM99, SPM2, SPM5, SPM8SPM code download: SPM99, SPM2, SPM5, SPM8
• Documentation & BibliographyDocumentation & Bibliography
• SPM short courseSPM short course
• Example data setsExample data sets
• SPM extensionsSPM extensions
• SPM SPM eemail discussion listmail discussion list
• Other software packages can complement SPMOther software packages can complement SPM– MRIcronMRIcron:: http://www.mccauslandcenter.sc.edu/mricro/mricron/index.htmlhttp://www.mccauslandcenter.sc.edu/mricro/mricron/index.html
– Quick and easy to read, display, and convert image dataQuick and easy to read, display, and convert image data
AlternativesAlternatives• FSL: FSL: http://www.fmrib.ox.ac.uk/fslhttp://www.fmrib.ox.ac.uk/fsl
• Open sourceOpen source
• Comprehensive tools for FMRI and DTI, has nice ICA analysis tool Comprehensive tools for FMRI and DTI, has nice ICA analysis tool
(MELODIC)(MELODIC)
• FreeFree
• AFNI: AFNI: http://afni.nimh.nih.govhttp://afni.nimh.nih.gov
• Open sourceOpen source
• Active community, multiple pluginsActive community, multiple plugins
• FreeFree
• BrainVoyager: BrainVoyager: http://www.brainvoyager.comhttp://www.brainvoyager.com
• Excellent visualizationExcellent visualization
• Closed source, ~$5kClosed source, ~$5k
Imaging data formatsImaging data formats• Analyze formatAnalyze format
– .img Raw, binary data; 3D or 4D.img Raw, binary data; 3D or 4D– .hdr Small binary header.hdr Small binary header
• Image dimensionImage dimension
• Voxel sizeVoxel size
• NIFTI formatNIFTI format– .img + .hdr.img + .hdr– Like Analyze, but different .hdr definitionLike Analyze, but different .hdr definition– .nii .nii Single file! Single file! Header and Image file concatenatedHeader and Image file concatenated– World space transformation coded in NIFTI headerWorld space transformation coded in NIFTI header
Is Left Right?Is Left Right?• Two conventions for viewing imagesTwo conventions for viewing images
– NeurologicalNeurological• On the screen, Left is Left side of subjectOn the screen, Left is Left side of subject• As if standing behind the head of the patientAs if standing behind the head of the patient
– RadiologicalRadiological• On the screen, Left is Right side of subjectOn the screen, Left is Right side of subject• As if standing at the foot of the patientAs if standing at the foot of the patient
• Standard in clinical radiology is, um, radiologicalStandard in clinical radiology is, um, radiological
• SPM always uses Neurological conventionSPM always uses Neurological convention– Default for Analyze set by defaults.analyze.flip in spm defaults.mDefault for Analyze set by defaults.analyze.flip in spm defaults.m
• flip = 0 ,Neuro., flip = 1 ,Rad.flip = 0 ,Neuro., flip = 1 ,Rad.• NIFTI images NIFTI images allegedly allegedly have no ambiguity about left & righthave no ambiguity about left & right
LL
RR
RR
LL
NoseNose
Coregister & realignmentCoregister & realignment• Coregistration & Realignment are rigid body Coregistration & Realignment are rigid body
transformationstransformations– SubjectSubject’’s head doesns head doesn’’t change size or warp between scanst change size or warp between scans– Well, actually...Well, actually...
• Each requires a Each requires a ““ReferenceReference”” and a and a ““SourceSource””– Reference: Fixed imageReference: Fixed image– Source: Image that is transformedSource: Image that is transformed
• SPM modifies the .hdr file of the SPM modifies the .hdr file of the object object imageimage– Unless you explicitly ask it to, it doesnUnless you explicitly ask it to, it doesn’’t write out an imaget write out an image– Saves lots of disk space!Saves lots of disk space!
Voxel space vs. world spaceVoxel space vs. world space• Voxel SpaceVoxel Space
– Just the original imageJust the original image– No reorientations or flipsNo reorientations or flips
• World SpaceWorld Space– Space defined by transformation from voxel to mm Space defined by transformation from voxel to mm
matrix Mmatrix M• Let v be a voxel location indexed from (1,1,1)Let v be a voxel location indexed from (1,1,1)• Then w=M*[v;1] is that location in world space, in mmThen w=M*[v;1] is that location in world space, in mm• Can represent rotations, translations and flipsCan represent rotations, translations and flips
Functional imagesraprun_01.nii
Low-res anatomyt1overlay.nii
High-res anatomyt1spgr.nii
Functional Space
Data Fresh from fMRI LabData Fresh from fMRI Lab
Template imageT1.nii
scalped_avg152T1.nii
MNI Atlas Space
CoregistrationCoregistration
SourceReference
Coregister button
Sets new world space in NIFTI headerDetermined from: Rigid body, M.I. registration of high-res to low-res anatomy
Functional Space
Functional imagesraprun_01.nii
Low-res anatomyt1overlay.nii
High-res anatomyt1spgr.nii
Template imageT1.nii
scalped_avg152T1.nii
MNI Atlas Space
Functional Space
After CoregistrationAfter Coregistration
Functional imagesraprun_01.nii
Low-res anatomyt1overlay.nii
Template imageT1.nii
scalped_avg152T1.nii
MNI Atlas Space
High-res anatomyt1spgr.nii
(NIFTI header)
Normalize button
Creates _sn.mat file
Determined from: Nonlinear, L.S. registration of high-res anatomy to T1 MNI template
Functional Space
Spatial NormalisationSpatial Normalisation
Functional imagesraprun_01.nii
Low-res anatomyt1overlay.nii
Template imageT1.nii
scalped_avg152T1.nii
MNI Atlas Space
High-res anatomyt1spgr.nii
(NIFTI header)
Functional Space
Spatial NormalisationSpatial Normalisation
_sn.mat file maps any
Functional Space image to MNI space!
MNI Atlas Space
Functional imagesraprun_01.nii
Low-res anatomyt1overlay.nii
Template imageT1.nii
scalped_avg152T1.nii
High-res anatomyt1spgr.nii
(NIFTI header)
Functional Space
After After ““Writing NormalizedWriting Normalized””
Functional Space
MNI Atlas Space
Functional imagesraprun_01.nii
Low-res anatomyt1overlay.nii
Template imageT1.nii
scalped_avg152T1.nii
High-res anatomyt1spgr.nii
(NIFTI header)
Normalized imageswt1spgr.nii
wraprun_01.nii
rap_run’s
Functional Space
MNI Atlas Space
Group Analysis: Strategy 1Group Analysis: Strategy 1Only transform contrast imgOnly transform contrast img’’ss
wcon’s
beta’scon’s
spmT’s
Intrasubjectanalysis result
Intrasubject analysis contrast images,transformed into atlas space (w/ _sn.mat),ready for group analysis
_sn.mat
rap_img’s
Functional Space
MNI Atlas Space
Group Analysis: Strategy 2Group Analysis: Strategy 2Transform all functionalsTransform all functionals
beta’scon’s
spmT’s
Intrasubjectanalysis result
con images ready for group analysis (already in atlas space)
wrap_run’s
All functionaldata transformed into atlas space (w/ _sn.mat)
_sn.mat
Normalisation recommendationsNormalisation recommendations
• With With ‘‘scalpedscalped’’ brains use brains use ‘‘scalpedscalped’’ template template– Scalped template Scalped template scalped_avg152T1.niiscalped_avg152T1.nii– Should Should give best resultsgive best results
• We donWe don’’t care about scalp alignment!t care about scalp alignment!
• Make sure WM equal in brightnessMake sure WM equal in brightness– T1T1’’s can have inhomogeneity artifact, where center of s can have inhomogeneity artifact, where center of
volume is brightervolume is brighter– Should apply homogeneity correction (bias correction)Should apply homogeneity correction (bias correction)– UM: make sure to UM: make sure to use use hheet1spgr, t1spgr, hhet1overlayet1overlay