# [FieldTrip] issues with ft_connectivityanalysis, interpolation, and parcellation in EEG

Christian Mista cmista at ingenieria.uner.edu.ar
Tue May 21 19:27:50 CEST 2019

```Hi FieldTrip community,

I've been trying to perform a connectivity analysis using a 66 eeg
recording database. So far, I've being able to solve the sourceanalysis
(following the tutorial
http://www.fieldtriptoolbox.org/tutorial/networkanalysis/) and plot the
source activity. However, the problem starts when I'm trying the
connectivity analysis. Any grid dimension lower than 20 mm in the
sourcemodel calculation results in a matlab error (Out of memory) in the
connectivity analysis. I guess that a grid dimension lower than 20 mm
conveys to huge matrix sizes, not manageable by my OS (linux + Matlab).

%% This is how I compute the sourcemodel (run ok)
cfg                 = [];
cfg.elec            = data.elec;
cfg.elec.unit = 'mm';                   % unit in cm
cfg.grid.resolution = 20;     % use a 3-D grid with a 20 mm resolution

After computing the sourcemodel using the 20 mm grid, I have issues to
parcellate my data. My main concern is about the mismatch size between the
connectivity matrix and the atlas.

source_conn =
dim: [7 9 8]
inside: [504×1 logical]
pos: [504×3 double]
cohspctrm: [5544×5544 double]
dimord: 'pos_pos_freq'
freq: 10
cfg: [1×1 struct]

atlas =
dim: [91 109 91]
hdr: [1×1 struct]
transform: [4×4 double]
unit: 'mm'
tissue: [91×109×91 double]
tissuelabel: {1×116 cell}
coordsys: 'mni'

I'd tried to interpolate and parcellate the matrix, but I must be missing
or confusing something... Below is the code to calculate the connectivity
and the parcellation.

%% connectivity
cfg         = [];
cfg.method  = 'coh';
cfg.complex = 'absimag';
source_conn = ft_connectivityanalysis(cfg, SourceData);

%The conectome
figure;imagesc(source_conn.cohspctrm); %5544x5544 double

%Parcellation
atlas =

cfg = [];
cfg.interpmethod='nearest';
cfg.parameter='tissue';
[int_atlas] = ft_sourceinterpolate(cfg, atlas, source_conn);
int_atlas.pos = source_conn.pos; % otherwise the parcellation won't work

% and call ft_sourceparcellate:
cfg = [];
cfg.parcellation = 'tissue';
cfg.parameter    = 'cohspctrm';
parc_conn = ft_sourceparcellate(cfg, source_conn, int_atlas);

figure;imagesc(parc_conn.cohspctrm);

++Error in command windows matlab

there are in total 504 positions, 230 positions are inside the brain, 181
positions have a label
168 of the positions inside the brain have a label
168 of the labeled positions are inside the brain
62 of the positions inside the brain do not have a label
unsupported dimord unknown_unknown_freq

Error in ft_error (line 39)

Error in ft_sourceparcellate (line 309)
ft_error('unsupported dimord %s', dimord{i})

Two questions
-Is 20 mm the min grid size to calculate connectivity?
-What I'm missing in the parcellation process?

I would really appreciate any advice, I've been scratching my head for a
while on this one.

Best,
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190521/5851aafe/attachment-0001.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
```