[FieldTrip] Whole-Brain Connectivity on parcellated data

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Fri Aug 26 12:24:12 CEST 2022

Hi Fanny,

ft_connectivityanalysis fails, because the parcellation step creates a data structure that ft_connectivityanalysis did not expect. The reason for this is that ft_connectivityanalysis has not been updated for a while to accommodate parcellated data more smoothly. The ft_sourceparcellate function is ‘younger’ than ft_connectivityanalysis, and with the limited capacity of the team of people that regularly contribute to keep the whole codebase up-to-date, your particular use case has not made it into the focus of attention.

This being said, I think that in the code you pasted into the e-mail it is problematic to apply ft_math, and compute a relative measure before computing the connectivity. This is mathematically wrong. If anything, you’d want to compute the connectivity for the active and baseline conditions separately, and compare this (but note that a fair interpretation of this comparison is not easy, as has been discussed often on this list, and in the literature).

Now, for the current problem at hand, I see 2 potential solutions, which should be both considered, and ideally both be implemented (if only to compare the outcome of both implementations):

1) you and your team find out a way to ’trick’ ft_connectivityanalysis into accepting parcellated data, which includes a ‘mom’ field. Ideally this will be contributed as a clean improvement to the relevant code (mainly the bookkeeping that occurs in ft_connecitivityanalysis before it passes on some data to the lower-level code that does the actual connectivity computation), and submitted as  a Pull Request to the fieldtrip github repository. As a side note, you’d need to think about the 3-dimensions of the parcels’ data, which seem to be a consequence of the orientation unconstrained analysis that you performed. As another side note, you need to think about whether it is appropriate to used the volumetric grid/atlas, where the parcellation step for spatially extended parcels will probably weight the deeper locations much more heavily than the more superficial ones (if I recall correctly the default way in which the dipoles are combined is by averaging). This is a well-known consequence of the depth bias of the beamformer, but probably not ideal.

2) you try and implement the analysis pipeline to use ft_virtualchannel to get to the parcels (rather than ft_sourceparcellate). This does not take away the issue of the depth bias, but it will lead to a parcel-based data representation that causes fewer problems in ft_connectivityanalysis. Also ft_virtualchannel allows for some more exotic ways to combine data across dipoles for a given parcel. Once you have figured out to do this (it could very well be that there’s already some documentation to be found about this), then it would be great if you and your team could add to this documentation (or to write a new piece of documentation). This can be directly added as a PR to the github repo of the fieldtrip website (which is on https://github.com/fieldtrip/website).

Good luck and best wishes,

On 18 Aug 2022, at 12:15, f.quandt--- via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear Community,

I am working on a MEG dataset and would like to calculate task-related whole-brain connectivity in one specific frequency band. As I am running into memory issues, I would like to calculate the imaginary coherence on parcellated data (aal atlas). However, I am having trouble doing so, as after the parcellation the data structure/dimord is changed and ft_connectivityanalysis is not working anymore.

Does anyone have any suggestions? I was working along the tutorial “ Whole brain connectivity and network analysis” . Your help is much appreciated!

Many thanks,

Here is the code I am using (Fieldtrip 20220216, macOs, Matlab R2021b) :

%% interpolate template sourcemodel and atlas
load(fullfile(templatedir, 'standard_sourcemodel3d8mm'));
atlas = ft_read_atlas(fullfile(templatedir, 'ROI_MNI_V4.nii'));

atlas = ft_convert_units(atlas,'mm');
sourcemodel = ft_convert_units(sourcemodel,'mm');

cfg = [];
cfg.interpmethod    = 'nearest';
cfg.parameter       = 'tissue';
sourceatlas = ft_sourceinterpolate(cfg, atlas, sourcemodel);

%% frequency analysis of sensor level timeseries data

freq_all=ft_freqanalysis(cfg,data_all); % for common filter
freq=ft_freqanalysis(cfg,data_act); % activation
freqBase=ft_freqanalysis(cfg,data_base);% baseline

%% PPC
% calculate common filter
cfg.elec = freq_all.grad;
cfg.rawtrials = 'yes';
cfg.keeptrials = 'yes';


% apply filter
cfg.sourcemodel.filter = source_all.avg.filter;
source  = ft_sourceanalysis(cfg, freq);
sourceBase = ft_sourceanalysis(cfg, freqBase);


% task related data
cfg = [];
cfg.parameter = 'avg.mom';
cfg.operation = '((x1-x2)./x2)';

% parcellation

parc=ft_sourceparcellate(cfg,sourceRel,sourceatlas); % also does not work with source_all

sourceRel =
         freq: 75.8735
          dim: [20 25 22]
          pos: [11000×3 double]
        label: {272×1 cell}
          mom: {11000×1 cell}
       inside: [11000×1 logical]
    trialinfo: [235×10 double]
          cfg: [1×1 struct]

parc =
             freq: 75.8735
        cumtapcnt: [470×1 double]
            label: {1×116 cell}
              mom: [116×3×5170 double]
        momdimord: 'chan_ori_rpttap'
    brainordinate: [1×1 struct]
              cfg: [1×1 struct]

% Connectivity Analysis


Error using getdimord (line 42)
field "crsspctrm" not present in data

Error in ft_connectivityanalysis (line 634)
    data.dimord = ['rpt_' getdimord(data, inparam)];


Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de<https://urldefense.com/v3/__http://www.uke.de/__;!!HJOPV4FYYWzcc1jazlU!6dQ7J_14yKC6q7Pcrft1stuGxVUkPYrk6ZdKxDRQh4AEOPQynM4kNVUsa4Pd44txDg0pcwUnYsZ_0CX3ndI75theYvPyjldn4P5x-Q$>
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Joachim Prölß, Prof. Dr. Blanche Schwappach-Pignataro, Marya Verdel



fieldtrip mailing list

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

More information about the fieldtrip mailing list