[Mne_analysis] Selecting nearest neighbors of a vertex in source space

Sheraz Khan, PhD sheraz at nmr.mgh.harvard.edu
Thu Sep 20 18:50:07 EDT 2018
Search archives:

Hi Laetitia,

Please see the code below, neighbours_list contains the list of the
neighbours of each vertex.


import mne
from mne.source_estimate import spatial_tris_connectivity
import numpy as np

surf = mne.surface._get_ico_surface(5)
connectivity = spatial_tris_connectivity(surf['tris'])
connectivity = connectivity.todense()
neighbours_list = [np.where(row==1)[1] for row in connectivity]
#neighbours_list contains the list of the neighbours of each vertex

Thanks

Sheraz


>         External Email - Use Caution
>
> Dear MNE users,
>
> I would like to implement a searchlight-based generalized linear model on
> source space data. To do so, I need to select the nearest neighbors of
> each
> vertex but I'm unsure of how to do that in practice.
> I have source estimates morphed to the fsaverage brain using ico5 spacing
> (10241 vertices per hemisphere) as well as the connectivity matrices and
> source spaces. I search in the methods of each of these classes, but did
> not find anything that could help me. How can I determine which are the x
> nearest neighbors of the nth vertex?
>
> Thank you for your help,
> Cheers,
> Laetitia
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis


-------------------------
Sheraz Khan, M.Eng, Ph.D.
Instructor in Radiology

Athinoula A. Martinos Center for Biomedical Imaging
Massachusetts General Hospital
Harvard Medical School

McGovern Institute for Brain Research
Massachusetts Institute of Technology

Tel:   +1 617-643-5634
Fax:   +1 617-948-5966
Email: sheraz at nmr.mgh.harvard.edu
       sheraz at mit.edu
Web:   http://sheraz.mit.edu


More information about the Mne_analysis mailing list