<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Stephen,
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">JM</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
J.M.Schoffelen, MD PhD<br class="">
Senior Researcher, VIDI-fellow - PI, language in interaction<br class="">
Telephone: +31-24-3614793</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Physical location: room 00.028</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands<br class="">
<br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">On 23 Jun 2017, at 16:28, Stephen Whitmarsh <<a href="mailto:stephen.whitmarsh@gmail.com" class="">stephen.whitmarsh@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">Dear Jan-Mathijs,<br class="">
<br class="">
</div>
Thanks, I've been away but back on it now. <br class="">
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 class="">
<br class="">
<span style="font-family:monospace,monospace" class="">         pos: [2982×3 double]<br class="">
        freq: 10.5000<br class="">
         cfg: [1×1 struct]<br class="">
          MI: [2982×1 double]<br class="">
      inside: [2982×1 logical]<br class="">
    MIdimord: 'pos'<br class="">
</span><br class="">
</div>
The error I keep getting is:<br class="">
<div class=""><span style="font-family:monospace,monospace" class=""><br class="">
Error using spm_bwlabel<br class="">
spm_bwlabel: CONN must be 6, 18 or 26<br class="">
<br class="">
Error in clusterstat (line 222)<br class="">
      [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);<br class="">
<br class="">
Error in ft_statistics_montecarlo (line 347)<br class="">
  [stat, cfg] = clusterstat(cfg, statrand, statobs);<br class="">
<br class="">
Error in ft_sourcestatistics (line 205)<br class="">
  [stat, cfg] = statmethod(cfg, dat, design);</span><br class="">
<br class="">
</div>
<div class="">It's a mystery what might be wrong. Would you have any further leads?<br class="">
<br class="">
</div>
<div class="">Thanks again,<br class="">
</div>
<div class="">Stephen<br class="">
</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On 18 May 2017 at 21:35, Schoffelen, J.M. (Jan Mathijs) <span dir="ltr" class="">
<<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank" class="">jan.schoffelen@donders.ru.nl</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hi Stephen,
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Do you need the source2sparse step to begin with?</div>
<div class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">JM</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div class=""><br class="">
</div>
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">
<div class="h5">
<div class="">On 17 May 2017, at 16:46, Stephen Whitmarsh <<a href="mailto:stephen.whitmarsh@gmail.com" target="_blank" class="">stephen.whitmarsh@gmail.com</a>> wrote:</div>
<br class="m_-2370281886775714604Apple-interchange-newline">
</div>
</div>
<div class="">
<div class="">
<div class="h5">
<div dir="ltr" class="">
<div class="">Hi there,<br class="">
<br class="">
<br class="">
</div>
After beamformer sourceanalysis I end up with datastructures looking like:<br class="">
<span style="font-family:monospace,monospace" class=""><br class="">
</span>
<div class=""><span style="font-family:monospace,monospace" class="">  struct with fields:<br class="">
<br class="">
         freq: 10.5000<br class="">
          cfg: [1×1 struct]<br class="">
          pos: [2982×3 double]<br class="">
          pow: [2982×1 double]<br class="">
       inside: [2982×1 logical]<br class="">
    powdimord: 'pos'<br class="">
</span><br class="">
</div>
<div class="">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 class="">
<br class="">
</div>
<div class=""><span style="color:rgb(255,0,0)" class=""><br class="">
</span><span style="font-family:monospace,monospace" class=""><span style="color:rgb(255,0,0)" class="">Error using spm_bwlabel<br class="">
spm_bwlabel: CONN must be 6, 18 or 26</span><br class="">
<br class="">
<span style="color:rgb(255,0,0)" class="">Error in clusterstat (line 222)<br class="">
      [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);<br class="">
<br class="">
Error in ft_statistics_montecarlo (line 347)<br class="">
  [stat, cfg] = clusterstat(cfg, statrand, statobs);<br class="">
<br class="">
Error in ft_sourcestatistics (line 205)<br class="">
  [stat, cfg] = statmethod(cfg, dat, design);</span><br class="">
 <br class="">
<span style="color:rgb(0,0,255)" class=""><u class="">222 </u></span>      [negclusobs, negnum] = spm_bwlabel(tmp, 2*numdims);</span><br class="">
<br class="">
<br class="">
</div>
<div class="">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 class="">
<br class="">
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 class="">
<br class="">
</div>
<div class="">So I guess I might just have put FieldTrip on the wrong leg, to use a Dutch expression.<br class="">
<br class="">
</div>
<div class="">Any suggestions?<br class="">
<br class="">
</div>
<div class="">Best,<br class="">
</div>
<div class="">Stephen<br class="">
</div>
<div class=""><br class="">
<br class="">
</div>
</div>
</div>
</div>
______________________________<wbr class="">_________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank" class="">fieldtrip@donders.ru.nl</a><br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank" class="">https://mailman.science.ru.nl/<wbr class="">mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
<br class="">
______________________________<wbr class="">_________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank" class="">https://mailman.science.ru.nl/<wbr class="">mailman/listinfo/fieldtrip</a><br class="">
</blockquote>
</div>
<br class="">
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="mailto:fieldtrip@donders.ru.nl" class="">fieldtrip@donders.ru.nl</a><br class="">
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</div>
</blockquote>
</div>
<br class="">
</div>
<br class="">
<br class="">
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
</div>
</div>
</div>
</div>
<br class="">
</body>
</html>