[FieldTrip] beamforming pipeline & comparing sources between groups of participants?

Ioanna Zioga i.zioga at qmul.ac.uk
Sun May 5 03:53:30 CEST 2019


Dear Vladimir,


Thank you so much for your valuable comments!


I input an inwardshift of 5 and the pixels are gone - the plots look pretty now, yayy :D


As I want to compare two groups of participants, I'm working on getting the source grand averages.

A few remaining issues mainly on the order of the steps to follow:


1) Option 1:

  1.  Calculate the individual sources
  2.  Interpolate the individual sources
  3.  Do volume normalization on the individual sources
  4.  Calculate the grand average sources separately for the two groups


Option 2 (less time and memory demanding):

  1.  Calculate the individual sources
  2.  Calculate the grand average sources separately for the two groups
  3.  Interpolate the two grand average sources
  4.  Do volume normalization on the two grand average sources


2) Please find attached the plots I get from option 2. Does it look ok that the sources are quite spread out (mostly central and posterior areas)? It is delta band activity (2.5-3.5 Hz) in response to acoustic tones (notes), so I expected something more focal, and especially temporal.


3) For normalization in the calculation of the individual sources, I used the Neural Activity Index, as normalizing with the baseline interval showed no sources at all in quite a few participants. I was quite surprised to see that. As participants were listerning to whole melodies (sequences of notes), and here I analyze the sources in response to the last note only, is it possible that the sources are contaminated because they use the same ones throughout the whole melody, so they cancel out?


Looking forward to your insights. As always, any comment/suggestion is more than welcome!

I truly appreciate your time and help, it's been a great learning experience.


Best,

Ioanna


---
Ioanna Zioga

PhD student

School of Biological and Chemical Sciences

Queen Mary University of London

https://www.researchgate.net/profile/Ioanna_Zioga4

<https://www.researchgate.net/profile/Ioanna_Zioga4>https://scholar.google.gr/citations?user=yPmCqmQAAAAJ&hl=en

________________________________
From: Vladimir Litvak <litvak.vladimir at gmail.com>
Sent: 04 May 2019 14:57:06
To: Ioanna Zioga
Cc: FieldTrip discussion list; M.vanEs at donders.ru.nl
Subject: Re: [FieldTrip] beamforming pipeline & comparing sources between groups of participants?

Dear Ioanna,

Indeed you are now closer to something sensible than before.


1) Does anyone have any idea why do the plots look so digitized? I used cfg.grid.resolution = 7 (units are mm). Is there any chance there is an incompatibility between my headmodel and the MRI template?

Those pixels are the points of BEM failure. You used negative inwardshift  which expands the grid rather than shrinks it. Make it positive and play with the value until those pixels are gone.

2) Is one contrasting method enough, i.e.: If I contrast the sources in the post-stimulus time window compared to a baseline, do I also need to do cfg.normalize in the calculation of the leadfield or calculate the Neural Activity Index?

If you want to get a single image that will look informative you can do those things. But if you want to do stats you should get raw images with depth bias and compare them statistically and then something sensible should come out in the statistical results if you’ve done everything correctly.

3) Is it ok to compute the volume condution model in SPM, then use that to calculate the leadfield in fieldtrip, and then use a template MRI to just do the visualization of the sources (see pipeline below)?

It should be OK if the coordinate systems are handled correctly.
If you keep everything in MNI-aligned coordinates in mm the output should match the template image.

4) Do I need to do cfg.reducerank when calculating the leadfield?

No, for EEG you don’t. I’m not sure what the default is but you can set it to 3.


Here I'm adding my code, in case anyone could have a look and spot any mistakes/make suggestions! That would be extremely helpful.

In principle it shouldn’t be necessary to do additional alignment in FT if you’ve already coregistered your volume and sensors in SPM and your grid was generated based on that same vol.

Best,

Vladimir


Maybe it can also be of help to people who want to do the same analysis in the future.
After using SPM to create a volume conduction model in SPM, I moved to fieldtrip:

% Convert volume conduction model and electrodes from SPM
volsens = spm_eeg_inv_get_vol_sens(D, 1, 'MNI-aligned', 'inv', 'EEG');
vol1      = volsens.EEG.vol;
sens1   = volsens.EEG.sens;

% Calculate the cross-spectral density matrix of my EEG data, EEGft (after re-referencing to common average)
cfg = [];
cfg.method = 'mtmfft';
cfg.output = 'powandcsd';
cfg.foilim      = [22 22];
cfg.taper       = 'dpss';
cfg.tapsmofrq = 10;
cfg.keeptrials  = 'no';
cfg.keeptapers  = 'no';
cfg.toi = 0.6;
cfg.t_ftimwin = 0.4;
freq = ft_freqanalysis(cfg, EEGft);

% Convert all units to mm
sens1 = ft_convert_units(sens1, 'mm');
vol1    = ft_convert_units(vol1, 'mm');

