SlideShare a Scribd company logo
1 of 29
FieldTrip for the analysis of
iEEG (ECoG and SEEG) data
Robert Oostenveld
Donders Institute, Radboud University, Nijmegen, NL
NatMEG, Karolinska Institute, Stockholm, SE
What is FieldTrip
a MATLAB toolbox for the analysis of MEG, EEG
and invasively recorded electrophysiology data
can import data from many different file formats
contains algorithms for timeseries analysis,
spectral analysis, anatomical processing,
connectivity, statistics, …
How do we record signals from healthy participants
How do we analyze signals from healthy participants
EEG channels are comparable over participants
(within a study) and spatially quite blurry,
hence often channel-level analysis
MEG has better spatial resolution and the position
of the head varies between participants, hence
often source reconstruction and analysis+stats
at the brain level
How do we analyze iEEG signals
Intracranial EEG (both sEEG and ECoG) is
recorded in the brain, hence channel level is at
the brain level.
However, different implantation schemes over
participants and incomplete coverage.
Anatomical processing is more elaborate than with
EEG and MEG.
Anatomical labeling of the channels is used to
combine data over participants
iEEG pipeline
Some FieldTrip basics
dataout = functionname(cfg, datain, …)
functionname(cfg, datain, …)
dataout = functionname(cfg)
the “cfg” argument is a configuration structure, e.g.
cfg.channel = {‘C3’, C4’, ‘F3’, ‘F4’}
cfg.foilim = [1 70]
FieldTrip v.s. default Matlab
dataout = functionname(cfg, datain, …)
dataout = functionname(datain, key1, value1, …)
cfg.key1 = value1
cfg.key2 = value2
Using functions in an analysis protocol
ft_preprocessing
ft_rejectartifact
ft_freqanalysis
ft_multiplotTFR ft_freqstatistics
ft_multiplotTFR
FT_PREPROCESSING reads MEG and/or EEG data according to user-specified
trials and applies several user-specified preprocessing steps to the
signals.
Use as
[data] = ft_preprocessing(cfg)
or
[data] = ft_preprocessing(cfg, data)
The first input argument "cfg" is the configuration structure, which
contains all details for the dataset filenames, trials and the
preprocessing options. You can only do preprocessing after defining the
segments of data to be read from the file (i.e. the trials), which is for
example done based on the occurence of a trigger in the data.
...
Using functions in an analysis protocol
ft_preprocessing
ft_rejectartifact
ft_freqanalysis
ft_multiplotTFR ft_freqstatistics
ft_multiplotTFR
cfg = [ ]
cfg.dataset = ‘Subject01.ds’
cfg.bpfilter = [0.01 150]
...
rawdata = ft_preprocessing(cfg)
Using functions in an analysis protocol
ft_preprocessing
ft_rejectartifact
ft_freqanalysis
ft_multiplotTFR ft_freqstatistics
ft_multiplotTFR
cfg = [ ]
cfg.method = ‘mtmfft’
cfg.foilim = [1 120]
...
freqdata = ft_freqanalysis(cfg, rawdata)
Raw data structure
rawData =
label: {151x1 cell}
trial: {1x80 cell}
time: {1x80 cell}
fsample: 300
hdr: [1x1 struct]
cfg: [1x1 struct]
Event related response
timelockData =
label: {151x1 cell}
avg: [151x900 double]
var: [151x900 double]
time: [1x900 double]
dimord: 'chan_time’
cfg: [1x1 struct]
Example use in scripts
cfg = []
cfg.dataset = ‘Subject01.ds’
cfg.bpfilter = [0.01 150]
...
rawdata = ft_preprocessing(cfg)
cfg = []
cfg.method = ‘mtmfft’
cfg.foilim = [1 120]
...
freqdata = ft_freqanalysis(cfg, rawdata)
cfg = []
cfg.method = ‘montecarlo’
cfg.statistic = ‘indepsamplesT’
cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ]
...
freqstat = ft_freqstatistics(cfg, freqdata)
ft_preprocessing
ft_freqanalysis
ft_freqstatistics
ft_topoplotTFR
…
Example use in scripts
cfg = []
cfg.dataset = ‘Subject01.ds’
cfg.bpfilter = [0.01 150]
...
rawdata = ft_preprocessing(cfg)
cfg = []
cfg.method = ‘mtmfft’
cfg.foilim = [1 120]
...
freqdata = ft_freqanalysis(cfg, rawdata)
cfg = []
cfg.method = ‘montecarlo’
cfg.statistic = ‘indepsamplesT’
cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ]
...
freqstat = ft_freqstatistics(cfg, freqdata)
ft_preprocessing
ft_freqanalysis
ft_freqstatistics
ft_topoplotTFR
…
Example use in scripts
cfg = []
cfg.dataset = ‘Subject01.ds’
cfg.bpfilter = [0.01 150]
...
rawdata = ft_preprocessing(cfg)
cfg = []
cfg.method = ‘mtmfft’
cfg.foilim = [1 120]
...
freqdata = ft_freqanalysis(cfg, rawdata)
cfg = []
cfg.method = ‘montecarlo’
cfg.statistic = ‘indepsamplesT’
cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ]
...
freqstat = ft_freqstatistics(cfg, freqdata)
ft_preprocessing
ft_freqanalysis
ft_freqstatistics
ft_topoplotTFR
…
Example use in scripts
cfg = []
cfg.dataset = ‘Subject01.ds’
cfg.bpfilter = [0.01 150]
...
rawdata = ft_preprocessing(cfg)
cfg = []
cfg.method = ‘mtmfft’
cfg.foilim = [1 120]
...
freqdata = ft_freqanalysis(cfg, rawdata)
cfg = []
cfg.method = ‘montecarlo’
cfg.statistic = ‘indepsamplesT’
cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ]
...
freqstat = ft_freqstatistics(cfg, freqdata)
ft_preprocessing
ft_freqanalysis
ft_freqstatistics
ft_topoplotTFR
…
Example use in scripts
cfg = []
cfg.dataset = ‘Subject01.ds’
cfg.bpfilter = [0.01 150]
...
rawdata = ft_preprocessing(cfg)
cfg = []
cfg.method = ‘mtmfft’
cfg.foilim = [1 120]
...
freqdata = ft_freqanalysis(cfg, rawdata)
cfg = []
cfg.method = ‘montecarlo’
cfg.statistic = ‘indepsamplesT’
cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ]
...
freqstat = ft_freqstatistics(cfg, freqdata)
ft_preprocessing
ft_freqanalysis
ft_freqstatistics
ft_topoplotTFR
…
Example use in scripts
subj = {‘S01.ds’, ‘S02.ds’, …}
trig = [1 3 7 9]
for s=1:nsubj
for c=1:ncond
cfg = []
cfg.dataset = subj{s}
cfg.trigger = trig(c)
rawdata{s,c} = ft_preprocessing(cfg)
cfg = []
cfg.method = ‘mtmfft’
cfg.foilim = [1 120]
freqdata{s,c} = ft_freqanalysis(cfg, rawdata{s,c})
end
end
Example use in scripts
subj = {‘S01.ds’, ‘S02.ds’, …}
trig = [1 3 7 9]
for s=1:nsubj
for c=1:ncond
cfg = []
cfg.dataset = subj{s}
cfg.trigger = trig(c)
rawdata = ft_preprocessing(cfg)
filename = sprintf(‘raw%s_%d.mat’, subj{s}, trig(c));
save(filename, ‘rawdata’)
end
end
FieldTrip is a toolbox
the data and the separate functions are in
your hands
the scripts depend on the data properties,
your computer and on your programming
skills and style
scripts correspond to analysis protocols
scripts can be reviewed by supervisors
scripts are often shared with colleagues
scripts can be published/released
Example organization over multiple scripts
preprocess_sub01.m
preprocess_sub02.m
preprocess_sub03.m
...
anatomical_sub01.m
anatomical_sub02.m
anatomical_sub03.m
...
analysis_pipeline_RQ1.m
analysis_pipeline_RQ2.m
...
https://www.frontiersin.org/research-topics/5158/from-raw-
megeeg-to-publication-how-to-perform-megeeg-group-analysis-
with-free-academic-software
https://github.com/robertoostenveld/Wakeman-and-Henson-2015
details_sub01.m
details_sub02.m
details_sub03.m
...
do_preprocess.m
do_anatomical.m
analysis_pipeline_RQ1.m
analysis_pipeline_RQ2.m
...
Example organization within a script
%% details_sub01
datafile = ...
mrifile = ...
condition = {‘vis’, ’aud’}
trigger = [37 48];
%% do_preprocessing
subjid = ’sub01’;
eval([details subjid])
do_step1 = true;
do_step2 = false;
do_step3 = false;
if do_step1
cfg = [];
cfg = ...
data = ft_preprpocessing(cfg)
save(...)
end
if do_step2
load(...)
...
end
Finding your way around in the FieldTrip toolbox
Matlab
help functionname
edit functionname, e.g., edit ft_preprocessing
Website
http://www.fieldtriptoolbox.org
Email discussion list
Expertise in your local group
Zooming out a bit…
More tutorials available on
https://www.fieldtriptoolbox.org/tutorial
Video lectures available on
https://www.fieldtriptoolbox.org/video
What is BIDS and some relevant papers to read...
What is BIDS?
BIDS is a way to organize your existing raw data
To improve consistent and complete documentation
To facilitate re-use by your future self and others
http://bids.neuroimaging.io
FieldTrip tutorial at WIRED20204 in Paris
FieldTrip tutorial at WIRED20204 in Paris
FieldTrip tutorial at WIRED20204 in Paris

