Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:coherence [2014/10/01 18:45]
nietzsche [Computing the coherence]
tutorial:coherence [2018/04/09 20:21] (current)
Line 18: Line 18:
 To compute the coherence between the MEG and EMG signals for the example dataset we will perform the following steps: To compute the coherence between the MEG and EMG signals for the example dataset we will perform the following steps:
  
-   * Read the data into Matlab ​using **[[reference:​ft_preprocessing|ft_preprocessing]]**+   * Read the data into MATLAB ​using **[[reference:​ft_preprocessing|ft_preprocessing]]**
    * Compute the power spectra and cross-spectral densities using the function **[[reference:​ft_freqanalysis|ft_freqanalysis]]** and subsequently compute the coherence using **[[reference:​ft_connectivityanalysis|ft_connectivityanalysis]]**    * Compute the power spectra and cross-spectral densities using the function **[[reference:​ft_freqanalysis|ft_freqanalysis]]** and subsequently compute the coherence using **[[reference:​ft_connectivityanalysis|ft_connectivityanalysis]]**
    * Visualize the results using **[[reference:​ft_singleplotER|ft_singleplotER]]**,​ **[[reference:​ft_multiplotER|ft_multiplotER]]**,​ and **[[reference:​ft_topoplotER|ft_topoplotER]]**    * Visualize the results using **[[reference:​ft_singleplotER|ft_singleplotER]]**,​ **[[reference:​ft_multiplotER|ft_multiplotER]]**,​ and **[[reference:​ft_topoplotER|ft_topoplotER]]**
Line 26: Line 26:
  
 We will calculate the coherence between the MEG and the EMG when the subject extended her LEFT wrist, while keeping the right forearm muscle relaxed. ​ We will calculate the coherence between the MEG and the EMG when the subject extended her LEFT wrist, while keeping the right forearm muscle relaxed. ​