% Plot brain, skull, and scalp [SEE FIGURE VOL_COND_MODEL ATTACHED]
figure; ft_plot_mesh(vol1.bnd(1), 'facecolor',[0.4 0.6 0.4], 'facealpha', 0.9, 'edgecolor', [1 1 1], 'edgealpha', 0.05); rotate3d on
hold on; ft_plot_mesh(vol1.bnd(2),'edgecolor','none','facealpha',0.4);
hold on; ft_plot_mesh(vol1.bnd(3),'edgecolor','none','facecolor',[0.2 0.2 0.2],'facealpha',0.3);

% Interactively aligned electrodes to head surface
cfg                    = [];
cfg.method       = 'interactive';
cfg.elec             = sens1;
cfg.headshape  = vol1.bnd(3); % scalp
sens1_aligned  = ft_electroderealign(cfg);

% plot scalp & sensors [SEE FIGURE ELEC_ALIGN ATTACHED]
figure; ft_plot_mesh(vol1.bnd,'edgecolor','none','facealpha',0.8,'facecolor',[0.6 0.6 0.8])
hold on; ft_plot_sens(sens1_aligned,'elecsize',30);
alpha 0.7; rotate3d on

% Calculate leadfield
cfg = [];
cfg.grid.resolution = 7;
cfg.inwardshift = -7;
cfg.unit = 'mm';
cfg.headmodel = vol1;
cfg.grad = sens1_aligned;
cfg.elec = sens1_aligned;
cfg.senstype = 'eeg';
grid = ft_prepare_leadfield(cfg, freq);

% plot leadfield and headmodel [SEE FIGURE LEADFIELD ATTACHED]
figure; hold on; ft_plot_mesh(grid.pos(grid.inside,:));
hold on; ft_plot_mesh(vol1.bnd(1));

% Beamforming
cfg = [];
cfg.headmodel = vol1;
cfg.grad      = sens1_aligned;
cfg.senstype  = 'eeg';
cfg.grid      = grid;
cfg.method    = 'dics';
cfg.frequency = [22 22];
cfg.dics.projectnoise   = 'yes';
cfg.dics.lambda         = '5%';
cfg.dics.keepfilter     = 'yes';
cfg.dics.realfilter     = 'yes';
sourceA = ft_sourceanalysis(cfg, freq);

% Plot results on an MRI template
load standard_mri;

% Interpolated sourceA to MRI
cfg                  = [];
cfg.parameter = 'pow';
sourceAint      = ft_sourceinterpolate(cfg, sourceA, mri);

% Plot source [SEE FIGURE SOURCEANALYSIS ATTACHED]
cfg = [];
cfg.method        = 'slice';
cfg.funparameter  = 'pow';
cfg.maskparameter = cfg.funparameter;
cfg.funcolorlim   = [0.0 2479475.3054];
cfg.opacitylim    = [0.0 1.2];
cfg.opacitymap    = 'rampup';
ft_sourceplot(cfg, sourceAint);

Please feel free to make any comments/suggestions on the above code and questions!
Any insight is extremely appreciated!

I think I'm getting there.. and luckily I'm -still- excited about it 😊

Thank you all so much in advance, have a great weekend!

Best,
Ioanna


________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>> on behalf of Es, M.W.J. van (Mats) <M.vanEs at donders.ru.nl<mailto:M.vanEs at donders.ru.nl>>
Sent: Thursday, May 2, 2019 11:03:39 AM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] beamforming pipeline & comparing sources between groups of participants?


Dear Ioanna,



Indeed, these types of analysis are exciting, but complex! I have some suggestions for you. They might not solve your problem per se, but at least it should give you some insight in your analysis.



1)      As Vladimir suggested, make sure your headmodel and sourcemodel align and are of the same unit. Also, it might be better to look at source contrasts due to the center of the head bias (see http://www.fieldtriptoolbox.org/tutorial/beamformer/#source-analysis-without-contrasting-condition)

Localizing oscillatory sources using beamformer techniques - FieldTrip toolbox<http://www.fieldtriptoolbox.org/tutorial/beamformer/#source-analysis-without-contrasting-condition>
www.fieldtriptoolbox.org<http://www.fieldtriptoolbox.org>
Tags: tutorial meg freq source headmodel mri plot meg-language Localizing oscillatory sources using beamformer techniques Introduction. In this tutorial we will continue working on the dataset described in the preprocessing tutorials. Below we will repeat code to select the trials and preprocess the data as described in the first tutorials (trigger based trial selection, visual artifact ...



-          Your frequency analysis looks correct. Since dics sourceanalysis is done on a single frequency, you can use smoothing to still encompass an entire frequency range.

-          This means that in the sourceanalysis you don’t have to specify the [12 32] but could enter the center frequency: [22 22],  since the estimate at this frequency encompasses the entire range.

-          In your sourceanalysis you don’t have to specify cfg.latency. Your frequency estimate is based on this window already. The cfg.latency option is used when your frequency data is time-resolved (cfg.method = ‘mtmconvol’/’wavelet’ in ft_freqanalysis).

-          In your frequency analysis, there’s no need to keep trial information for sourceanalysis. As default, sourceanalysis will average over trials anyway. (trial information is only required if you use some kind of resampling procedure (like cfg.jackknife, cfg.bootstrap etc). (If you’d want to do single-trial analysis, you could multiply the spatial filter (from sourceanalysis) with channel-level single-trial frequency estimates. )

2)      Yes, you should do sourceanalysis separately for every participant.

3)      Take a look at ft_sourcegrandaverage

4)      Very good question, without a straightforward answer.

