ohba m/eeg analysis workshop · osl = ohba’s software library osl is written in matlab but uses...
TRANSCRIPT
![Page 1: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/1.jpg)
MarkWoolrichDiegoVidaurreAndrewQuinn
Romesh AbeysuriyaRobertBecker
OHBAM/EEGAnalysisWorkshop
![Page 2: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/2.jpg)
WorkshopSchedule
• Tuesday• Session1:Preprocessing,manualandautomaticpipelines• Session2:Taskdataanalysisinsensorspace(subjectlevel)• Session3:Taskdataanalysisinsourcespace(subjectlevel)
• Thursday• Session4:Taskdataanalysisgrouplevel• Session5:Connectivityanalysisinsourcespace,subjectandgrouplevel• Session6:Hidden-Markov-Modeling inrestandtaskdata
![Page 3: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/3.jpg)
Tuesday’sSchedule
09:30Session1lecture10:00CoffeeBreak10:10Session1practical11:30Session2lecture12:00Lunch(notprovided)13:00Session2practical14:20CoffeeBreak14:30Session3lecture15:00Session3practical16:30Finish
![Page 4: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/4.jpg)
OSLPreprocessing
RobertBeckerOSLworkshopOHBA,Oxford
25.04.17
![Page 5: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/5.jpg)
OSL=OHBA’ssoftwarelibrary
OSLiswritteninmatlabbutusesalsoanumberofdifferenttoolboxes:
• SPM• fieldtrip• FSL• osl-core(incl.OPT,OAT,ROInets,GLEAN,HMM-MARetc)• Utilities• …ProvidescompletepipelinetoprocessandanalyseyourMEGdata
![Page 6: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/6.jpg)
MEGbasics:Howwemeasure
• ElektaNeuromagsystemhas306helium-cooledSQUIDsensors:102radialmagnetometersand204planargradiometers• Magnetometersmeasuremagneticfieldstrengthperpendiculartosurfaceofsensors(z-axis),gradiometersmeasuremagneticfieldchanges(xandydirection)• HasalsoEEGrecordingcapabilities+ECGandEOG
![Page 7: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/7.jpg)
MEGandartefacts:Whatwe(wantto)measure
This!
![Page 8: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/8.jpg)
Session1:Overview
• Introduction:typicalMEGartefacts• ManualPreprocessing:• Usingthemaxfilter• Filteringanddownsampling• VisualInspectionofdata:OSLview• De-noisingdata:artefactrejectionbyusingindependentcomponentanalysis(AFRICA)
• AutomatedPreprocessing:• UsingOSL’spreprocessingtool(OPT)
![Page 9: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/9.jpg)
MEGandartefacts:Commonsources
• Biologicalartifacts• Saccades,blinks,microsaccades
• Muscularartefacts• Heartbeat• Respiration
• Electrical/other• 50Hzlinenoise• Scannerartifacts(jumps,spikes)• Channelsaturation• MRImagnetisation• Subjectmovements
![Page 10: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/10.jpg)
Strategiesfordealingwithartefacts
• Beforeandduringacquisition:• Avoidthem(eyeblinks,movementsetc.)!
• Post-acquisition:• Maxfilternoisesuppression• Filteroutproblematicfrequencies• Removingbadperiodsbyvisualinspection• UseICAtoremoveproblematiccomponents• -->themoreyouknowaboutthem,thebetter,e.gbyrecordingECGandEOG(seelater)
![Page 11: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/11.jpg)
Manualpreprocessing:Maxfilter
• MaxfilterisproprietarysoftwareprovidedbyElektafortheirscanner,whichimplementsasignalspaceseparation(SSS)algorithmtoreduceexternalnoise(bout):
Maxfiltercanalsodo:
MovementcompensationAlignmentDetectbadchannelsDownsampledata
![Page 12: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/12.jpg)
Manualpreprocessing:Filteringanddownsampling• Efficientforremovingoflow-frequencydriftsandline-noise
• Downside:Mightdistortyoursignalofinterest:• Taskdata:Phase,latencyofevokedfields• Restdata:Connectivitymeasures?
• à Conservativeuseoffiltering;alwaysinspectyourdataafterfiltering!
• Downsampling:optional
![Page 13: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/13.jpg)
Manualpreprocessing:Visualinspection forbadperiods• Importantstepduringmanualpreprocessing
• But:Equallyimportanttodouble-checkperformanceduringautomaticpreprocessing!
• Downside:Completelossofrejecteddata(channels/periods/trials)
• WewilluseourOSLviewdataviewertodothis:
![Page 14: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/14.jpg)
Manualpreprocessing:Visualinspectionwith OSLview
channelvariances
“BadEpoch”segments
savebutton
changechanneltype
datainviewingwindow
Rightclickinthisspacetosetdata
to“Bad”
Averagechannelvariance
![Page 15: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/15.jpg)
Manualpreprocessing:AfRICA:ArtefactrejectionusingIndependentComponentAnalysis(AfRICA)
ICAisadata-drivenBBSalgorithmtosplitourMEGdata(Y)
intoanumberoftemporallyindependentcomponents(S)byidentifyingthemixingmatrix(A).
YNsamples
Nchanne
ls
ANcomponents
Nchan
nels S
Nsamples
Ncompo
nentsx=
![Page 16: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/16.jpg)
HowICAworksNon
-Gaussianity
(kurtosis)
Numberofmixedsignals ↑
Thekeyingredient:AmixtureofsignalsisalwaysmoreGaussian thantheunderlyingsignals (akathecentrallimittheorem).
• Means:Bysearchingforthesetofmaximallynon-Gaussiansignalswecanreversethemixingprocessandrecoverourunknownsources.
![Page 17: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/17.jpg)
HowICAworksNon
-Gaussianity
(kurtosis)
Numberofmixedsignals ↑
• Means:Bysearchingforthesetofmaximallynon-Gaussiansignalswecanreversethemixingprocessandrecoverourunknownsources.• DoesnotworkwithGaussiansources…
Sources(brainactivity)
Sources(linenoise)Mixture(Y)
Thekeyingredient:AmixtureofsignalsisalwaysmoreGaussianthantheunderlyingsignals(akathecentrallimittheorem).
![Page 18: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/18.jpg)
AfRICA:Classifyingcomponents
• Now,havingindependentcomponents isgreat,butwhichofthesourcesareartefacts?
• AfrICAofferswaystoguideyou:• Visualinspection
• Timecourse,spectrum,topography• Correlationwithexternalsignals
• IfyouhaveacquiredECGorEOGthenAfRICAwillsorttheindepentcomponentsaccordingtotheirsimilarity
![Page 19: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/19.jpg)
AfrICA:Userinterfacemetrics(e.g.kurtosis,ECG,
EOG,mains)
sensortopographies
Setcomponentasbad(orrevertto
good)
powerspectrum
![Page 20: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/20.jpg)
AfrICA:Typicalcomponents
Cardiac component
Eye blink component
Mains (50 Hz) component
![Page 21: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/21.jpg)
AfrICA:Removingcomponents
• Onceweknowthecontributionofthebadcomponents
𝑌"#$%& = 𝐴"#$%& ∗ 𝑆"#$%&toourdata,wecansimplyremovethem:
𝑌+,-". = 𝑌 − 𝑌"#$%&
• ThislinearoperationcanberewrittenasamatrixoperationfromYtoYclean• àWheneveryouwant,youcansimplytransformyouroriginaldataY intoYclean byapplyingthatmatrixmultiplicationonthefly,i.e.online,noneedforanewdataset!• That’scalledan‘onlinemontage’!
![Page 22: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/22.jpg)
Youroutputafterrunningthemanualpipeline
• Youshouldhavecreatednewfileswithaprefixindicatingthepreprocessingperformedonthedata,.e.g
• ‘f’forfiltering• ‘d’fordownsampling• ‘A’fortheAFRICAdenoiseddata• ‘e’forepoching
• SamenamingconventionfortheautomatedOPTpipeline!
![Page 23: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/23.jpg)
Automaticpreprocessing withOPT
• Wouldn’titbegreattodoallthepreviousstepsjustautomaticallyandleanback?
• OSL’spreprocessingtool(OPT)allowsyoutodothat!
![Page 24: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/24.jpg)
OPT’sfullyautomatedpipeline:
OPTrunsthroughthefollowingpipelinesteps(anyofwhichcanbeoptionallyturnedoff):• ElektaNeuromagdata:Runsthe "DoubleMaxfilterProcedure"• ConversionofdataintoSPMformat• Downsampling• Filtering(hi-pass,notch,…)• Markingbadsegments• AutomatedAFRICAdenoising• Coregistration (neededifintendingtodosubsequentanalysisinsourcespace)• Epoching(Ifappropriate)• Automatedoutliertrialandchannelrejection
![Page 25: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/25.jpg)
OPTdatainput
Datacanbeinputas:
• Either(onlyforElektaNeuromagdata):• - thefullpathoftherawfiffiles(pre-SSS)topasstotheMaxfilter• Or:• - thefullpathoftheinput filesthatwillbepassedtotheSPMconvertfunction(for ElektaNeuromagdatathiswillbepost-SSS.fif files• Or:• - thefullpathofthe(alreadyconverted)SPMMEEGfiles
![Page 26: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/26.jpg)
RunOPT
Useosl_check_optcalltosetupanOPTstruct:• opt=osl_check_opt(opt);• Requiresonlylimitedmandatorysettings• Fillsotherfieldwithdefaultvalues(whichcanthenbeadjustedbeforerunning)
Useosl_run_opttorunanOPT:• opt=osl_run_opt(opt);
![Page 27: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/27.jpg)
OPToutput
• Resultsarestoredinthedirectoryspecifiedinopt.dirname,witha‘.opt’suffix• opt=osl_run_opt(opt) returnsaresultsfield:opt.results
• Thiscontains:• opt.results.logfile (filecontainingthematlabtextoutput)• opt.results.report:(Webpagereportwithdiagnosticplots)• opt.results.spm_files: (listofSPMMEEGobjectfilesforthecontinuousdata,e.g.topassintoanOATanalysis)• opt.results.spm_files_epoched: (listofSPMMEEGobjectfilesfortheepocheddata,e.g.topassintoanOATanalysis)
![Page 28: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/28.jpg)
Today’spracticals
• Practicals+dataareontheOSLWiki
• Practicalcorrespondstothislecturesandhas twoparts:
• 1)ManualPreprocessingPipeline
• 2)AutomatedPreprocessingPipeline(OPT)
![Page 29: OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses also a number of different toolboxes: •SPM •fieldtrip •FSL •osl-core (incl](https://reader034.vdocuments.us/reader034/viewer/2022042621/5f4f4aa32afa395c63033f06/html5/thumbnails/29.jpg)
Recommendedreading
• LookatandusetheOSLWiki!• IndependentComponentAnalysis(easy,butawholebook)
• IndependentComponentAnalysis– ATutorialIntroduction– JamesV.Stone
• fastICA&ICASSO(advanced)• Hyvärinen,A.,1999.Fastandrobustfixed-pointalgorithmsforindependentcomponentanalysis.IEEETrans.NeuralNetw.10(3),626–634.
• ICAde-noisinginMEG(relevant)• Mantini,D.,etal.2011.ASignal-ProcessingPipelineforMagnetoencephalographyResting-StateNetworks.BrainConnectivity,1(1),49–59.
• Iwantademo!• Finnishcocktailpartyhere:https://research.ics.aalto.fi/ica/cocktail/cocktail_en.cgihttps://research.ics.aalto.fi/ica/cocktail/cocktail_en.cgi