-The first step is to read the data. In this section we will apply automatic artifact rejection. Preprocessing requires the original MEG dataset, which is available from [[ftp://​ftp.fcdonders.nl/​pub/​fieldtrip/​tutorial/​SubjectCMC.zip]].+The first step is to read the data. In this section we will apply automatic artifact rejection. Preprocessing requires the original MEG dataset, which is available from [[ftp://​ftp.fieldtriptoolbox.org/​pub/​fieldtrip/​tutorial/​SubjectCMC.zip]].
  
-The epochs of interest have to be defined according to a custom-written function called trialfun_left.m. Note that this function is not part of the FieldTrip toolbox: see [[tutorial:​coherence#​appendix_2trialfun_left|appendix 2]], or download it from [[ftp://​ftp.fcdonders.nl/​pub/​fieldtrip/​tutorial/​coherence/​trialfun_left.m]]. This function uses the information provided by the triggers which were recorded simultaneously with the data. In this experiment each trigger corresponds with the start or the end of a contraction. The epochs which correspond to a contraction of the left forearm muscle are selected. Subsequently these 10-second pieces are cut into ten 1-second epochs.+The epochs of interest have to be defined according to a custom-written function called trialfun_left.m. Note that this function is not part of the FieldTrip toolbox: see [[tutorial:​coherence#​appendix_2trialfun_left|appendix 2]], or download it from [[ftp://​ftp.fieldtriptoolbox.org/​pub/​fieldtrip/​tutorial/​coherence/​trialfun_left.m]]. This function uses the information provided by the triggers which were recorded simultaneously with the data. In this experiment each trigger corresponds with the start or the end of a contraction. The epochs which correspond to a contraction of the left forearm muscle are selected. Subsequently these 10-second pieces are cut into ten 1-second epochs.
  
 <​code>​ <​code>​
Line 93: Line 93:
   save data data    save data data 
  
-The preprocessed data is available as a mat-file from the  [[ftp://​ftp.fcdonders.nl/​pub/​fieldtrip/​tutorial/​coherence/​data.mat|FieldTrip ftp server (data.mat)]] and you can skip the preprocessing above by loading the data like this+The preprocessed data is available as a mat-file from the  [[ftp://​ftp.fieldtriptoolbox.org/​pub/​fieldtrip/​tutorial/​coherence/​data.mat|FieldTrip ftp server (data.mat)]] and you can skip the preprocessing above by loading the data like this
  
   load data    load data 
Line 113: Line 113:
 {{tutorial:​coherence:​figure1c.png?​400}} {{tutorial:​coherence:​figure1c.png?​400}}
  
-//Figure 1; An example of the raw MEG data from sensor MLC21 (upper frame) and the EMG data (lower frame). The signals are from the output of **[[reference:​ft_preprocessing|ft_preprocessing]]** and plotted using the matlab ​plot function. Note that the signal strength of the left EMG is bigger than that of the right EMG.//+//Figure 1; An example of the raw MEG data from sensor MLC21 (upper frame) and the EMG data (lower frame). The signals are from the output of **[[reference:​ft_preprocessing|ft_preprocessing]]** and plotted using the MATLAB ​plot function. Note that the signal strength of the left EMG is bigger than that of the right EMG.//
  
 === Exercise 1 === === Exercise 1 ===
Line 121: Line 121:
 ===== Computing the coherence ===== ===== Computing the coherence =====
  
-Using **[[reference:​ft_freqanalysis|ft_freqanalysis]]**,​ the characteristics in the frequency domain will be computed. This step requires the preprocessed MEG and EMG data (see above or download from [[ftp://​ftp.fcdonders.nl/​pub/​fieldtrip/​tutorial/​coherence/​data.mat]]). Load the data with:+Using **[[reference:​ft_freqanalysis|ft_freqanalysis]]**,​ the characteristics in the frequency domain will be computed. This step requires the preprocessed MEG and EMG data (see above or download from [[ftp://​ftp.fieldtriptoolbox.org/​pub/​fieldtrip/​tutorial/​coherence/​data.mat]]). Load the data with:
  
   load data    load data 
Line 175: Line 175:
   cfg.xlim ​            = [5 80];   cfg.xlim ​            = [5 80];
   cfg.refchannel ​      = '​EMGlft';​   cfg.refchannel ​      = '​EMGlft';​
-  cfg.layout ​          = 'CTF151.lay';+  cfg.layout ​          = 'CTF151_helmet.mat';
   cfg.showlabels ​      = '​yes';​   cfg.showlabels ​      = '​yes';​
   figure; ft_multiplotER(cfg,​ fd)   figure; ft_multiplotER(cfg,​ fd)
Line 204: Line 204:
   cfg.zlim ​            = [0 0.1];   cfg.zlim ​            = [0 0.1];
   cfg.refchannel ​      = '​EMGlft';​   cfg.refchannel ​      = '​EMGlft';​
-  cfg.layout ​          = 'CTF151.lay';+  cfg.layout ​          = 'CTF151_helmet.mat';
   figure; ft_topoplotER(cfg,​ fd)   figure; ft_topoplotER(cfg,​ fd)
  
Line 330: Line 330:
 In order to localise the neuronal sources which are coherent with the EMG, we can apply beamformers to the data. For a more extensive background in beamforming,​ in particular beamforming with frequency-domain data, please consult the beamformer tutorial. In order to localise the neuronal sources which are coherent with the EMG, we can apply beamformers to the data. For a more extensive background in beamforming,​ in particular beamforming with frequency-domain data, please consult the beamformer tutorial.
 In this example, we are going to use an algorithm, known as DICS, to estimate the activity of the neuronal sources and to subsequently estimate the coherence with the EMG. In order to achieve this, we first need an estimate of the cross-spectral density between all MEG-channel combinations,​ and between the MEG-channels and the EMG, at a frequency of interest. ​ In this example, we are going to use an algorithm, known as DICS, to estimate the activity of the neuronal sources and to subsequently estimate the coherence with the EMG. In order to achieve this, we first need an estimate of the cross-spectral density between all MEG-channel combinations,​ and between the MEG-channels and the EMG, at a frequency of interest. ​
-This requires the preprocessed data, see above, or download from [[ftp://​ftp.fcdonders.nl/​pub/​fieldtrip/​tutorial/​coherence/​data.mat]]. Load with:+This requires the preprocessed data, see above, or download from [[ftp://​ftp.fieldtriptoolbox.org/​pub/​fieldtrip/​tutorial/​coherence/​data.mat]]. Load with:
  
   load data   load data
Line 346: Line 346:
  
 Once we computed this, we can use **[[reference:​sourceanalysis|ft_sourceanalysis]]** using the following configuration. \\ Once we computed this, we can use **[[reference:​sourceanalysis|ft_sourceanalysis]]** using the following configuration. \\
-This step requires the subject'​s headmodel, which is available from [[ftp://​ftp.fcdonders.nl/​pub/​fieldtrip/​tutorial/​SubjectCMC.zip]].+This step requires the subject'​s headmodel, which is available from [[ftp://​ftp.fieldtriptoolbox.org/​pub/​fieldtrip/​tutorial/​SubjectCMC.zip]].
  
   cfg                 = [];   cfg                 = [];
Line 359: Line 359:
   ​   ​
 The resulting source-structure is a volumetric reconstruction which is specified in head-coordinates. In order to be able to visualise the result with respect to the subject'​s MRI, we have to interpolate the functional data to the anatomical MRI. \\ The resulting source-structure is a volumetric reconstruction which is specified in head-coordinates. In order to be able to visualise the result with respect to the subject'​s MRI, we have to interpolate the functional data to the anatomical MRI. \\
-For this, we need the subject'​s MRI, which is available from [[ftp://​ftp.fcdonders.nl/​pub/​fieldtrip/​tutorial/​SubjectCMC.zip]]. After reading the anatomical MRI, we reslice it along the axes of the head coordinate system for improved visualization.+For this, we need the subject'​s MRI, which is available from [[ftp://​ftp.fieldtriptoolbox.org/​pub/​fieldtrip/​tutorial/​SubjectCMC.zip]]. After reading the anatomical MRI, we reslice it along the axes of the head coordinate system for improved visualization.
  
   mri = ft_read_mri('​SubjectCMC.mri'​);​   mri = ft_read_mri('​SubjectCMC.mri'​);​
Line 417: Line 417:
  
   ​   ​
-This tutorial was last tested by Jörn with version r9460 (April 30 2014) of FieldTrip using Matlab ​2010b on a 64-bit Linux platform. ​+This tutorial was last tested by Jörn with version r9460 (April 30 2014) of FieldTrip using MATLAB ​2010b on a 64-bit Linux platform. ​