[FieldTrip] ft_sourceinterpolate for ft_sourcestatistics

Zito Giuseppe Angelo giuseppeangelo.zito at hest.ethz.ch
Tue Sep 20 10:45:28 CEST 2022

Hello Fieldtrip experts,

I would like to ask a question on plotting the results of ft_sourcestatistics.

I have followed the pipeline described here (https://www.fieldtriptoolbox.org/example/source_statistics/) for the group stats, and I combined it with the last part of the tutorial I found here (https://www.fieldtriptoolbox.org/tutorial/beamformer/) for the plot.
However, when I call ft_sourceinterpolate with stat as input parameter, I receive the following error:

Error using isstruct
Not enough input arguments.

Error in fixpos (line 77)
    if isstruct(mesh.(fn{i}))

Error in fixpos (line 78)
      mesh.(fn{i}) = fixpos(mesh.(fn{i}), recurse+1);

Error in ft_sourceinterpolate (line 129)
functional = fixpos(functional);

Interestingly, if I do not apply cluster correction, the pipeline works.
Here is the code I used:

% run statistics post real vs pre real
cfg                  = [];
cfg.dim              = realPre{1}.dim;
cfg.method           = 'montecarlo';
cfg.statistic        = 'ft_statfun_depsamplesT';
cfg.parameter        = 'avg.pow';
cfg.correctm         = 'cluster';
cfg.clusteralpha     = 0.05;
cfg.numrandomization = 10000;
cfg.alpha            = 0.05;
cfg.tail             = 0;
designMatrix = [];
designMatrix(1,1:nReal+nReal) = [1:nReal 1:nReal];
designMatrix(2,1:nReal+nReal) = [ones(1,nReal) 2*ones(1,nReal)];
cfg.design = designMatrix;
cfg.uvar = 1;
cfg.ivar = 2;
stat = ft_sourcestatistics(cfg, realPost{:}, realPre{:});
% Load and reslice MRI
mri = ft_read_mri('C:\toolbox\fieldtrip-20220317\template\anatomy\single_subj_T1_1mm.nii');
mri = ft_volumereslice([], mri);
cfg            = [];
cfg.downsample = 2;
cfg.parameter  = 'stat';
statPlot  = ft_sourceinterpolate(cfg, stat, mri);
% Plot source
close all
maxval = max(statPlot.stat);
cfg = [];
cfg.method        = 'ortho';
cfg.funparameter  = 'stat';
cfg.maskparameter = cfg.funparameter;
cfg.opacitymap    = 'rampup';
ft_sourceplot(cfg, statPlot);

I would appreciate any input.

Thank you very much,

Dr. Giuseppe Angelo Zito
Principal Investigator, Swiss National Science Foundation

Decision Neuroscience Lab
Department of Health Sciences and Technology (D-HEST)
ETH – Swiss Federal Institute of Technology Zurich

Winterthurerstrasse 190
8057 Zürich

Tel: +41 44 633 05 17
mailto: giuseppeangelo.zito at hest.ethz.ch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220920/a48701e2/attachment.htm>

More information about the fieldtrip mailing list