[FieldTrip] Why are time-frequency results so much different from Beamformer source localization?

Patrick Wiegel patrick.wiegel at sport.uni-freiburg.de
Tue Nov 24 10:21:35 CET 2020


Hi Stephen, hi fiedltrip community

first of all, thanks for the good discussion that we have:-).

The 2 channels in the back were indeed a bit noisy, so I removed those. I attached the results from the new mtmfft analysis. The abs and rel differences between A and B become clearer now, although you could still argue to remove the most right posterior channel. However, I don’t want to loose too much information and I think it is okay to stick with this.

Your argumentation on the right/left behavior in MRIs was helpful. I had to think/read about that for a while. Since I am using the standard_MRI from the fieldtrip page (https://github.com/fieldtrip/fieldtrip/tree/master/template/headmodel), I cannot certainly tell where left and right is. the transformation matrix of the standard MRI is the following which leads me to assume that right is right?

    0.1000         0         0  -12.8500
         0    0.1000         0  -12.8500
         0         0    0.1000  -12.8500
         0         0         0    1.0000


I tried to use a larger grid during ft_prepare_sourcemodel, however, it seems that as soon as I use a negative inward shift, the ft_sourceanalysis function does not work. I get the following error.


Error using svd
Input to SVD must not contain NaN or Inf.

Error in ft_inverse_dics>pinv (line 590)
  [U,S,V] = svd(A,0);

Error in ft_inverse_dics (line 475)
        filt = pinv(lf' * invC * lf) * lf' * invC; % Gross eqn. 3 & van Veen eqn. 23, use PINV/SVD to cover rank
        deficient leadfield

Error in ft_sourceanalysis (line 763)
          dip(i) = ft_inverse_dics(sourcemodel, sens, headmodel, [],  squeeze_Cf, methodopt{:}, leadfieldopt{:});

Error in FT_example_without_baseline (line 121)
sourceAll_beta = ft_sourceanalysis(cfg, data_beta);


Not using a negative inward-shift results in the attached source-differences between conditions.
Best, Patrick



Patrick Wiegel
Department of Sport and Sport Science

University of Freiburg
Sandfangweg 4
79117 Freiburg i. Br .

phone: +49 (0)761/ 203-4550
email: patrick.wiegel at sport.uni-freiburg.de<mailto:patrick.wiegel at sport.uni-freiburg.de>
web: www.sport.uni-freiburg.de

Am 20.11.2020 um 13:02 schrieb Stephen Whitmarsh <stephen.whitmarsh at gmail.com<mailto:stephen.whitmarsh at gmail.com>>:

Hi Patrick,

Things are becoming clearer now, good to see.

So yes, that artefact in the back of the head: I would definitely take care of that. Maybe do another run of (visual) artefact rejection, or remove those channels.
That the effect is less apparent in the relative difference is not surprising as the absolute differences are expected to be bigger than on other channels due to large amplitudes of the artefacts, which will be 'normalized' over channels when using a relative difference.

I would be careful about interpreting left-right on the plot. Note that you assume you are looking from the top/front of the head downwards/backwards - but there is no way of confirming that based on the picture! People often place some kind of marker on the left or right side of the head when doing an MRI scan - e.g. a vitamin D (?) capsule I think so that one can verify the radiological versus anatomical (?) representation (LR is flipped in radiological plots). You could do this once, and verify your pipeline, if you want to be 100% sure.

Lastly, it seems that the source picture could benefit from using a slightly larger beamformer scanning grid so to overlap more with the edge of the brain/skull. I used to do that using a negative value for the inward shift parameter (cfg.inwardshift) in ft_prepare_sourcemodel. Maybe there is an easy way for you to do that in your pipeline as well.

Looking good!
Stephen





Op vr 20 nov. 2020 om 12:31 schreef Patrick Wiegel <patrick.wiegel at sport.uni-freiburg.de<mailto:patrick.wiegel at sport.uni-freiburg.de>>:
Dear Stephen,

thanks for the response.

I followed your suggestions and attached the plots. I performed Morlet wavelets TF analyses and mtmfft for conditions A and B. I did not use a baseline correction to see whether this is necessary. As you can see in the topographical plots, both conditions (A and B) have high power in 2 posterior electrodes (I guess some kind of artifact or noise is the reason). Using the abs. difference between A and B does not get rid of that fact, probably because one condition is more affected than the other. Using the rel. difference does a better job and resembles my previous baseline-corrected results. I also compared the baselines and they were not different. The two conditions were furthermore randomized within the same protocol. I assume that adding a baseline is thus unnecessary.

Regarding the source_analysis, the results for individual conditions A and B (NAI) as well as abs dif between A and B look weird again. But that’s very likely due to the same problem as for the power. For rel dif between A and B, the source plot seems more reasonable, although I expect the source to be in the right hemisphere and not in the left as shown in the plot. I controlled that all my input data (electrodes, volume condition model, MRI) have the same definition of the axes (x+ pointing right, y+ pointing anterior, z+ pointing superior) so I don’t think there is a right-left mix-up!?

Now I am wondering whether I have to accept the result for the rel difference in sources between A and B (which is very hard to interpret and justify after what I am observing in the TF analysis, namely an effect in the other hemisphere) or whether there might be still some issue in my approach. It is very hard for me to believe that the source analysis does have so strong assumptions such that it can be in such strong contrast to my power data.

If I am correct, what I input into the source analyses (apart from my models) for conditions A and B are 1) the corresponding power matrix (64 channels x 1 power value) and the CSD (2016 * 1). It could of course be that the source analysis is very sensitive to the large abs differences in power/CSD data between electrodes. However, I also used cfg.supchan (suppressing specific channels) in the source analysis for the 2 channels that were „off“ to see whether this makes it different.However, the source result is similar.

Any comment is appreciated.   All plots, data and scripts are at (https://github.com/PatrickWiegel/EEG-Beamformer-Source-localisation).

Best, Patrick

%%

cfg                  = [];
cfg.headmodel        = vol;
cfg.elec             = elec_aligned;
cfg.reducerank       = 2;
cfg.resolution       = 1;
sourcemodel_beta = ft_prepare_leadfield(cfg,data_beta);

%%

cfg              = [];
cfg.method       = 'dics';
cfg.sourcemodel  = sourcemodel_beta;
cfg.headmodel    = vol;
cfg.elec         = elec_aligned;
cfg.frequency    = 28;
cfg.dics.projectnoise = 'yes';
cfg.dics.keepfilter   = 'yes';
cfg.dics.realfilter   = 'yes';
sourceAll_beta = ft_sourceanalysis(cfg, data_beta);

%%

cfg              = [];
cfg.method       = 'dics';
cfg.headmodel    = vol;
cfg.elec         = elec_aligned;
cfg.dics.projectnoise = 'yes';
cfg.dics.keepfilter   = 'yes';
cfg.dics.realfilter   = 'yes';
cfg.sourcemodel  = sourcemodel_beta;
cfg.sourcemodel.filter = sourceAll_beta.avg.filter;

source_beta_1 = ft_sourceanalysis(cfg, data_beta_1);
source_beta_0 = ft_sourceanalysis(cfg, data_beta_0);


%%

sourceNAI1 = source_beta_1;
sourceNAI1.avg.pow = source_beta_1.avg.pow ./ source_beta_1.avg.noise;

sourceNAI0 = source_beta_0;
sourceNAI0.avg.pow = source_beta_0.avg.pow ./ source_beta_0.avg.noise;

cfg            = [];
cfg.parameter = 'pow';
cfg.operation = 'x1./x2';
sourceDiff_beta_rel = ft_math(cfg, source_beta_1,source_beta_0);

cfg            = [];
cfg.parameter = 'pow';
cfg.operation = 'x1 - x2';
sourceDiff_beta_abs = ft_math(cfg, source_beta_1,source_beta_0);

%%
cfg            = [];
cfg.downsample = 2;
cfg.parameter  = 'pow';
sourceDiffInt_beta_dif_rel  = ft_sourceinterpolate(cfg, sourceDiff_beta_rel , mri_realigned);
sourceDiffInt_beta_dif_abs  = ft_sourceinterpolate(cfg, sourceDiff_beta_abs , mri_realigned);
sourceDiffInt_beta_dif_0  = ft_sourceinterpolate(cfg, sourceNAI0 , mri_realigned);
sourceDiffInt_beta_dif_1  = ft_sourceinterpolate(cfg, sourceNAI1 , mri_realigned);

%%
maxval_beta_rel = max(sourceDiffInt_beta_dif_rel.pow);
maxval_beta_abs = max(sourceDiffInt_beta_dif_abs.pow);

%%
cfg = [];
cfg.nonlinear     = 'no';
sourceDiffIntNorm_beta_dif_rel = ft_volumenormalise(cfg, sourceDiffInt_beta_dif_rel);
sourceDiffIntNorm_beta_dif_abs = ft_volumenormalise(cfg, sourceDiffInt_beta_dif_abs);
sourceDiffIntNorm_beta_dif_0 = ft_volumenormalise(cfg, sourceDiffInt_beta_dif_0);
sourceDiffIntNorm_beta_dif_1 = ft_volumenormalise(cfg, sourceDiffInt_beta_dif_1);

Patrick Wiegel
Department of Sport and Sport Science

University of Freiburg
Sandfangweg 4
79117 Freiburg i. Br .

phone: +49 (0)761/ 203-4550
email: patrick.wiegel at sport.uni-freiburg.de<mailto:patrick.wiegel at sport.uni-freiburg.de>
web: www.sport.uni-freiburg.de<http://www.sport.uni-freiburg.de/>

Am 19.11.2020 um 14:59 schrieb Stephen Whitmarsh <stephen.whitmarsh at gmail.com<mailto:stephen.whitmarsh at gmail.com>>:

Dear Patrick,

Nice to see you are progressing. The TFR topoplots look nice (and the effect seems even stronger in the mtmfft version)!

I agree the source reconstruction looks pretty iffy. A single dot like that shouldn't be there - no source in Beamformer is so focal. It suggests something is off, which could be as simple as a single electrode doing something weird (given how focal and superficial the artefact is).

I would take another step back;
I would first look at the distribution of your absolute beta, i.e. without baseline correction. For both conditions.
I would then look at the distribution of your baseline beta, i.e. only your baseline. For both conditions.
You should satisfy yourself that the results make sense, i.e. nothing too drastic, focal, etc., and some density of beta power around the central sulcus (?).

Now I understand your contrast better, I have to ask why you do the baseline correction as you do. In this way you are using a separate BL for each condition, meaning that after BL-correction you are actually also comparing BL as much as you are comparing post-BL activity - after BL-correction any differences in BL become difference in your active period.
If you assume differences in BL you might want to compare those separately before you 'add' them to your active period. If you have a randomized design, you might not want to do any BL correction in your contrast at all. Also, if there are no differences in BL, then it would make no difference...
So, when you have a good sense of the absolute values and source distributions, you might want to try just comparing active period A vs B, relative (/) or absolute (-), and forget about the BL. Sometimes the BL is more noisy than the active period even.

Anyway, your script looks fine to me, but it's been a while. However, I suspect that one of your datasets (A, A_BL, B, or B_BL) has some artefact that is introduced in the contrast.

Cheers,
Stephen











Op do 19 nov. 2020 om 13:27 schreef Patrick Wiegel <patrick.wiegel at sport.uni-freiburg.de<mailto:patrick.wiegel at sport.uni-freiburg.de>>:
Dear fieldtrip community,

first of all, thank you for your valuable responses @Tzvetan and Stephen. They were both very helpful and got me to dig deeper into the analysis.

You were absolutely right in describing my approach for my Morlet wavelet TF analysis. The data were baseline corrected (in db). When contrasting the 2 conditions of interest, I receive the attached figure (dif_morlet). After your responses, I took the same approach for the mtmfft data with cfg.tapsmofrq = 8 (center frequency at 28 Hz) to reproduce the effect that I found between 20-35 Hz in the morlet wavelet analyses. I calculated frequency analysis (mtmfft) for both conditions (data_1, data_0) and their baseline periods (data_1_bas, data_0_bas) separately and then „baseline corrected“ the data from both conditions (also in db, see dif_mtmfft). The differences between conditions are now very similar between both approaches (morlet vs mtmfft).

In the next step. I followed your advice and performed source analyses of frequency_data for all 4 conditions separately (pow_1, pow_0, pow_1_baseline, pow_0_baseline) as well as from all_data from ft_appenddata. For the source_analyses from all 4 conditions, I am using the common filter from all_data as well as the source model (ft_prepare_leadfieldds) from all_data. After performing the ft_source_analysis function for all 4 conditions, I am trying to replicate what I have done with the power data ( in db). For this reason, I am using ft_math with source_1_dif = 10*log10 (source_1/source_1_baseline) and the same for source_0. After this, I am subtracting source_0_dif from source_1_dif as done during the frequency analysis yielding my final source data.

After interpolating the source differences, I am using ft_volumenormalise. The result from this approach is attached in dif_sources.

I am a bit puzzled since I would not expect these source data based on my power mtmfft data. I made sure that the coordinate systems and units are the same across models (volume_conduction_model, electrodes, MRI) but I am wondering whether I am doing something wrong in performing the source_analysis or whether the source results are reasonable.

Again, I uploaded the script and the data such that my analysis pipeline could be reproduced by everyone who is interested (https://github.com/PatrickWiegel/EEG-Beamformer-Source-localisation). Below, I am attaching the code for the source_analyses steps. Any comments on my results or approach are welcome.

All the Best from Germany,
Patrick



.






cfg              = [];
cfg.method       = 'dics';
cfg.headmodel    = vol;
cfg.elec         = elec_aligned;
cfg.dics.projectnoise = 'yes';
cfg.dics.lambda       = '5%';
cfg.dics.keepfilter   = 'yes';
cfg.dics.realfilter   = 'yes';
cfg.sourcemodel  = sourcemodel_beta;
source_beta_1 = ft_sourceanalysis(cfg, data_beta_1);
source_beta_0 = ft_sourceanalysis(cfg, data_beta_0);
source_beta_1_bas = ft_sourceanalysis(cfg, data_beta_1_bas);
source_beta_0_bas = ft_sourceanalysis(cfg, data_beta_0_bas);


%%
cfg            = [];
cfg.parameter = 'pow';
cfg.operation = '10*log10(x1/x2)';
sourceDiff1_beta = ft_math(cfg, source_beta_1,source_beta_1_bas);
sourceDiff0_beta = ft_math(cfg, source_beta_0,source_beta_0_bas);

sourceDiff_beta_dif = sourceDiff1_beta;
sourceDiff_beta_dif.pow = sourceDiff1_beta.pow - sourceDiff0_beta.pow;

%%
cfg            = [];
cfg.downsample = 2;
cfg.parameter  = 'pow';
sourceDiffInt_beta_dif  = ft_sourceinterpolate(cfg, sourceDiff_beta_dif , mri_realigned);

%%
maxval_beta = max(sourceDiffInt_beta_dif.pow);
%%
cfg = [];
cfg.nonlinear     = 'no';

sourceDiffIntNorm_beta_dif = ft_volumenormalise(cfg, sourceDiffInt_beta_dif);

%%
cfg = [];
cfg.method        = 'ortho';
cfg.interactive   = 'yes';
cfg.funparameter  = 'pow';
cfg.maskparameter = cfg.funparameter;
cfg.funcolorlim   = [0.0 maxval_beta];
cfg.opacitylim    = [0.0 maxval_beta];
cfg.opacitymap    = 'rampup';
ft_sourceplot(cfg, sourceDiffIntNorm_beta_dif);
%%


Patrick Wiegel
Department of Sport and Sport Science

University of Freiburg
Sandfangweg 4
79117 Freiburg i. Br .

phone: +49 (0)761/ 203-4550
email: patrick.wiegel at sport.uni-freiburg.de<mailto:patrick.wiegel at sport.uni-freiburg.de>
web: www.sport.uni-freiburg.de<http://www.sport.uni-freiburg.de/>

Am 13.11.2020 um 12:48 schrieb Stephen Whitmarsh <stephen.whitmarsh at gmail.com<mailto:stephen.whitmarsh at gmail.com>>:

Hi Patrick, (and Tzvetan - who responded in the meantime),

I agree that you should start with a good correspondence between your initial results (wavelets), and the power difference you are trying to localize (with mtmfft).

Wavelets and fft methods can result in very similar - practically identical - results, but that depends on a number of parameters, especially concerning frequency-smoothing; Wavelets are typically defined in terms of nr. of cycles, while fft methods are defined in terms of time-windows. Wavelets defined in nr. of cycles will have a decreasing time-windows with increasing frequency, while with mtmfft time windows will remain the same. Because of this, frequency smoothing will increase with frequency with wavelets, and stay the same with a constant time window. Of course, you can make the fft time window frequency-dependent, as is described in the frequency-analyses tutorial, to make them more comparable. Secondly, the fft method allows you to specify frequency smoothing when you use Sleppian multitapers (cfg.taper = 'dpss'). To be clear, you should be able to recognize these differences in frequency smoothing/resolution when looking at the different TFR plots. Currently they look too different, probably because of something else (baseline?) than a wavelet-fft difference.

I would advise making a 'full' TFR with mtmfft similar as your wavelet results so that you can properly compare them. This allows you to also set the best parameters for smoothing/timeperiods. In fact, you can use the multitaper approach to more accurately extract the power in a certain frequency band. Only then compare the topo's, and only then do the beamformer, so you will pick up any unexpected results.

Because of different contrasts/baseline correction, I cannot compare the topo's / beamformer results.

Bon courage,
Stephen









Op vr 13 nov. 2020 om 11:30 schreef Patrick Wiegel <patrick.wiegel at sport.uni-freiburg.de<mailto:patrick.wiegel at sport.uni-freiburg.de>>:
Dear Field-trip community,

I am working on EEG data from a motor learning task. in the first part of my analysis, I performed a time-frequency analysis (Morlet wavelet method) and cluster-based permutation test. I compared two different conditions (correct & incorrect movements) within subjects and found a significant difference in the beta band (20-35 Hz) when subjects were provided with feedback. I attached the topographical plot from one subject that illustrates the difference between the conditions at the selected time point and frequency (dif_morlet). As you can see, beta power was higher in one condition in lateral frontal electrodes.

Now, I would like to better spatially locate the effect for this single subject. For this purpose, I followed the Beamformer tutorial on the website. In the first step, I selected the raw data of interest (at the time where the effect was seen) and performed frequency analyses for the 20-35 Hz range (mtmfft, contrast between conditions shown in dif_mtmfft). There is an apparent difference between dif_morlet and dif_mtmfft and I am wondering why this is the case? One apparent reason is that the time-frequency data were baseline corrected and the frequency data from mtmfft not.

Using the power and CSD data from mtmfft, I performed the source analysis with a standard MRI and head model. The source was located in the left hemisphere (source plot), which is in stark contrast to the time-frequency data (dif_morlet). I am aware that the source analysis is based on a lot of assumptions (conductivity etc.) that influence the calculations but it is very difficult to make sense of such discrepancy.
Maybe it is necessary to also baseline correct the mtmfft data before inputting them to the source analysis? Or doing the contrasting source localization betwee a single condition and the corresponding baseline data before contrasting the 2 conditions?

I am providing all necessary files and scripts (TF_analysis & BEAMFORMER) if anyone is interested to reproduce the results that I am showing and reporting for this single subject (https://github.com/PatrickWiegel/EEG-Beamformer-Source-localisation).

I would appreciate any help and discussion on that.

All the best,
Patrick





Patrick Wiegel
Department of Sport and Sport Science

University of Freiburg
Sandfangweg 4
79117 Freiburg i. Br .

phone: +49 (0)761/ 203-4550
email: patrick.wiegel at sport.uni-freiburg.de<mailto:patrick.wiegel at sport.uni-freiburg.de>
web: www.sport.uni-freiburg.de<http://www.sport.uni-freiburg.de/>

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201124/458e4ef0/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dif_mtmfft2.eps
Type: application/postscript
Size: 182485 bytes
Desc: dif_mtmfft2.eps
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201124/458e4ef0/attachment-0002.eps>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: source_dif2.eps
Type: application/postscript
Size: 296216 bytes
Desc: source_dif2.eps
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201124/458e4ef0/attachment-0003.eps>


More information about the fieldtrip mailing list