[FieldTrip] source statistics - spm_bwlabel error
Schoffelen, J.M. (Jan Mathijs)
jan.schoffelen at donders.ru.nl
Mon May 29 09:52:04 CEST 2017
Hi Malgorzata,
Could you try to add the original ‘tri’ field to each of your varargins, and check whether the problem persists?
Thanks,
Jan-Mathijs
On 26 May 2017, at 11:52, Malgorzata Wislowska <malgorzata.wislowska at gmail.com<mailto:malgorzata.wislowska at gmail.com>> wrote:
Dear Julian,
thank you very much for your prompt response.
Yes, my numdims == 2 because my cfg.dim == [8196 1]
which comes from ft_sourcestatistics.m (code lines 131-132)
datdim = find(~strcmp(dimtok, 'subj') & ~strcmp(dimtok, 'rpt') & ~strcmp(dimtok, 'rpttap'));
datsiz = dimsiz(datdim);
calculated on the following input data:
varargin{1}:
cfg: [1x1 struct]
inside: [8196x1 logical]
pos: [8196x3 double]
time: 0.1750
pow: [8196x1 double]
dimord: 'chan_time'
The above source level structure comes from ft_sourceanalysis calculated with cfg.method = 'mne'.
Averaging over time unfortunately doesn't help - the same error continues to occur:
But data that is not averaged over time has numdims == 2 too, because length(cfg.dim) == 2, even though that cfg.dim itself is different (for not averaged data it's e.g cfg.dim == [8196 61], whereas for averaged data it's cfg.dim == [8196 1]),
It helps (well, the function runs through without errors and produces some output) if the line:
if numdims == 2 || numdims == 3 % if 2D or 3D data
gets replaced with:
if numdims == 3
In clusterstat.m, code line: 318 (and also 269, 215, 184)
Do you (or anybody else) have maybe any better idea how to fix it?
Thanks and best regards,
Malgorzata,
University Salzburg
Subject: Re: [FieldTrip] source statistics - spm_bwlabel error
Dear Malgorzata,
from a quick glance, it appears that in the call to spm_bwlabel "numdims" should be 3 to give you 2*numdims = 6.
So, could you check what numdims is in your case?
I suspect that you have 4-dimensional data (time by 3 spatial dimensions), so it might help to check where the dimensions are coming from and what happens if you average over time.
Good luck,
Julian
Am 24.05.2017 um 16:34 schrieb Malgorzata Wislowska:
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] = ft_sourcestatistics(cfg,avg_con_sel{:},avg_incon_sel{:});
As far as I can see somebody had asked the same question last year, but the post doesn't seem to have been addressed:
https://mailman.science.ru.nl/pipermail/fieldtrip/2016-August/010762.html
Thank you for your help in advance.
Best regards,
Malgorzata Wislowska,
University of Salzburg
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170529/26cd7005/attachment-0002.html>
More information about the fieldtrip
mailing list