Connectivity

Authors: Hossein Shahabi, Raymundo Cassani, Takfarinas Medani, François Tadel, Marc Lalancette, Sylvain Baillet

Brain functions (e.g., in cognition, behavior and perception) stem from the coordinated activity of multiple regions. Brain connectivity measures are designed to probe how brain regions (or nodes) interact as a network. A distinction is made between structural (fiber pathways), functional (non-directed statistical associations) and effective (causal interactions, or "directed functional connectivity") connectivity between regions. Here we explain how to compute various connectivity metrics for non-directed and directed functional connectivity analyses with Brainstorm, both with simulated (ground-truth) and empirical data.

We encourage the interested reader to learn more about the specific aspects of electrophysiology for studying human connectomics.

Introduction

Definitions

Connectivity analyses are commonly performed by computing a bivariate measure between pairs of regional time series of interest. The outcome (a.k.a a connectome) can be represented as a connectivity graph (left panel below), with each brain region as a node (x, y, z,...), and the connectivity measures shown above each edge of the graph. The connectome can also be represented by a connectivity array, a.k.a. an adjacency matrix (right panel below).

cnx_graph_matrix.png

Sensors or sources: The time series used for connectivity analyses can be from sensor data (EEG/MEG signals) or from source time series (brain voxels or scouts).

Directed vs. non-directed: The direction of interactions between signals (as a measure of statistical causation) is estimated with directed metrics. Non-directed metrics produce symmetrical connectivity graphs/matrices: the connectivity measure "from Signal $$x$$ to Signal $$y$$ " is identical to the connectivity measure "from Signal $$y$$ to Signal $$x$$".

Experimental condition: Depending on the neuroscience question, connectivity analyses can be performed on resting-state or task (e.g., ongoing or trial-based) data.

Full (NxN) vs. seeded (1xN) connectivity: In a full connectivity analysis, the connectivity metric is computed for all the possible pairs of nodes between N time series (noted N×N here). Alternatively, seeded connectivity (noted 1×N) is measured between one time series of interest (a seed, e.g., one brain region or a behavioral marker) and N other regions/time series.

Time-frequency transformations: Some connectivity metrics rely on a time-frequency representation of the signals. These latter are obtained with approaches such as the short-time Fourier transform, Hilbert transform, or Morlet wavelets.

Just as in other areas of electrophysiology studies, connectivity analyses need to be guided by mechanistic hypotheses concerning the expected neurophysiological effects.

Sensor-level analyses

  1. Their anatomical interpretation is limited and ambiguous.

  2. Sensor data is affected by field spread and volume conduction of brain activity across the scalp/sensor array. Hence, activity from one single brain area is picked up at multiple, possibly distant sensor locations. Connectivity measures may show strong interactions between sensor time series, which may be wrongly interpreted as inter-regional brain connections.

Source-level analyses

Connectivity measures between source time series are neuroanatomically interpretable and can be derived across participants.

We recommended that the outcomes of sensor and source connectivity analyses are mutually compatible; see (Lai et al., 2018).

Full-brain connectomes

Whole-brain connectivity analyses at the typical resolution of cortical surfaces in Brainstorm involve thousands of source locations, making the N×N derivations impractical. For instance, 15000 cortical vertices would yield a connectivity matrix of 15000x15000x8 bytes = 1.6 GB. If unconstrained cortical sources are used and coherence is computed across 50 frequency bins, the memory allocation increases to 45000x45000x50x8 = 754 GB per participant/condition/trial/etc. Reducing the N (via e.g., cortical parcellations, ROIs) may be required for practical reasons, depending on computing resources.

Regions of interest

Grouping individual brain sources into ROIs, defined on the cortical surface or in the brain volume helps contain the computational resources required for connectivity analyses (see above). ROIs can be defined based on neuroscience priors and the purpose of the study (Schhoffen and Gross, 2009). You may consider:

The tutorial Corticomuscular coherence explains the computation of connectivity measures between one sensor (EMG) and minimum-norm source maps: sensor x sources and sensor x scouts. The computation of ROI-based connectomes (scouts x scouts) is described in the section Scout-level connectivity below.

Studies have reported similarities and differences between electrophysiological connectomes (from MEG/EEG) and fMRI connectomes. See how the electrophysiological connectomes provide unique insights on how functional communication is implemented in the brain in Sadaghiani et al., 2022.

On whole-brain connectivity analyses and the issue of circular analysis, please see Kriegeskorte et al., 2009.

Pre-requisites

