[FieldTrip] reverse source interpolate?

Vitoria Piai v.piai.research at gmail.com
Wed Mar 12 17:50:00 CET 2014


Dear Erick,

"simply label and/or define my ROI in the MNI grid. When I warp to the 
individuals, everything is in place without a hitch" -> that sounds like 
a good thing to do.
Is this a very complicated thing to do? Would you mind sharing a piece 
of code or some tips for how I could achieve it?

Thanks once more, Vitória

On 3/12/2014 11:37 AM, Erick Ortiz wrote:
> Dear Vitoria,
>
> What I do usually, is to simply label and/or define my ROI in the MNI 
> grid. When I warp to the individuals, everything is in place without a 
> hitch.
>
> About the interpolation, I cannot help much more. I have been using my 
> own tools for years, and I was not following the support of atlases in 
> Fieldtrip.I tried it today, but had issues with coordinate system 
> labeling when defining a ROI (I updated to the latest version by SVN):
>
> afni = ft_read_atlas('template/atlas/afni/TTatlas+tlrc.HEAD');
> cfg              = [];
> cfg.method       = 'ortho';
> cfg.interactive  = 'yes';
> cfg.funparameter = 'coh';
> cfg.atlas        = afni;
> cfg.coordsys     = 'mni';
> % cfg.roi          = 'Middle Temporal Gyrus';
> % cfg.inputcoord   = 'tal';
> ft_sourceplot(cfg, interp);
>
> Also note that I had to use ft_read_atlas, because ft_prepare_atlas 
> does not generate the brick0label/brick1label fields.
>
> It works well, but if I try to define a ROI (uncommenting the two 
> lines), I get the error "The field cfg.inputcoord is required". There 
> seems to be some confusion between inputcoord and coordsys.
>
> It can be because I was doing something wrong: maybe a Fieldtrip 
> developer could comment on that?
>
> Best,
> Erick
>
>
>
> On Wed, Mar 12, 2014 at 9:24 AM, Vitoria Piai 
> <v.piai.research at gmail.com <mailto:v.piai.research at gmail.com>> wrote:
>
>     Dear Erick,
>
>     Thanks for your detailed reply.
>     I've been using individual MNI-warped grids (point 4 below) and
>     I'm always using ft_convert_unit so those points are alright in my
>     data.
>
>     The reason why I do need to interpolate (at least, I think I
>     need), is because I'm looking for max 'pow' in anatomically
>     defined regions given the afni atlas. I managed to get it to work
>     by interpolating to the mri and looking for max 'pow' given a
>     label (e.g., 'Middle Temporal Gyrus') using ft_volumelookup.
>     Do you have any experience with this approach (searching within
>     anatomical labels) without having to interpolate?
>
>     Thanks once more, Vitória
>
>
>
>
>     On 3/11/2014 6:35 PM, Erick Ortiz wrote:
>>     Dear Vitória and Cornelius,
>>
>>     this is a common problem, and maybe it would be good to clarify
>>     the strategies that can be used here. I hope this can help others
>>     in a similar situation, which I have found many times.
>>
>>     1) You are trying to convert voxel indexes to head (CTF)
>>     coordinates. In this case, there are two mistakes in the code:
>>     1a) pos = warp_apply( pinv( sourceNAIInt.transform ), posInt,
>>     'homogeneous' );
>>     ... should be done with sourceNAIInt, not mri. The transforms are
>>     different, in general; e.g. note the downsample=2.
>>     1b) use cfg.locationcoordinates = 'head', as commented by JM in a
>>     previous post. Or remove this line, since 'head' is the default.
>>
>>     2) But if you are working with the same subject/grid, there is no
>>     need for interpolation at all. Simply find the grid position with
>>     highest 'pow' and take its position.
>>         [dummy,ind] = max(source.avg.pow);
>>         pos = source.pos(ind,:);
>>
>>     3) However, this is not possible when using different grids, e.g.
>>     in a grand average in MNI coordinates. Find the peak ('pos') in
>>     the interpolated volume, as in Cornelius' code, then find the
>>     index of the nearest grid position for a common (again, MNI)
>>     grid. This is also in JM's message.
>>
>>     dpos = source.pos - repmat( pos, size(source.pos,1), 1 );
>>     [dummy,ind] = min(sum(dpos.^2,2));
>>
>>     4) What I have been using, and strongly recommend, is an MNI grid
>>     warped to the subject's anatomy, according to this procedure:
>>     http://fieldtrip.fcdonders.nl/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space
>>
>>     This would give you both the benefits of working in MNI
>>     coordinates, and the ease of having a common grid across subjects
>>     (for instance, enabling solution #2). Still, some projects do
>>     call for one of the other options.
>>
>>     Just a couple of details:
>>     - Pay utmost attention to coordinate systems and units. For
>>     instance, it is common to confuse unlabeled cm for mm, and either
>>     of these with voxels. Try to also label all structures as CTF or
>>     SPM (MNI).
>>     - Using pinv instead of inv is usually a good idea. Here, it is a
>>     not an issue, but matrix inversion in MATLAB can lead to a world
>>     of hurt to the unwary.
>>
>>     Best,
>>     Erick
>>
>>
>>
>>     On Tue, Mar 11, 2014 at 4:04 PM, Vitoria Piai
>>     <v.piai.research at gmail.com <mailto:v.piai.research at gmail.com>> wrote:
>>
>>         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
>>
>>
>>
>>
>>
>>
>>         _______________________________________________
>>         fieldtrip mailing list
>>         fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl>
>>         http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>>
>>
>>     _______________________________________________
>>     fieldtrip mailing list
>>     fieldtrip at donders.ru.nl  <mailto:fieldtrip at donders.ru.nl>
>>     http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>     _______________________________________________
>     fieldtrip mailing list
>     fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl>
>     http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
>
> _______________________________________________
> 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/20140312/c18a913d/attachment-0002.html>


More information about the fieldtrip mailing list