fNIRS Functional Connectivity Analysis

Has anyone be able to come up with or come across a functional connectivity analysis for fNIRS using MNE ? If so i would love to see your code to see how this is done! Any links to a github or associated code sharing websites would be immensely appreciated. Thanks in advance for your help!

Hi,

I’m not super familiar with fNIRS, but from a quick look here (section 3.6.8) lots of different methods have been used.

If it’s time domain you’re interested in, a standard non-directed measure is the Pearson correlation which tells you the similarity of two signals. You can compute this using NumPy’s corrcoef function.

For directed connectivity, cross-correlation can be used to identify how similar two signals are for a set of displacements. Depending on what direction the displacement with the greatest similarity occurs, that can inform the direction of information flow. SciPy’s correlate function can be used here.

Granger causality is another possibility for directed connectivity. One way to compute this is using vector autoregessive models which is available in MNE-Connectivity’s vector_autoregression function. However, there isn’t an example showing how to compute Granger causality from this (but I have done it before).

The paper I linked above also has examples of using fNIRS to look at frequency-domain connectivity with measures like coherence and phase locking. These methods are implemented in MNE-Connectivity’s spectral_connectivity_epochs function, but I don’t have experience using this with such limited frequency ranges and low sampling rate data like the papers show.

I’m happy to share code if there’s a particular method you’re interested in!

Cheers,
Thomas

Hey Thomas,

Thanks for your thorough and quick response! Im quite interesting in anything you have to share! Im trying to look at continuous wave data over a period of about 15 mins to see if frontal and partial regions are functionally connected during certain task blocks. whatever method you think would best suit this type of analysis i would love to see your approach from the ones listed above for this kind of data! Thanks in advance for all your help!

In that case, a good start could be to look at the Pearson correlation to quantify the similarity of frontal and parietal activity.

Assuming you have already run whatever preprocessing you need, you can extract the data for your frontal channels and parietal channels as arrays. Below the frontal channels are “seeds” and the parietal channels “targets” (but for non-directed connectivity this definition is arbitrary, you just need two groups of signals).

import numpy as np

# Extract seed and target timeseries data
seed_data = < frontal data (channels x timepoints) >
target_data = < parietal data (channels x timepoints) >

# Compute Pearson correlation
corr = np.corrcoef(seed_data, target_data)

# Extract seed-target connectivity
n_seeds = seed_data.shape[0]
con = corr[:n_seeds, n_seeds:]  # shape (seeds x targets)

The corrcoef function returns a large matrix that can be divided into 4 quadrants:

  • upper left - seed to seed connectivity
  • upper right - seed to target connectivity
  • lower left - target to seed connectivity
  • lower right - target to target connectivity

The code extracts this upper right seed-target connectivity information (but since this is a non-directed connectivity measure, the upper right and lower left quadrants contain the same information).

What con gives you is a set of connectivity values between each of your frontal and parietal channels in the range [-1, 1]. -1 means a perfect negative correlation, +1 a perfect positive correlation. If the direction of correlation is not of interest, you could just take the absolute values to get scores in the range [0, 1] (i.e., no correlation, perfect correlation).

Hope this helps to get you started. Cheers!