[FieldTrip] Network Analysis Question: charpath & parcellation issues

Duru Gun Ozkan durugun.ozkan at uniroma1.it
Thu Apr 4 12:12:59 CEST 2019


Dear Jan-Mathijs,

Thank you for your response, indeed removing the threshold worked (with a
lot longer computing times, but able to get non-inf values).

For my second question, I wasn’t very clear. Upon your feedback I went back
to my processing steps, and I suspect that I’m failing the match my grid to
aal atlas, since I end up getting a version of these 2 errors when I try to
use ft_sourceparcellate:

1 - Warning: there are more labels than actuall tissue types in tissuelabel

Error using ft_sourceparcellate (line 108)

the source positions are not consistent with the parcellation, please use
FT_SOURCEINTERPOLATE

Index exceeds matrix dimensions.


2 - there are in total 2136 positions, 2136 positions are inside the brain,
1457 positions have a label, 797 of the positions inside the brain have a
label

Error in ft_sourceparcellate (line 171)

fprintf('%d of the labeled positions are inside the brain\n',
sum(source.inside(seg(:)~=0)));

I have tried multiple solutions, and here is some of them:

I tried to use “standard_sourcemodel3d10mm.mat” converted to mm, instead of
the Grid I generated from “standard_BEM.mat” and standard_1020 electrodes,
with 10mm resolution.

Then I used ft_sourceinterpolate to match the aal atlas to the sourcemodel
(and my grid in a different attempt). But each try resulted in the
aforementioned errors, with different number of labels inside the brain,
depending on the sourcemodel/grid parameters I try.



I tried to change my grid using the ‘auto’ grid dimentions in
ft_prepare_sourcemodel, which resulted in a low-resolution grid (grid.pos =
500x3). Using ft_sourceinterpolate with the aal atlas and grid, followed by
ft_sourceparcellate, I finally get a parcellation matrix, but it is only
0’s. There is no error message, but there is the following warning.

Warning: there are more labels than actuall tissue types in tissuelabel

there are in total 500 positions, 500 positions are inside the brain, 0
positions have a label

0 of the positions inside the brain have a label

0 of the labeled positions are inside the brain

500 of the positions inside the brain do not have a label

creating 0*0 parcel combinations for parameter cohspctrm by taking the mean

computing parcellation





My understanding of the network analysis isn’t good enough yet to see where
I’m making the mistake. I think I’m circling around the actual issue, but I
can’t think of anything else to try. I would appreciate any other feedback
you might have for me on this.

Thank you in advance!



Best,

Duru



>
> Date: Wed, 27 Mar 2019 14:42:44 +0000
> From: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Network Analysis Question: carpath &
>         parcellation issues
> Message-ID: <1E6011BB-B193-4696-ACC4-CE360B1B5751 at donders.ru.nl>
> Content-Type: text/plain; charset="utf-8"
>
>
> 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/20190404/ddeee0e4/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