More Related Content

Similar to FieldTrip tutorial at WIRED20204 in Paris

20181212 - PGconfASIA - LT - English
20181212 - PGconfASIA - LT - English20181212 - PGconfASIA - LT - English
20181212 - PGconfASIA - LT - EnglishKohei KaiGai
 
TensorFlow.Data 및 TensorFlow Hub
TensorFlow.Data 및 TensorFlow HubTensorFlow.Data 및 TensorFlow Hub
TensorFlow.Data 및 TensorFlow HubJeongkyu Shin
 
Trelles_QnormBOSC2009
Trelles_QnormBOSC2009Trelles_QnormBOSC2009
Trelles_QnormBOSC2009bosc
 
Introduction to Kernel Programming
Introduction to Kernel ProgrammingIntroduction to Kernel Programming
Introduction to Kernel ProgrammingAhmed Mekkawy
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisFastly
 
Introduction to datastructure and algorithm
Introduction to datastructure and algorithmIntroduction to datastructure and algorithm
Introduction to datastructure and algorithmPratik Mota
 
Certification Study Group -Professional ML Engineer Session 2 (GCP-TensorFlow...
Certification Study Group -Professional ML Engineer Session 2 (GCP-TensorFlow...Certification Study Group -Professional ML Engineer Session 2 (GCP-TensorFlow...
Certification Study Group -Professional ML Engineer Session 2 (GCP-TensorFlow...gdgsurrey
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptxKarthikVijay59
 
Cloud Observation and Performance Analysis using Solaris 11 DTrace
Cloud Observation and Performance Analysis using Solaris 11 DTraceCloud Observation and Performance Analysis using Solaris 11 DTrace
Cloud Observation and Performance Analysis using Solaris 11 DTraceOrgad Kimchi
 
Kapacitor - Real Time Data Processing Engine
Kapacitor - Real Time Data Processing EngineKapacitor - Real Time Data Processing Engine
Kapacitor - Real Time Data Processing EnginePrashant Vats
 
Inference accelerators
Inference acceleratorsInference accelerators
Inference acceleratorsDarshanG13
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 DsQundeel
 
Data Structure
Data StructureData Structure
Data Structuresheraz1
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 DsQundeel
 
Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Piotr Milanowski
 
Flink Forward San Francisco 2019: TensorFlow Extended: An end-to-end machine ...
Flink Forward San Francisco 2019: TensorFlow Extended: An end-to-end machine ...Flink Forward San Francisco 2019: TensorFlow Extended: An end-to-end machine ...
Flink Forward San Francisco 2019: TensorFlow Extended: An end-to-end machine ...Flink Forward
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with RYanchang Zhao
 

Similar to FieldTrip tutorial at WIRED20204 in Paris (20)

Writing Faster Python 3
Writing Faster Python 3Writing Faster Python 3
Writing Faster Python 3
 
20181212 - PGconfASIA - LT - English
20181212 - PGconfASIA - LT - English20181212 - PGconfASIA - LT - English
20181212 - PGconfASIA - LT - English
 
TensorFlow.Data 및 TensorFlow Hub
TensorFlow.Data 및 TensorFlow HubTensorFlow.Data 및 TensorFlow Hub
TensorFlow.Data 및 TensorFlow Hub
 
Trelles_QnormBOSC2009
Trelles_QnormBOSC2009Trelles_QnormBOSC2009
Trelles_QnormBOSC2009
 
Introduction to Kernel Programming
Introduction to Kernel ProgrammingIntroduction to Kernel Programming
Introduction to Kernel Programming
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
 
Introduction to datastructure and algorithm
Introduction to datastructure and algorithmIntroduction to datastructure and algorithm
Introduction to datastructure and algorithm
 
Profiling in Python
Profiling in PythonProfiling in Python
Profiling in Python
 
Certification Study Group -Professional ML Engineer Session 2 (GCP-TensorFlow...
Certification Study Group -Professional ML Engineer Session 2 (GCP-TensorFlow...Certification Study Group -Professional ML Engineer Session 2 (GCP-TensorFlow...
Certification Study Group -Professional ML Engineer Session 2 (GCP-TensorFlow...
 
Data structures notes for college students btech.pptx
Data structures notes for college students btech.pptxData structures notes for college students btech.pptx
Data structures notes for college students btech.pptx
 
Cloud Observation and Performance Analysis using Solaris 11 DTrace
Cloud Observation and Performance Analysis using Solaris 11 DTraceCloud Observation and Performance Analysis using Solaris 11 DTrace
Cloud Observation and Performance Analysis using Solaris 11 DTrace
 
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop  - Xi...PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop  - Xi...
PMED Undergraduate Workshop - R Tutorial for PMED Undegraduate Workshop - Xi...
 
Kapacitor - Real Time Data Processing Engine
Kapacitor - Real Time Data Processing EngineKapacitor - Real Time Data Processing Engine
Kapacitor - Real Time Data Processing Engine
 
Inference accelerators
Inference acceleratorsInference accelerators
Inference accelerators
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
 
Data Structure
Data StructureData Structure
Data Structure
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
 
Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.
 
Flink Forward San Francisco 2019: TensorFlow Extended: An end-to-end machine ...
Flink Forward San Francisco 2019: TensorFlow Extended: An end-to-end machine ...Flink Forward San Francisco 2019: TensorFlow Extended: An end-to-end machine ...
Flink Forward San Francisco 2019: TensorFlow Extended: An end-to-end machine ...
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with R
 

More from Robert Oostenveld

Developing and sharing tools for bioelectromagnetic research
Developing and sharing tools for bioelectromagnetic researchDeveloping and sharing tools for bioelectromagnetic research
Developing and sharing tools for bioelectromagnetic researchRobert Oostenveld
 
Connecting GLIMR with the BIDS initiative
Connecting GLIMR with the BIDS initiativeConnecting GLIMR with the BIDS initiative
Connecting GLIMR with the BIDS initiativeRobert Oostenveld
 
Spectral-, source-, connectivity- and network analysis of EEG and MEG data
Spectral-, source-, connectivity- and network analysis of EEG and MEG dataSpectral-, source-, connectivity- and network analysis of EEG and MEG data
Spectral-, source-, connectivity- and network analysis of EEG and MEG dataRobert Oostenveld
 
Donders neuroimage toolkit - open science and good practices
Donders neuroimage toolkit -  open science and good practicesDonders neuroimage toolkit -  open science and good practices
Donders neuroimage toolkit - open science and good practicesRobert Oostenveld
 
Using Open Science to advance science - advancing open data
Using Open Science to advance science - advancing open data Using Open Science to advance science - advancing open data
Using Open Science to advance science - advancing open data Robert Oostenveld
 
OHBM 2020 OSR - Brain research data sharing and personal data privacy
OHBM 2020 OSR - Brain research data sharing and personal data privacyOHBM 2020 OSR - Brain research data sharing and personal data privacy
OHBM 2020 OSR - Brain research data sharing and personal data privacyRobert Oostenveld
 
The Brain Imaging Data Structure and its use for fNIRS
The Brain Imaging Data Structure and its use for fNIRSThe Brain Imaging Data Structure and its use for fNIRS
The Brain Imaging Data Structure and its use for fNIRSRobert Oostenveld
 
Organizing EEG data using the Brain Imaging Data Structure
Organizing EEG data using the Brain Imaging Data Structure Organizing EEG data using the Brain Imaging Data Structure
Organizing EEG data using the Brain Imaging Data Structure Robert Oostenveld
 
BIOMAG2018 - Denis Engemann - MNE-HCP
BIOMAG2018 - Denis Engemann - MNE-HCPBIOMAG2018 - Denis Engemann - MNE-HCP
BIOMAG2018 - Denis Engemann - MNE-HCPRobert Oostenveld
 
BIOMAG2018 - Tzvetan Popov - HCP from a user's perspective
BIOMAG2018 - Tzvetan Popov - HCP from a user's perspectiveBIOMAG2018 - Tzvetan Popov - HCP from a user's perspective
BIOMAG2018 - Tzvetan Popov - HCP from a user's perspectiveRobert Oostenveld
 
BIOMAG2018 - Vladimir Litvak - Frontiers
BIOMAG2018 - Vladimir Litvak - FrontiersBIOMAG2018 - Vladimir Litvak - Frontiers
BIOMAG2018 - Vladimir Litvak - FrontiersRobert Oostenveld
 
BIOMAG2018 - Jan-Mathijs Schoffelen - COBIDAS
BIOMAG2018 - Jan-Mathijs Schoffelen - COBIDASBIOMAG2018 - Jan-Mathijs Schoffelen - COBIDAS
BIOMAG2018 - Jan-Mathijs Schoffelen - COBIDASRobert Oostenveld
 
BIOMAG2018 - Darren Price - CamCAN
BIOMAG2018 - Darren Price - CamCANBIOMAG2018 - Darren Price - CamCAN
BIOMAG2018 - Darren Price - CamCANRobert Oostenveld
 
CuttingEEG - Open Science, Open Data and BIDS for EEG
CuttingEEG - Open Science, Open Data and BIDS for EEGCuttingEEG - Open Science, Open Data and BIDS for EEG
CuttingEEG - Open Science, Open Data and BIDS for EEGRobert Oostenveld
 
ChildBrain/Predictable summer school - Open Science
ChildBrain/Predictable summer school - Open Science ChildBrain/Predictable summer school - Open Science
ChildBrain/Predictable summer school - Open Science Robert Oostenveld
 
Using Open Science to accelerate advancements in auditory EEG signal processing
Using Open Science to accelerate advancements in auditory EEG signal processingUsing Open Science to accelerate advancements in auditory EEG signal processing
Using Open Science to accelerate advancements in auditory EEG signal processingRobert Oostenveld
 
Donders Repository - removing barriers for management and sharing of research...
Donders Repository - removing barriers for management and sharing of research...Donders Repository - removing barriers for management and sharing of research...
Donders Repository - removing barriers for management and sharing of research...Robert Oostenveld
 
RDM and the Donders Repository
RDM and the Donders RepositoryRDM and the Donders Repository
RDM and the Donders RepositoryRobert Oostenveld
 
Donders Research Data Repository
Donders Research Data Repository Donders Research Data Repository
Donders Research Data Repository Robert Oostenveld
 

More from Robert Oostenveld (20)

Developing and sharing tools for bioelectromagnetic research
Developing and sharing tools for bioelectromagnetic researchDeveloping and sharing tools for bioelectromagnetic research
Developing and sharing tools for bioelectromagnetic research
 
Connecting GLIMR with the BIDS initiative
Connecting GLIMR with the BIDS initiativeConnecting GLIMR with the BIDS initiative
Connecting GLIMR with the BIDS initiative
 
Spectral-, source-, connectivity- and network analysis of EEG and MEG data
Spectral-, source-, connectivity- and network analysis of EEG and MEG dataSpectral-, source-, connectivity- and network analysis of EEG and MEG data
Spectral-, source-, connectivity- and network analysis of EEG and MEG data
 
Donders neuroimage toolkit - open science and good practices
Donders neuroimage toolkit -  open science and good practicesDonders neuroimage toolkit -  open science and good practices
Donders neuroimage toolkit - open science and good practices
 
The Donders Repository
The Donders RepositoryThe Donders Repository
The Donders Repository
 
Using Open Science to advance science - advancing open data
Using Open Science to advance science - advancing open data Using Open Science to advance science - advancing open data
Using Open Science to advance science - advancing open data
 
OHBM 2020 OSR - Brain research data sharing and personal data privacy
OHBM 2020 OSR - Brain research data sharing and personal data privacyOHBM 2020 OSR - Brain research data sharing and personal data privacy
OHBM 2020 OSR - Brain research data sharing and personal data privacy
 
The Brain Imaging Data Structure and its use for fNIRS
The Brain Imaging Data Structure and its use for fNIRSThe Brain Imaging Data Structure and its use for fNIRS
The Brain Imaging Data Structure and its use for fNIRS
 
Organizing EEG data using the Brain Imaging Data Structure
Organizing EEG data using the Brain Imaging Data Structure Organizing EEG data using the Brain Imaging Data Structure
Organizing EEG data using the Brain Imaging Data Structure
 
BIOMAG2018 - Denis Engemann - MNE-HCP
BIOMAG2018 - Denis Engemann - MNE-HCPBIOMAG2018 - Denis Engemann - MNE-HCP
BIOMAG2018 - Denis Engemann - MNE-HCP
 
BIOMAG2018 - Tzvetan Popov - HCP from a user's perspective
BIOMAG2018 - Tzvetan Popov - HCP from a user's perspectiveBIOMAG2018 - Tzvetan Popov - HCP from a user's perspective
BIOMAG2018 - Tzvetan Popov - HCP from a user's perspective
 
BIOMAG2018 - Vladimir Litvak - Frontiers
BIOMAG2018 - Vladimir Litvak - FrontiersBIOMAG2018 - Vladimir Litvak - Frontiers
BIOMAG2018 - Vladimir Litvak - Frontiers
 
BIOMAG2018 - Jan-Mathijs Schoffelen - COBIDAS
BIOMAG2018 - Jan-Mathijs Schoffelen - COBIDASBIOMAG2018 - Jan-Mathijs Schoffelen - COBIDAS
BIOMAG2018 - Jan-Mathijs Schoffelen - COBIDAS
 
BIOMAG2018 - Darren Price - CamCAN
BIOMAG2018 - Darren Price - CamCANBIOMAG2018 - Darren Price - CamCAN
BIOMAG2018 - Darren Price - CamCAN
 
CuttingEEG - Open Science, Open Data and BIDS for EEG
CuttingEEG - Open Science, Open Data and BIDS for EEGCuttingEEG - Open Science, Open Data and BIDS for EEG
CuttingEEG - Open Science, Open Data and BIDS for EEG
 
ChildBrain/Predictable summer school - Open Science
ChildBrain/Predictable summer school - Open Science ChildBrain/Predictable summer school - Open Science
ChildBrain/Predictable summer school - Open Science
 
Using Open Science to accelerate advancements in auditory EEG signal processing
Using Open Science to accelerate advancements in auditory EEG signal processingUsing Open Science to accelerate advancements in auditory EEG signal processing
Using Open Science to accelerate advancements in auditory EEG signal processing
 
Donders Repository - removing barriers for management and sharing of research...
Donders Repository - removing barriers for management and sharing of research...Donders Repository - removing barriers for management and sharing of research...
Donders Repository - removing barriers for management and sharing of research...
 
RDM and the Donders Repository
RDM and the Donders RepositoryRDM and the Donders Repository
RDM and the Donders Repository
 
Donders Research Data Repository
Donders Research Data Repository Donders Research Data Repository
Donders Research Data Repository
 

Recently uploaded

All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...Sérgio Sacani
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)Areesha Ahmad
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptxRajatChauhan518211
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfSumit Kumar yadav
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 
Pests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPirithiRaju
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡anilsa9823
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )aarthirajkumar25
 
fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyDrAnita Sharma
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSSLeenakshiTyagi
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)Areesha Ahmad
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bSérgio Sacani
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfSumit Kumar yadav
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)Areesha Ahmad
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfSumit Kumar yadav
 

Recently uploaded (20)

All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptx
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 
Pests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdfPests of mustard_Identification_Management_Dr.UPR.pdf
Pests of mustard_Identification_Management_Dr.UPR.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )
 
fundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomologyfundamental of entomology all in one topics of entomology
fundamental of entomology all in one topics of entomology
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSS
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdf
 

FieldTrip tutorial at WIRED20204 in Paris

  • 1. FieldTrip for the analysis of iEEG (ECoG and SEEG) data Robert Oostenveld Donders Institute, Radboud University, Nijmegen, NL NatMEG, Karolinska Institute, Stockholm, SE
  • 2. What is FieldTrip a MATLAB toolbox for the analysis of MEG, EEG and invasively recorded electrophysiology data can import data from many different file formats contains algorithms for timeseries analysis, spectral analysis, anatomical processing, connectivity, statistics, …
  • 3. How do we record signals from healthy participants
  • 4. How do we analyze signals from healthy participants EEG channels are comparable over participants (within a study) and spatially quite blurry, hence often channel-level analysis MEG has better spatial resolution and the position of the head varies between participants, hence often source reconstruction and analysis+stats at the brain level
  • 5. How do we analyze iEEG signals Intracranial EEG (both sEEG and ECoG) is recorded in the brain, hence channel level is at the brain level. However, different implantation schemes over participants and incomplete coverage. Anatomical processing is more elaborate than with EEG and MEG. Anatomical labeling of the channels is used to combine data over participants
  • 7. Some FieldTrip basics dataout = functionname(cfg, datain, …) functionname(cfg, datain, …) dataout = functionname(cfg) the “cfg” argument is a configuration structure, e.g. cfg.channel = {‘C3’, C4’, ‘F3’, ‘F4’} cfg.foilim = [1 70]
  • 8. FieldTrip v.s. default Matlab dataout = functionname(cfg, datain, …) dataout = functionname(datain, key1, value1, …) cfg.key1 = value1 cfg.key2 = value2
  • 9. Using functions in an analysis protocol ft_preprocessing ft_rejectartifact ft_freqanalysis ft_multiplotTFR ft_freqstatistics ft_multiplotTFR FT_PREPROCESSING reads MEG and/or EEG data according to user-specified trials and applies several user-specified preprocessing steps to the signals. Use as [data] = ft_preprocessing(cfg) or [data] = ft_preprocessing(cfg, data) The first input argument "cfg" is the configuration structure, which contains all details for the dataset filenames, trials and the preprocessing options. You can only do preprocessing after defining the segments of data to be read from the file (i.e. the trials), which is for example done based on the occurence of a trigger in the data. ...
  • 10. Using functions in an analysis protocol ft_preprocessing ft_rejectartifact ft_freqanalysis ft_multiplotTFR ft_freqstatistics ft_multiplotTFR cfg = [ ] cfg.dataset = ‘Subject01.ds’ cfg.bpfilter = [0.01 150] ... rawdata = ft_preprocessing(cfg)
  • 11. Using functions in an analysis protocol ft_preprocessing ft_rejectartifact ft_freqanalysis ft_multiplotTFR ft_freqstatistics ft_multiplotTFR cfg = [ ] cfg.method = ‘mtmfft’ cfg.foilim = [1 120] ... freqdata = ft_freqanalysis(cfg, rawdata)
  • 12. Raw data structure rawData = label: {151x1 cell} trial: {1x80 cell} time: {1x80 cell} fsample: 300 hdr: [1x1 struct] cfg: [1x1 struct]
  • 13. Event related response timelockData = label: {151x1 cell} avg: [151x900 double] var: [151x900 double] time: [1x900 double] dimord: 'chan_time’ cfg: [1x1 struct]
  • 14. Example use in scripts cfg = [] cfg.dataset = ‘Subject01.ds’ cfg.bpfilter = [0.01 150] ... rawdata = ft_preprocessing(cfg) cfg = [] cfg.method = ‘mtmfft’ cfg.foilim = [1 120] ... freqdata = ft_freqanalysis(cfg, rawdata) cfg = [] cfg.method = ‘montecarlo’ cfg.statistic = ‘indepsamplesT’ cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ] ... freqstat = ft_freqstatistics(cfg, freqdata) ft_preprocessing ft_freqanalysis ft_freqstatistics ft_topoplotTFR …
  • 15. Example use in scripts cfg = [] cfg.dataset = ‘Subject01.ds’ cfg.bpfilter = [0.01 150] ... rawdata = ft_preprocessing(cfg) cfg = [] cfg.method = ‘mtmfft’ cfg.foilim = [1 120] ... freqdata = ft_freqanalysis(cfg, rawdata) cfg = [] cfg.method = ‘montecarlo’ cfg.statistic = ‘indepsamplesT’ cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ] ... freqstat = ft_freqstatistics(cfg, freqdata) ft_preprocessing ft_freqanalysis ft_freqstatistics ft_topoplotTFR …
  • 16. Example use in scripts cfg = [] cfg.dataset = ‘Subject01.ds’ cfg.bpfilter = [0.01 150] ... rawdata = ft_preprocessing(cfg) cfg = [] cfg.method = ‘mtmfft’ cfg.foilim = [1 120] ... freqdata = ft_freqanalysis(cfg, rawdata) cfg = [] cfg.method = ‘montecarlo’ cfg.statistic = ‘indepsamplesT’ cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ] ... freqstat = ft_freqstatistics(cfg, freqdata) ft_preprocessing ft_freqanalysis ft_freqstatistics ft_topoplotTFR …
  • 17. Example use in scripts cfg = [] cfg.dataset = ‘Subject01.ds’ cfg.bpfilter = [0.01 150] ... rawdata = ft_preprocessing(cfg) cfg = [] cfg.method = ‘mtmfft’ cfg.foilim = [1 120] ... freqdata = ft_freqanalysis(cfg, rawdata) cfg = [] cfg.method = ‘montecarlo’ cfg.statistic = ‘indepsamplesT’ cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ] ... freqstat = ft_freqstatistics(cfg, freqdata) ft_preprocessing ft_freqanalysis ft_freqstatistics ft_topoplotTFR …
  • 18. Example use in scripts cfg = [] cfg.dataset = ‘Subject01.ds’ cfg.bpfilter = [0.01 150] ... rawdata = ft_preprocessing(cfg) cfg = [] cfg.method = ‘mtmfft’ cfg.foilim = [1 120] ... freqdata = ft_freqanalysis(cfg, rawdata) cfg = [] cfg.method = ‘montecarlo’ cfg.statistic = ‘indepsamplesT’ cfg.design = [1 2 1 2 2 1 2 1 1 2 ... ] ... freqstat = ft_freqstatistics(cfg, freqdata) ft_preprocessing ft_freqanalysis ft_freqstatistics ft_topoplotTFR …
  • 19. Example use in scripts subj = {‘S01.ds’, ‘S02.ds’, …} trig = [1 3 7 9] for s=1:nsubj for c=1:ncond cfg = [] cfg.dataset = subj{s} cfg.trigger = trig(c) rawdata{s,c} = ft_preprocessing(cfg) cfg = [] cfg.method = ‘mtmfft’ cfg.foilim = [1 120] freqdata{s,c} = ft_freqanalysis(cfg, rawdata{s,c}) end end
  • 20. Example use in scripts subj = {‘S01.ds’, ‘S02.ds’, …} trig = [1 3 7 9] for s=1:nsubj for c=1:ncond cfg = [] cfg.dataset = subj{s} cfg.trigger = trig(c) rawdata = ft_preprocessing(cfg) filename = sprintf(‘raw%s_%d.mat’, subj{s}, trig(c)); save(filename, ‘rawdata’) end end
  • 21. FieldTrip is a toolbox the data and the separate functions are in your hands the scripts depend on the data properties, your computer and on your programming skills and style scripts correspond to analysis protocols scripts can be reviewed by supervisors scripts are often shared with colleagues scripts can be published/released
  • 22. Example organization over multiple scripts preprocess_sub01.m preprocess_sub02.m preprocess_sub03.m ... anatomical_sub01.m anatomical_sub02.m anatomical_sub03.m ... analysis_pipeline_RQ1.m analysis_pipeline_RQ2.m ... https://www.frontiersin.org/research-topics/5158/from-raw- megeeg-to-publication-how-to-perform-megeeg-group-analysis- with-free-academic-software https://github.com/robertoostenveld/Wakeman-and-Henson-2015 details_sub01.m details_sub02.m details_sub03.m ... do_preprocess.m do_anatomical.m analysis_pipeline_RQ1.m analysis_pipeline_RQ2.m ...
  • 23. Example organization within a script %% details_sub01 datafile = ... mrifile = ... condition = {‘vis’, ’aud’} trigger = [37 48]; %% do_preprocessing subjid = ’sub01’; eval([details subjid]) do_step1 = true; do_step2 = false; do_step3 = false; if do_step1 cfg = []; cfg = ... data = ft_preprpocessing(cfg) save(...) end if do_step2 load(...) ... end
  • 24. Finding your way around in the FieldTrip toolbox Matlab help functionname edit functionname, e.g., edit ft_preprocessing Website http://www.fieldtriptoolbox.org Email discussion list Expertise in your local group
  • 25. Zooming out a bit… More tutorials available on https://www.fieldtriptoolbox.org/tutorial Video lectures available on https://www.fieldtriptoolbox.org/video What is BIDS and some relevant papers to read...
  • 26. What is BIDS? BIDS is a way to organize your existing raw data To improve consistent and complete documentation To facilitate re-use by your future self and others http://bids.neuroimaging.io