[FieldTrip] source statistics - spm_bwlabel error

Malgorzata Wislowska malgorzata.wislowska at gmail.com
Wed May 24 16:34:17 CEST 2017

Dear FT-community,

when calculating cluster permutation statistics on the source level, I
receive the following error:

Error using spm_bwlabel
spm_bwlabel: CONN must be 6, 18 or 26

Error in clusterstat (line 319)
        [negclusrnd, negrndnum] = spm_bwlabel(tmp, 2*numdims); % use
spm_bwlabel for 2D/3D to avoid usage of image toolbox

Error in ft_statistics_montecarlo (line 347)
  [stat, cfg] = clusterstat(cfg, statrand, statobs);

Error in ft_sourcestatistics (line 218)
  [stat, cfg] = statmethod(cfg, dat, design);

I used MNE method for the inverse problem. I have 8196 grid points 1555
time points.
But the error occurs also when I average across the time.

Here is my configuration structure for the source analysis:

design          = zeros(2, nb_of_sbj*2);
design(1,:)   = [1:nb_of_sbj 1:nb_of_sbj];
design(2,:)     = [ones(1,nb_of_sbj) ones(1,nb_of_sbj)*2];

cfg                     = [];
cfg.method              = 'montecarlo';
cfg.statistic           = 'ft_statfun_depsamplesT';
cfg.parameter           = 'pow';
cfg.correctm            = 'cluster';
cfg.clusterstatistic    = 'maxsum';
cfg.design              = design;
cfg.ivar                = 2;
cfg.uvar                = 1;
cfg.numrandomization    = 5000;
cfg.tail                = 0;
cfg.alpha               = 0.025;

[stat]                  =

As far as I can see somebody had asked the same question last year, but the
post doesn't seem to have been addressed:

Thank you for your help in advance.

Best regards,
Malgorzata Wislowska,
University of Salzburg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170524/30607d5f/attachment-0001.html>

More information about the fieldtrip mailing list