OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses...
Transcript of OHBA M/EEG Analysis Workshop · OSL = OHBA’s software library OSL is written in matlab but uses...
MarkWoolrichDiegoVidaurreAndrewQuinn
Romesh AbeysuriyaRobertBecker
OHBAM/EEGAnalysisWorkshop
WorkshopSchedule
• Tuesday• Session1:Preprocessing,manualandautomaticpipelines• Session2:Taskdataanalysisinsensorspace(subjectlevel)• Session3:Taskdataanalysisinsourcespace(subjectlevel)
• Thursday• Session4:Taskdataanalysisgrouplevel• Session5:Connectivityanalysisinsourcespace,subjectandgrouplevel• Session6:Hidden-Markov-Modeling inrestandtaskdata
Tuesday’sSchedule
09:30Session1lecture10:00CoffeeBreak10:10Session1practical11:30Session2lecture12:00Lunch(notprovided)13:00Session2practical14:20CoffeeBreak14:30Session3lecture15:00Session3practical16:30Finish
OSLPreprocessing
RobertBeckerOSLworkshopOHBA,Oxford
25.04.17
OSL=OHBA’ssoftwarelibrary
OSLiswritteninmatlabbutusesalsoanumberofdifferenttoolboxes:
• SPM• fieldtrip• FSL• osl-core(incl.OPT,OAT,ROInets,GLEAN,HMM-MARetc)• Utilities• …ProvidescompletepipelinetoprocessandanalyseyourMEGdata
MEGbasics:Howwemeasure
• ElektaNeuromagsystemhas306helium-cooledSQUIDsensors:102radialmagnetometersand204planargradiometers• Magnetometersmeasuremagneticfieldstrengthperpendiculartosurfaceofsensors(z-axis),gradiometersmeasuremagneticfieldchanges(xandydirection)• HasalsoEEGrecordingcapabilities+ECGandEOG
MEGandartefacts:Whatwe(wantto)measure
This!
Session1:Overview
• Introduction:typicalMEGartefacts• ManualPreprocessing:• Usingthemaxfilter• Filteringanddownsampling• VisualInspectionofdata:OSLview• De-noisingdata:artefactrejectionbyusingindependentcomponentanalysis(AFRICA)
• AutomatedPreprocessing:• UsingOSL’spreprocessingtool(OPT)
MEGandartefacts:Commonsources
• Biologicalartifacts• Saccades,blinks,microsaccades
• Muscularartefacts• Heartbeat• Respiration
• Electrical/other• 50Hzlinenoise• Scannerartifacts(jumps,spikes)• Channelsaturation• MRImagnetisation• Subjectmovements
Strategiesfordealingwithartefacts
• Beforeandduringacquisition:• Avoidthem(eyeblinks,movementsetc.)!
• Post-acquisition:• Maxfilternoisesuppression• Filteroutproblematicfrequencies• Removingbadperiodsbyvisualinspection• UseICAtoremoveproblematiccomponents• -->themoreyouknowaboutthem,thebetter,e.gbyrecordingECGandEOG(seelater)
Manualpreprocessing:Maxfilter
• MaxfilterisproprietarysoftwareprovidedbyElektafortheirscanner,whichimplementsasignalspaceseparation(SSS)algorithmtoreduceexternalnoise(bout):
Maxfiltercanalsodo:
MovementcompensationAlignmentDetectbadchannelsDownsampledata
Manualpreprocessing:Filteringanddownsampling• Efficientforremovingoflow-frequencydriftsandline-noise
• Downside:Mightdistortyoursignalofinterest:• Taskdata:Phase,latencyofevokedfields• Restdata:Connectivitymeasures?
• à Conservativeuseoffiltering;alwaysinspectyourdataafterfiltering!
• Downsampling:optional
Manualpreprocessing:Visualinspection forbadperiods• Importantstepduringmanualpreprocessing
• But:Equallyimportanttodouble-checkperformanceduringautomaticpreprocessing!
• Downside:Completelossofrejecteddata(channels/periods/trials)
• WewilluseourOSLviewdataviewertodothis:
Manualpreprocessing:Visualinspectionwith OSLview
channelvariances
“BadEpoch”segments
savebutton
changechanneltype
datainviewingwindow
Rightclickinthisspacetosetdata
to“Bad”
Averagechannelvariance
Manualpreprocessing:AfRICA:ArtefactrejectionusingIndependentComponentAnalysis(AfRICA)
ICAisadata-drivenBBSalgorithmtosplitourMEGdata(Y)
intoanumberoftemporallyindependentcomponents(S)byidentifyingthemixingmatrix(A).
YNsamples
Nchanne
ls
ANcomponents
Nchan
nels S
Nsamples
Ncompo
nentsx=
HowICAworksNon
-Gaussianity
(kurtosis)
Numberofmixedsignals ↑
Thekeyingredient:AmixtureofsignalsisalwaysmoreGaussian thantheunderlyingsignals (akathecentrallimittheorem).
• Means:Bysearchingforthesetofmaximallynon-Gaussiansignalswecanreversethemixingprocessandrecoverourunknownsources.
HowICAworksNon
-Gaussianity
(kurtosis)
Numberofmixedsignals ↑
• Means:Bysearchingforthesetofmaximallynon-Gaussiansignalswecanreversethemixingprocessandrecoverourunknownsources.• DoesnotworkwithGaussiansources…
Sources(brainactivity)
Sources(linenoise)Mixture(Y)
Thekeyingredient:AmixtureofsignalsisalwaysmoreGaussianthantheunderlyingsignals(akathecentrallimittheorem).
AfRICA:Classifyingcomponents
• Now,havingindependentcomponents isgreat,butwhichofthesourcesareartefacts?
• AfrICAofferswaystoguideyou:• Visualinspection
• Timecourse,spectrum,topography• Correlationwithexternalsignals
• IfyouhaveacquiredECGorEOGthenAfRICAwillsorttheindepentcomponentsaccordingtotheirsimilarity
AfrICA:Userinterfacemetrics(e.g.kurtosis,ECG,
EOG,mains)
sensortopographies
Setcomponentasbad(orrevertto
good)
powerspectrum
AfrICA:Typicalcomponents
Cardiac component
Eye blink component
Mains (50 Hz) component
AfrICA:Removingcomponents
• Onceweknowthecontributionofthebadcomponents
𝑌"#$%& = 𝐴"#$%& ∗ 𝑆"#$%&toourdata,wecansimplyremovethem:
𝑌+,-". = 𝑌 − 𝑌"#$%&
• ThislinearoperationcanberewrittenasamatrixoperationfromYtoYclean• àWheneveryouwant,youcansimplytransformyouroriginaldataY intoYclean byapplyingthatmatrixmultiplicationonthefly,i.e.online,noneedforanewdataset!• That’scalledan‘onlinemontage’!
Youroutputafterrunningthemanualpipeline
• Youshouldhavecreatednewfileswithaprefixindicatingthepreprocessingperformedonthedata,.e.g
• ‘f’forfiltering• ‘d’fordownsampling• ‘A’fortheAFRICAdenoiseddata• ‘e’forepoching
• SamenamingconventionfortheautomatedOPTpipeline!
Automaticpreprocessing withOPT
• Wouldn’titbegreattodoallthepreviousstepsjustautomaticallyandleanback?
• OSL’spreprocessingtool(OPT)allowsyoutodothat!
OPT’sfullyautomatedpipeline:
OPTrunsthroughthefollowingpipelinesteps(anyofwhichcanbeoptionallyturnedoff):• ElektaNeuromagdata:Runsthe "DoubleMaxfilterProcedure"• ConversionofdataintoSPMformat• Downsampling• Filtering(hi-pass,notch,…)• Markingbadsegments• AutomatedAFRICAdenoising• Coregistration (neededifintendingtodosubsequentanalysisinsourcespace)• Epoching(Ifappropriate)• Automatedoutliertrialandchannelrejection
OPTdatainput
Datacanbeinputas:
• Either(onlyforElektaNeuromagdata):• - thefullpathoftherawfiffiles(pre-SSS)topasstotheMaxfilter• Or:• - thefullpathoftheinput filesthatwillbepassedtotheSPMconvertfunction(for ElektaNeuromagdatathiswillbepost-SSS.fif files• Or:• - thefullpathofthe(alreadyconverted)SPMMEEGfiles
RunOPT
Useosl_check_optcalltosetupanOPTstruct:• opt=osl_check_opt(opt);• Requiresonlylimitedmandatorysettings• Fillsotherfieldwithdefaultvalues(whichcanthenbeadjustedbeforerunning)
Useosl_run_opttorunanOPT:• opt=osl_run_opt(opt);
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)
Today’spracticals
• Practicals+dataareontheOSLWiki
• Practicalcorrespondstothislecturesandhas twoparts:
• 1)ManualPreprocessingPipeline
• 2)AutomatedPreprocessingPipeline(OPT)
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