[Mne_analysis] MRI coordinate to closest volume source point

Eric Larson larson.eric.d at gmail.com
Wed Jan 8 10:18:38 EST 2020
Search archives:

        External Email - Use Caution        

This documentation might help:

https://mne.tools/dev/overview/implementation.html#the-forward-solution

MNE uses "Freesurfer surface RAS" coordinates for the source space, so make
sure your points are in that coordinate frame in meters. So if they x/y/z
you gave were in surface RAS mm, divide by 1000. If they were voxel
numbers, you could use img.header.vox2ras_tkr after loading your img with
nibabel.load, then divide by 1000 (since Nibabel uses mm units).

Once your points are in meters in Freesurfer surface RAS coordinate system,
you can just brute force the nearest calculation using some suitable
nearest-point algorithm (scipy's KDTree, sklearn's BallTree, or just
scipy.spatial.distance.cdist plus argmin) to the `src[0]['rr']` points.

Eric


On Wed, Jan 8, 2020 at 9:32 AM Marijn van Vliet <marijn.vanvliet at aalto.fi>
wrote:

>         External Email - Use Caution
>
> Hello MNE community,
>
> I've made a volume source space for the MNE-Somato dataset like so:
>
>
> import mne
> import mne_bids
>
> bids_root = mne.datasets.somato.data_path()
> subjects_dir = f'{bids_root}/derivatives/freesurfer/subjects'
> trans =
> mne_bids.get_head_mri_trans(f'{bids_root}/sub-01/meg/sub-01_task-somato_meg.fif',
>
> bids_root)
> bem = mne.make_bem_model('01', ico=4, subjects_dir=subjects_dir)
> bem_sol = mne.make_bem_solution(bem)
> src = mne.setup_volume_source_space(subject='01', bem=bem_sol,
> subjects_dir=subjects_dir)
>
>
> How would I translate an MRI coordinate, lets say (x=33, y=8, z=57) to the
> nearest source point (="vertex") in the source space? Could someone
> explain a
> bit about the coordinate systems and transforms in play?
>
> best,
> Marijn.
>
> --
> Marijn van Vliet
> Postdoctoral Researcher
> Department of Neuroscience and Biomedical Engineering
> Aalto University, Finland
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20200108/7c32fb4f/attachment.html 


More information about the Mne_analysis mailing list