[FieldTrip] Results from source analysis with different fieldtrip versions differ!?

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Thu Nov 5 14:43:03 CET 2020


Hi Alexandra,

We use Zoom to meet. I would assume you are familiar with it. Once you have an invite link you can easily join. Then we typically discuss a bit and create ‘breakout rooms’ where we can work in teams. Zoom allows for remote control of other people’s computer, so ideally we’d then be able to work on your problem locally. This would require zoom to run (on your end) on a machine that has access to the graphical interface that is running matlab. If you then could set up a matlab session that is in a ’state’ that allows for easy reproduction of the problem (i.e. freq data loaded in, and the relevant script open in the editor), we could hit the ground running.

I will send you a link, if you’d like to join today (I’ll send this off list).

Best wishes,
Jan-Mathijs


On 5 Nov 2020, at 13:40, Alexandra Steina <alexandra.steina at uni-duesseldorf.de<mailto:alexandra.steina at uni-duesseldorf.de>> wrote:

Hi Jan-Mathijs,

Option 3 sounds great to me as well! It's probably the best way to fix this issue. So what format does the meeting have in times of Corona?
I do my PhD in Jan Hirschmann's group and I talked to him and to other people from my group, but there is nobody who has been using 'dics' beamforming and source localisation with Fieldtrip recently, so that I can not tell if anyone experienced similar issues. That's why Jan suggested to contact the Fieldtrip Mailing List.

Greetings,
Alexandra

Am 05.11.2020 um 09:39 schrieb Schoffelen, J.M. (Jan Mathijs):
Thanks Alexandra,

This sounds like something that might need to be looked into a bit more thoroughly.

I see several possible ways forward.

1) The most straightforward way would be to have one of your local technical experts look along. I might be mistaken, but given your affiliation I have the impression that there might be quite some people around that 1) know the MEG system that you are using, and 2) use very similar analyses. Have you already consulted locally, to see whether people have experienced similar issues? Or have you asked people to look along with you, to diagnose the issue a bit further?

2) You could file an issue on https://github.com/fieldtrip/fieldtrip, which at a minimum would include some code and data to reproduce the issue. In itself, this is a little bit less preferred, because in this case one of the developers needs to look into this (individually), (s)he might solve and fix it, and report back to you that it has been fixed. The problems I see with this approach is that 1) the person looking into the problem is doing some unrewarding problem solving, and 2) the person whose problem hopefully will be solved does not really gain a lot of insight into what was wrong in the first place.

So, I would vote for option 3: why don’t we work on this together?

At the DCCN we have a weekly MEEG-‘hackaton’, usually on the Thursday afternoons (15.00-17.00), in which we team up to work on something together. One of these ’something’s could be to fix issues that people are experiencing in their analysis pipelines. As such there is no reason to constrain these meetings to local people, so I’d say why don’t you join the club for one of the upcoming meetings? Just drop me a line off-list.

Best wishes,

Jan-Mathijs


On 5 Nov 2020, at 08:27, Alexandra Steina <Alexandra.Steina at uni-duesseldorf.de<mailto:Alexandra.Steina at uni-duesseldorf.de>> wrote:

Hi  Jan-Mathijs,

Thanks for the quick reply.
I've checked it for the april and october version and the 'freq' structures are the same.

Greetings,
Alexandra

Am 04.11.2020 um 14:09 schrieb Schoffelen, J.M. (Jan Mathijs):
Hi Alexandra,

Hmmm, that’s not good. We have recently tried to clean up the codebase that is doing various inverse calculations, which was indeed around the time at which you identified a change in figure quality. I don’t think this has to do with the leadfield computation.

Just as a first step, could you check whether the ‘freq’ structures are the same in the different FieldTrip versions? Just to be sure that indeed the cause of this lies in ft_sourceanalysis or ft_inverse_dics.

Best wishes,
Jan-Mathijs



On 4 Nov 2020, at 13:38, Alexandra Steina <Alexandra.Steina at uni-duesseldorf.de<mailto:Alexandra.Steina at uni-duesseldorf.de>> wrote:

Hello everyone,

