Source localization scouts extraction

Dear @Francois

Hope you are doing well. I am currently testing source estimation with the beamformer method, I got some questions that I did not find on the forum and the tutorial. Maybe you could give me some recommendations/suggestions on my case. :slight_smile:

My analysis pipeline:
EEG preprocessing โ†’ source analysis โ†’ scouts extraction (based on several brain regions) โ†’ connectivity analysis

As written in your tutorial, the extracted time series has three orientations (x,y,z), but the connectivity analysis methods usually work between two time series rather than between two time series and a triplet of components. Thus, we need to project along the strongest dipole direction according to the tutorial from Fieldtrip.

In their example code, they use SVD(singular value decomposition) to find the parameter and then multiply the original time series.

beamformer = source.avg.filter{1};

%% construct a single virtual channel in the maximum power orientation
timeseries = cat(2, sourcedata.trial{:});
[u, s, v] = svd(timeseries, 'econ');

%% this is equal to the first column of matrix V, apart from the scaling with s(1,1)
timeseriesmaxproj = u(:,1)' * timeseries;

virtualchanneldata = [];
virtualchanneldata.label = {'cortex'};
virtualchanneldata.time = data.time;
for i=1:length(data.trial)
  virtualchanneldata.trial{i} = u(:,1)' * beamformer * data.trial{i}(chansel,:);
end

In brainstorm, there is a option to save the filter from beamfomer interface(as shown below). As I did not know how the beamfomer was implemented in brainstorm, my question is: if I extracted the time series from brainstorm by scouts, do I need to multiply the filter with the extracted time series?

spatial filter

As written in your tutorial, the extracted time series has three orientations (x,y,z)

This depends on type of source model (constrained orientations or unconstrained orientations):

but the connectivity analysis methods usually work between two time series rather than between two time series and a triplet of components.

The estimation of connectivity from unconstrained source maps is discussed in the new connectivity tutorials:

In brainstorm, there is a option to save the filter from beamfomer interface(as shown below).

This is not part of the current distribution of Brainstorm, and probably disappeared a long time ago.

Start by updating Brainstorm, then if you want to use a beamformer solution, please refer to the current documentation:
https://neuroimage.usc.edu/brainstorm/Tutorials/SourceEstimation#Advanced_options:_LCMV_beamformer

Alternatively, you can use FieldTrip's beamformer, but then you need to ask for help on the FieldTrip mailing list.

1 Like

@Francois
Thank you very much for the prompt reply. It was a great help. I have here one more question regarding the analysis after source estimation.

I am planning to apply time-resolved PAC on the scout extractions from the unconstrained source estimation with the LCMV beamformer. Shall I extract as one time series (norm/PCA from the flatmap) or keep the three orientations? It seems that each orientation will be also computed on my test run. I have checked the source code of PAC implementation, the unconstrained orientations will be averaged. Would this be the same for tPAC? and since it is not implemented in process_pac_dynamic, is there any additional step needed in this case?

Many thanks!

Shall I extract as one time series (norm/PCA from the flatmap) or keep the three orientations?

Norm: NO. You can't take the norm the three orientations as this would get rid of signal features needed by the PAC and tPAC estimates.
PCA: I'm not sure. @Samiee @Sylvain ?

It seems that each orientation will be also computed on my test run. I have checked the source code of PAC implementation, the unconstrained orientations will be averaged. Would this be the same for tPAC?

Yes:

@Francois

Thanks for the explanation, I have just checked the code and I tried to apply tPAC directly on the estimated source result. After choosing scouts from the interface, it runs for some time, however, it gets me an error in the end. This might be a potential issue with the Brainstorm as I get same error in every repetition and the files in the folder cannot be viewed in Brainstorm. The screenshot is attached, how can I debug this one or would it be possible to double-check from your end?

I could reproduce the error and fix it: Bugfix: tPAC on scouts was creating buggy files structures ยท brainstorm-tools/brainstorm3@691a30c ยท GitHub

  1. Update Brainstorm to get the updated code
  2. Delete the buggy tPAC files from the database:
    • With the file explorer of Windows, go to the folder ProtocolFolder\data\Subject01\S01_AEF_20131218_01_600Hz_notch
    • Delete all the timefreq_tpac_...mat files
    • In the Brainstorm database explorer: Right-click on the Subject01 folder > Reload

Next time you compute the tPAC files from scouts, it should create valid files.

1 Like

@Francois

Thank you very much for such rapid updates. I have attempted again, the process went through well. However, it seems the three orientations of the scout time series were not averaged. I have chosen one ROI and the result shows 3 scouts in Brainstorm. I double-checked the script in dynamic PAC. It seems the data type of the result(source estimation) was not correctly cognized as result type but matrix. Additionally, the result matrix seems to show channels as index of voxels. (see screenshot)

Indeed, the tPAC code was clearly not designed to handle scouts correctly.
I fixed this, so that the results from the 3 orientations are averaged, similarly to what is done in bst_timefreq.m. Please update Brainstorm and try again.

Note that in the tPAC process, the various vertices within a scout are never averaged together.
I'm not sure this is the expected behavior...
@Samiee @Sylvain Can you please comment on that?