[FieldTrip] Running source statistics on atlas virtual channel

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Tue Aug 15 11:30:43 CEST 2023


Hi Michael,

If you want to run a statistical test on virtual channel data, you’d need to run ft_timelockstatistics, or ft_freqstatistics, depending on how you further processed the virtual channel data.
I would not recommend to use ft_virtualchannel to create a data object using all source dipole positions, because that leads to uncontrollable increase in RAM requirements.
I think that the particular error you get refers to an incorrect usage of ft_virtualchannel. I would think that it is correctly described in the help of the function, but in case you want to define virtual channels based on a set of dipole positions that are defined within the original source data object, you don’t need to input a fourth atlas-like data structure.

Good luck,
Jan-Mathijs


On 14 Aug 2023, at 17:36, Michael Glassen via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hi all,

I have a pipeline working to get source data into trial by trial form, interpolated onto the brainetome atlas using ft_virtual_channel. I was previously taking this data and running connectivity analysis outside of fieldtrip, but I want to run source power analysis and connectivity analysis in fieldtrip now. The connectivity analysis seems to be straightforward, but as I was trying to follow this tutorial(Source statistics - FieldTrip toolbox<https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/example/source_statistics/__;!!HJOPV4FYYWzcc1jazlU!8NKHjd2nuO01v9keAIF1QkHk0sbso2-hl8vMMB6nGjuogzDUXWGBsf9c6DhnkJR5YuewKW4EtUMJR6ctlQ1XD391dPVp$>), I noticed it required trial by trial source data on the whole brain(not parcellated using an atlas). sourcestatistics can take an atlas in cfg and parcellate for you, but I dont see an option to enter virtual channel data as an input.

I tried to use ft_virtualchannel without the atlas in order to get trial by trial data on the whole brain, but received the error message:
cfg = [];
cfg.pos = source_allexp.pos;
cfg.method = 'svd';
roiData = ft_virtualchannel(cfg,timelock_allexp_all,source_allexp);

the spatial filter information is missing
for dipole with position [-68 -104 -52].

Any help in either getting trial based source data for the whole brain working that sourcestatistics can accept as input, or getting sourcestatistics to accept my already parcellated atlas activity would be hugely appreciated.

I am using the template standard bem headmodel and the template brainnetom atlas BNA_MPM_thr25_1.25mm.nii

Best,
Michael Glassen


%% Code
cfg = [];
cfg.method = 'project'; % onto scalp surface
cfg.headshape = headmodel.bnd(scalp_index); % scalp surface
eegData.elec = ft_electroderealign(cfg, eegData.elec);

cfg = [];
cfg.headmodel = headmodel;
cfg.elec = eegData.elec;
cfg.grid.resolution = 4;
cfg.grid.unit       = 'mm';
cfg.channel = 'all';
grid = ft_prepare_leadfield(cfg);

cfg = [];
cfg.covariance = 'yes';
cfg.covariancewindow = 'all';
timelock_allexp = ft_timelockanalysis(cfg, eegData);

cfg = [];
cfg.covariance = 'yes';
cfg.covariancewindow = 'all';
cfg.keeptrials  = 'yes';
timelock_allexp_all = ft_timelockanalysis(cfg, eegData);

%General source localisation
cfg = [];
cfg.headmodel = vol;
cfg.elec = timelock_allexp.elec;
cfg.grid = grid;
cfg.method = 'lcmv';
cfg.lcmv.fixedori = 'yes';  %Project onto largest variance orientation
cfg.lcmv.keepfilter = 'yes'; %Keep the beamformer weights
cfg.lcmv.lambda = '5%'; %Regularise a little
source_allexp = ft_sourceanalysis(cfg, timelock_allexp);

cfg = [];
cfg.method        = 'nearest';
cfg.parameter = 'tissue';
grid2 = ft_sourceinterpolate(cfg,atlas,grid);
grid2.tissue = fix(grid2.tissue);
grid2.tissuelabel = atlas.tissuelabel;

cfg = [];
cfg.parcellation = 'tissue';
cfg.method = 'svd';
roiData = ft_virtualchannel(cfg,timelock_allexp_all,source_allexp,grid2);



_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!_rUj7Lyl6a_A9uIGgthQ4jhKPl_kBY3iYrzkr30L9qNkHtZ28mjD0GPJmS_V0CkzgfXaaUd_d3CWlPsfOPu9YdF8ZwGwPB3W9389Qg$ 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230815/faf8ab5f/attachment.htm>


More information about the fieldtrip mailing list