Envelope Correlation N x N (2020) - Dimensions of arrays being concatenated are not consistent

@pdhami
The PR is now merged into the Brainstorm distribution.
Please update Brainstorm and try again.

Hi Francois,

Thank you, it works now!

I am still having trouble however reproducing the same results as found using the Amplitude Envelope Correlation (N x N).

The top figure (theta band) is that calculated with Envelope Correlation N x N (2020), with the 'Estimation window length' set to the length of the full epoch (9998 ms; this is resting state continuous EEG where I split the data into ~10 sec epochs). The bottom is with the static Amplitude Envelope Correlation N x N process.

EDIT: orthogonalization was applied to both.

Any suggestions as to what I may be doing wrong?

Best,
Paul

These are results obtained with the files you shared earlier?

Can you please post screen captures of the options that you are using in the two cases (including all the secondary option windows that can be set from the pipeline editor)?

Hi Francois,

For the Envelope Correlation (2020) process:

image

Please note this is a different file as the one I had previously shared is no longer in my database.

For the Amplitude Envelope Correlation:

For sake of time, I thought I would do the analysis on just a few scouts and compare them again. This time, they are equivalent:

I may have done something wrong with the definition of the time window that led to the differences originally reported.

On a related note, is there any reason why would want to define the "time window" and "overlap %" when using the static option? From my understanding the 2 parameters are for dynamic?

Thanks,
Paul

I double checked everything regarding the time window options, and now am getting the original differences I reported in the same dataset.

The dataset that showed the difference vs the one above (where they are the same) are different. Not sure if this could be an issue with the data? I will dig further.

Hi Francois,

I've compared the two methods again, and they are indeed not converging on this particular data. What is interesting is that when comparing the correlations values for each connection, either they do match, or they do match in magnitude, but are opposite in direction.

A few examples:

As the tutorial says:
" Time resolution: If Dynamic, connectivity is saved for each time window. If Static, the connectivity measures are averaged across all windows. Select Dynamic."
https://neuroimage.usc.edu/brainstorm/Tutorials/Connectivity#Envelope_correlation

I've compared the two methods again, and they are indeed not converging on this particular data.

Can you share an example dataset?
The simplest could be that you extract the scouts time series (with the dedicated process) first. Make sure that you can reproduce the same differences with the scouts time series in input (select the scouts "matrix" files in the Process1, instead of the source maps). Then share only this matrix_...mat file so we can reproduce your observations on our end.

Thanks

Hi Francois,

I followed your instructions and am still getting differences.

Top is with the Amplitude Envelope Correlation process, and bottom is Envelope Correlation (2020) process.

Please find the matrix file using the following link:

Thank you,
Paul

Thank you for the example file.
I could reproduce exactly the behavior you reported.

I noticed that the values are mostly the same, except for some differences:

  • The old function (AEC) return positive/negative values, while the new function (HENV) returns strictly positive values
  • A small number of values are very different (not only a sign difference), like the one selected in the screen captures below (same as yours, but with the colormap configured with the option "Absolute values")

Old function (AEC):
image

New function (HENV):
image

@hossein27en
You can download the example posted above as a readily available Brainstorm protocol from the link below. You can import it with the menu File > Load protocol > Load from zip file.
https://www.dropbox.com/s/00fqc10srbbxq5n/TutorialConnectivity_Comparison_AEC.zip?dl=0

@pdhami Note that we've just updated the HENV processes. This corrects many bug fixes, but does not change the differences you observed.
Please update Brainstorm to get these fixes before doing any further tests.

https://github.com/brainstorm-tools/brainstorm3/commit/0d634662e3e135beabe77c5f53263db49078e3a7

Hi Francois,

Thank you for the update.

I was able to finish my AEC calculations using the old process.

I'm assuming (due to providing both positive and negative correlations) that these results are 'correct' and okay to move forward with, and that the issue is strictly with the newer HENV process?

Best,
Paul

We tested further the comparison between the older AEC and the new HENV processes.
You can reproduce exactly the results obtained the new HENV results with the older processes AEC by editing bst_connectivity.m.
Eeplace line 504:

R(:,:,iBand) = (R(:,:,iBand)+R(:,:,iBand)')/2;

with

R(:,:,iBand) = (abs(R(:,:,iBand))+abs(R(:,:,iBand))')/2;

And replace line 515:

R(iSeed,:,iBand) = (r1+r2)/2;

with:

R(iSeed,:,iBand) = (abs(r1)+abs(r2))/2;

Explaination from Hossein:

Amplitude envelope correlation is not a symmetric measure by its nature. Still, most people have used it as symmetric, and there is no clear explanation about the meaning of the connectivity from A->B Vs. B->A.
As a result, my code and the AEC make the matrix symmetric by adding its transpose and dividing over 2. However, I apply abs() before summation, but the AEC does not (so if there is a negative value, it might cancel the positive one). I do think the abs value is necessary. In MNE-python, they have abs as the default.

1 Like

The AEC processes have been deprecated:
https://github.com/brainstorm-tools/brainstorm3/commit/33a5ffa28d7f9d17495c75fe1e1d8d132d50693b

Thank you for the detailed explanation.

I computed the Envelope Correlation (2020) process on a concatenated time window of 379.92 seconds for 68 scouts by selecting 'Envelope correlation (orthogonalized)', 'Time resolution as Dynamic', 'Estimation window length of 20000 ms' with overlap of 50%, unchecked the parallel processing toolbox, and 'average among output files' as outcome options.

Reading the discussion, I edited the bst_connectivity.m considering the absolute value in both the lines mentioned (for me line 525 and line 536) to see if I was able to reproduce the same results of the HENV process with the old AEC one. Unfortunately, I obtained two different results (figures attached). The upper figure is the HENV process and the bottom one is the old AEC one with the edited absolute value in the code. Can it be because the old AEC process considers averaged measures across the time window? In the results obtained from the HENV process, I kept the 'dynamic' time resolution as suggested in the tutorials and from my understanding in this discussion.

For both processes, I applied the orthogonalization and studied the following frequency bands: delta / 1, 4 / mean, theta / 4, 8 / mean, alpha / 8 12 / mean, beta / 12, 30 / mean, gamma / 30, 70 / mean, broadband / 1, 70 / mean.

Thank you in advance.

Thank you for your report.

In line with the present thread, we are actively looking into options to consolidate the current code. Please stand by; we'll get back to you with a revised version of the Brainstorm toolkit for AEC measures over the next couple of weeks.

1 Like

Perfect, thank you. Look forward to hearing from you.

Hi Sylvain!

Just was wanted to ask if there was any update regarding the AEC measures?

Thank you,
Paul

Not yet, and probably not before the end of the summer.

Hi Francois/BST Team,

I just wanted to follow up and ask if there was any update regarding the Amplitude Envelope Correlation calculations?

Best,
Paul

Sorry for the long delay. We'll be looking into this issue as soon as possible, but we need to prioritize our limited resources.