<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Johannes,
<div class=""><br class="">
</div>
<div class=""><br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 8 Oct 2021, at 15:27, Johannes Gehrig <<a href="mailto:jgehrig@med.uni-frankfurt.de" class="">jgehrig@med.uni-frankfurt.de</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">
<p class="">Dear Jan-Mathijs,</p>
<p class="">Thanks for your advice! It still took a while till Bob was my uncle, but after adding this (<font color="#800000" class="">%JG</font>) to ft_sourceparcellate in line 488 he was:
<br class="">
</p>
</div>
</div>
</blockquote>
<div>Well, I guess uncles in Germany are more often called Franz oder Peter...</div>
<div><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div class="">
<p class=""></p>
<p class="">function y = cellmean1(x)<br class="">
siz = size(x);<br class="">
if siz(1)==1 && siz(2)>1<br class="">
  siz([2 1]) = siz([1 2]);<br class="">
  x = reshape(x, siz);<br class="">
end<br class="">
<font color="#800000" class="">if size(x,1)>0 %JG</font><br class="">
    y = x{1};<br class="">
    n = 1;<br class="">
<font color="#800000" class="">else %JG<br class="">
    y = 1 %JG<br class="">
    n = 1 %JG<br class="">
end %JG</font><br class="">
</p>
<p class="">Using this I skipped the 5 parcells where there was no label at the "inside" compartment (->241 parcells).
<br class="">
</p>
</div>
</div>
</blockquote>
<div>It’s interesting that you need to make the above changes in order for the parcellation to work. I created the downsampled atlas was obtained as:</div>
<div><br class="">
</div>
<div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(2, 128, 9);" class="">
% load the standard 3d grid to-be-used</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
[ftver,path] = ft_version;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(170, 4, 249);" class="">
<span style="color: #000000" class="">load(fullfile(path, </span>'template/sourcemodel'<span style="color: #000000" class="">,
</span>'standard_sourcemodel3d8mm.mat'<span style="color: #000000" class="">));</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
sourcemodel = ft_convert_units(sourcemodel, <span style="color: #aa04f9" class="">
'mm'</span>);</div>
<p style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(170, 4, 249);" class="">
<span style="color: #000000" class="">atlasfile = fullfile(path, </span>'template/atlas/brainnetome'<span style="color: #000000" class="">,
</span>'BNA_MPM_thr25_1.25mm.nii'<span style="color: #000000" class="">);</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
atlas     = ft_read_atlas(atlasfile);</div>
<p style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(2, 128, 9);" class="">
% downsample the atlas</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.parameter = <span style="color: #aa04f9" class="">'tissue'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.interpmethod = <span style="color: #aa04f9" class="">'nearest'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
atlas_lowres = ft_sourceinterpolate(cfg, atlas, sourcemodel);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
assert(numel(unique(atlas_lowres.tissue(:)))==numel(atlas.tissuelabel)+1);</div>
<div style="margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; font-family: Courier; min-height: 14px;" class="">
<br class="">
</div>
</div>
<div>and this seemed to work fine. That is (not shown here), a parcellation of a dummy dataset created on the fly worked without changing the cellmean function in ft_sourceparcellate.</div>
<div><br class="">
</div>
<div>This being said, you identified a new problem, which I didn’t think of before, and which you reference below:</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="">
<p class="">Now the parcellation works, but the connectivity analyses is not possible.... I have the csd-, mom, and noisecsd- matrix but the connectivity analyses fails with:
<br class="">
</p>
<p class="">"Error using getdimord (line 42)<br class="">
field "crsspctrm" not present in data"</p>
<p class="">Do I have to label the mom matrix (241x3x1764 with dimord: chan_ori_rpttap) as crsspctrm and perform a svd analyses on the 2nd dimension?</p>
</div>
</div>
</blockquote>
<div>Well indeed, the data bookkeeping in ft_connectivityanalysis (which causes the error for you) pre-dates the ft_sourceparcellate function, and I think we never got to making it more robust. Rather than fooling around with the dimensions, I’d like to suggest
 a different recipe (slightly different from the one you suggested below, although that also would have been a possibility). My suggested pipeline does not use ft_sourceparcellate, but rather uses ft_virtualchannel, in combination with 3 data objects: the lowres
 atlas, the sensor level freq-structure, and a source structure, obtained with ‘dics’, and keepfilter=‘yes’:</div>