Here we focus on the specifics on connectivity analyses with Brainstorm. Please make sure you are familiar with Brainstorm and go through all introduction tutorials first, before following the present tutorial.

We first use simulated, synthetic data to emphasize the theoretical aspects of each connectivity metric with respect to groundtruth outcomes. Real, empirical MEG data are featured later in the tutorial (same auditory oddball dataset as in the other tutorial sections).

Let's start by creating a new protocol in the Brainstorm database:

Simulated data

To compare connectivity metrics, let's use synthetic time series simulated with known ground truth interactions. We will use a multivariate autoregressive (MVAR) model that consists of the following three signals:

The 25-Hz component of Signal 3 will be driven in part by the 25-Hz component of Signal 1 (denoted Signal 1>>Signal 3).

Let's now generate the three time series:

Process options:

Execution:

References used:



Correlation

Correlation is a relatively simple, non-directed connectivity metric of association between two time series. It is relatively limited without further preprocessing of the input time series: correlation is sensitive to volume conduction and is not frequency specific.

Process options

Result visualization

Display options:



Coherence

Coherency or complex coherence, $$C_{xy}(f)$$, is a complex-valued metric that measures the linear relationship of two signals in the frequency domain. Magnitude square coherence (MSC), $$|C_{xy}(f)|^2$$, or coherence, measures the covariance of two signals in the frequency domain. For a pair of time series $$x(t)$$ and $$y(t)$$, with spectra $$X(f)$$ and $$Y(f)$$, the MSC is defined as:

Two related measures, which address the problem of volume conduction, are imaginary coherence (Nolte et al., 2004), $IC_{xy}(f)$, and lagged coherence (Pascual-Maqui, 2007), $LC_{xy}(f)$, which are defined as:

where $$\mathrm{Im()}$$ and $$\mathrm{Re()}$$ are the imaginary and real parts of a complex number, respectively.

Note that the cross-spectrum ($$S_{xy}(f)$$) and the power spectral densities ($$S_{xx}(f)$$ and $$S_{yy}(f)$$), and as consequence also coherency ($$C_{xy}(f)$$) can be obtained through different time-frequency decomposition methods (such as: Hilbert transform, wavelet transform and short-time Fourier transform), and for different time resolutions (per sample, windowed and entire file).

Process options

Result visualization

Coherence is frequency specific: a connectivity graph and a connectivity matrix are produced for each frequency bin of the spectrum. Right-click on the coherence result file to show display options:

Open the 3 types of visualization: they are linked by clicking on the spectral representation of the coherence, which will change the current frequency bin and update the connectivity measures displayed in the graph and matrix. The value of the current frequency bin can also be changed in the Time panel.

res_cohere1n.png

Other variants of coherence can be derived following the above procedure. The figures below display the coherence spectra obtained from the imaginary coherence (left) and the lagged coherence (right) measures.

res_cohere1n_d.png

res_cohere1n_e.png



Granger causality

Granger causality (GC) is a measure of directed functional connectivity based on the Wiener-Granger causality framework. GC measure linear dependencies between time series, and tests whether the prediction of the future of signal $$x(t)$$ (approximated by a linear autoregressive model) is improved by considering signal $$y(t)$$ (also approximated by a linear autoregressive model). If there is such improvement, one concludes that signal $$y(t)$$ has a Granger causal effect on the other signal. In sum, some independent information from the past of signal $$y(t)$$ improves the prediction of the future of signal $$x(t)$$, with respect to only observing its past $$x(t)$$. GC takes nonnegative values; its is zero when no Granger causality can be attributed. The term independent means that GC is invariant with the scale of the input signals $$x(t)$$ and $$y(t)$$.
See Granger causality - mathematical background for a more complete background.

Despite the name, Granger causality indicates directionality but not true causality.
For example, if a variable $$w$$ is causing both $$x$$ and $$y$$, but with a smaller delay for $$y$$ than for $$x$$, then the GC measure between $$x$$ and $$y$$ would show a non-zero GC for $$y$$ --> $$x$$, even though $$y$$ is not truly causing $$x$$ (Bressler and Seth, 2011).

Process options

Results visualization

The connectivity matrix (right panel below) is not symmetric because GC values are direction specific. The upper right elements of the matrix indicate there is a GC influence from signal 1 to signal 3. In the connectivity graph (left panel below) the directionality is shown with an arrowhead at the center for the arc connecting two nodes.

res_granger1n_a.png

res_granger1n_b.png



Spectral Granger causality

