<div dir="ltr"><div><div><div>Hi Jan-Mathijs,<br><br></div>Indeed, adding a .dim field did it!<br><br></div>Thanks again,<br></div>Stephen<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 24 June 2017 at 09:30, Schoffelen, J.M. (Jan Mathijs) <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
Hi Stephen,
<div><br>
</div>
<div>The error suggests that Fieldtrip does not manage to guess whether the set of dipole positions are defined on a regular grid, or whether it’s on a 2D mesh. Your source structure either needs a ‘dim’ field (if indeed the positions describe a full
 3D grid in an ordered way), or it needs a ‘tri’, defining the edges between the nodes.</div>
<div><br>
</div>
<div>Best,</div>
<div>JM</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap:break-word">
J.M.Schoffelen, MD PhD<br>
Senior Researcher, VIDI-fellow - PI, language in interaction<br>
Telephone: <a href="tel:+31%2024%20361%204793" value="+31243614793" target="_blank">+31-24-3614793</a></div>
<div style="word-wrap:break-word">
Physical location: room 00.028</div>
<div style="word-wrap:break-word">
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br>
<br>
</div><div><div class="h5">
<div>
<blockquote type="cite">
<div>On 23 Jun 2017, at 16:28, Stephen Whitmarsh <<a href="mailto:stephen.whitmarsh@gmail.com" target="_blank">stephen.whitmarsh@gmail.com</a>> wrote:</div>
<br class="m_-4725666021363548075Apple-interchange-newline">
<div>
<div dir="ltr">
<div>
<div>Dear Jan-Mathijs,<br>
<br>
</div>
Thanks, I've been away but back on it now. <br>
I've been going over it again, and while plotting works fine (after sourceinterpolate), sourcestatistics still throws the same error. Just to be clear - i am using/creating current source-level datastructures and without complicating things, I end up with the
 following data structures that go into sourceanalysis.<br>
<br>
<span style="font-family:monospace,monospace">         pos: [2982×3 double]<br>
        freq: 10.5000<br>
         cfg: [1×1 struct]<br>
          MI: [2982×1 double]<br>
      inside: [2982×1 logical]<br>
    MIdimord: 'pos'<br>
</span><br>
</div>
The error I keep getting is:<br>
<div><span style="font-family:monospace,monospace"><br>
Error using spm_bwlabel<br>
spm_bwlabel: CONN must be 6, 18 or 26<br>
<br>
Error in clusterstat (line 222)<br>
      [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);<br>
<br>
Error in ft_statistics_montecarlo (line 347)<br>
  [stat, cfg] = clusterstat(cfg, statrand, statobs);<br>
<br>
Error in ft_sourcestatistics (line 205)<br>
  [stat, cfg] = statmethod(cfg, dat, design);</span><br>
<br>
</div>
<div>It's a mystery what might be wrong. Would you have any further leads?<br>
<br>
</div>
<div>Thanks again,<br>
</div>
<div>Stephen<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 18 May 2017 at 21:35, Schoffelen, J.M. (Jan Mathijs) <span dir="ltr">
<<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Hi Stephen,
<div><br>
</div>
<div>source2full and source2sparse are probably quite outdated, and do not seem to work well anymore with the latest type of source-level data structures. Most relevantly, the inside field these days is by default a boolean vector of size nposx1, whereas
 once upon a time the inside and outside fields together contained the indices of the dipole positions, indicating which positions are on the in-/outside.</div>
<div><br>
</div>
<div>Do you need the source2sparse step to begin with?</div>
<div><br>
</div>
<div>Best,</div>
<div>JM</div>
<div><br>
</div>
<div>
<div>
<div><br>
</div>
<div><br>
<blockquote type="cite">
<div>
<div class="m_-4725666021363548075h5">
<div>On 17 May 2017, at 16:46, Stephen Whitmarsh <<a href="mailto:stephen.whitmarsh@gmail.com" target="_blank">stephen.whitmarsh@gmail.com</a>> wrote:</div>
<br class="m_-4725666021363548075m_-2370281886775714604Apple-interchange-newline">
</div>
</div>
<div>
<div>
<div class="m_-4725666021363548075h5">
<div dir="ltr">
<div>Hi there,<br>
<br>
<br>
</div>
After beamformer sourceanalysis I end up with datastructures looking like:<br>
<span style="font-family:monospace,monospace"><br>
</span>
<div><span style="font-family:monospace,monospace">  struct with fields:<br>
<br>
         freq: 10.5000<br>
          cfg: [1×1 struct]<br>
          pos: [2982×3 double]<br>
          pow: [2982×1 double]<br>
       inside: [2982×1 logical]<br>
    powdimord: 'pos'<br>
</span><br>
</div>
<div>The .inside field is created by ft_selectdata used to average across frequencies, and contains all 1s. Running sourceanalysis with this data trows the following error:<br>
<br>
</div>
<div><span style="color:rgb(255,0,0)"><br>
</span><span style="font-family:monospace,monospace"><span style="color:rgb(255,0,0)">Error using spm_bwlabel<br>
spm_bwlabel: CONN must be 6, 18 or 26</span><br>
<br>
<span style="color:rgb(255,0,0)">Error in clusterstat (line 222)<br>
      [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);<br>
<br>
Error in ft_statistics_montecarlo (line 347)<br>
  [stat, cfg] = clusterstat(cfg, statrand, statobs);<br>
<br>
Error in ft_sourcestatistics (line 205)<br>
  [stat, cfg] = statmethod(cfg, dat, design);</span><br>
 <br>
<span style="color:rgb(0,0,255)"><u>222 </u></span>      [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);</span><br>
<br>
<br>
</div>
<div>I think this results because of a wrong estimate of the dimensionality, resulting from the fact that the data is represented in an array rather than a 3-dimensional matrix, which it seems to expect.
<br>
<br>
I think therefor that I might need to convert my data back into a 3-d representation, i..e not a sparse but full representation. I have tried using ft_source2full, but that is not straightforward as I only have inside voxels/positions. In other words, I would
 need to do exactly the same as ft_source_statistics seems to want to do with spm_bwlabel.<br>
<br>
</div>
<div>So I guess I might just have put FieldTrip on the wrong leg, to use a Dutch expression.<br>
<br>
</div>
<div>Any suggestions?<br>
<br>
</div>
<div>Best,<br>
</div>
<div>Stephen<br>
</div>
<div><br>
<br>
</div>
</div>
</div>
</div>
______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br>
</div>
______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br>
</div></div></div>
<br>
<br>
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<br>
</div>
</div>
</div>
</div>
<br>
</div>

<br>______________________________<wbr>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/<wbr>mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>