[FieldTrip] Network Analysis Question: carpath & parcellation issues
Duru Gun Ozkan
durugun.ozkan at uniroma1.it
Mon Mar 25 16:30:50 CET 2019
Dear Fieldtrippers,
Following the network analysis tutorial (on resting state EEG data in my
case), I have some questions.
I would like to obtain Graph theory metrics for each subject. I can obtain
the clustering coefficient, degree and betweenness measurements. However, I
am having some trouble getting other measures.
1 - To use charpath method, I have first used the distance method which
results in a distance matrix that consists values from 1 to 4 and also Inf
(cfg.threshold = .1). when I use the charpath method however, the only
value I get is 1 for every single subject.
I suspect I am going wrong somewhere but the tutorial (or the forum) hasn’t
helped me find what’s wrong.
%% %%%%%%%%%% DISTANCE METHOD %%%%%%%%%% %%
cfg = [];
cfg.method = 'distance';
cfg.parameter = 'cohspctrm';
cfg.threshold = .1;
IF_network_full_distance = ft_networkanalysis(cfg,IF_source_conn_coh);
%% %%%%%%%%%% charpath METHOD %%%%%%%%%% %% have to use output from nw
analysis distance method
cfg = [];
cfg.method = 'charpath';
cfg.parameter = 'distance';
cfg.threshold = .1;
network_full_charpath = ft_networkanalysis(cfg,IF_network_full_distance);
2 - Another issue is with parcellation.
I have matched every template, atlas, sourcemodel to each other. However,
since the atlas that I can use with my data does not contain a parcellation
field, I don’t think this is possible.
Has there been any developments on this part of network analysis? Or is
there a work around that I am not seeing?
% %% %%% PARCELLATE %%% %%
atlas =
ft_read_atlas('C\fieldtrip-20190220\fieldtrip-20190220\template\sourcemodel\standard_sourcemodel3d10mm.mat');
% and call ft_sourceinterpolate:
cfg = [];
cfg.interpmethod = 'nearest';
cfg.parameter = 'tissue';
sourcemodel2 = ft_sourceinterpolate(cfg, atlas, grid);
Error using ft_sourceparcellate (line 108)
the source positions are not consistent with the parcellation, please use
FT_SOURCEINTERPOLATE
Thanks in advance for your help,
Best,
Duru Ozkan
My full code is below:
addpath('C:\MATLAB\fieldtrip-20190220\fieldtrip-20190220');
ft_defaults
%%
clear all
close all
%% Load Variables
sub = 'S001'; % Sub Num
dir = strcat('C:\\tACS_EEG_JA_DATA\',sub);
cd(dir)
dataica = load(strcat('C:\Users\BrainStem\Google
Drive\tACS_EEG_JA_DATA\',sub,'\',sub,'_clean.mat'));
dataica = dataica.cleanData;
% load standard_mri
load standard_mri.mat
mri = ft_volumereslice([], mri);
mri = ft_convert_units(mri,'mm');
load standard_BEM.mat;
vol = ft_convert_units(vol,'mm');
electrodes = load('C:\\tACS_EEG_JA_DATA\Conn\elecRULEZ.mat');
electrodes = ft_convert_units(electrodes.elec,'mm');
%% compute grid
cfg = [];
cfg.elec = electrodes;
cfg.headmodel = vol;
cfg.grid.resolution = 10;
cfg.grid.unit = 'mm';
cfg.inwardshift = -1.5;
grid = ft_prepare_sourcemodel(cfg);
%% compute sensor level Fourier spectra, to be used for cross-spectral
density computation.
cfg = [];
cfg.method = 'mtmfft';
cfg.output = 'fourier';
cfg.keeptrials = 'yes';
cfg.tapsmofrq = 2;
cfg.foi = 18.5;
IF_freq = ft_freqanalysis(cfg, dataica);
%% do the source reconstruction
cfg = [];
cfg.frequency = IF_freq.freq;
cfg.method = 'pcc';
cfg.elec = electrodes;
cfg.grid = grid;
cfg.headmodel = vol;
cfg.keeptrials = 'yes';
cfg.pcc.keepmom = 'yes';
cfg.keepnoise = 'yes';
cfg.pcc.lambda = '10%';
cfg.pcc.projectnoise = 'yes';
cfg.pcc.fixedori = 'yes';
cfg.pcc.keepcsd = 'yes';
IF_source = ft_sourceanalysis(cfg, IF_freq);
IF_source_nai = ft_sourcedescriptives([], IF_source); % to get the
neural-activity-index
%% plot the neural activity index (power/noise)
cfg = [];
cfg.method = 'surface';
cfg.funparameter = 'nai';
cfg.maskparameter = cfg.funparameter;
% cfg.funcolorlim = [0.0 8];
% cfg.opacitylim = [3 8];
cfg.opacitymap = 'rampup';
cfg.funcolormap = 'jet';
cfg.colorbar = 'yes';
ft_sourceplot(cfg, IF_source_nai);
view([-90 30]);
light;
%% compute connectivity
IF_source_sparse = ft_source2sparse(IF_source);
cfg=[];
cfg.method ='coh';
cfg.complex = 'absimag';
IF_source_conn_coh = ft_connectivityanalysis(cfg, IF_source_sparse);
figure;imagesc(IF_source_conn_coh.cohspctrm);
%% %%%%%%%%%% DISTANCE METHOD %%%%%%%%%% %%
cfg = [];
cfg.method = 'distance';
cfg.parameter = 'cohspctrm';
cfg.threshold = .1;
IF_network_full_distance = ft_networkanalysis(cfg,IF_source_conn_coh);
%% %%%%%%%%%% charpath METHOD %%%%%%%%%% %% have to use output from nw
analysis distance method
cfg = [];
cfg.method = 'charpath';
cfg.parameter = 'distance';
cfg.threshold = .1;
network_full_charpath = ft_networkanalysis(cfg,IF_network_full_distance);
save network_full_charpath network_full_charpath
Variable_pathLength = charpath(network_full_distance.distance);
% %% %%% PARCELLATE %%% %%
atlas =
ft_read_atlas('C:\Users\BrainStem\Documents\MATLAB\fieldtrip-20190220\fieldtrip-20190220\template\atlas\aal\ROI_MNI_V4.nii');
load('C:\Users\BrainStem\Documents\MATLAB\fieldtrip-20190220\fieldtrip-20190220\template\sourcemodel\standard_sourcemodel3d10mm.mat');
% and call ft_sourceinterpolate:
cfg = [];
cfg.interpmethod = 'nearest';
cfg.parameter = 'tissue';
sourcemodel2 = ft_sourceinterpolate(cfg, atlas, grid);
% sourcemodel2 = ft_convert_units(sourcemodel2,'mm');
cfg = [];
cfg.parcellation = 'tissue';
cfg.parameter = 'tissue';
parc_conn = ft_sourceparcellate(cfg, IF_source_conn_coh,
sourcemodel2);
figure;imagesc(parc_conn.cohspctrm);
--
*Duru G**ü**n **Ö**zkan*
*Ph.D. student in Cognitive Social and Affective Neuroscience.*
*Department of Psychology.University of Rome "La Sapienza".Via dei Marsi 78
- 00185 - Roma.*
*e-mail: durugun.ozkan at uniroma1.it <vanessa.era at uniroma1.it>*
*https://agliotilab.org/lab-staff/phd-students/2nd-year#anchor
<https://agliotilab.org/lab-staff/phd-students/2nd-year#anchor>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190325/1e4f1588/attachment-0001.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
More information about the fieldtrip
mailing list