<div><br class="">
</div>
<div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(2, 128, 9);" class="">
% alternative</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.method = <span style="color: #aa04f9" class="">'dics'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.dics.keepfilter = <span style="color: #aa04f9" class="">'yes'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; color: rgb(2, 128, 9);" class="">
% here you can add a  bunch of other options to be used, if needed</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.sourcemodel = leadfield;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
source = ft_sourceanalysis(cfg, freq);</div>
<p style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.parcellation = <span style="color: #aa04f9" class="">'tissue'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.numcomponent = 1;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
freq_vc = ft_virtualchannel(cfg, freq, source, atlas_lowres);</div>
<p style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
cfg.method = <span style="color: #aa04f9" class="">'coh'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; font-family: Courier;" class="">
coh = ft_connectivityanalysis(cfg, freq_vc);</div>
<div class=""><br class="">
</div>
</div>
<div>The leadfield variable contains precomputed leadfields on the same 8mm grid as the atlas. Now, one thing that one can play with is the numcomponent option for ft_virtualchannel. The long story short is that the parcellation step by default involves a SVD
 (~PCA) decomposition of the concatenated dipoles’ data for all dipoles that belong to a single parcel. This may be increased at libitum, but this will yield a connectivity matrix that does not directly map one-to-one on the individual parcel pairs anymore.
 For now, I think I would recommend using numcomponent = 1;</div>
<div><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div class="">
<p class="">I was thinking if not maybe tlock data -> lcmv beamformer -> parcellation -> freq.analysis -> connectivity analysis is the "better" option?</p>
<div class=""><br class="">
</div>
</div>
</div>
</blockquote>
<div>Yes, this would have been a possibility in principle, but tricky, since you’d need single trial data at the source level for the spectral analysis step, so Franz or Peter would have to wait a bit on this route, too.</div>
<div><br class="">
</div>
<div>Best wishes,</div>
<div>JM</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="">
<p class="">Thanks one again for your support and best regards, <br class="">
Johannes<br class="">
</p>
<p class=""><br class="">
</p>
<div class="moz-cite-prefix">Am 07/10/2021 um 14:45 schrieb Schoffelen, J.M. (Jan Mathijs):<br class="">
</div>
<blockquote type="cite" cite="mid:86AE9AAE-1DBB-4021-B4A5-413694504CDD@donders.ru.nl" class="">
Dear Johannes,
<div class=""><br class="">
</div>
<div class="">Gotcha, thanks for the information. I think that in general it would be wise to use a volumetric atlas since you are using a volumetric grid for source reconstruction. For sure a 3D version of the Glasser atlas exists, and it should not be too
 difficult to trick FieldTrip into importing it. Do you have a specific reason for using this particular parcellation, or would any other sensible number-of-points reducing atlas do equally well for you? If the latter is true, you could use the brainnetome
 atlas (which is shipped with fieldtrip, so easy to use).</div>
<div class=""><br class="">
</div>
<div class="">Then, under the assumption that you are using inverse warped 3D grid for the patients, it would make most sense to create a low-resolution version of the atlas, sampled on the standard grid that you use for the beamformer analysis: something like
 ft_sourceinterpolate(cfg, atlas, sourcemodel), where the atlas is the atlas (in normalised MNI space), the sourcemodel is the 8mm standard sourcemodel, and cfg.method = ’nearest’.</div>
<div class=""><br class="">
</div>
<div class="">Ideally in the low-res version of the atlas each dipole position in the ‘inside’ compartment should be labeled (and vice versa each label in the original high res atlas should be present in the low res atlas). If these constraints are not met,
 the parcellation might still fail later on.</div>
<div class=""><br class="">
</div>
<div class="">Then, once you are ready for the parcellation, you need to ensure the source.pos and atlas (low-res).pos to be identical, and Bob should be your uncle.</div>
<div class=""><br class="">
</div>
<div class="">There might be some dedicated documentation about this on the website, but since it is currently down, I couldn’t search for and point you to it.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 7 Oct 2021, at 12:02, Johannes Gehrig <<a href="mailto:jgehrig@med.uni-frankfurt.de" class="" moz-do-not-send="true">jgehrig@med.uni-frankfurt.de</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1;
                caret-color: rgb(0, 0, 0); font-family: Helvetica;
                font-size: 14px; font-style: normal; font-variant-caps:
                normal; font-weight: normal; letter-spacing: normal;
                text-align: start; text-indent: 0px; text-transform:
                none; white-space: normal; word-spacing: 0px;
                -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0cm; font-size: 11pt; font-family:
                  Calibri, sans-serif;" class="">
