Error on cauculating connectivity

I'm working on source-level connectivity based on schaefer network parcellation.

After getting the wPLI value by using the scout function 'before', we wants to confirm the difference between the scout function 'before' and 'after'.

Yet, it shows us the error message below:
Requested 85658565201(219.7GB) array exceeds maximum array size preference ( 63.9GB). This might cause MATLAB to becocom unresponsive.

Is there's a way to calculate this data?

The problem is that we need to cauculate the wPLI from 64 ROI and use after the avoid compressing phase information by function 'before'. Any way to process 64 ROI using 'after'?

Another question is from source to connectivity, which should I use, when using 'before' scout function?
1, Unconstrained source, When calculating connectivity, 1)use Flatten unconstrained source orientations using PCA.2), scout before calculate Mean.?
2, Unconstrained source, When calculating connectivity, 1)use Flatten unconstrained source orientations using PCA.2), scout before calculate PCA?
3, constrained source, When calculating connectivity, scout calculate PCA?
4, constrained source, When calculating connectivity, scout calculate mean?
5, constrained source, When calculating connectivity, scout calculate All?
6, Unconstrained source, When calculating connectivity, 1)use Flatten unconstrained source orientations using PCA.2), scout before and calculate All?

And, when using 'after' scout function, which should I used?

You can find all the details on how connectivity is computed at the Scout level in this link:
https://neuroimage.usc.edu/brainstorm/Tutorials/CorticomuscularCoherence#Coherence_Scouts_x_Scouts

Is there's a way to calculate this data?
[/quote]

It seems you are using the before option and computing wPLI for all Scouts-x-Scouts.
Since before is selected, the connectivity metric is computed before the scout aggregation, i.e., you are trying to compute wPLI for all sources, Sources-x-Sources, this computation demands a large amount of RAM, which is not present in your system.

Yes, these are at least two ways to do so:

  1. Having the computation resources that are required.
  2. Or computing the connectivity one Scout-x-Scout pair at the time
1 Like

Thanks for your reply, and sorry for the misunderstanding.

I’m currently calculating and comparing the connectivity results of PLV, ciPLV, and wPLI from an unconstrained source model that used MNI space and was flattened using PCA.

We’re concerned that using the “before” option for scout time series averaging might compress phase differences, potentially leading to inaccurate connectivity values. When we compared wPLI and PLV results—both computed using the “before” method—we found no similarity between them. This is unexpected, as previous studies have typically reported around 60% similarity between wPLI and PLV.

I was able to compute PLV and ciPLV using the “after” method, which processes one frequency band at a time. However, for wPLI, since we’re computing scout-by-scout connectivity (64×64 from the Schaefer parcellation), the full N×N connectivity matrix calculation throws a memory error. The estimated memory requirement is around 256 GB, which exceeds our lab’s resources.

Would it be appropriate to compute wPLI in a 1Ă—N or 1Ă—1 fashion and then assemble the results into the full 64Ă—64 matrix??

Yes, that is right. You can compute [1xN] , (i.e, 1Scout-x-NScouts) in a loop over all your 64 Scouts, and merge the connectivity matrices.

:light_bulb: Since wPLI is symmetric, wPLI(a,b) == wPLI(b,a). You can make more efficient your code by computing only wPLI for the upper triangle of the connectivity matrix. So instead of 4096 (64*64) wPLI computations, only 2016 (upper triangle) wPLI computations are needed.