[FieldTrip] Running source statistics on atlas virtual channel

Michael Glassen mglassen at shp.rutgers.edu
Mon Aug 14 17:36:48 CEST 2023

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

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

More information about the fieldtrip mailing list