Dear Jan-Mathijs,</div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                  Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB">In general, I want to compare the connectivity between two MEG sessions in which patients took different drugs.<span class="Apple-converted-space"> </span><o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB"><o:p class=""> </o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB">I followed the tutorial "whole brain connectivity" to get a first idea of the data (so I tried to calculate the connectivity in dipole space...).<span class="Apple-converted-space"> </span><o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB">I tried to use the parcellation of Glasser et al 2016 (atlas_MMP1.0_4k.mat). To fit this to my data, I used ft_sourceinterpolate of my source model (subject-specific, using the template "standard_sourcemodel3d8mm") and the atlas.<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB"><o:p class=""> </o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB">I think this is exactly the cause: "One possible cause is the fact that some parcels in the input parcellation are not assigned any of the locations where your subject data is represented."<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB">Because when I debug (ft_sourceparcellate), the second parcel is not found (j==2, and dat(tissue==j) is an "Empty cell array: 0-by-1").<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB"><o:p class=""> </o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB">How could I solve this issue?<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB"><o:p class=""> </o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB">Thanks in advance an best regards,<span class="Apple-converted-space"> </span><o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
<span class="" lang="EN-GB">Johannes<o:p class=""></o:p></span></div>
</div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                  Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="border-style: solid none none;
                  border-top-width: 1pt; border-top-color: rgb(225, 225,
                  225); padding: 3pt 0cm 0cm;" class="">
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif; border: none; padding: 0cm;" class="">
<b class="">Von:<span class="Apple-converted-space"> </span></b><a href="mailto:fieldtrip@science.ru.nl" style="color: blue; text-decoration: underline;" class="" moz-do-not-send="true">Schoffelen,J.M. (Jan Mathijs) via fieldtrip</a><br class="">
<b class="">Gesendet:<span class="Apple-converted-space"> </span></b>Donnerstag, 7. Oktober 2021 10:28<br class="">
<b class="">An:<span class="Apple-converted-space"> </span></b><a href="mailto:fieldtrip@science.ru.nl" style="color: blue; text-decoration: underline;" class="" moz-do-not-send="true">FieldTrip discussion list</a><br class="">
<b class="">Cc:<span class="Apple-converted-space"> </span></b><a href="mailto:janmathijs.schoffelen@donders.ru.nl" style="color: blue; text-decoration: underline;" class="" moz-do-not-send="true">Schoffelen, J.M. (Jan Mathijs)</a><br class="">
<b class="">Betreff:<span class="Apple-converted-space"> </span></b>Re: [FieldTrip] problem using ft_sourceparcellate</div>
</div>
<div style="margin: 0cm; font-size: 11pt; font-family:
                  Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family:
                    Calibri, sans-serif;" class="">
Dear Johannes,<span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                      font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                      font-family: Calibri, sans-serif;" class="">
Could you explain a bit more what you attempt to do? Specifically: what is the parcellation that you are using? Ideally, you should use one that is defined on exactly the same surface as your data.  Otherwise (e.g. when using a parcellation defined in 3D space)
 some on-the-fly interpolation is required, and this may not work robustly enough. One possible cause is the fact that some parcels in the input parcellation will not get assigned any of the locations at which your functional data is represented. Which is probably
 the cause of the error you are facing.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                      font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                      font-family: Calibri, sans-serif;" class="">
Best wishes,<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                      font-family: Calibri, sans-serif;" class="">
Jan-Mathijs<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                      font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                      font-family: Calibri, sans-serif;" class="">
PS: as a side note, in general I would recommend to compute connectivity in parcellated space, rather than in ‘dipole space’. Apart from potential memory issues, the sheer number of pairwise combination makes the interpretation / statistical evaluation quite
 complicated.<o:p class=""></o:p></div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                        font-family: Calibri, sans-serif;" class="">
<br class="">
<br class="">
<o:p class=""></o:p></div>
<blockquote style="margin-top: 5pt; margin-bottom:
                        5pt;" class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                            font-family: Calibri, sans-serif;" class="">
On 7 Oct 2021, at 09:08, Johannes Gehrig via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" style="color: blue; text-decoration:
                              underline;" class="" moz-do-not-send="true">fieldtrip@science.ru.nl</a>> wrote:<o:p class=""></o:p></div>
