Comparing Coherence data

Hi All,

I would like to reveal the transition of coherence between pre- and post-operation in one patient with epilepsy. I’ve recorded resting state row data at pre and post operation (1000Hz; sampling ratio). After the pre-processing, I could get 20 epoch data (3.5s each epoch) in each condition. For calculating the coherence of each epoch, I’ve done the process as below,

  1. I selected one scout.
  2. I calculated the coherence [1×N] at each epoch. (Process options: scout function:Max, After) (Max freq is 1Hz, Highest Freq is 100Hz, Metric significativity is <0.01)

Next, I’m going to compare these coherence data between conditions. What I want to know is where, what frequency band coherence value is increased or decreased.
How should I compare these coherence data between pre- and post? As far as I know, there is no tutorial related to comparing the coherence or Time-frequency data. Could you give me some advise?

Regards,
Jun

Sorry for the late reply, Jun:

I would recommend you do not select the Max scout function (which takes the maximum amplitude across a scout at each time point): it might jump from time point to time point and therefore alter the dynamics of the region quite substantially. Please select Mean or PCA instead.
What I would further recommend is to compute the 1xN coherence scores for longer epochs, if possible. For instance, you could compute coherence on an epoch of the duration of your recording (if it fits in memory) and select a sliding time window in the coherence process that is at least 5 to 10 times longer that the slowest cycle of oscillation of interest to you (here 1Hz, hence a time window of at least 5 to 10s). Do this for both conditions and plot the coherence spectra. What does the data tell you then: do you see substantial differences between the spectra?

Best wishes,

Hi Sylvain,
Thank you for reply. I will follow your suggestion.
Yes. I want to elucidate the difference of coherence between conditions. So I think that I may be need the comparing the differences between the spectra.
Can I see the information related to comparing the spectra on tutorial?

Best regards,
Jun

Hello:

This comparison is not featured in the Tutorials. However, if you compare two conditions or two groups of subjects, I would suggest you use t-tests or permutation tests to compare between the spectra, as if they were time series.

Best wishes,

Hi Sylvain,

I would be happy if you could give more detail suggestion about comparing between the spectra data for coherence.
Can I get a statistical results by using t-tests in brainstorm? or I should export the data for using SPM?

Best regards,
Jun

Hi Jun,

I don’t know what is the correct way to compare the coherence values you get for multiple subjects or conditions.
Maybe Sylvain would have more suggestions…

The t-tests on connectivity measures are not implemented yet in Brainstorm, and there is no I know to export those results to process them in SPM.
You will have to work directly from the data saved in the .mat files in the Brainstorm database.
Let me know if you need help for understanding the contents of those files.

Cheers,
Francois

Hello.
Let me ask you some points concerning this issue.

<< You will have to work directly from the data saved in the .mat files in the Brainstorm database.
Let me know if you need help for understanding the contents of those files.

I checked the contents saved in the .mat files.
Then, I found some values.
In this case, consider three scouts: A, B, C. Time Frequency Band:1Hz, 3Hz, 5H.
In TF tag, I found

[, , 1]
NaN
0.01
NaN
0.02
0.31
[, , 2]
NaN
0.01
0.04
0.31
0.012
NaN

This is just an example. But I want to make sure following points.

①Does “NaN” means “A×A”, “B×B”, “C×C”?
②What kind of order in this in? For instance, A×A, A×B, A×C, B×A…?? But, it seems to be incorrect when I checked the value.
③Does [, , 1] means the frequency band? In this case, “1” means 1Hz ?

Thank you for your support.

OHKI

Hello,

The connectivity matrices are compressed before they are saved. The coherence, correlation and phase-locking value are symmetric measures (AxB=BxA), so we don’t have to save twice all the values.

To get the connectivity matrix correctly formatted, you can do the following:

  • Read the file timefreq_connect…mat into the variable TfMat, or right-click > File > Export to Matlab > “TfMat”
  • R = bst_memory(‘GetConnectMatrix’, TfMat);
  • The matrix R is the connectivity matrix [signalsA x signalsB x Frequencies]
  • The frequency bins are described in the TfMat.Freqs: R(:,:,1) is frequency TfMat.Freqs(1)

Your NaN values correspond to the diagonals, but you are not supposed to get NaN values there. You should get the real metric value (it should be 1 for correlation or coherence).
I’m not sure what is going on there. You can try debugging the function bst_cohn.m for understanding how the coherence is calculated.

Cheers,
Francois

Hello, Francois.
Thank you for your quick support.
It helps me alot, and I figured it out basically.
But, checking matrix data, there is one more thing that I need to ask you.

In this case, I set three scouts, A,B,C.
Then, calculating Mean value,

val(:,:,1) =
NaN
0.0074
NaN
0.0007
0.0013
NaN

In TfMat form,

R(:,:,1,1) =
NaN 0.0074 0.0007
0.0074 NaN 0.0013
0.0007 0.0013 NaN

These matrix look fine.

But, in calculating Max value

val(:,:,1) =
0.5717
0.3487
0.4046
0.1702
0.1839
0.2435

