<div>Hi jan mathijs, hello mailing list,</div><div><br></div><div>thanks for your answer. I think i got your idea with finding the minimum in this squared differences. This should the work with positions of any scaling, right?</div>
<div>However it gives me strange results when trying to get voxel indices in the "raw" source using voxel indices  aquired from interpolated source.</div><div>But even using the ctf coordinates in mm doesn't work.</div>
<div><br></div><div>Here is a short script showing what i did, i also attached the necessary mat files.</div><div><br></div><div>greetings, Cornelius</div><div><br></div><div><br></div><div><div>clear all;</div><div>load testdata.mat;</div>
<div><br></div><div>% Interpolate source on anatomy</div><div>cfg = [];</div><div>cfg.parameter = 'avg.itc';</div><div>cfg.interpmethod  =  'linear';</div><div>sourceInt = ft_sourceinterpolate(cfg, source,mri);</div>
<div><br></div><div>% Find position of max voxel in interpolated source</div><div>[maxval, maxindx] = max(sourceInt.avg.itc(:));</div><div>[x,y,z]=ind2sub(size(sourceInt.avg.itc),maxindx);</div><div>pos=[x y z];</div><div>
<br></div><div>% plot this position in interpolated source </div><div>figure;</div><div>cfg = [];</div><div>cfg.method        = 'ortho';</div><div>cfg.funparameter  = 'avg.itc';</div><div>cfg.locationcoordinates = 'voxel';</div>
<div>cfg.location      = pos;</div><div>ft_sourceplot(cfg, sourceInt); </div><div><br></div><div>% Calculate respective position in 'raw' source struct</div><div>dpos = source.pos - repmat(pos, size(source.pos,1),1);</div>
<div>[m,ind] = min(sum(dpos.^2,2));</div><div>spos=source.pos(ind,:);</div><div><br></div><div>% Plot position in 'raw' source.</div><div>% This gives not the position of max activity!!!</div><div>figure;</div><div>
cfg = [];</div><div>cfg.method        = 'ortho';</div><div>cfg.funparameter  = 'avg.itc';</div><div>cfg.locationcoordinates = 'voxel';</div><div>cfg.location      = spos;</div><div>ft_sourceplot(cfg, source); </div>
</div><div><br></div><br><br><div class="gmail_quote">2012/6/27 jan-mathijs schoffelen <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Hi Cornelius,<div><br></div><div>There is no need to 'uninterpolate' because the coordinates are already expressed in the correct coordinate system. What you probably want is to find the index to the voxel in the original source-structure closest to your 'hotspot' in the interpolated image.</div>
<div>This can be achieved by something like this:</div><div><br></div><div>write down the coordinates of your favourite position in the interpolated image (in world coordinates, here I assume that you are still in MEG coordinate system and have not normalized to MNI space), call this pos</div>
<div><br></div><div>pos = pos./10 (from mm to cm)</div><div><br></div><div>dpos = source.pos - repmat(pos, size(source.pos,1),1);</div><div>[m,ind] = min(sum(dpos.^2,2));</div><div><br></div><div>source is the original source structure.</div>
<div>ind is the index you are looking for.</div><div><br></div><div>If you have interpolate to the MNI-template grid you need to replace the source.pos with the set of grid positions from your template grid (i.e. expressed in MNI coordinates).</div>
<div><br></div><div><br></div><div>Cheers,</div><div><br></div><div>JM</div><div><br></div><div><br><div><div><div class="h5"><div>On Jun 27, 2012, at 5:26 PM, cornelius abel wrote:</div><br></div></div><blockquote type="cite">
<div><div><div class="h5">Hello,<br><br>does anybody know how to get the uninterpolated source position giving the coordinates aquired after interpolation with an anatomy.<br>In principle i want to get an individual source time course at the position i picked from the interpolated grand average source plot. Therfore i need the corresponding filter and its position in the source structure.<br>
<br>I tried to get the position by applying the inverse transformation matrix of the used anatomy like:<br>pos_before_interpolation=warp_apply(inv(anatomy.transform), position_after_interpolation);<br><br>but that did not give usefull results :(<br>
<br>Any ideas how it could be done?<br><br>Greetings, Cornelius<br><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></div></blockquote></div><br><div>
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<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" target="_blank">J.Schoffelen@donders.ru.nl</a></div><div>Telephone: <a href="tel:%2B31-24-3614793" value="+31243614793" target="_blank">+31-24-3614793</a></div>
</div></span></div></span></div></span></div></span></div></span></span>
</div>
<br></div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">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>