</div>
<div style="margin: 0cm; font-size: 11pt;
                          font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
Dear Stefan,<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
thanks for your reply. At the moment I use simple "coherence" following the „whole brain connectivity“ tutorial. However, if there was a memory efficient solution for dwPLI that is also an option. If I followed the discussion correctly, this is not yet fully
 implemented?<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
Have you tried to parcellate your data before doing the connectivity analysis? I suspect that my problem could be related with ft_sourceinterpollate, because the output of the source analysis (avg.csd, avg.mom, avg.noisecsd, computed withels pcc) is no longer
 present after ft_sourceinterpolate and without the source interpolation the source parcellation doesn't work, so far my impression...<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
Thanks and best regards,<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
Johannes<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div style="border-style: solid none none;
                            border-top-width: 1pt; border-top-color:
                            rgb(225, 225, 225); padding: 3pt 0cm 0cm;" class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                                font-family: Calibri, sans-serif;" class="">
<b class="">Von:<span class="apple-converted-space"> </span></b><a href="mailto:stefan.dvoretskii@tum.de" style="color: blue; text-decoration:
                                  underline;" class="" moz-do-not-send="true">Stefan Dvoretskii</a><br class="">
<b class="">Gesendet:<span class="apple-converted-space"> </span></b>Mittwoch, 6. Oktober 2021 17:39<br class="">
<b class="">An:<span class="apple-converted-space"> </span></b><a href="mailto:fieldtrip@science.ru.nl" style="color: blue; text-decoration:
                                  underline;" class="" moz-do-not-send="true">FieldTrip discussion list</a><br class="">
<b class="">Cc:<span class="apple-converted-space"> </span></b><a href="mailto:jgehrig@med.uni-frankfurt.de" style="color: blue;
                                  text-decoration: underline;" class="" moz-do-not-send="true">Johannes Gehrig</a>;<span class="apple-converted-space"> </span><a href="mailto:cristina.gil@tum.de" style="color: blue; text-decoration:
                                  underline;" class="" moz-do-not-send="true">Gil
 Avila, Cristina</a><br class="">
<b class="">Betreff:<span class="apple-converted-space"> </span></b>Re: [FieldTrip] problem using ft_sourceparcellate<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                                font-family: Calibri, sans-serif;" class="">
Dear Johannes, <o:p class=""></o:p></div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
                                  11pt; font-family: Calibri,
                                  sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
                                  11pt; font-family: Calibri,
                                  sans-serif;" class="">
which connectivity measure are you using? There is a potential bottleneck in the 'ft_connectivityanalysis', which can however be circumvented with custom code, at least for dwPLI. Then you won't even need to parcelate.<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
                                  11pt; font-family: Calibri,
                                  sans-serif;" class="">
We are currently working to incorporate it into the Fieldtrip code.<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
                                  11pt; font-family: Calibri,
                                  sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
                                  11pt; font-family: Calibri,
                                  sans-serif;" class="">
Best regards,<o:p class=""></o:p></div>
</div>
</div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
                                  11pt; font-family: Calibri,
                                  sans-serif;" class="">
Stefan<o:p class=""></o:p></div>
</div>
</div>
<div style="margin: 0cm 0cm 12pt; font-size:
                              11pt; font-family: Calibri, sans-serif;" class="">
 <br class="webkit-block-placeholder">
</div>
<div class="">
<div class="">
<div class="">
<div style="margin: 0cm; font-size:
                                    11pt; font-family: Calibri,
                                    sans-serif;" class="">
пн, 4 окт. 2021 г., 11:06 Johannes Gehrig via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" style="color: blue;
                                      text-decoration: underline;" class="" moz-do-not-send="true">fieldtrip@science.ru.nl</a>>:<o:p class=""></o:p></div>
</div>
</div>
<blockquote style="border-style: none none
                                none solid; border-left-width: 1pt;
                                border-left-color: rgb(204, 204, 204);
                                padding: 0cm 0cm 0cm 6pt; margin: 5pt
                                0cm 5pt 4.8pt;" class="">
