<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Joram,<div><br></div><div>Probably this is my bad. </div><div>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.</div><div>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)).</div><div>Could you try this out and let me know if that works? Then I can incorporate it in FT.</div><div><br></div><div>Best and sorry for the inconvenience,</div><div>JM</div><div><br></div><div><br></div><div><br><div><div>On Jan 24, 2014, at 12:21 PM, Joram van Driel wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Sorry, this should have been:<div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">This 'pos' field is removed in further steps (ft_sourceinterpolate). When calling <b>ft_sourcestatistics</b> in version fieldtrip-20140109, the function statistics_wrapper searches for this field (line 228) and can't find it.</span><br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 24, 2014 at 12:16 PM, Joram van Driel <span dir="ltr"><<a href="mailto:joramvandriel@gmail.com" target="_blank">joramvandriel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Nietzsche,<div><br><div>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'."</div>

<div><br></div><div>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 ;)).</div>

</div><div><br></div><div>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.</div>

<div>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.</div>

<div><br></div><div>Chrs,</div><div><br></div><div>- Joram</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 24, 2014 at 9:55 AM, Lam, Nietzsche <span dir="ltr"><<a href="mailto:n.lam@fcdonders.ru.nl" target="_blank">n.lam@fcdonders.ru.nl</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Joram,<br>
<br>
I'm not entirely sure if this is the solution, but when you call ft_sourcestatistics, you can try this:<br>
<br>
<stat = ft_sourcestatistics(cfg,sourceDiffNorm{:}, sourceDiffNorm{:})><br>
<br>
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}.<br>
<br>
Best,<br>
Nietzsche<br>
<div><div><br>
<br>
<br>
----- Original Message -----<br>
> From: "Joram van Driel" <<a href="mailto:joramvandriel@gmail.com" target="_blank">joramvandriel@gmail.com</a>><br>
> To: "FieldTrip discussion list" <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br>
> Sent: Friday, 24 January, 2014 8:54:24 AM<br>
> Subject: [FieldTrip] ft_sourcestatistics cannot find field 'pos'<br>
> Hi all,<br>
><br>
><br>
> I'm getting stuck with ft_sourcestatistics.<br>
> I want to do a simple two-condition contrast on neuromag MEG data,<br>
> where I did frequency beamforming on a pre vs. post tf-window.<br>
><br>
><br>
> I followed the instructions of the tutorial, so for each subject and<br>
> condition:<br>
><br>
><br>
> 1) ft_sourceanalysis with subject-specific vol and grid structures,<br>
> where I did the pre vs post contrast as follows:<br>
><br>
><br>
><br>
> sourceAll = ft_sourceanalysis(cfg, freqAll(condi));<br>
><br>
> cfg.grid.filter = sourceAll.avg.filter;<br>
> sourcePre_con = ft_sourceanalysis(cfg, freqPre(condi) );<br>
> sourcePost_con = ft_sourceanalysis(cfg, freqPost(condi));<br>
><br>
><br>
><br>
> sourceDiff(condi) = sourcePost_con;<br>
> sourceDiff(condi).avg.pow = (sourcePost_con.avg.pow -<br>
> sourcePre_con.avg.pow) ./ sourcePre_con.avg.pow;<br>
><br>
><br>
> 2) ft_sourceinterpolate with the subject-specific mri<br>
> 3) ft_volumenormalize to MNI with coordsys 'neuromag'.<br>
> 4) The output is stored in a subject-by-condition cell array, which I<br>
> put into ft_sourcestatistics with the following cfg:<br>
><br>
><br>
><br>
> cfg = [];<br>
> cfg.parameter = 'avg.pow';<br>
> cfg.method = 'analytic';<br>
> cfg.statistic = 'depsamplesT';<br>
> cfg.correctm = 'no';<br>
> cfg.alpha = 0.05;<br>
><br>
><br>
> Nsub = 10;<br>
> cfg.design(1,1:2*Nsub) = [ones(1,Nsub) 2*ones(1,Nsub)];<br>
> cfg.design(2,1:2*Nsub) = [1:Nsub 1:Nsub];<br>
> cfg.tail = 0; % number, -1, 1 or 0 (default = 0)<br>
> cfg.ivar = 1; % number or list with indices, independent variable(s)<br>
> cfg.uvar = 2; % number or list with indices, unit variable(s)<br>
><br>
><br>
> stat = ft_sourcestatistics(cfg,sourceDiffNorm{:,1},<br>
> sourceDiffNorm{:,2});<br>
><br>
><br>
><br>
><br>
> This results in the error that it cannot find the field 'pos'; however<br>
> this field is only present in the result from ft_sourceanalysis (and<br>
> differs for each subject), but disappears as soon as<br>
> ft_sourceinterpolate is applied. I tried to put the result from<br>
> ft_sourceanalysis straight into ft_sourcestatistics (which according<br>
> to the help should be possible), but this doesn't recognize the input<br>
> as volume data (and apart from that, the subjects aren't spatially<br>
> aligned this way).<br>
><br>
><br>
> I hope someone can help me with this; any help is much appreciated!<br>
><br>
><br>
> Thanks,<br>
> Joram<br>
><br>
><br>
> --<br>
><br>
> Joram van Driel, MSc.<br>
> PhD student @ University of Amsterdam<br>
> Brain & Cognition @ Department of Psychology<br>
</div></div>> _______________________________________________<br>
> fieldtrip mailing list<br>
> <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
> <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<br>
--<br>
Nietzsche H.L. Lam, MSc<br>
PhD Candidate<br>
<br>
Max Planck Institute for Psycholinguistics<br>
Wundtlaan 1, 6525 XD Nijmegen, The Netherlands<br>
<br>
Donders Institute for Brain, Cognition and Behaviour,<br>
Centre for Cognitive Neuroimaging,<br>
Kapittelweg 29, 6525EN Nijmegen, The Netherlands<br>
<br>
<a href="mailto:n.lam@fcdonders.ru.nl" target="_blank">n.lam@fcdonders.ru.nl</a><br>
<a href="tel:%2B31-24-3668219" value="+31243668219" target="_blank">+31-24-3668219</a><br>
<br>
<br>
<a href="http://neurobiologyoflanguage.com/" target="_blank">neurobiologyoflanguage.com</a><br>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Joram van Driel, MSc.<div>PhD student @ University of Amsterdam</div><div>Brain & Cognition @ Department of Psychology</div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Joram van Driel, MSc.<div>PhD student @ University of Amsterdam</div><div>Brain & Cognition @ Department of Psychology</div></div>

</div>
_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Jan-Mathijs Schoffelen, MD PhD </div><div><br></div><div>Donders Institute for Brain, Cognition and Behaviour, <br>Centre for Cognitive Neuroimaging,<br>Radboud University Nijmegen, The Netherlands</div><div><br></div><div>Max Planck Institute for Psycholinguistics,</div><div>Nijmegen, The Netherlands</div><div><br></div><div><a href="mailto:J.Schoffelen@donders.ru.nl">J.Schoffelen@donders.ru.nl</a></div><div>Telephone: +31-24-3614793</div><div><br></div><div><a href="http://www.hettaligebrein.nl">http://www.hettaligebrein.nl</a></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></span>
</div>
<br></div></body></html>