[FieldTrip] Problem of conducting connectivity analysis after eLORETA source reconstruction
Neo Lin
s129087158 at gmail.com
Sat Oct 31 10:42:19 CET 2020
Dear FieldTripppers,
I was trying to do source connectivity analysis. The EEG data is collected
with Neuroscan system and with 64 channels cap. Preprocessing was done with
EEGLAB and translated to FieldTrip data structure. I used head model and
source model template provided by FieldTrip. Frequency analysis was done by
mtmfft method. Then inverse solution was calculated by eLORETA algorithm.
But when I tried to do connectivity analysis, the following error happened:
Error using *
Requested 729444x729444 (7928.7GB) array exceeds maximum array size
preference. Creation of arrays greater than this limit may take
a long time and cause MATLAB to become unresponsive. See array size limit
or preference panel for more information.
Error in univariate2bivariate (line 316)
data.crsspctrm = (transpose(mom)*conj(mom))./nrpt;
Error in ft_connectivityanalysis (line 472)
[data, powindx, hasrpt] = univariate2bivariate(data, 'mom',
'crsspctrm', dtype, 'channelcmb', cfg.refindx, 'keeprpt', 0);
This is my code for analysis:
%% Transform preprocessed data from EEGLAB to FieldTrip format
data = eeglab2fieldtrip(EEG, 'preprocessing')
%% Forward model
% Read head model template from FieldTrip
template = ft_read_headmodel('standard_bem.mat');
template = ft_convert_units(template, 'mm');
% Channal location
elec = data.elec;
% Electrodes re-alignment
cfg = [];
cfg.method = 'project'; % onto scalp surface
cfg.headshape = template.bnd(1); % scalp surface
elec_realigned = ft_electroderealign(cfg, elec);
% Calculate BEM head model
cfg = [];
cfg.conductivity = [0.33 0.0042 0.33];
cfg.method = 'bemcp';
headmodel_sphere = ft_prepare_headmodel(cfg, template.bnd);
headmodel = headmodel_sphere;
% Read source model template from FieldTrip
sourcemodel = ft_read_headshape('cortex_8196.surf.gii')
% Lead field calculation
cfg = [];
cfg.sourcemodel = sourcemodel; %% where are the sources?
cfg.headmodel = headmodel; %% how do currents spread?
cfg.elec = elec_realigned; %% where are the sensors?
sourcemodel_and_leadfield = ft_prepare_leadfield(cfg); %% how do sources
and sensors connect?
%%
% Calculate complex Fourier-spectra with fast Fourier transformation
cfg = [];
cfg.output = 'fourier';
cfg.channel = 'EEG';
cfg.method = 'mtmfft';
cfg.taper = 'hanning';
cfg.foi = 10;
cfg.tapsmofrq = 1;
TFRhann = ft_freqanalysis(cfg, data);
TFRhann =
struct with fields:
label: {62×1 cell}
dimord: 'rpttap_chan_freq'
freq: 10
fourierspctrm: [89×62 double]
cumsumcnt: [89×1 double]
cumtapcnt: [89×1 double]
elec: [1×1 struct]
trialinfo: [89×1 table]
cfg: [1×1 struct]
% Calculate inverse solution with eLORETA algorithm
cfg = [];
cfg.method = 'eloreta';
cfg.grid = sourcemodel_and_leadfield;
cfg.headmodel = headmodel;
cfg.eloreta.lambda = 3;
source = ft_sourceanalysis(cfg,TFRhann);
source = ft_sourcedescriptives([], source);
source =
struct with fields:
freq: 10
cumtapcnt: [89×1 double]
cfg: [1×1 struct]
inside: [8196×1 logical]
pos: [8196×3 double]
tri: [16384×3 double]
method: 'average'
avg: [1×1 struct]
The result is a 3xNtime matrix as the source activation, which is in
source.avg.mom (or in source.trial(i).mom). The three rows of the moment
are the strength of the source in the x-, y- and z-direction.
source.avg.ori % the orientation as an 1 x n cell array, where n is
the number of locations and each cell is a 3 x 1 array of x y z
orientation and n refers to the same source in each array
% Connectivity analysis
cfg = [];
cfg.method ='coh';
cfg.complex = 'absimag'; % imaginary part of coherence
source_conn = ft_connectivityanalysis(cfg, source);
Can you give me some advises on how to solve this problem?
And I have another question. After the eLORETA source reconstruction, the
Fourier spectrum become three values which represent the strength in x, y,
z orientation. If I want to do connectivity analysis like coherence, by
definition I have to calculate cross-spectral density between the two
signals, how can I calculate the coherence value when I have three
orientation values?
I would appreciate your help,
Kind regards,
Kao-Hung Lin
Master student
National Taiwan Normal University
e-mail: s129087158 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20201031/1a22ed12/attachment.htm>
More information about the fieldtrip
mailing list