<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div dir="ltr"><p class="MsoNormal" style="text-align:justify;margin:0cm 0cm 10pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif"><span lang="IT">Dear Jan-Mathijs,</span></p>
<p class="MsoNormal" style="text-align:justify;margin:0cm 0cm 10pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">Thank you for your response,
indeed removing the threshold worked (with a lot longer computing times, but able
to get non-inf values).</p>
<p class="MsoNormal" style="text-align:justify;margin:0cm 0cm 10pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">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:</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:14.6667px">1 - </span>Warning:
there are more labels than actuall tissue types in tissuelabel </p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">Error
using ft_sourceparcellate (line 108)</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">the
source positions are not consistent with the parcellation, please use
FT_SOURCEINTERPOLATE</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">Index
exceeds matrix dimensions.</p><p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif"><br></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:14.6667px">2 - </span>there are in total
2136 positions, 2136 positions are inside the brain, 1457 positions have a
label, <span style="font-size:11pt">797 of the
positions inside the brain have a label</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">Error in
ft_sourceparcellate (line 171)</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">fprintf('%d of the
labeled positions are inside the brain\n',
sum(source.inside(seg(:)~=0)));</p>
<p class="MsoNormal" style="margin:12pt 0cm 10pt;text-align:justify;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif">I have tried
multiple solutions, and here is some of them:</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">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.</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">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.</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif"> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">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.</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">Warning: there are more labels than actuall tissue types in
tissuelabel </p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">there are in total 500 positions, 500 positions are inside the
brain, 0 positions have a label</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">0 of the positions inside the brain have a label</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">0 of the labeled positions are inside the brain</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">500 of the positions inside the brain do not have a label</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">creating 0*0 parcel combinations for parameter cohspctrm by
taking the mean</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt 36pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">computing parcellation</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif"> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif"> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">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.</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">Thank you in advance!</p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif"> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">Best, </p>
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:justify;line-height:normal;font-size:11pt;font-family:Calibri,sans-serif">Duru</p>
<p class="MsoNormal" style="text-align:justify;margin:0cm 0cm 10pt;line-height:115%;font-size:11pt;font-family:Calibri,sans-serif"> </p></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Date: Wed, 27 Mar 2019 14:42:44 +0000<br>
From: "Schoffelen, J.M. (Jan Mathijs)" <<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>><br>
To: FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br>
Subject: Re: [FieldTrip] Network Analysis Question: carpath &<br>
parcellation issues<br>
Message-ID: <<a href="mailto:1E6011BB-B193-4696-ACC4-CE360B1B5751@donders.ru.nl" target="_blank">1E6011BB-B193-4696-ACC4-CE360B1B5751@donders.ru.nl</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
<br>
On 25 Mar 2019, at 16:30, Duru Gun Ozkan <<a href="mailto:durugun.ozkan@uniroma1.it" target="_blank">durugun.ozkan@uniroma1.it</a><mailto:<a href="mailto:durugun.ozkan@uniroma1.it" target="_blank">durugun.ozkan@uniroma1.it</a>>> wrote:<br>
<br>
Dear Fieldtrippers,<br>
<br>
Following the network analysis tutorial (on resting state EEG data in my case), I have some questions.<br>
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.<br>
<br>
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.<br>
I suspect I am going wrong somewhere but the tutorial (or the forum) hasn’t helped me find what’s wrong.<br>
<br>
%% %%%%%%%%%% DISTANCE METHOD %%%%%%%%%% %%<br>
cfg = [];<br>
cfg.method = 'distance';<br>
cfg.parameter = 'cohspctrm';<br>
cfg.threshold = .1;<br>
IF_network_full_distance = ft_networkanalysis(cfg,IF_source_conn_coh);<br>
<br>
<br>
%% %%%%%%%%%% charpath METHOD %%%%%%%%%% %% have to use output from nw analysis distance method<br>
cfg = [];<br>
cfg.method = 'charpath';<br>
cfg.parameter = 'distance';<br>
cfg.threshold = .1;<br>
network_full_charpath = ft_networkanalysis(cfg,IF_network_full_distance);<br>
<br>
Have you tried to run ft_networkanalysis without the cfg.threshold specified, when computing the ‘charpath’?<br>
<br>
<br>
<br>
<br>
<br>
2 - Another issue is with parcellation.<br>
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.<br>
Has there been any developments on this part of network analysis? Or is there a work around that I am not seeing?<br>
<br>
<br>
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.<br>
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.<br>
<br>
Please feel free to contribute to the development of the network analysis functionality by writing documentation, best practices, code.<br>
<br>
Best wishes,<br>
Jan-Mathijs<br>
<br>
<br>
J.M.Schoffelen, MD PhD<br>
Associate PI, VIDI-fellow - PI, language in interaction<br>
Telephone: +31-24-3614793<br>
Physical location: room 00.028<br>
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br>
<br>
<br>
<br>
% %% %%% PARCELLATE %%% %%<br>
atlas = ft_read_atlas('C\fieldtrip-20190220\fieldtrip-20190220\template\sourcemodel\standard_sourcemodel3d10mm.mat');<br>
<br>
% and call ft_sourceinterpolate:<br>
cfg = [];<br>
cfg.interpmethod = 'nearest';<br>
cfg.parameter = 'tissue';<br>
sourcemodel2 = ft_sourceinterpolate(cfg, atlas, grid);<br>
<br>
Error using ft_sourceparcellate (line 108)<br>
the source positions are not consistent with the parcellation, please use FT_SOURCEINTERPOLATE<br>
<br>
<br>
<br>
Thanks in advance for your help,<br>
<br>
Best,<br>
<br>
Duru Ozkan<br>
<br>
<br>
<br>
My full code is below:<br>
<br>
<br>
addpath('C:\MATLAB\fieldtrip-20190220\fieldtrip-20190220');<br>
ft_defaults<br>
%%<br>
clear all<br>
close all<br>
%% Load Variables<br>
sub = 'S001'; % Sub Num<br>
dir = strcat('C:\\tACS_EEG_JA_DATA\',sub);<br>
cd(dir)<br>
dataica = load(strcat('C:\Users\BrainStem\Google Drive\tACS_EEG_JA_DATA\',sub,'\',sub,'_clean.mat'));<br>
dataica = dataica.cleanData;<br>
<br>
% load standard_mri<br>
load standard_mri.mat<br>
mri = ft_volumereslice([], mri);<br>
mri = ft_convert_units(mri,'mm');<br>
<br>
load standard_BEM.mat;<br>
vol = ft_convert_units(vol,'mm');<br>
<br>
electrodes = load('C:\\tACS_EEG_JA_DATA\Conn\elecRULEZ.mat');<br>
electrodes = ft_convert_units(electrodes.elec,'mm');<br>
<br>
%% compute grid<br>
cfg = [];<br>
cfg.elec = electrodes;<br>
cfg.headmodel = vol;<br>
cfg.grid.resolution = 10;<br>
cfg.grid.unit = 'mm';<br>
cfg.inwardshift = -1.5;<br>
grid = ft_prepare_sourcemodel(cfg);<br>
<br>
%% compute sensor level Fourier spectra, to be used for cross-spectral density computation.<br>
cfg = [];<br>
cfg.method = 'mtmfft';<br>
cfg.output = 'fourier';<br>
cfg.keeptrials = 'yes';<br>
cfg.tapsmofrq = 2;<br>
cfg.foi = 18.5;<br>
IF_freq = ft_freqanalysis(cfg, dataica);<br>
<br>
<br>
%% do the source reconstruction<br>
cfg = [];<br>
cfg.frequency = IF_freq.freq;<br>
cfg.method = 'pcc';<br>
cfg.elec = electrodes;<br>
cfg.grid = grid;<br>
cfg.headmodel = vol;<br>
cfg.keeptrials = 'yes';<br>
cfg.pcc.keepmom = 'yes';<br>
cfg.keepnoise = 'yes';<br>
cfg.pcc.lambda = '10%';<br>
cfg.pcc.projectnoise = 'yes';<br>
cfg.pcc.fixedori = 'yes';<br>
cfg.pcc.keepcsd = 'yes';<br>
IF_source = ft_sourceanalysis(cfg, IF_freq);<br>
IF_source_nai = ft_sourcedescriptives([], IF_source); % to get the neural-activity-index<br>
<br>
%% plot the neural activity index (power/noise)<br>
cfg = [];<br>
cfg.method = 'surface';<br>
cfg.funparameter = 'nai';<br>
cfg.maskparameter = cfg.funparameter;<br>
% cfg.funcolorlim = [0.0 8];<br>
% cfg.opacitylim = [3 8];<br>
cfg.opacitymap = 'rampup';<br>
cfg.funcolormap = 'jet';<br>
cfg.colorbar = 'yes';<br>
ft_sourceplot(cfg, IF_source_nai);<br>
view([-90 30]);<br>
light;<br>
<br>
%% compute connectivity<br>
IF_source_sparse = ft_source2sparse(IF_source);<br>
<br>
cfg=[];<br>
cfg.method ='coh';<br>
cfg.complex = 'absimag';<br>
IF_source_conn_coh = ft_connectivityanalysis(cfg, IF_source_sparse);<br>
<br>
figure;imagesc(IF_source_conn_coh.cohspctrm);<br>
<br>
<br>
%% %%%%%%%%%% DISTANCE METHOD %%%%%%%%%% %%<br>
cfg = [];<br>
cfg.method = 'distance';<br>
cfg.parameter = 'cohspctrm';<br>
cfg.threshold = .1;<br>
IF_network_full_distance = ft_networkanalysis(cfg,IF_source_conn_coh);<br>
<br>
<br>
%% %%%%%%%%%% charpath METHOD %%%%%%%%%% %% have to use output from nw analysis distance method<br>
cfg = [];<br>
cfg.method = 'charpath';<br>
cfg.parameter = 'distance';<br>
cfg.threshold = .1;<br>
network_full_charpath = ft_networkanalysis(cfg,IF_network_full_distance);<br>
<br>
save network_full_charpath network_full_charpath<br>
<br>
Variable_pathLength = charpath(network_full_distance.distance);<br>
<br>
% %% %%% PARCELLATE %%% %%<br>
atlas = ft_read_atlas('C:\Users\BrainStem\Documents\MATLAB\fieldtrip-20190220\fieldtrip-20190220\template\atlas\aal\ROI_MNI_V4.nii');<br>
load('C:\Users\BrainStem\Documents\MATLAB\fieldtrip-20190220\fieldtrip-20190220\template\sourcemodel\standard_sourcemodel3d10mm.mat');<br>
% and call ft_sourceinterpolate:<br>
cfg = [];<br>
cfg.interpmethod = 'nearest';<br>
cfg.parameter = 'tissue';<br>
sourcemodel2 = ft_sourceinterpolate(cfg, atlas, grid);<br>
% sourcemodel2 = ft_convert_units(sourcemodel2,'mm');<br>
<br>
cfg = [];<br>
cfg.parcellation = 'tissue';<br>
cfg.parameter = 'tissue';<br>
parc_conn = ft_sourceparcellate(cfg, IF_source_conn_coh, sourcemodel2);<br>
<br>
figure;imagesc(parc_conn.cohspctrm);<br>
<br>
<br>
<br>
--<br>
Duru Gün Özkan<br>
<br>
Ph.D. student in Cognitive Social and Affective Neuroscience.<br>
Department of Psychology.<br>
University of Rome "La Sapienza".<br>
Via dei Marsi 78 - 00185 - Roma.<br>
e-mail: <a href="mailto:durugun.ozkan@uniroma1.it" target="_blank">durugun.ozkan@uniroma1.it</a><mailto:<a href="mailto:vanessa.era@uniroma1.it" target="_blank">vanessa.era@uniroma1.it</a>><br>
<a href="https://agliotilab.org/lab-staff/phd-students/2nd-year#anchor" rel="noreferrer" target="_blank">https://agliotilab.org/lab-staff/phd-students/2nd-year#anchor</a><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
<br></blockquote></div></div>