[FieldTrip] reverse source interpolate?

Vitoria Piai v.piai.research at gmail.com
Tue Mar 11 16:04:51 CET 2014


Dear FT-ers,

I found an old posting to the mailing list (see below) that never got 
answered so my question still holds: given a location I found in the 
interpolated source, how do I find back the same location in .pos of the 
non-interpolated data?
I can try and go around it by finding the corresponding MNI coordinates 
in the interpolated data (which by now I have to do by hand, so not 
optimal anyways), and then look for those coordinates in .pos. But I was 
wondering, like Cornelius was in his post, whether there is a neater way 
to get this information.

Thanks a lot for the help,
Vitória


     >>>>>>>>>>>>>>

    Hi mailing list,

    I'm still struggling with the conversion of coordinates between
    source and
    interpolated source space.
    For example, if i have the position of a single grid point how do i
    get the
    corresponding voxel  in the interpolated source structure. Or the
    other way
    around, how to get the grid point which corresponds to a voxel (e.g
    the max
    voxel) in the interpolated source structure.

    I think this should be a common problem when working with virtual
    electrodes, shouldn't it?

    To make things easier i put together a example with the data from the
    source tutorial where i tried to calculated the grid pos of the max
    voxel
    in the interpolated source.

    clear all;
    load sourcePost_nocon;               % source structure from tutorial
    mri = ft_read_mri('Subject01.mri');  % mri of subject01 from tutorial

    sourceNAI = sourcePost_nocon;
    sourceNAI.avg.pow = sourcePost_nocon.avg.pow ./
    sourcePost_nocon.avg.noise;
    sourceNAI=rmfield(sourceNAI,'freq'); % had to remove that to let

    cfg = [];
    cfg.downsample = 2;
    cfg.parameter = 'avg.pow';
    sourceNAIInt = ft_sourceinterpolate(cfg, sourceNAI , mri);

    % Find position of max activity
    [dum, maxindx] = max(sourceNAIInt.avg.pow(:));
    [xi, yi, zi] = ind2sub(sourceNAIInt.dim, maxindx);
    posInt=[xi, yi, zi];

    % Plot interpolated source with position of max activity
    cfg              = [];
    cfg.method       = 'ortho';
    cfg.funparameter = 'avg.pow';
    cfg.locationcoordinates = 'voxel';
    cfg.location      = posInt;          % location of max activity is
    marked
    correctly.
    figure;
    ft_sourceplot(cfg,sourceNAIInt);

    % Transform coordinate back to uninterpolated source???
    dpos = warp_apply(inv(mri.transform), posInt, 'homogeneous');


    % Plot uninterpolated source with position aquired from interpolated
    source
    cfg              = [];
    cfg.method       = 'ortho';
    cfg.funparameter = 'avg.pow';
    cfg.locationcoordinates = 'voxel';
    cfg.location      = dpos;               % unfortunately this
    coordinate is
    obviously wrong!!! WHY?
    figure;
    ft_sourceplot(cfg,sourceNAI);


    Unfortunately the solution of Jan Mathijs did not work, nor did mine :(

    Any ideas???

    Cornelius





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140311/a0a530a4/attachment-0001.html>


More information about the fieldtrip mailing list