Connectivity
Namespace: CONNECTIVITYLIB · Library: Connectivity Library · Source: connectivity/connectivity.h
mne_connectivity.spectral_connectivity_epochs in MNE-Python.
#include <connectivity/connectivity.h>
class CONNECTIVITYLIB::Connectivity
Dispatcher that runs one or more functional-connectivity estimators over a batch of pre-processed trials and returns one Network per estimator.
The selected methods are read from CONNECTIVITYLIB::ConnectivitySettings::getConnectivityMethods "ConnectivitySettings::getConnectivityMethods" and matched by string against the supported metric set ("COR", "XCOR", "COH", "IMAGCOH", "PLI", "USPLI", "WPLI", "DSWPLI", "PLV", "GC", "DTF", "PDC"). All spectral metrics share the same DPSS tapered FFT and CSD accumulator inside ConnectivitySettings, so running e.g. PLI + wPLI + dwPLI in one call costs only one FFT pass.
Runs the selected functional-connectivity metrics over a ConnectivitySettings batch.
ConnectivitySettings settings;
for (int i = 0; i < kTrials; ++i) {
settings.append(makeTrial(gen)); // channels x samples, one call per trial
}
settings.setSamplingFrequency(kSFreq);
settings.setFFTSize(kSamples);
settings.setWindowType("hanning");
MatrixX3f positions(3, 3);
positions << 0.0f, 0.0f, 0.0f, 0.05f, 0.0f, 0.0f, 0.0f, 0.05f, 0.0f;
settings.setNodePositions(positions);
settings.setConnectivityMethods({"COH", "PLV", "WPLI"});
const QList<Network> networks = Connectivity::calculate(settings);
for (Network network : networks) {
network.setFrequencyRange(8.0f, 12.0f); // average the per-bin weights over the alpha band
qInfo().noquote() << network.getConnectivityMethod() << "0-1:" << edgeWeight(network, 0, 1);
}
Public Methods
Connectivity()
Constructs a Connectivity object.
Static Methods
calculate(connectivitySettings)
Computes the network based on the current settings.
Parameters:
- connectivitySettings : ConnectivitySettings & Input trials and requested methods; per-trial spectral caches are filled in during computation.
Returns:
- QList< Network > — Returns the list with calculated networks for each provided method.
Example
- Start here: ex_connectivity_metrics — Connectivity metrics on synthetic data with a known coupling.
- Full source:
src/examples/ex_connectivity_metrics/main.cpp - Build target:
ex_connectivity_metrics(runs under CTest)
Used in examples
ex_connectivity_metrics
Connectivity metrics on synthetic data with a known coupling.
settings.setConnectivityMethods({"COH", "PLV", "WPLI"});
const QList<Network> networks = Connectivity::calculate(settings);
for (Network network : networks) {
network.setFrequencyRange(8.0f, 12.0f); // average the per-bin weights over the alpha band
qInfo().noquote() << network.getConnectivityMethod() << "0-1:" << edgeWeight(network, 0, 1);
}
ok &= expect(networks.size() == 3, "Connectivity::calculate returns one network per method");
ex_connectivity
Sensor- or source-level functional connectivity of averaged MEG/EEG data with a selectable metric, shown as a 3D network.
QCommandLineParser parser;
parser.setApplicationDescription("Connectivity Example");
parser.addHelpOption();
ex_connectivity_comparison
Compare connectivity metrics side by side on the same averaged sensor- or source-level data.
QCommandLineParser parser;
parser.setApplicationDescription("Connectivity Comparison Example");
parser.addHelpOption();
Also used in ex_dsp_rt, ex_connectivity_performance.
Authors of this file
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Gabriel Motta <gabrielbenmotta@gmail.com>
- Christoph Dinh <christoph.dinh@mne-cpp.org>