[FieldTrip] ft_sourcestatistics cannot find field 'pos'

Joram van Driel joramvandriel at gmail.com
Fri Jan 24 14:09:35 CET 2014


Hi Jan-Mathijs,
Thanks, that works.
I also had to change line 643 into (copied from statistics_wrapper in FT
version 20131031):

  fprintf('only selecting voxels inside the brain for statistics
(%.1f%%)\n', 100*length(varargin{1}.inside)/prod(varargin{1}.dim));

This line also used the non-existing .pos field.
Thanks again,
Joram



On Fri, Jan 24, 2014 at 12:40 PM, jan-mathijs schoffelen <
jan.schoffelen at donders.ru.nl> wrote:

> Hi Joram,
>
> Probably this is my bad.
> ft_sourceinterpolate intentionally removes the pos field, which has to do
> with the representation of the data. FieldTrip either represents source
> reconstructed data that can be defined on a regular 3D grid as a so-called
> 'source-structure' (with a pos field), or as a so-called volume-structure
> (without a pos field). After the sourceinterpolate step your data is
> represented as the latter, lacking a pos field (intentionally), but
> unintentionally causing a crash in ft_sourcestatistics.
> A workaround for now would be for you to change line 228 in
> statistics_wrapper into if isfield(varargin{1}, 'transform') ||
> (isfield(varargin{1}, 'dim') &&
> prod(varargin{1}.dim)==size(varargin{1}.pos,1)).
> Could you try this out and let me know if that works? Then I can
> incorporate it in FT.
>
> Best and sorry for the inconvenience,
> JM
>
>
>
> On Jan 24, 2014, at 12:21 PM, Joram van Driel wrote:
>
> Sorry, this should have been:
> This 'pos' field is removed in further steps (ft_sourceinterpolate). When
> calling *ft_sourcestatistics* in version fieldtrip-20140109, the function
> statistics_wrapper searches for this field (line 228) and can't find it.
>
>
> On Fri, Jan 24, 2014 at 12:16 PM, Joram van Driel <joramvandriel at gmail.com
> > wrote:
>
>> Hi Nietzsche,
>>
>> Thanks for the suggestion, but unfortunately that's not what's going
>> wrong. My input data is a subject-by-condition array, so if I fill in
>> sourcedat{:,1} and sourcedat{:,2}, that would be equivalent to having two
>> separate variables and do source_condition1{:},source_condition2{:}. I
>> tried that but I get the same error "??? Reference to non-existent field
>> 'pos'."
>>
>> In fact, the error is I think a bug of the newest fieldtrip version,
>> because when I tried an older version (fieldtrip-20131031), it works
>> (although it later crashes on a design array issue, but that's something I
>> have to figure out myself ;)).
>>
>> The 'pos' field is a field that is present in the output of
>> ft_sourceanalysis; according to the help it's a N-by-3 matrix of the x-y-z
>> position of all the sources, where N is the sum of the length of the
>> 'inside' and 'outside' fields.
>> This 'pos' field is removed in further steps (ft_sourceinterpolate). When
>> calling ft_sourceanalysis in version fieldtrip-20140109, the function
>> statistics_wrapper searches for this field (line 228) and can't find it.
>>
>> Chrs,
>>
>> - Joram
>>
>>
>>
>> On Fri, Jan 24, 2014 at 9:55 AM, Lam, Nietzsche <n.lam at fcdonders.ru.nl>wrote:
>>
>>> Hi Joram,
>>>
>>> I'm not entirely sure if this is the solution, but when you call
>>> ft_sourcestatistics, you can try this:
>>>
>>> <stat = ft_sourcestatistics(cfg,sourceDiffNorm{:}, sourceDiffNorm{:})>
>>>
>>> FieldTrip statistics functions understands that you want to use the data
>>> from all subjects when you use {:}, so there's no need to call individual
>>> columns with {:,X}.
>>>
>>> Best,
>>> Nietzsche
>>>
>>>
>>>
>>> ----- Original Message -----
>>> > From: "Joram van Driel" <joramvandriel at gmail.com>
>>> > To: "FieldTrip discussion list" <fieldtrip at science.ru.nl>
>>> > Sent: Friday, 24 January, 2014 8:54:24 AM
>>> > Subject: [FieldTrip] ft_sourcestatistics cannot find field 'pos'
>>> > Hi all,
>>> >
>>> >
>>> > I'm getting stuck with ft_sourcestatistics.
>>> > I want to do a simple two-condition contrast on neuromag MEG data,
>>> > where I did frequency beamforming on a pre vs. post tf-window.
>>> >
>>> >
>>> > I followed the instructions of the tutorial, so for each subject and
>>> > condition:
>>> >
>>> >
>>> > 1) ft_sourceanalysis with subject-specific vol and grid structures,
>>> > where I did the pre vs post contrast as follows:
>>> >
>>> >
>>> >
>>> > sourceAll = ft_sourceanalysis(cfg, freqAll(condi));
>>> >
>>> > cfg.grid.filter = sourceAll.avg.filter;
>>> > sourcePre_con = ft_sourceanalysis(cfg, freqPre(condi) );
>>> > sourcePost_con = ft_sourceanalysis(cfg, freqPost(condi));
>>> >
>>> >
>>> >
>>> > sourceDiff(condi) = sourcePost_con;
>>> > sourceDiff(condi).avg.pow = (sourcePost_con.avg.pow -
>>> > sourcePre_con.avg.pow) ./ sourcePre_con.avg.pow;
>>> >
>>> >
>>> > 2) ft_sourceinterpolate with the subject-specific mri
>>> > 3) ft_volumenormalize to MNI with coordsys 'neuromag'.
>>> > 4) The output is stored in a subject-by-condition cell array, which I
>>> > put into ft_sourcestatistics with the following cfg:
>>> >
>>> >
>>> >
>>> > cfg = [];
>>> > cfg.parameter = 'avg.pow';
>>> > cfg.method = 'analytic';
>>> > cfg.statistic = 'depsamplesT';
>>> > cfg.correctm = 'no';
>>> > cfg.alpha = 0.05;
>>> >
>>> >
>>> > Nsub = 10;
>>> > cfg.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)];
>>> > cfg.design(2,1:2*Nsub) = [1:Nsub 1:Nsub];
>>> > cfg.tail = 0; % number, -1, 1 or 0 (default = 0)
>>> > cfg.ivar = 1; % number or list with indices, independent variable(s)
>>> > cfg.uvar = 2; % number or list with indices, unit variable(s)
>>> >
>>> >
>>> > stat = ft_sourcestatistics(cfg,sourceDiffNorm{:,1},
>>> > sourceDiffNorm{:,2});
>>> >
>>> >
>>> >
>>> >
>>> > This results in the error that it cannot find the field 'pos'; however
>>> > this field is only present in the result from ft_sourceanalysis (and
>>> > differs for each subject), but disappears as soon as
>>> > ft_sourceinterpolate is applied. I tried to put the result from
>>> > ft_sourceanalysis straight into ft_sourcestatistics (which according
>>> > to the help should be possible), but this doesn't recognize the input
>>> > as volume data (and apart from that, the subjects aren't spatially
>>> > aligned this way).
>>> >
>>> >
>>> > I hope someone can help me with this; any help is much appreciated!
>>> >
>>> >
>>> > Thanks,
>>> > Joram
>>> >
>>> >
>>> > --
>>> >
>>> > Joram van Driel, MSc.
>>> > PhD student @ University of Amsterdam
>>> > Brain & Cognition @ Department of Psychology
>>> > _______________________________________________
>>> > fieldtrip mailing list
>>> > fieldtrip at donders.ru.nl
>>> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>> --
>>> Nietzsche H.L. Lam, MSc
>>> PhD Candidate
>>>
>>> Max Planck Institute for Psycholinguistics
>>> Wundtlaan 1, 6525 XD Nijmegen, The Netherlands
>>>
>>> Donders Institute for Brain, Cognition and Behaviour,
>>> Centre for Cognitive Neuroimaging,
>>> Kapittelweg 29, 6525EN Nijmegen, The Netherlands
>>>
>>> n.lam at fcdonders.ru.nl
>>> +31-24-3668219
>>>
>>>
>>> neurobiologyoflanguage.com
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>
>>
>>
>> --
>> Joram van Driel, MSc.
>> PhD student @ University of Amsterdam
>> Brain & Cognition @ Department of Psychology
>>
>
>
>
> --
> Joram van Driel, MSc.
> PhD student @ University of Amsterdam
> Brain & Cognition @ Department of Psychology
>  _______________________________________________
> 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
>



-- 
Joram van Driel, MSc.
PhD student @ University of Amsterdam
Brain & Cognition @ Department of Psychology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140124/1306463b/attachment-0001.html>


More information about the fieldtrip mailing list