The Spectral Granger causality is a measure of directed functional connectivity that was developed to indicate frequency specific influences between time series (Dhamala et al., 2008).

Process options

Result visualization

As with coherence, spectral GC can be plotted as a function of frequency. The display below shows a peak around 25 Hz that corresponds to the expected causal interaction of Signal 1 on Signal 3.

res_spgranger1n.png

Envelope correlation

In the time-frequency tutorial, we have introduced Morlet wavelets and the Hilbert transform as methods to decompose time series in the time-frequency (TF) domain.

The outcome of the Hilbert transform is an analytic signal, $$\tilde{x}(t)$$, which is a complex time series uniquely associated to the original data time series, $$x(t)$$, which module $$a_{\tilde{x}}(t)$$, and phase $$\phi_{\tilde{x}}(t)$$, correspond to the instantaneous amplitude (or envelope) and instantaneous phase of the original time series $$x(t)$$, respectively. The real part of $$\tilde{x}(t)$$ is the original time series $$x(t)$$, and the imaginary part is the Hilbert transform of that same time series $$x(t)$$.

The analytic signal of oscillatory or narrowband signals provide meaningful and interpretable estimations of instantaneous amplitude and phase. While it is technically feasible to derive these elements from broadband time series, they would not be interpretable (see Cohen, 2014).

The instantaneous amplitude (or envelope) of the analytic signals can be used to carry out pairwise connectivity analysis with metrics such as correlation and coherence (including lagged coherence).

An optional step consists in orthogonalizing the pairs of envelope time series used to compute the amplitude envelope correlation, by first removing the real part of their coherence to reduce volume conduction (at the sensor level) or cross-talk effects (at the source level) (Hipp et al., 2012).

Process options

Results visualization

As with coherence and spectral Granger causality, amplitude envelope correlations (AEC) can be displayed as a function of frequency, and as a function of time if the Time resolution option was set to Dynamic. Below are the AEC results obtained with the Hilbert transform (left panels) and with Morlet wavelets (right panels) for the first 5-s time window (top panels) and the 5-s last window (bottom panels).

res_henv1n_h.png

First 5-s window

res_henv1n_w.png

res_henv1n_h2.png

Last 5-s window

res_henv1n_w2.png

Phase-Locking Value

An alternative class of connectivity metrics considers the relative instantaneous phase between two time series as a marker of connectivity. Phase-locking or phase synchronization are two such measures (Tass et al., 1998). In principle, phase-based measures are robust against fluctuations in signal amplitude, although low signal-to-noise conditions remain challenging for these measures (Lachaux et al., 1999; Mormann et al., 2000).

The phase-locking value (PLV) is a popular metric defined as the length of the average vector of many unit vectors whose phase angle corresponds to the phase difference between two time series (Tass et al., 1998). If the distribution of the phase difference between the two signals is uniform, the length of such an average vector will be 0. If the phases of the two signals are strongly coupled, the length of the average vector will be close to 1. For event-related studies, we would expect phase differences across trials to be uniformly distributed, unless the phase of the brain signals is locked to the event onset, which would then indicate a form of phase locking between the two time series. Considering a pair of narrow-band analytic signals $$\tilde{x}(t)$$ and $$\tilde{y}(t)$$, obtained from the Hilbert transform (see above):

\begin{eqnarray*}
\mathrm{PLV} = \left | E\left [ e^{j\Delta \phi (t)} \right ] \right | \\
\end{eqnarray*}

with:

\begin{eqnarray*}
\Delta \phi (t) = \phi_{\tilde{x}}(t) - \phi_{\tilde{y}}(t) = arg\left ( \frac{\tilde{x}(t)\tilde{y}^{*}(t)}{\left | \tilde{x}(t) \right |\left | \tilde{y}(t) \right |} \right ) \\
\end{eqnarray*}

plv.png

Several variants of PLV have been contritributed. Brainstorm features
ciPLV (Bruña 2018) and wPLI (Vinck 2011) variants contributed to Brainstorm by Daniele Marinazzo.

PLV values tend to be overestimated when derived from few (<50) time samples. As a consequence, when comparing PLV values between conditions, please make sure that they are derived from about the same number of samples in each condition.

Process options

Results visualization

PLV is frequency resolved, and here was computed for the delta, theta, alpha, beta and gamma bands. With the simulated data, we expect a higher PLV value in the beta band (15 to 29 Hz), between Signal 1 and Signal 3. This is indeed our observation, with a peak at 22 Hz (center of beta band) in the PLV spectrum.

res_plv1n.png

Phase-Transfer Entropy

