[FieldTrip] ROI-based source analysis with ft_sourcestatistics

Zito Giuseppe Angelo giuseppeangelo.zito at hest.ethz.ch
Fri Sep 2 10:09:34 CEST 2022


Dear Jan-Mathijs,

Yes, that’s unfortunate, thank you for the hint.

I tried to walk around this issue. I modified the field “inside” from each subject, so that it only contains values within my ROI. Here is the code:

% Load atlas and select supramarginal gyrus (labels 63 and 64)
aal = ft_read_atlas('C:\toolbox\fieldtrip-20220317\template\atlas\aal\ROI_MNI_V4.nii');
SMG = aal;
SMG.tissue = zeros(aal.dim(1),aal.dim(2),aal.dim(3));
SMG.tissue(aal.tissue==63) = 1;     % supramarginal gyrus
SMG.tissue(aal.tissue==64) = 1;
SMG.tissue = logical(SMG.tissue);
% Interpolate subjects' data so that they match the size of the atlas
cfg            = [];
cfg.downsample = 1;
cfg.parameter  = 'pow';
for i = 1:nReal
    realPrePostInt{i,1} = ft_sourceinterpolate(cfg, realPrePost{i}, aal);
    realPrePostInt{i,1}.inside = SMG.tissue;
end
for i = 1:nSham
    shamPrePostInt{i,1} = ft_sourceinterpolate(cfg, shamPrePost{i}, aal);
    shamPrePostInt{i,1}.inside = SMG.tissue;
end

This seems to restrict the analysis only to the specific ROI, however, in the later plot, it seems that the activity maps do not match with each other in the ortho-view (see picture attached). In other words, when I center the axes over a cluster in the coronal view, I do not see any cluster in the sagittal/axial views. Any input of what could have gone wrong?
Here is the code I use to run the stats and the plot.

% run statistics [(post-pre)/pre]real vs [(post-pre)/pre]sham
cfg                  = [];
cfg.dim              = realPrePost{1}.dim;
cfg.method           = 'montecarlo';
cfg.statistic        = 'ft_statfun_indepsamplesT';
cfg.parameter        = 'pow';
cfg.correctm         = 'cluster';
cfg.clusteralpha     = 0.05;
cfg.numrandomization = 1000;
cfg.alpha            = 0.05;
cfg.tail             = 0;
designMatrix = [];
designMatrix(1,1:nReal+nSham) = [ones(1,nReal) 2*ones(1,nSham)];
cfg.design = designMatrix;
cfg.ivar = 1;
stat = ft_sourcestatistics(cfg, realPrePostInt{:}, shamPrePostInt{:});
% 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.funcolorlim   = [0.5 maxval];
cfg.opacitylim    = [0.5 maxval];
cfg.opacitymap    = 'rampup';
ft_sourceplot(cfg, statPlot);

Thank you again, and have a nice week end,
Giuseppe


From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of Schoffelen, J.M. (Jan Mathijs) via fieldtrip
Sent: 26 August 2022 10:16
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Schoffelen, J.M. (Jan Mathijs) <janmathijs.schoffelen at donders.ru.nl>
Subject: Re: [FieldTrip] ROI-based source analysis with ft_sourcestatistics

Hi Giuseppe,

If you open ft_sourcestatistics and read the help documentation, it states:

% FIXME the following needs to be reimplemented
%
% You can restrict the statistical analysis to regions of interest (ROIs)
% or to the average value inside ROIs using the following options:
%   cfg.atlas        = filename of the atlas
%   cfg.roi          = string or cell of strings, region(s) of interest from anatomical atlas
%   cfg.avgoverroi   = 'yes' or 'no' (default = 'no')
%   cfg.hemisphere   = 'left', 'right', 'both', 'combined', specifying this is required when averaging over regions

If I subsequently search the code for the term ‘roi’ or ‘avgoverroi’, I only get a hit for the occurrences in the help documention, so that means that there is no functional  consequence of specifying those options.

In other words: it is not so surprising that it doesn’t work, at least not in the way that you implemented it in your scripts. This also means that the documentation you used to create your scripts is out of sync with the code. That’s unfortunate, and it would be helpful if propose a change to the website (it could be as minimal as inserting a disclaimer or so) that flags the non-functionality of that snippet of code (for the time being).

This being said, there have been various code/workflow improvements over the past years, which in principle would make it possible for you to achieve what you want, using a different route.

This requires the use of ft_sourceparcellate (or ft_virtualchannel), followed by a call to ft_timelockstatistics/ft_freqstatistics. If the documentation online proves insufficient, then it would be helpful if you were to write a bit of documentation once you find out how to do it.

Good luck and best wishes,
Jan-Mathijs


On 24 Aug 2022, at 15:53, Zito Giuseppe Angelo via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear Fieldtrip community,

I would like to bring up the topic of ROI-based source analysis. I’ve seen that many have asked about this in the last years, but I could not find an answer that worked.

I would like to restrict my ft_sourcestatistics to specific ROIs taken from the aal atlas. I implemented the code as suggested in other discussions/tutorials, but the results are identical to the ones obtained without ROI selection.
Could you please give me an advice on how to solve it?

Here is my code:

realPrePost{1} =

  struct with fields:

      freq: 5.5008
       cfg: [1×1 struct]
       dim: [15 18 15]
    inside: [4050×1 logical]
       pos: [4050×3 double]
    method: 'average'
       avg: [1×1 struct]


% Prepare cfg to run the stats
cfg                  = [];
cfg.dim              = realPrePost{1}.dim;
cfg.method           = 'montecarlo';
cfg.statistic        = 'ft_statfun_indepsamplesT';
cfg.parameter        = 'pow';
cfg.correctm         = 'cluster';
cfg.clusteralpha     = 0.05;
cfg.numrandomization = 10000;
cfg.alpha            = 0.05;
cfg.tail             = 0;

% Atlas-related cfg options
aal = ft_read_atlas('C:\toolbox\fieldtrip-20220317\template\atlas\aal\ROI_MNI_V4.nii');
cfg.atlas        = aal;
cfg.roi          = aal.tissuelabel(63:64);
cfg.avgoverroi   = 'yes';
cfg.hemisphere   = 'both'; % 'combined'

% Design matrix
designMatrix = [];
designMatrix(1,1:nReal+nSham) = [ones(1,nReal) 2*ones(1,nSham)];
cfg.design = designMatrix;
cfg.ivar = 1;
stat = ft_sourcestatistics(cfg, realPrePost{:}, shamPrePost{:});
% Load and reslice MRI template
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.funcolorlim   = [0.5 maxval];
cfg.opacitylim    = [0.5 maxval];
cfg.opacitymap    = 'rampup';
ft_sourceplot(cfg, statPlot);

Any help would be appreciated,
Giuseppe

________________________________
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
Switzerland

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

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5XqTR4XAv-0LkbWpXqVYKB9EFohXB0-iGQ2XmHrhHTHTO5KztgBk42By40VmIFTymbtSjwffiL29v2K0aVyhPIUTmP1-6L68GVQhww$<https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5XqTR4XAv-0LkbWpXqVYKB9EFohXB0-iGQ2XmHrhHTHTO5KztgBk42By40VmIFTymbtSjwffiL29v2K0aVyhPIUTmP1-6L68GVQhww$>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220902/aac54517/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Untitled.png
Type: image/png
Size: 170605 bytes
Desc: Untitled.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220902/aac54517/attachment-0001.png>


More information about the fieldtrip mailing list