I used the following pipeline to perform a source analysis on MEG-LFP data. I noticed different results when using different Fieldtrip Versions for the exact same data and analysis pipeline.
I read that there was a bug in the 'ft_prepare_leadfield' function in the release of June and it says that the bug was fixed, but I got some weird results when doing dics source reconstruction on the MEG data with the Fieldtrip releases from August on (I also just tried the release from yesterday). I attached some sourceplots (all from the exact same data) that are all done with a different Fieldtrip Version.
Does anyone know if there is still a bug in the newest fieldtrip releases or why these differences occur?

   mri  = ft_read_mri(mri_path);
   mri.anatomy=double(mri.anatomy);
   fidu = importdata([fidu_path,'fiducial.txt']);
   cfg=[];
   cfg.coordsys='neuromag';
   cfg.method = 'fiducial';
   cfg.fiducial.nas    = fidu.data(2,:);
   cfg.fiducial.lpa    = fidu.data(3,:);
   cfg.fiducial.rpa    = fidu.data(1,:);
   real_mri=ft_volumerealign(cfg,mri);

   cfg                = [];
   cfg.keepintermediate = 'no';
   cfg.write          = 'no';
   cfg.name          = [folder_intermediate,'spmtmp'];
   segmentedmri   = ft_volumesegment(cfg, real_mri);

   cfg                = [];
   cfg.method = 'singleshell';
   hdm                = ft_prepare_headmodel(cfg,segmentedmri);
   hdm = ft_convert_units(hdm,'cm');

   template = load(fullfile('fieldtrip/template/sourcemodel/standard_sourcemodel3d10mm'));

   cfg                = [];
   cfg.grid.warpmni   = 'yes';
   cfg.grid.template  = template.sourcemodel;  % template_grid
   cfg.grid.nonlinear = 'yes';
   cfg.mri            = real_mri;
   cfg.grid.unit      ='cm';
   grid               = ft_prepare_sourcemodel(cfg);

   cfg = [];
   cfg.dataset = dataset;
   cfg.dftfilter = 'yes';
   cfg.trl = trl;
   cfg.channel = ['MEG***2','MEG***3',Info_et.(subj).(cond).(file).bad_meg];
   meg = ft_preprocessing(cfg);


   cfg = [];
   cfg.dataset = dataset;
   cfg.dftfilter = 'yes';
   cfg.trl = trl;
   cfg.channel = Info_et.(subj).(cond).(file).old_lfp_labels;
   cfg.montage = Info_et.(subj).(cond).(file).montage;
   lfp = ft_preprocessing(cfg);

  data = ft_appenddata([],meg,lfp);

   cfg = [];
   cfg.length = 1;
   cfg.overlap = 0.5;
   data_seg = ft_redefinetrial(cfg,data);


   centerfreq = 12;
   chan = ‘LFP-right-1-2A’;
   bandwidth = 2;

   cfg = [];
   cfg.method = 'mtmfft';
   cfg.output = 'powandcsd';
   cfg.foi = centerfreq;
   cfg.tapsmofrq = bandwidth;
   cfg.keeptrials = 'yes';
   freq = ft_freqanalysis(cfg,data_seg);

   cfg=[];
   cfg.method='dics';
   cfg.dics.lambda='5%';
   cfg.headmodel=hdm;
   cfg.sourcemodel=grid;
   cfg.frequency = centerfreq;
   cfg.reducerank=2;
   cfg.refchan = chan;
   source=ft_sourceanalysis(cfg,freq);
   source.pos = template.sourcemodel.pos;
   source.dim = template.sourcemodel.dim;

   [maxval, maxcohindx] = max(source.avg.coh);
   max_pos = source.pos(maxcohindx, :);

    cfg = [];
    cfg.parameter = 'coh';
    cfg.interpmethod        = 'nearest';
    it = ft_sourceinterpolate(cfg,source,p); % p

    cfg =  [];
    cfg.method = ‘ortho’;
    cfg.funparameter = 'coh';
    cfg.maskparameter = 'coh';
    ft_sourceplot(cfg,it);

Thanks and greetings,
Alexandra Steina<ft_2019.png><ft_april2020.png><ft_june2020.png><ft_november2020.png><ft_october2020.png>_______________________________________________
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/20201105/550046f9/attachment.htm>


More information about the fieldtrip mailing list