# How to obtain MNI coords using mne.vertex\_to\_mni	(newbie)

**URL:** <https://mne.discourse.group/t/how-to-obtain-mni-coords-using-mne-vertex-to-mni-newbie/1516>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [May 10, 2018, 8:05am UTC](https://mne.discourse.group/t/how-to-obtain-mni-coords-using-mne-vertex-to-mni-newbie/1516 "2018-05-10T08:05:15Z")\
**Posts on this page:** 2\
**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:** [May 10, 2018, 8:05am UTC](https://mne.discourse.group/t/how-to-obtain-mni-coords-using-mne-vertex-to-mni-newbie/1516/1 "2018-05-10T08:05:15Z")

</div>

External Email - Use Caution

Thanks, Alex.

Since I don't know how to write python code (I work with Matlab), I want to  
do my statistical analysis in Matlab. But first I need to have the data in  
MNI coordinates. I need a piece of Python code that gives me the MNI  
coordinates for the source locations for each subject. The only code I  
could find is this, which calculates MNI coordinates of center of mass. How  
to modify this to give me instead the stc locations?

# calculate center of mass and transform to mni coordinatesvtx, \_,  
t\_lh = stc\_lh.center\_of\_mass('sample')mni\_lh = mne.vertex\_to\_mni  
\<[https://martinos.org/mne/stable/generated/mne.vertex\_to\_mni.html#mne.vertex\_to\_mni](https://martinos.org/mne/stable/generated/mne.vertex_to_mni.html#mne.vertex_to_mni)\>(vtx,  
0, 'sample')[0]vtx, \_, t\_rh = stc\_rh.center\_of\_mass('sample')mni\_rh =  
mne.vertex\_to\_mni  
\<[https://martinos.org/mne/stable/generated/mne.vertex\_to\_mni.html#mne.vertex\_to\_mni](https://martinos.org/mne/stable/generated/mne.vertex_to_mni.html#mne.vertex_to_mni)\>(vtx,  
1, 'sample')[0]

Thanks again,  
Adela

---

<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:** [May 10, 2018, 1:29pm UTC](https://mne.discourse.group/t/how-to-obtain-mni-coords-using-mne-vertex-to-mni-newbie/1516/2 "2018-05-10T13:29:22Z")

</div>

External Email - Use Caution

If you already have a STC, doing:

left\_mni = mne.vertex\_to\_mni(stc.vertices[0], 0)  
right\_mni = mne.vertex\_to\_mni(stc.vertices[1], 1)

?  
might do it.

Eric
