[FieldTrip] Using Atlas ROIs in EEG Source Statistics (ft_sourcestatistics)

Roey Schurr roeysc at gmail.com
Tue Oct 8 23:41:19 CEST 2013


Dear fieldtrippers (Jan-Mathijs included),

(This message seems long, but is actually quite simple)

Having downloaded the latest fieldtrip version (20131008), we tried
rerunning the code and got the following error:

    ??? Reference to non-existent field 'coordsys'.

     Error in ==> ft_volumelookup at 206
           if     strcmp(cfg.inputcoord, 'mni') &&
           strcmp(atlas.coordsys, 'tal')

     Error in ==> statistics_wrapper at 136
             tmp = ft_volumelookup(tmpcfg, varargin{1});

     Error in ==> ft_sourcestatistics at 107
         [stat, cfg] = statistics_wrapper(cfg, varargin{:});


Since the spm8 MNI atlas indeed has no "coordsys" field.
Even if we bypass this problem (by setting "atlas.coordsys = 'mni' " by
hand, or by simply deleting that "if" line), we still get one of two errors:

* * * * * (1) * * * * *
If we define "cfg.roi = AAL_names;" where AAL_names stores all 90 ROIs the
MNI atlas has to offer, we get an indices error:

     ??? Subscript indices must either be real positive integers or
     logicals.

     Error in ==> statistics_wrapper at 213
           tmp(i,:) = mean(dat(roi,:), 1);

     Error in ==> ft_sourcestatistics at 107
         [stat, cfg] = statistics_wrapper(cfg, varargin{:});


* * * * * (2) * * * * *
If we define "cfg.roi = AAL_names{1};" for example, we get a different
error:

     ??? In an assignment  A(:) = B, the number of elements in A and
     B must be the same.

     Error in ==> clusterstat at 187
         tmp(cfg.inside) = postailobs;

     Error in ==> ft_statistics_montecarlo at 326
       [stat, cfg] = clusterstat(cfg, statrand,
       statobs,'issource',issource);

     Error in ==> statistics_wrapper at 298
         [stat, cfg] = statmethod(cfg, dat, design,
         'issource',issource);

     Error in ==> ft_sourcestatistics at 107
         [stat, cfg] = statistics_wrapper(cfg, varargin{:});

And in "cluserstat" appears this comment: "%this snippet is to support
correct clustering of N-dimensional data, not fully tested yet".
Changing line 187 to: "tmp(cfg.inside) = postailobs(1);" (and line 211 to
"tmp(cfg.inside) = negtailobs(1);") prevents this problem, but misuses the
variables vectors "postailobs" and "negtailobs"


Any ideas on how to solve this atlas source statistics problem (defining
the coordsys field, performing statistics across all ROIs, and using the
postailobs/negtailobs vectors) would be greatly appreciated!

Good night,
Aia and Roey


On Tue, Oct 8, 2013 at 9:43 AM, Roey Schurr <roeysc at gmail.com> wrote:

> Dear Jan-Mathijs,
>
> Thank you so much for your kind and quick answer!
> We do hope this will fix things up. We will check it asap.
>
> Best regards,
> Aia and Roey
>
>
>
>
> On Tue, Oct 8, 2013 at 9:38 AM, jan-mathijs schoffelen <
> jan.schoffelen at donders.ru.nl> wrote:
>
>> Dear Roey and Aia,
>>
>> This indeed was our bad. We have fixed it in the current version of
>> FieldTrip.
>> The version will be available for download tonight (CET), but you can get
>> an instantaneous update of the code repository by doing 'ft_version update'
>> on the Matlab command line.
>> This will update the fieldtrip copy you are using to the latest version.
>> Note that if you want to keep a 'static' version, you need to back up the
>> version with a fixed date, because all changes will be incorporated.
>>
>> A little note to the following piece of code:
>>
>> % Load the Atlas
>>> templateDir = which('ft_defaults'); % use a known function (ft_defaults)
>>> to find FieldTrip's directory
>>> backslashIndices = find(templateDir=='\');
>>> templateDir(backslashIndices(end)+1:end) = [];      clear
>>> backslashIndices;
>>> cfg.atlas = [templateDir, 'template\atlas\aal\ROI_MNI_V4.nii'];
>>>
>>
>> The same can be achieved with the fullfile function (which deals with
>> platform specific file-separators automatically):
>>
>> templateDir=which('ft_defaults');
>> cfg.atlas = fullfile(templateDir,template,atlas,ROI_MNI_V4.nii');
>>
>>
>> Best,
>> Jan-Mathijs
>>
>>
>>
>> On Oct 8, 2013, at 8:25 AM, Roey Schurr wrote:
>>
>> Hello again,
>>
>> Sorry, it seems like the older version (with ft_volumelookup) is just
>> our mistake.
>> However the problem is still relevant, for the function volumelookup is
>> still undefinded in our case.
>>
>> Hopefully someone might know what we did wrong.
>>
>> Thank you once again!
>> Aia and Roey
>>
>>
>> On Tue, Oct 8, 2013 at 12:54 AM, Roey Schurr <roeysc at gmail.com> wrote:
>>
>>> Hello all,
>>>
>>> We are having some problems defining atlas-based ROIs using
>>> ft_sourcestatistics on two source structures obtained via ft_sourceanalysis
>>> (whose grid is later changed according to a precalculated MNI-warped grid).
>>>
>>> It seems like the function "statistics_wrapper" has changed between
>>> "fieldtrip-20130822" and "fieldtrip-20131007": line 136 now calls
>>> "volumelookup" and not "ft_volumelookup", so we get the following error:
>>>
>>>       ??? Undefined function or method 'volumelookup' for input
>>>       arguments of type 'struct'.
>>>
>>>       Error in ==> statistics_wrapper at 136
>>>               tmp = volumelookup(tmpcfg, varargin{1});
>>>
>>> Using the older fieldtrip vesion we get this error:
>>>     ??? Subscript indices must either be real positive integers or
>>>     logicals.
>>>
>>>       Error in ==> statistics_wrapper at 213
>>>             tmp(i,:) = mean(dat(roi,:), 1);
>>>
>>>       Error in ==> ft_sourcestatistics at 107
>>>           [stat, cfg] = statistics_wrapper(cfg, varargin{:});
>>>
>>> So it seems like we didn't define the ROIs correctly, however we are not
>>> sure why.
>>>
>>> Any suggestions would be greatly appreciated!
>>> The relevant pieceof code is attached.
>>>
>>> Thank you all,
>>> Aia and Roey
>>>
>>>
>>>
>>> Relevant code
>>> ============
>>> % Convert sources units to mm, to fit the atlas's units
>>> sourceCondition1 = ft_convert_units(sourceCondition1, 'mm');
>>> sourceCondition2 = ft_convert_units(sourceCondition2, '
>>> design = [ ones(1,length(sourceCondition1.trial)),
>>> 2*ones(1,length(sourceCondition2.trial)) ];
>>>
>>> cfg = [];
>>> cfg.dim = sourceCondition1.dim;
>>> cfg.method = 'montecarlo';
>>> cfg.statistic = 'indepsamplesT';
>>> cfg.parameter = 'pow';
>>> cfg.correctm = 'cluster';
>>> cfg.numrandomization = 1000;
>>> cfg.alpha = 0.01;
>>> cfg.tail = 0;
>>> cfg.design(1,:) = design;
>>> cfg.ivar = 1;
>>>
>>> % Load the Atlas
>>> templateDir = which('ft_defaults'); % use a known function (ft_defaults)
>>> to find FieldTrip's directory
>>> backslashIndices = find(templateDir=='\');
>>> templateDir(backslashIndices(end)+1:end) = [];      clear
>>> backslashIndices;
>>> cfg.atlas = [templateDir, 'template\atlas\aal\ROI_MNI_V4.nii'];
>>>
>>>
>>> cfg.roi = AAL_names; % This is a cell array of the atlas's ROIs:
>>> "Precentral_L", "Precentral_R", etc/
>>>
>>> cfg.avgoverroi   = 'yes';
>>> cfg.hemisphere   = 'both';
>>> cfg.inputcoord   = 'mni';
>>>
>>> stat = ft_sourcestatistics(cfg, sourceCondition1, sourceCondition2);
>>>
>>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>     Jan-Mathijs Schoffelen, MD PhD
>>
>> Donders Institute for Brain, Cognition and Behaviour,
>> Centre for Cognitive Neuroimaging,
>> Radboud University Nijmegen, The Netherlands
>>
>> Max Planck Institute for Psycholinguistics,
>> Nijmegen, The Netherlands
>>
>> J.Schoffelen at donders.ru.nl
>> Telephone: +31-24-3614793
>>
>> http://www.hettaligebrein.nl
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20131009/47725795/attachment-0002.html>


More information about the fieldtrip mailing list