[FieldTrip] Network Analysis Question: carpath & parcellation issues
Schoffelen, J.M. (Jan Mathijs)
jan.schoffelen at donders.ru.nl
Wed Mar 27 15:42:44 CET 2019
On 25 Mar 2019, at 16:30, Duru Gun Ozkan <durugun.ozkan at uniroma1.it<mailto:durugun.ozkan at uniroma1.it>> wrote:
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);
Have you tried to run ft_networkanalysis without the cfg.threshold specified, when computing the ‘charpath’?
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?
There might be a question behind your question, e.g. something does not seem to work for you. For me it’s not clear what this is.
In general, it is not obligatory that the data-field used for the parcellation is called ‘parcellation’. In your case it seems to be called ‘tissue’. This should work, if properly processed.
Please feel free to contribute to the development of the network analysis functionality by writing documentation, best practices, code.
Best wishes,
Jan-Mathijs
J.M.Schoffelen, MD PhD
Associate PI, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands
% %% %%% 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<mailto:vanessa.era at uniroma1.it>
https://agliotilab.org/lab-staff/phd-students/2nd-year#anchor
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190327/f7789ec3/attachment-0002.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