[FieldTrip] Defining cfg.neighbourdist at source level

Robert Oostenveld r.oostenveld at donders.ru.nl
Tue Feb 7 11:34:20 CET 2012


Dear Ulrich

On 1 Feb 2012, at 13:44, Pomper, Ulrich wrote:

> Dear Robert and Stephan,
> Thank you for your replies. 
> I guess I use what Robert called the 'regular' 3D grid, but I'm not quite sure.
...
> ldf = 
> 
>         xgrid: [-65 -58 -51 -44 -37 -30 -23 -16 -9 -2 5 12 19 26 33 40 47 54 61 68]
>         ygrid: [-107 -100 -93 -86 -79 -72 -65 -58 -51 -44 -37 -30 -23 -16 -9 -2 5 12 19 26 33 40 47 54 61 68 75]
>         zgrid: [-52 -45 -38 -31 -24 -17 -10 -3 4 11 18 25 32 39 46 53 60 67 74 81]
>           dim: [20 27 20]
>           pos: [10800x3 double]
...
> 
> In any case, I still don't quite understand how to calculate the neighbours to each voxel.

Yes, you are using a regular 3D grid with dipole positions that are placed at the center of a large number of voxels which jointly fill a cube that spans the head. Just like an MRI.

If you look in ldf.pos you will see all positions. Those positions form a 20x27x20 regular grid, with the x-, y, and z-values according to xgrid/ygrid/zgrid. You have a grid spacing of 7mm in each direction.

The first positions is [-65 -107 -52] and its neighbours are the grid points that are 7mm to the right, top and front. Just think of it as
functional_data = rand(20, 27, 20)
i.e. a cube. It is clear for each voxel what the neighbours are.

FieldTrip makes use of vectorization, i.e. the 3d matrix with the functional data can also be represented by MATLAB as a vector.
functional_data = functional_data(:)
What you then get is a vector of length 10800, i.e. matching all the [x y z] positions as they are specified in ldf.pos.

>  By saying that the "neighbours are trivial to find and you do not have to specify a structure", do you mean that I don't need to define the cfg.neighbours property at all (given that I do use a regular 3D grid)?

correct.

Robert














 



More information about the fieldtrip mailing list