[FieldTrip] ft_sourceinterpolate

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Mon Mar 8 09:45:55 CET 2021


Dear John and Stefania,

I am not sure whether I understand what the problem is, and whether there is a problem to begin with.

I tried to simulate (part of) your use case with the below snippet of code, and to me, it seems to behave as expected.

From what I read (both on, and between the lines) in your message (not backed up by example data from your specific use case) your issue seems to be that the interpolation of the boolean inside field of the tetra mesh onto the regular volumetric (hexahedral) grid does not behave as expected. Indeed, this could be due to the fact that the interpolation from less well-structured point clouds (i.e. the tetrahedral mesh) is done using the ’nearest’ method, which is an all-or-none phenomenon when the functional values are either 0 or 1.

What happens if you'd, rather than relying on the ’inside’ definition of the mesh, explicitly define the ‘inside’ compartment in the mri volume (as I did just before the second call to ft_sourceinterpolate)? It seems that this results in a volume with functional values that do not ‘bleed into’ the outside compartment.

Best wishes,
Jan-Mathijs





% create a volumetric sphere, at '1 mm'
mri = [];
mri.dim = [75 75 75];
mri.transform = [eye(3) ones(3,1).*-38; 0 0 0 1];



[x,y,z] = ndgrid(-37:37,-37:37,-37:37);



pos     = [x(:) y(:) z(:)];
mri.brain = (x./37).^2 + (y./37).^2 + (z./37).^2 < 1;



% downsample the sphere to '3 mm'
cfg = [];
cfg.downsample = 3;
mri2 = ft_volumedownsample(cfg, mri);



% create a 'low res' tetrahedral mesh from the sphere
cfg = [];
cfg.method = 'tetrahedral';
mesh = ft_prepare_mesh(cfg, mri2);



% add some 'functional' data to the mesh, this should be approximately
% equal to reflect the distance to the origin.
mesh.pow = sqrt(mesh.pos(:,1).^2+mesh.pos(:,2).^2+mesh.pos(:,3).^2);



% what happens now if we try to interpolate?
mri.anatomy = double(mri.brain);



cfg = [];
cfg.parameter = 'pow';
mesh_int = ft_sourceinterpolate(cfg, mesh, mri);



cfg = [];
cfg.funparameter = 'pow';
ft_sourceplot(cfg, mesh_int);
% conclusion: without an explicitly defined 'inside' compartment the
% interpolated mesh also obtains values in 'voxels' that were not in the
% boolean input volume: this makes sense, because the sourcemodel (i.e. the
% tetra mesh cannot make a distinction between inside/outside, because it
% cannot be defined similarly to a 3D (or hex) grid, which is regular, and
% has a dim (to define the reshaping)



% what happens now if we try to interpolate while adding an inside to the
% mri?
mri.inside = mri.brain;



cfg = [];
cfg.parameter = 'pow';
mesh_int2 = ft_sourceinterpolate(cfg, mesh, mri);



cfg = [];
cfg.funparameter = 'pow';
ft_sourceplot(cfg, mesh_int2);



On 6 Mar 2021, at 17:45, RICHARDS, JOHN <RICHARDS at mailbox.sc.edu<mailto:RICHARDS at mailbox.sc.edu>> wrote:

I figured part of it out.

The functional data, computed from a tetra source, is not on a regular grid and so is "unstructured".  We had a dim member in the source structure which defined it in ft_sourceinterpolate as regular grid.  The anatomical 1mm data was structured hex.

However, its still not exactly correct.  The output MRI volume based on the interpout data seems to be on discrete voxels.  Perhaps it’s the "nearest" interp method which is the only interp allowed for non-grid functional?   The 3mm regular hex sources allow "spline" interp, that might be it?

John




***********************************************
John E. Richards
Carolina Distinguished Professor
Department of Psychology
University of South Carolina
Columbia, SC  29208
Dept Phone: 803 777 2079
Fax: 803 777 9558
Email: richards-john at sc.edu<mailto:richards-john at sc.edu>
https://jerlab.sc.edu
*************************************************

-----Original Message-----
From: RICHARDS, JOHN
Sent: Saturday, March 6, 2021 10:50 AM
To: fieldtrip at science.ru.nl
Cc: CONTE, STEFANIA <CONTES at mailbox.sc.edu>
Subject: ft_sourceinterpolate

We are trying to use ft_sourceinterpolate.

1--We have a tetra source model, do source analysis with eLORETA, ERP data, etc.  The source model is based on a tetrahedral mesh on gm rather than a hex mesh.

2--We have a 1mm hex mesh on gm

3--The goal is to interpolate the "sparse" tetra mesh with the functional data, onto the 1 mm hex mesh, in order to create MRI volumes with the activation.

4--The ft_sourceinterpolate(cfg,sourcewithtetrameash,hex1mmmesh) does not work.  It does not result in the same no of "inside" voxels as the 1mm hex mesh

e.g., like 25K voxels in the tetra, 855K in the 1 mm grid, but only 15K voxels in the interpout.inside(:).

Alternatively
1--using a 3 mm hex mesh, source analysis, the source model is based on a 3 mm hex mesh on gm.
2--1mm hex
3--same goal
4--ft_sourceinterpolate(cfg,sourcewith3mmhexmesh,hex1mmmesh) works.  It has 855K voxels in the interpout.inside(:).  It also correctly saves to the gm of the MRI volume.


Any ideas on this?
We have tried int32(pos) on both tetra3mm ahd hex1mm; used only overlapping  tetra3mm and hex1mm voxels; etc

John


***********************************************
John E. Richards
Carolina Distinguished Professor
Department of Psychology
University of South Carolina
Columbia, SC  29208
Dept Phone: 803 777 2079
Fax: 803 777 9558
Email: richards-john at sc.edu
https://jerlab.sc.edu
*************************************************


_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210308/cb00f01a/attachment.htm>


More information about the fieldtrip mailing list