# [FieldTrip] Extracting virtual EEG channel from a atlas based ROI

Julian Keil julian.keil at gmail.com
Tue Aug 16 13:44:13 CEST 2016

```Hi Gabriel,

have you tried using a grid with the exact same dimensions as the MRI, i.e.:

%% Set the start and End of the x,y,z axis
vox1 = mri.transform*[mri.dim,1]'; % start
vox1 = vox1(1:3)/10; % convert to mm
vox2 = mri.transform*[1,1,1,1]';   %end
vox2 = vox2(1:3)/10; % convert to mm

%% Choose the Minima
vox_min = min([vox1,vox2]')';
vox_max = max([vox1,vox2]')';

%% Set the spacing
vox_delta = abs(mri.transform*[1,1,1,1]'-mri.transform*[2,2,2,1]');
vox_delta = vox_delta(1:3)/10; % convert to mm
RES = vox_delta(1);

and then use:

cfg.grid.xgrid = vox_min(1):RES:vox_max(1);
cfg.grid.ygrid = vox_min(2):RES:vox_max(2);
cfg.grid.zgrid = vox_min(3):RES:vox_max(3);

Good luck,

Julian

Am 15.08.2016 um 17:46 schrieb gab dippel:

> Dear Fieldtrippers,
>
> my current question(s) has previously been answered here by Julian Keil: https://mailman.science.ru.nl/pipermail/fieldtrip/2015-December/009882.html yet I appear to face a conceptual problems in my understanding.
>
> So the goal is to compute the virtual channels of a certain atlas region let say the SMA.
> As we do not have individual MRI, I thought it should be possible to make use of the MNI template MRI the 'standard_mri.mat' as included in fieldtrip.
>
> Now according to Julian's answer from the above link the steps to go about the virtual channels reconstruction is:
> 1. Compute the virtual channels for all grid points in the cortex (regular grid /sourcemodel)
> --> So here I construct an MRI based grid
>
> cfg = [];
> cfg.mri = mri;
> template_grid  = ft_prepare_sourcemodel(cfg);
>
> this yields a grid with dimensions of 19x22x18 and 4093 gridpoints within the brain.
>
> 2. If you have computed the virtual channels on an  individual MRI, make sure  that the position corresponds  to the standard MRI (I think that's described in the source analysis -tutorial)
> --> this is obsolete in my case i guess
>
> 3. Build a high resolution 3D-Grid on the standard MRI (It's important to use one grid point per voxel)
> --> I am not sure how. the following gives me an Error 'incorrect cfg specification for constructing a dipole grid':
> cfg = [];
> cfg.grid.xgrid  = -90:1:90;
> cfg.grid.ygrid  = -108:1:108;
> cfg.grid.zgrid  = -90:1:90;
> cfg.grid.unit   = 'mm';
> cfg.grid.tight  = 'yes';
> cfg.mri = mri;
> high_res_grid_mm  = ft_prepare_sourcemodel(cfg)
>
>
> 4. Select all grid points from the grid of step 3 which belongs to an atlas (ft_volumelookup)
> --> Now atlas has a dimension of 91x109x91 but the standard mri of 181x217x181. Here, I am wondering how to align the two to use logical indexing for finding the ROI voxels.
>
> 5. Use pythagoras to find the virtual channels from step 2 closest to the grid points from step 4.
> --> This is clear if the grid from step 1 and 3 are of the same dimension which is however not the case here.
>
> I would appreciate any feedback and ideas on this issue.
>
> Kind regards,
>
> Gabriel
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160816/06dbce95/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160816/06dbce95/attachment-0002.sig>
```