R(:,:,1,1) =
0.5717 0.3487 0.1702
0.3487 0.4046 0.1839
0.1702 0.1839 0.2435

In val(:,:,1) data format, I am wondering whether the diagonals, “0.5717”, “0.4046”, “0.2435”, should be “Nan”?

Do I make a wrong guess??

OHKI

You should never have NaN values in this matrix. Or at least I don’t know how they can appear there.
If you select the options max/after or mean/before for the scouts, the diagonals should be 1 (coherence of a signal with itself = 1).

There is something wrong with those results…
I would recommend you do some debugging in bst_cohn.m

Francois

Hello.

Thank you for your advice.
OK. Let me try debuggin in bst_cohn.m.

By the way, updating Brainstorm(Version: 3.2.141024 ), Brainstorm shows some error messages when I checked NxN coherence.
In detail, as following…

Error in figure_connect.m

Line 4398: Subscripted assignment dimension mismatch.
Call stack:
>figure_connect.m>OrganiseNodesWithConstantLobe at 4398
>figure__connect.m > LoadFigurePlot at 1428
>bst_call.m at 28
>macro_methodcall.m at 39
>figure_connect.m at 27
>view_connect.m at 207
>bst_call.m at 28
> tree_callbacks.m>@(h, ev)bst_call(@view_connect,filenameRelative, ‘GraphFull’) at 1401

Error in panel_display.m
Line 379:Attempted to access ThresholdMinMax(2);index out of bounds numel(ThresholdMinMax)=0

Call stack:
>panel_display.m>UpdatePanel at 379
>Panel_display.m > CurrentFigureChanged_Callback at 250
>bst_call.m at 28
>macro_methodcall.m at 39
>panel_display.m at 31
>bst_figures.m >SetCurrentFigure at 939
>bst_call.m at 28
>macro_methodcall.m at 39
>bst_figures.m at 59
>view_connect.m at 212
>bst_call.m at 28
_tree_callbacks.m > @(h, ev)bst_bst_call(@view_connect,filenameRelative, ‘GraphFull’ at 1401

Error in panel_display.m
Line 379:Attempted to access ThresholdMinMax(2);index out of bounds numel(ThresholdMinMax)=0.

>panel_display.m>UpdatePanel at 379
>bst_call.m at 28
>macro_methodcall.m at 39
>panel_display.m at 31
>view_connect.m at 214
>bst_call.m at 28
>tree_callbacks.m > @(h, ev)bst_bst_call(@view_connect,filenameRelative, ‘GraphFull’ at 1401

Are all these issues are related with bug in bst_cohn.m, or just issues “figure_connect.m”??

Ohki

Hi Ohki,

The errors you are reporting point do not match the line numbers in the current version of Brainstorm.
Please make sure that you delete ALL the existing version of Brainstorm on your hard drive.
Once you executed once a newer version, do not try to revert to an older one, you may damage your database structure.

Also remove all the existing references to Brainstorm from your Matlab path:
you should not add the Brainstorm folders to your path, it does it automatically and sets correctly the order in the path.

Then restart Matlab and try again.
You will most likely have to delete the connectivity files you produced with the old version, and recalculate them again.

Francois

Hi,

I have a question related to this topic. I calculated the coherence from two scouts, obtained a (compressed) connectivity matrix, which I formatted with the above posted code (R = bst_memory(‘GetConnectMatrix’, TfMat);
Now, I get a 4D matrix (2;10000;1;15) from which I only understand the last value that corresponds to the frequencies of interest. Did I understand correctly, that be chosing the “mean” option, I get one time frequency series per scout? What are the other dimensions? How can I plot the coherence for the 15 frequency bands of interest?

Best wishes and thanks in advance
Fabienne

Hi Fabienne,

I guess you computed this file using the process “Coherence 1xN”.
For source values, this computes the coherence between each of the selected scouts (2) with all the other sources of the brain (10000). Hence the [2 x 10000 x time x freq] matrix.
The matrix was probably not compressed initially because it was not symmetrical.

To compute the coherence between two scouts, use the menu “Coherence NxN” and select your two scouts. It will produce a 2x2x1x15 symmetric matrix.

Cheers,
Francois

Hi Francois,
this helps! Thank you.
Could you maybe also explain, what the option “Flip the sign of sources with opposite directions” does?
Best,
Fabienne

Hi Fabienne,

The option “Flip the sign of sources with opposite directions” tries to correct for non-homogeneous normals in a scout when using minimum norm solutions with constrained orientations.
The two walls of a sulcus have by construction opposite current density signs:
http://neuroimage.usc.edu/brainstorm/Tutorials/SourceEstimation#Sign_of_constrained_minimum_norm_values

If you are using ROIs that are large enough to include both sides of a sulcus, and average non-rectified min norm maps, the result might be close to zero (positive and negative values cancel out).
This option finds the dominant orientation in the scout and flips the sign of all the sources that have an opposite orientation.
This is done in function bst_scout_value.m.

Cheers,
Francois

Aaah! Ok, I understand! :slight_smile: Thank you.