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

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed Nov 4 14:09:58 CET 2020


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> 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




More information about the fieldtrip mailing list