<div class="">
<div style="margin: 0cm 0cm 0cm
                                    40.8pt; font-size: 11pt;
                                    font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt;
                                      font-family: Helvetica,
                                      sans-serif;" class="">Dear Fieldtrip-user,<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0cm
                                    40.8pt; font-size: 11pt;
                                    font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt;
                                      font-family: Helvetica,
                                      sans-serif;" class="">I am facing a problem using ft_sourceinterpolate. I am following the "Whole brain connectivity and network
 analysis"- Tutorial and as I can not compute the connectivity directly with the source data ("out of memory") I would like to perform the source parcellation before computing the connectivity. Unfortunately (fieldtrip 20211001 and matlab2018b) ft_sourceparcellate
 crashes after calling it. Before computing the source data the sourcemodel was interpolated with the atlas using ft_sourceinterpolate. Therefore the amount of positions in the atlas and the source data is the same (8004).<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0cm
                                    40.8pt; font-size: 11pt;
                                    font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt;
                                      font-family: Helvetica,
                                      sans-serif;" class="">load('atlas_MMP1.0_4k.mat');<span class="apple-converted-space"> </span><br class="">
cfg = [];<br class="">
cfg.parcellation = 'parcellation';<br class="">
cfg.method       = 'mean';<br class="">
cfg.parameter    = 'all';<span class="apple-converted-space"> </span><br class="">
parc_sourceOn = ft_sourceparcellate(cfg, source_ON, atlas);<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0cm
                                    40.8pt; font-size: 11pt;
                                    font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt;
                                      font-family: Helvetica,
                                      sans-serif;" class="">Error message:"<br class="">
there are in total 8004 positions, 4544 positions are inside the brain, 8004 positions have a label<br class="">
4544 of the positions inside the brain have a label<br class="">
4544 of the labeled positions are inside the brain<br class="">
0 of the positions inside the brain do not have a label<br class="">
creating 362 parcels for parameter csd by taking the mean<br class="">
computing parcellation<br class="">
232           tmp(j,:,:) = cellmean1(dat(tissue==j));<br class="">
computing parcellation for L_V1_ROI<br class="">
Index exceeds array bounds.<br class="">
<br class="">
Error in ft_sourceparcellate>cellmean1 (line 494)<br class="">
y = x{1};<br class="">
<br class="">
Error in ft_sourceparcellate (line 232)<br class="">
          tmp(j,:,:) = cellmean1(dat(tissue==j));<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0cm
                                    40.8pt; font-size: 11pt;
                                    font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt;
                                      font-family: Helvetica,
                                      sans-serif;" class="">"<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0cm
                                    40.8pt; font-size: 11pt;
                                    font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt;
                                      font-family: Helvetica,
                                      sans-serif;" class="">Any help and ideas are very much appreciated!<o:p class=""></o:p></span></div>
<div style="margin: 0cm 0cm 0cm
                                    40.8pt; font-size: 11pt;
                                    font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt;
                                      font-family: Helvetica,
                                      sans-serif;" class="">Best regards, Johannes<o:p class=""></o:p></span></div>
</div>
</blockquote>
</div>
</div>
<div style="margin-left: 4.8pt;" class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank" style="color: blue;
                                text-decoration: underline;" class="" moz-do-not-send="true">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!pg0W3nFXzJCE9mE1pvYfYPxllCL06pTokAzKEH8cYGsjnXbtXGbXLrC_6SLHcu0eFLPB1lmxevpST48$" target="_blank" style="color: blue;
                                text-decoration: underline;" class="" moz-do-not-send="true">https://doi.org/10.1371/journal.pcbi.1002202<br class="">
</a><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt;
                              font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div style="margin: 0cm; font-size: 11pt;
                            font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt; font-family:
                              Helvetica, sans-serif;" class="">_______________________________________________<br class="">
fieldtrip mailing list<br class="">
</span><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="color: blue; text-decoration:
                              underline;" class="" moz-do-not-send="true"><span style="font-size: 10.5pt; font-family:
                                Helvetica, sans-serif;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</span></a><span style="font-size: 10.5pt; font-family:
                              Helvetica, sans-serif;" class=""><br class="">
</span><a href="https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!pg0W3nFXzJCE9mE1pvYfYPxllCL06pTokAzKEH8cYGsjnXbtXGbXLrC_6SLHcu0eFLPB1lmxevpST48$" style="color: blue; text-decoration:
                              underline;" class="" moz-do-not-send="true"><span style="font-size: 10.5pt; font-family:
                                Helvetica, sans-serif;" class="">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!pg0W3nFXzJCE9mE1pvYfYPxllCL06pTokAzKEH8cYGsjnXbtXGbXLrC_6SLHcu0eFLPB1lmxevpST48$</span></a></div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>