[FieldTrip] Whole-Brain Connectivity on parcellated data
f.quandt at uke.de
f.quandt at uke.de
Thu Aug 18 12:15:58 CEST 2022
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,
Fanny
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);
sourceatlas.pos=sourcemodel.pos;
%% frequency analysis of sensor level timeseries data
cfg=[];
cfg.method='mtmfft';
cfg.output='fourier';
cfg.keeptrials='yes';
cfg.tapsmofrq=tapsmofreq;
cfg.foi=foi;
cfg.polyremoval=1;
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=[];
cfg.frequency=freq.freq;
cfg.method='pcc';
cfg.sourcemodel=leadfield;
cfg.elec = freq_all.grad;
cfg.headmodel=headmodel;
cfg.rawtrials = 'yes';
cfg.keeptrials = 'yes';
cfg.pcc.lambda='10%';
cfg.pcc.projectnoise='yes';
cfg.pcc.keepfilter='yes';
source_all=ft_sourceanalysis(cfg,freq_all);
% apply filter
cfg.sourcemodel.filter = source_all.avg.filter;
source = ft_sourceanalysis(cfg, freq);
sourceBase = ft_sourceanalysis(cfg, freqBase);
cfg=[];
source=ft_sourcedescriptives(cfg,source);
sourceBase=ft_sourcedescriptives(cfg,sourceBase);
% task related data
cfg = [];
cfg.parameter = 'avg.mom';
cfg.operation = '((x1-x2)./x2)';
sourceRel=ft_math(cfg,source,sourceBase);
% parcellation
sourceRel.pos=sourcemodel.pos;
sourceRel.dim=sourcemodel.dim;
cfg=[];
cfg.method='mean';
cfg.parameter='mom';
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
cfg=[];
cfg.method='coh';
cfg.complex='absimag';
sourceConn=ft_connectivityanalysis(cfg,parc);
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
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Joachim Prölß, Prof. Dr. Blanche Schwappach-Pignataro, Marya Verdel
_____________________________________________________________________
SAVE PAPER - THINK BEFORE PRINTING
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220818/4029b96e/attachment.htm>
More information about the fieldtrip
mailing list