-          If you’ve already found a statistically significant effect at the channel level, there’s no need to do statistics at the source level anymore; you’ve already rejected the null-hypothesis. You use source analysis only to visualize and interpret the data.

-          If you think you can gain statistical sensitivity by going to the source level, you should think of some way to reduce the dimensionality of your data. If you would statistically test power at every grid point, you will probably lose any effect when doing multiple comparison correction. For example, you might know (from the literature) that if there would be an effect, it will most likely be in a specific ROI. Then you could choose to average power in this ROI and test this between groups.

Alternatively, you could define your own ROI based on for example the induced power effect over all subjects: find out which region has the highest power increase (i.e. from baseline) in this task in general (thus irrespective of condition). Use this region the then test differences between conditions.



Hope this helps!



All the best,

Mats



PhD candidate


Dynamic Connectivity


Donders Institute for Brain,

Cognition and Behaviour


e:


m.vanes at donders.ru.nl<mailto:m.vanes at donders.ru.nl>


a:


Kapittelweg 29, 6525 EN Nijmegen



p:


+31(0)24 36 68291












From: Ioanna Zioga <i.zioga at qmul.ac.uk<mailto:i.zioga at qmul.ac.uk>>
Sent: woensdag 1 mei 2019 16:48
To: litvak.vladimir at gmail.com<mailto:litvak.vladimir at gmail.com>
Cc: fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
Subject: [FieldTrip] beamforming pipeline & comparing sources between groups of participants?



Dear Vladimir,



For anyone interested, I used SPM to make a template head model which I'm going to use to do beamforming in FT.

I have queries with regards to the source analysis pipeline I'm using in FT, as the results I get don't seem right.



Vladimir, following our previous email exchange (and thanks to your suggestions), I have now managed to compute the lead field matrix in FT (by removing eeglab and fieldtrip directories from the path, and adding spm's).



I want to contrast the sources of two groups of participants (high- vs. low-learners) in two frequency bands (low: 2.5-4.5 Hz; high: 12-32 Hz), from 0.20-1 sec post stimulus onset.



Here is my pipeline:



% Calculate the cross spectral density matrix (e.g., for the 12-32 Hz frequency band)

cfg                    = [];

cfg.method     = 'mtmfft';

cfg.output       = 'powandcsd';

cfg.foilim         = [22 22];

cfg.taper          = 'dpss';

cfg.tapsmofrq = 10;

cfg.keeptrials   = 'yes';

cfg.keeptapers = 'no';

cfg.toi                = 0.6;

cfg.t_ftimwin   = 0.4;

freq                    = ft_freqanalysis(cfg, EEGft);



% Source analysis using DICS beamformer

cfg                      = [];

cfg.headmodel = vol1;

cfg.grad             = sens1;

cfg.senstype     = 'eeg';

cfg.grid              = grid;

cfg.method       = 'dics';

cfg.frequency   = [12 32];

cfg.latency        = [0.2 1];

cfg.dics.projectnoise   = 'yes';

cfg.dics.lambda            = 0;

cfg.dics.keepfilter        = 'yes';

cfg.dics.realfilter          = 'yes';

sourceA                         = ft_sourceanalysis(cfg, freq);



% Plot sources

cfg                           = [];

cfg.method            = 'slice';

cfg.funparameter = 'pow';

ft_sourceplot(cfg, sourceA);



=> The source plots look weird though - they scale from 0 to x10^45, and are totally black.



1) Am I doing something wrong in the freqanalysis or the sourceanalysis?

2) Do I need to do the ft_sourceanalysis separately for each participant?

3) Is there a way to average the results of the source analysis over groups of participants?

4) Could you give any direction/resource on how to statistically compare the sources of different groups?



As you all know this is a very exciting but also not trivial analysis.. so I'd be extremely grateful for any help at this point, it'd be very much appreciated! Thanks so much in advance!



Best,

Ioanna



<sourceanalysis.png>
<vol_cond_model.png>
<elec_align.png>
<leadfield.png>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190505/8b24c977/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sourcegrandavg_normalized.png
Type: image/png
Size: 553207 bytes
Desc: sourcegrandavg_normalized.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190505/8b24c977/attachment-0002.png>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list