# MNI to vertex?

**URL:** <https://mne.discourse.group/t/mni-to-vertex/686>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [March 9, 2014, 2:49am UTC](https://mne.discourse.group/t/mni-to-vertex/686 "2014-03-09T02:49:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 9, 2014, 2:49am UTC](https://mne.discourse.group/t/mni-to-vertex/686/1 "2014-03-09T02:49:36Z")

</div>

What's the best way to get the vertex number nearest to a set of MNI  
coordinates in a volume source space? The functions for volume source  
spaces (e.g, tf\_lcmv) expect labels but I'm not sure how to construct a  
label for a region outside of the cortical sheet, other than simply filling  
in the vertex numbers.

Thanks

Jon  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20140308/cccedf33/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20140308/cccedf33/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 9, 2014, 7:52am UTC](https://mne.discourse.group/t/mni-to-vertex/686/2 "2014-03-09T07:52:20Z")

</div>

hi Jon,

there is no support for labels/ROIs for volume source spaces.  
I would use freeview and freesurfer tools to explore volume estimates.  
Did you consider using a surface source space with LCMV?

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 9, 2014, 4:00pm UTC](https://mne.discourse.group/t/mni-to-vertex/686/3 "2014-03-09T16:00:04Z")

</div>

Hi Alex,

I did, but I'm looking at sources not contained in the surface source space  
(i.e., cerebellum). All I really want to do is extract the raw source  
timecourse for a given set of MNI coordinates, for use in time frequency  
analysis, coherence, etc. I suppose it would be possible to go through the  
file with lcmv\_raw and drop the vertices of no interest (?99%) from each  
time sample prior to saving, but that would be kind of a kludge.

For now it's just a handful of subjects, I can always do it in Graph with  
an SSP as my spatial filter.

Thanks

Jon

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 9, 2014, 8:33pm UTC](https://mne.discourse.group/t/mni-to-vertex/686/4 "2014-03-09T20:33:48Z")

</div>

hi jon,

> I did, but I'm looking at sources not contained in the surface source space  
> (i.e., cerebellum). All I really want to do is extract the raw source  
> timecourse for a given set of MNI coordinates, for use in time frequency  
> analysis, coherence, etc. I suppose it would be possible to go through the  
> file with lcmv\_raw and drop the vertices of no interest (?99%) from each  
> time sample prior to saving, but that would be kind of a kludge.

how did you generate the source space with the cerebellum?

I am afraid there is no simple solution to your problem. You'll need to  
hack something and ideally share your progress so it can benefit to  
others. The clean solution would be to write a grow\_label function  
that would work with a volume source space ... there is a bit of work...

> For now it's just a handful of subjects, I can always do it in Graph with an  
> SSP as my spatial filter.

not as nice but if it works...

A

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [March 10, 2014, 6:20pm UTC](https://mne.discourse.group/t/mni-to-vertex/686/5 "2014-03-10T18:20:56Z")

</div>

I'd use a kd-tree for this. If you have a list of vertices in b:

import numpy as np  
from scipy.spatial import KDTree

b = np.zeros((nv, 3))  
&nbsp;&nbsp;... fill in b ...  
k = KDTree(b)

Now, e.g., k.query\_ball\_point(b[j,:], 2.) will return a list of indices  
for vertices within 2. units. You can query any (x,y,z) point and get  
a list of nearby vertices.

Jon Houck wrote:
