[FieldTrip] Running source statistics on atlas virtual channel

Michael Glassen mglassen at shp.rutgers.edu
Tue Aug 15 21:27:16 CEST 2023

Hi Jan-Mathijs,

Thank you for the quick response! Both timelockstatistics and freqstatistics are exactly what im looking for! I played around with both functions, but I'm running into some issues preparing neighbors. Because I'm using the brainetome atlas on a volumetric headmodel, I cant use ft_prepareneighbors if I understand correctly. So I was going to create my own neighbor template, by picking a threshold distance and for each roi in the atlas, calculating the distance from the center of each roi to all others and any pairs that are below the threshold distance will be marked as neighbors. Would you have any suggestions on a distance to use, and does this approach seem sound? I tried running a quick analysis without neighbors(just clustering based on freq and time) on one subject between 2 conditions. 2 negative clusters were found significant, each cluster consisting of only one roi(out of the whole 246 from the atlas). Im hoping by including neighbors into the analysis that it will be improved.

Thank you again for your help!

Michael Glassen
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Schoffelen, J.M. (Jan Mathijs) via fieldtrip <fieldtrip at science.ru.nl>
Sent: Tuesday, August 15, 2023 5:30 AM
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Schoffelen, J.M. (Jan Mathijs) <janmathijs.schoffelen at donders.ru.nl>
Subject: Re: [FieldTrip] Running source statistics on atlas virtual channel

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,

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

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://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!9nM7G7jyqLmrY8yJuMHx8gvb8_xOeWXIf4ib2fhG-1597Hz23qf5nfNs-RXIBnkXf4KPSW3E7I18a12gCdLZ626bkuVb$ <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/d3e3305d/attachment.htm>

More information about the fieldtrip mailing list