Phase transfer entropy (PTE) is a directed connectivity metric that quantifies the transfer entropy (TE) between two instantaneous phase time series (Lobier et al., 2014). Similar to GC, TE estimates whether including the past of both source and target timeseries influences the ability to predict the future of the target timeseries. In PTE, if a phase signal $$\phi_{\tilde{x}}(t)$$ causes the signal $$\phi_{\tilde{y}}(t)$$, the mutual information, between $$\phi_{\tilde{y}}(t)$$ and the past of $$\phi_{\tilde{x}}(t)$$ i.e. $$\phi_{\tilde{x}}(t')$$ is larger than the mutual information of $$\phi_{\tilde{y}}(t)$$, the past of $$\phi_{\tilde{y}}(t)$$ i.e. $$\phi_{\tilde{y}}(t')$$ and $$\phi_{\tilde{x}}(t')$$. This relationship can be represented on the Venn diagram below, where $$\mathrm{I()}$$ and $$\mathrm{H()}$$, indicate mutual information and the individual entropies, respectively. PTE values are positive and unbounded.

pte.png

Process options

Results visualization

Here we computed PTE for the delta, theta, alpha, beta and gamma bands. From the synthetic data used here, we expect to observe a higher PTE value in the beta band, From Signal 1 To Signal 3. This is indeed shown with a peak at 22 Hz (center of beta band) in the PTE spectrum.

res_pte1n.png .

Method selection and comparison

The following table list the available connectivity metrics in Brainstorm and their description.

Metric

Directionality

Domain

1×N

N×N

Time resolved

Process

Info

Correlation

Non-directed

Time

bst_corrn.m

Link

Coherence

Non-directed

Frequency

bst_cohn.m

Link

Granger causality

Directed

Time

bst_granger.m

Link

Spectral Granger causality

Directed

Frequency

bst_granger_spectral.m

Link

Envelope Correlation (2020)

Non-directed

T-F

bst_henv.m

Link

Phase locking value

Non-directed

Phase

bst_connectivity.m

Link

Phase transfer entropy

Directed

Phase

PhaseTE_MF.m

Link

Scout-level connectivity

The sections above explain the computation of various connectivity measures between pairs of time series. When computing whole-brain connectomes (i.e., NxN connectivity matrices between all brain sources), additional technical considerations need to be taken into account: the number of time series is typically too large to be computationally tractable on most workstations (see introduction above); if using unconstrained source maps, with 3 time series at each brain location, this requires an extra step to derive connectivity estimates.

The tutorial Corticomuscular coherence explains the computation of connectivity measures between one sensor and brain source maps, with sensor x sources and sensor x scouts scenarios, both with constrained and unconstrained source orientation models.

This section explains dimension reduction using ROIs (or Brainstorm "scouts"), using the coherence NxN (scouts x scouts) as an example, in the case of unconstrained source maps (three orthogonoal source orientations at each brain location). In this configuration, as for constrained sources, the process returns one connectivity estimate (i.e., coherence spectrum) for each distinct pair of scouts.

Input options

When the input(s) to a connectivity process are source files, there are additional input options available to select scouts from existing atlases, and specify the aggregating function and when to perform the aggregation.

ScoutOptions_Cohere2.png ScoutOptions_Cohere.png

Scout function: It is necessary to specify two parameters to indicate how the data is aggregated in each scout: The scout function (for instance, the mean), and whether this within-scout aggregation procedure is applied before or after the computation of the connectivity measure. This is illustrated below. The available functions depend on when it is applied.

Unconstrained maps: There are two options for dealing with unconstrained source orientations, specified with the checkbox "Flatten unconstrained source orientations with PCA first".

PCA Options: If PCA is selected as the scout function or for flattening unconstrained maps, additional options are available through this Edit button.

The graphs below show the processing steps in the "before" and "after" cases, for two scouts (Scout-1 and Scout-2), with 3 orientations each (x,y,z). In either case, the outcome is one coherence spectrum per pair of scouts.

Before: The scout function (e.g., mean) is applied on each direction on the elementary source time series in the scout, which results in one time series per elementary direction, per scout. These scouts time series are then used to compute coherence measures, and the resulting coherence spectra are finally aggregated across the x, y and z dimensions, yielding one single coherence spectrum for each pair of scouts. https://neuroimage.usc.edu/brainstorm/Tutorials/CorticomuscularCoherence?action=AttachFile&do=get&target=diagram_nxn_coh_sct_bef.png

After: With this option, coherence is first computed between each pair of elementary sources (number of sources in each scout x 3 orientations) for two scouts, yielding 9 coherence spectra. Then, these coherence spectra are aggregated across dimensions to obtain one single coherence spectrum for each pair of elementary sources within the scouts. Finally, the scout function (e.g., mean) is applied to the coherence spectra for each elementary source within the scouts to obtain one single coherence spectrum for each pair of scouts. This is a considerably more greedy option that the "before" option above, as it computes coherence measures between all 45000x45000 elementary source signals. This requires more computing resources; see the introduction for an example.https://neuroimage.usc.edu/brainstorm/Tutorials/CorticomuscularCoherence?action=AttachFile&do=get&target=diagram_nxn_coh_sct_aft.png

The result is a connectivity file () that contains Scouts x Scouts coherence spectra.

The connectivity graph or the adjacency matrix are displayed for each frequency bin of the coherence spectra. For more details, see the connectivity graph tutorial.

Mixed source models

Mixed models refer to source models with mutliple regions that may include surface and volume regions, and regions with different source orientation constraints. To compute connectivity between surface and volume regions, you must first create volume scouts for the volume regions of the mixed model, and then use the process2 tab with the same files on both sides. On one side you can select surface scouts, and the other, the volume scouts you created. For connectivity between surface regions only, or volume regions only, use the process1 tab.

Thresholding of connectivity estimates

Interactive tools

Brainstorm provides tools to apply empirical thresholds to display the resulting connectivity estimates. Interactions can be filtered interactively based on their magnitudes, the distance between the nodes of the graph or their category. See the tutorial: Connectivity graphs.

display_panel.gif

Threshold by percentile

The process Test > Threshold by percentile allows the selection of the top n% connectivity estimates in a single input file.

percentile.png

All connectivity estimates (left panel below). The top-5% connectivity matrix (right panel below) only keeps the 5 percentile of all the connectivity estimates.

percentile_100.png

percentile_5.png

Statistical significance

Inference based threshold can be derived to assess the statistical significance of the connectivity estimates, for instance using non-parametric paired permutation tests.

Connectivity outcomes can be computed for different experimental conditions, or between an active state and a baseline. Non-parametric paired permutation tests are available in Brainstorm to compare between two groups of repeated measures. More information in the Statistics tutorial.

stat_perm.gif

On the hard drive

File name

The connectivity file structure is an extension of the time-frequency structure. The file names start with timefreq_, followed by connect1 (1xN) or connectn (NxN or AxB), the connectivity method and a time stamp. Example: timefreq_connectn_corr_220120_1350.mat.

File structure

Right click on the first connectivity file computed > File > View file contents.

The data structure is the same as for Brainstorm time-frequency files. Only the fields specific to connectivity analyses are documented below:

Connectivity matrix encoding

Let's consider the structure TfMat, loaded from a connectivity file, for example by right-clicking on the file > File > Export to Matlab. The connectivity matrix R can be obtained with function GetConnectMatrix. The size of R is [Na x Nb x Ntime x Nfreq].

R = bst_memory('GetConnectMatrix', TfMat);

If the matrix is not symmetrical (i.e., not compressed): for each time and frequency, the list of values from the first dimension of the TF variable is reshaped into a 2D matrix: [Na x Nb].

If the matrix is symmetrical and compressed: only the lower triangular matrix is saved in the TF variable. The full matrix is first reconstructed with function process_compress_sym>Expand, then reshaped into [Na x Nb].

Saving the connectivity matrix R back in the TF variable is possible by reshaping to [Nx1] (R(:)) and then compressing again the matrix:

TfMat.TF = process_compress_sym('Compress', R(:));

Additional documentation

Articles

Forum discussions

Scripting

The following script from the Brainstorm distribution reproduces the analysis presented in this tutorial page: brainstorm3/toolbox/script/tutorial_connectivity.m

1 function tutorial_connectivity(reports_dir) 2 % TUTORIAL_CONNECTIVITY: Script that runs the Brainstorm connectivity tutorial. 3 % 4 % INPUTS: 5 % - reports_dir : Directory where to save the execution report (instead of displaying it) 6 7 % @============================================================================= 8 % This function is part of the Brainstorm software: 9 % https://neuroimage.usc.edu/brainstorm 10 % 11 % Copyright (c) University of Southern California & McGill University 12 % This software is distributed under the terms of the GNU General Public License 13 % as published by the Free Software Foundation. Further details on the GPLv3 14 % license can be found at http://www.gnu.org/copyleft/gpl.html. 15 % 16 % FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE 17 % UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY 18 % WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF 19 % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY 20 % LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE. 21 % 22 % For more information type "brainstorm license" at command prompt. 23 % =============================================================================@ 24 % 25 % Author: Raymundo Cassani, 2021-2022 26 % Francois Tadel, 2022 27 28 29 %% ===== PARAMETERS ===== 30 % Output folder for reports 31 if (nargin < 1) || isempty(reports_dir) || ~isfolder(reports_dir) 32 reports_dir = []; 33 end 34 35 36 %% ===== CREATE PROTOCOL ===== 37 % Start brainstorm without the GUI 38 if ~brainstorm('status') 39 brainstorm nogui 40 end 41 % Create Protocol 42 ProtocolName = 'TutorialConnectivity'; 43 % Delete existing protocol 44 gui_brainstorm('DeleteProtocol', ProtocolName); 45 % Create new protocol 46 gui_brainstorm('CreateProtocol', ProtocolName, 0, 0); 47 % Start a new report 48 bst_report('Start'); 49 50 51 %% ===== SIMULATE DATA (MVAR MODEL) ===== 52 % Seed for random number generator 53 rng(111); 54 % Process: Simulate AR signals 55 sFileSim = bst_process('CallProcess', 'process_simulate_ar_spectra', [], [], ... 56 'subjectname', 'Subject01', ... 57 'condition', 'Simulation', ... 58 'samples', 12000, ... 59 'srate', 120, ... 60 'interactions', ['1, 1 / 10, 25 / 0.3, 0.5' 10 ... 61 '2, 2 / 10, 25 / 0.7, 0.3' 10 ... 62 '3, 3 / 10, 25 / 0.2, 0.2' 10 ... 63 '1, 3 / 25 / 0.1']); 64 65 % Make sure the display mode is "columns" 66 bst_set('TSDisplayMode', 'column'); 67 % Process: Snapshot: Recordings time series 68 bst_process('CallProcess', 'process_snapshot', sFileSim, [], ... 69 'type', 'data', ... % Recordings time series 70 'Comment', 'Simulated signals'); 71 72 73 74 %% ===== CORRELATION ===== 75 % Process: Correlation NxN 76 sFiles = bst_process('CallProcess', 'process_corr1n', sFileSim, [], ... 77 'timewindow', [], ... 78 'scalarprod', 0, ... 79 'outputmode', 1); % Save individual results (one file per input file) 80 81 % Process: Snapshot: Connectivity matrix 82 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 83 'type', 'connectimage', ... % Connectivity matrix 84 'Comment', 'Correlation NxN'); 85 86 87 %% ===== COHERENCE ===== 88 % Process: Magnitude-squared coherence: |C|^2 = |Cxy|^2/(Cxx*Cyy) 89 sFiles = bst_process('CallProcess', 'process_cohere1n', sFileSim, [], ... 90 'timewindow', [], ... 91 'removeevoked', 0, ... 92 'cohmeasure', 'mscohere', ... % Magnitude-squared coherence: |C|^2 = |Cxy|^2/(Cxx*Cyy) 93 'tfmeasure', 'stft', ... % Fourier transform 94 'tfedit', struct(... 95 'Comment', 'Complex', ... 96 'TimeBands', [], ... 97 'Freqs', [], ... 98 'StftWinLen', 1, ... 99 'StftWinOvr', 50, ... 100 'StftFrqMax', 60, ... 101 'ClusterFuncTime', 'none', ... 102 'Measure', 'none', ... 103 'Output', 'all', ... 104 'SaveKernel', 0), ... 105 'timeres', 'none', ... % None 106 'avgwinlength', 1, ... 107 'avgwinoverlap', 50, ... 108 'outputmode', 'input'); % separately for each file 109 110 % Process: Snapshot: Frequency spectrum 111 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 112 'type', 'spectrum', ... % Frequency spectrum 113 'Comment', 'MSC NxN'); 114 115 % Process: Snapshot: Connectivity graph 116 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 117 'type', 'connectgraph', ... % Connectivity graph 118 'Comment', 'MSC NxN'); 119 120 % Process: Snapshot: Connectivity matrix 121 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 122 'type', 'connectimage', ... % Connectivity matrix 123 'Comment', 'MSC NxN'); 124 125 % Process: Imaginary coherence: IC = |imag(C)| 126 sFiles = bst_process('CallProcess', 'process_cohere1n', sFileSim, [], ... 127 'timewindow', [], ... 128 'removeevoked', 0, ... 129 'cohmeasure', 'icohere2019', ... % Imaginary coherence: IC = |imag(C)| 130 'tfmeasure', 'stft', ... % Fourier transform 131 'tfedit', struct(... 132 'Comment', 'Complex', ... 133 'TimeBands', [], ... 134 'Freqs', [], ... 135 'StftWinLen', 1, ... 136 'StftWinOvr', 50, ... 137 'StftFrqMax', 60, ... 138 'ClusterFuncTime', 'none', ... 139 'Measure', 'none', ... 140 'Output', 'all', ... 141 'SaveKernel', 0), ... 142 'timeres', 'none', ... % None 143 'avgwinlength', 1, ... 144 'avgwinoverlap', 50, ... 145 'outputmode', 'input'); % separately for each file 146 147 % Process: Snapshot: Frequency spectrum 148 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 149 'type', 'spectrum', ... % Frequency spectrum 150 'Comment', 'Imaginary coherence NxN'); 151 152 % Process: Lagged coherence / Corrected imaginary coherence: LC = |imag(C)|/sqrt(1-real(C)^2) 153 sFiles = bst_process('CallProcess', 'process_cohere1n', sFileSim, [], ... 154 'timewindow', [], ... 155 'removeevoked', 0, ... 156 'cohmeasure', 'lcohere2019', ... % Lagged coherence / Corrected imaginary coherence: LC = |imag(C)|/sqrt(1-real(C)^2) 157 'tfmeasure', 'stft', ... % Fourier transform 158 'tfedit', struct(... 159 'Comment', 'Complex', ... 160 'TimeBands', [], ... 161 'Freqs', [], ... 162 'StftWinLen', 1, ... 163 'StftWinOvr', 50, ... 164 'StftFrqMax', 60, ... 165 'ClusterFuncTime', 'none', ... 166 'Measure', 'none', ... 167 'Output', 'all', ... 168 'SaveKernel', 0), ... 169 'timeres', 'none', ... % None 170 'avgwinlength', 1, ... 171 'avgwinoverlap', 50, ... 172 'outputmode', 'input'); % separately for each file 173 174 % Process: Snapshot: Frequency spectrum 175 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 176 'type', 'spectrum', ... % Frequency spectrum 177 'Comment', 'Lagged coherence NxN'); 178 179 180 %% ===== GRANGER CAUSALITY ===== 181 % Process: Bivariate Granger causality NxN 182 sFiles = bst_process('CallProcess', 'process_granger1n', sFileSim, [], ... 183 'timewindow', [], ... 184 'removeevoked', 0, ... 185 'grangerorder', 6, ... 186 'outputmode', 1); % Save individual results (one file per input file) 187 188 % Process: Snapshot: Connectivity graph 189 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 190 'type', 'connectgraph', ... % Connectivity graph 191 'Comment', 'Granger causality NxN'); 192 193 % Process: Snapshot: Connectivity matrix 194 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 195 'type', 'connectimage', ... % Connectivity matrix 196 'Comment', 'Granger causality NxN'); 197 198 199 %% ===== SPECTRAL GRANGER CAUSALITY ===== 200 % Process: Bivariate Granger causality (spectral) NxN 201 sFiles = bst_process('CallProcess', 'process_spgranger1n', sFileSim, [], ... 202 'timewindow', [], ... 203 'removeevoked', 0, ... 204 'grangerorder', 6, ... 205 'maxfreqres', 1, ... 206 'maxfreq', 60, ... 207 'outputmode', 1); % Save individual results (one file per input file) 208 209 % Process: Snapshot: Frequency spectrum 210 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 211 'type', 'spectrum', ... % Frequency spectrum 212 'Comment', 'Spectral Granger causality NxN'); 213 214 215 %% ===== ENVELOPE CORRELATION ===== 216 % Process: Envelope Correlation NxN [2023] 217 sFiles = bst_process('CallProcess', 'process_henv1n', sFileSim, [], ... 218 'timewindow', [], ... 219 'removeevoked', 0, ... 220 'cohmeasure', 'oenv', ... % Envelope correlation (orthogonalized) 221 'tfmeasure', 'hilbert', ... % Hilbert transform 222 'tfedit', struct(... 223 'Comment', 'Complex', ... 224 'TimeBands', [], ... 225 'Freqs', {{'delta', '2, 4', 'mean'; 'theta', '5, 7', 'mean'; 'alpha', '8, 12', 'mean'; 'beta', '15, 29', 'mean'; 'gamma1', '30, 59', 'mean'}}, ... 226 'ClusterFuncTime', 'none', ... 227 'Measure', 'none', ... 228 'Output', 'all', ... 229 'SaveKernel', 0), ... 230 'timeres', 'windowed', ... % Windowed 231 'avgwinlength', 5, ... 232 'avgwinoverlap', 50, ... 233 'parallel', 0, ... 234 'outputmode', 'input'); % separately for each file 235 236 % Process: Snapshot: Frequency spectrum 237 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 238 'type', 'spectrum', ... % Frequency spectrum 239 'Comment', 'Envelope correlation (Hilbert transform) NxN'); 240 241 % Process: Envelope Correlation NxN [2023] 242 sFiles = bst_process('CallProcess', 'process_henv1n', sFileSim, [], ... 243 'timewindow', [], ... 244 'removeevoked', 0, ... 245 'cohmeasure', 'oenv', ... % Envelope correlation (orthogonalized) 246 'tfmeasure', 'morlet', ... % Morlet wavelets 247 'tfedit', struct(... 248 'Comment', 'Complex,1-60Hz', ... 249 'TimeBands', [], ... 250 'Freqs', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60], ... 251 'MorletFc', 1, ... 252 'MorletFwhmTc', 3, ... 253 'ClusterFuncTime', 'none', ... 254 'Measure', 'none', ... 255 'Output', 'all', ... 256 'SaveKernel', 0), ... 257 'timeres', 'windowed', ... % Windowed 258 'avgwinlength', 5, ... 259 'avgwinoverlap', 50, ... 260 'parallel', 0, ... 261 'outputmode', 'input'); % separately for each file 262 263 % Process: Snapshot: Frequency spectrum 264 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 265 'type', 'spectrum', ... % Frequency spectrum 266 'Comment', 'Envelope correlation (Morlet wavelet) NxN'); 267 268 269 %% ===== PHASE LOCKING VALUE ===== 270 % Process: Phase locking value 271 sFiles = bst_process('CallProcess', 'process_plv1n', sFileSim, [], ... 272 'timewindow', [], ... 273 'plvmethod', 'plv', ... % Phase locking value 274 'plvmeasure', 2, ... % Magnitude 275 'tfmeasure', 'hilbert', ... % Hilbert transform 276 'tfedit', struct(... 277 'Comment', 'Complex', ... 278 'TimeBands', [], ... 279 'Freqs', {{'delta', '2, 4', 'mean'; 'theta', '5, 7', 'mean'; 'alpha', '8, 12', 'mean'; 'beta', '15, 29', 'mean'; 'gamma1', '30, 59', 'mean'}}, ... 280 'ClusterFuncTime', 'none', ... 281 'Measure', 'none', ... 282 'Output', 'all', ... 283 'SaveKernel', 0), ... 284 'timeres', 'none', ... % None 285 'avgwinlength', 1, ... 286 'avgwinoverlap', 50, ... 287 'outputmode', 'input'); % separately for each file 288 289 % Process: Snapshot: Frequency spectrum 290 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 291 'type', 'spectrum', ... % Frequency spectrum 292 'Comment', 'Phase locking value NxN'); 293 294 295 %% ===== PHASE TRANSFER ENTROPY ===== 296 % Process: Phase Transfer Entropy NxN 297 sFiles = bst_process('CallProcess', 'process_pte1n', sFileSim, [], ... 298 'timewindow', [], ... 299 'freqbands', {'delta', '2, 4', 'mean'; 'theta', '5, 7', 'mean'; 'alpha', '8, 12', 'mean'; 'beta', '15, 29', 'mean'; 'gamma1', '30, 59', 'mean'}, ... 300 'normalized', 0, ... 301 'outputmode', 1); % Save individual results (one file per input file) 302 303 % Process: Snapshot: Frequency spectrum 304 bst_process('CallProcess', 'process_snapshot', sFiles, [], ... 305 'type', 'spectrum', ... % Frequency spectrum 306 'Comment', 'Phase transfer entropy NxN'); 307 308 309 %% ===== SAVE REPORT ===== 310 % Save and display report 311 ReportFile = bst_report('Save', []); 312 if ~isempty(reports_dir) && ~isempty(ReportFile) 313 bst_report('Export', ReportFile, reports_dir); 314 else 315 bst_report('Open', ReportFile); 316 end





Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):


TODO

Hossein, Richard

Raymundo, Sylvain

Tutorials/Connectivity (last edited 2023-11-20 17:02:21 by RaymundoCassani)