<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 5 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=DE link=blue vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Dear Jan-Mathijs,</p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span lang=EN-GB>In general, I want to compare the connectivity between two MEG sessions in which patients took different drugs. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span 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...). <o:p></o:p></span></p><p class=MsoNormal><span 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></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span 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></o:p></span></p><p class=MsoNormal><span 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></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>How could I solve this issue?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB>Thanks in advance an best regards, <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB>Johannes<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>Von: </b><a href="mailto:fieldtrip@science.ru.nl">Schoffelen,J.M. (Jan Mathijs) via fieldtrip</a><br><b>Gesendet: </b>Donnerstag, 7. Oktober 2021 10:28<br><b>An: </b><a href="mailto:fieldtrip@science.ru.nl">FieldTrip discussion list</a><br><b>Cc: </b><a href="mailto:janmathijs.schoffelen@donders.ru.nl">Schoffelen, J.M. (Jan Mathijs)</a><br><b>Betreff: </b>Re: [FieldTrip] problem using ft_sourceparcellate</p></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Dear Johannes, <o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Best wishes,<o:p></o:p></p></div><div><p class=MsoNormal>Jan-Mathijs<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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></o:p></p><div><p class=MsoNormal><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>On 7 Oct 2021, at 09:08, Johannes Gehrig via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>> wrote:<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>Dear Stefan,<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>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></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>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></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Thanks and best regards,<o:p></o:p></p></div><div><p class=MsoNormal>Johannes<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><div><p class=MsoNormal><b>Von:<span class=apple-converted-space> </span></b><a href="mailto:stefan.dvoretskii@tum.de">Stefan Dvoretskii</a><br><b>Gesendet:<span class=apple-converted-space> </span></b>Mittwoch, 6. Oktober 2021 17:39<br><b>An:<span class=apple-converted-space> </span></b><a href="mailto:fieldtrip@science.ru.nl">FieldTrip discussion list</a><br><b>Cc:<span class=apple-converted-space> </span></b><a href="mailto:jgehrig@med.uni-frankfurt.de">Johannes Gehrig</a>;<span class=apple-converted-space> </span><a href="mailto:cristina.gil@tum.de">Gil Avila, Cristina</a><br><b>Betreff:<span class=apple-converted-space> </span></b>Re: [FieldTrip] problem using ft_sourceparcellate<o:p></o:p></p></div></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><div><p class=MsoNormal>Dear Johannes, <o:p></o:p></p></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>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></o:p></p></div></div><div><div><p class=MsoNormal>We are currently working to incorporate it into the Fieldtrip code.<o:p></o:p></p></div></div><div><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=MsoNormal>Best regards,<o:p></o:p></p></div></div><div><div><p class=MsoNormal>Stefan<o:p></o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'> </p><div><div><div><p class=MsoNormal>пн, 4 окт. 2021 г., 11:06 Johannes Gehrig via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.ru.nl</a>>:<o:p></o:p></p></div></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:40.8pt'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>Dear Fieldtrip-user,<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:40.8pt'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>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></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:40.8pt'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>load('atlas_MMP1.0_4k.mat');<span class=apple-converted-space> </span><br>cfg = [];<br>cfg.parcellation = 'parcellation';<br>cfg.method       = 'mean';<br>cfg.parameter    = 'all';<span class=apple-converted-space> </span><br>parc_sourceOn = ft_sourceparcellate(cfg, source_ON, atlas);<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:40.8pt'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>Error message:"<br>there are in total 8004 positions, 4544 positions are inside the brain, 8004 positions have a label<br>4544 of the positions inside the brain have a label<br>4544 of the labeled positions are inside the brain<br>0 of the positions inside the brain do not have a label<br>creating 362 parcels for parameter csd by taking the mean<br>computing parcellation<br>232           tmp(j,:,:) = cellmean1(dat(tissue==j));<br>computing parcellation for L_V1_ROI<br>Index exceeds array bounds.<br><br>Error in ft_sourceparcellate>cellmean1 (line 494)<br>y = x{1};<br><br>Error in ft_sourceparcellate (line 232)<br>          tmp(j,:,:) = cellmean1(dat(tissue==j));<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:40.8pt'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>"<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:40.8pt'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>Any help and ideas are very much appreciated!<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:40.8pt'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>Best regards, Johannes<o:p></o:p></span></p></div></blockquote></div></div><div style='margin-left:4.8pt'><p class=MsoNormal>_______________________________________________<br>fieldtrip mailing list<br><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br><a href="https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!pg0W3nFXzJCE9mE1pvYfYPxllCL06pTokAzKEH8cYGsjnXbtXGbXLrC_6SLHcu0eFLPB1lmxevpST48$" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202<br></a><o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><p class=MsoNormal><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>_______________________________________________<br>fieldtrip mailing list<br></span><a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip"><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</span></a><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'><br></span><a href="https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!pg0W3nFXzJCE9mE1pvYfYPxllCL06pTokAzKEH8cYGsjnXbtXGbXLrC_6SLHcu0eFLPB1lmxevpST48$"><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'>https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!pg0W3nFXzJCE9mE1pvYfYPxllCL06pTokAzKEH8cYGsjnXbtXGbXLrC_6SLHcu0eFLPB1lmxevpST48$</span></a><span class=apple-converted-space><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif'> </span></span><o:p></o:p></p></div></blockquote></div></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>