<p><span style="padding: 3px 10px; border-radius: 5px; color: #ffffff; font-weight: bold; display: inline-block; background-color: #ff0000;"> External Email - Use Caution </span></p><p></p><div dir="ltr">Thanks, Alex.<div><br></div><div>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?</div><div><br></div><div><pre style="box-sizing:border-box;overflow:auto;font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:14px;display:block;padding:10px;margin:0px 0px 10.5px;line-height:1.42857;word-break:break-all;word-wrap:break-word;color:rgb(123,138,139);border:1px solid rgb(204,204,204);border-radius:4px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial;background-color:rgb(242,249,255)"><span class="gmail-c1" style="box-sizing:border-box;color:rgb(64,128,144);font-style:italic"># calculate center of mass and transform to mni coordinates</span>
<span class="gmail-n" style="box-sizing:border-box">vtx</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-n" style="box-sizing:border-box">_</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-n" style="box-sizing:border-box">t_lh</span> <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-n" style="box-sizing:border-box">stc_lh</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">center_of_mass</span><span class="gmail-p" style="box-sizing:border-box">(</span><span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'sample'</span><span class="gmail-p" style="box-sizing:border-box">)</span>
<span class="gmail-n" style="box-sizing:border-box">mni_lh</span> <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <a href="https://martinos.org/mne/stable/generated/mne.vertex_to_mni.html#mne.vertex_to_mni" title="View documentation for mne.vertex_to_mni" style="box-sizing:border-box;background-color:transparent;color:rgb(41,122,204);text-decoration:none"><span class="gmail-n" style="box-sizing:border-box">mne</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">vertex_to_mni</span></a><span class="gmail-p" style="box-sizing:border-box">(</span><span class="gmail-n" style="box-sizing:border-box">vtx</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-mi" style="box-sizing:border-box;color:rgb(32,128,80)">0</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'sample'</span><span class="gmail-p" style="box-sizing:border-box">)[</span><span class="gmail-mi" style="box-sizing:border-box;color:rgb(32,128,80)">0</span><span class="gmail-p" style="box-sizing:border-box">]</span>
<span class="gmail-n" style="box-sizing:border-box">vtx</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-n" style="box-sizing:border-box">_</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-n" style="box-sizing:border-box">t_rh</span> <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <span class="gmail-n" style="box-sizing:border-box">stc_rh</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">center_of_mass</span><span class="gmail-p" style="box-sizing:border-box">(</span><span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'sample'</span><span class="gmail-p" style="box-sizing:border-box">)</span>
<span class="gmail-n" style="box-sizing:border-box">mni_rh</span> <span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">=</span> <a href="https://martinos.org/mne/stable/generated/mne.vertex_to_mni.html#mne.vertex_to_mni" title="View documentation for mne.vertex_to_mni" style="box-sizing:border-box;background-color:transparent;color:rgb(41,122,204);text-decoration:none"><span class="gmail-n" style="box-sizing:border-box">mne</span><span class="gmail-o" style="box-sizing:border-box;color:rgb(102,102,102)">.</span><span class="gmail-n" style="box-sizing:border-box">vertex_to_mni</span></a><span class="gmail-p" style="box-sizing:border-box">(</span><span class="gmail-n" style="box-sizing:border-box">vtx</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-mi" style="box-sizing:border-box;color:rgb(32,128,80)">1</span><span class="gmail-p" style="box-sizing:border-box">,</span> <span class="gmail-s1" style="box-sizing:border-box;color:rgb(64,112,160)">'sample'</span><span class="gmail-p" style="box-sizing:border-box">)[</span><span class="gmail-mi" style="box-sizing:border-box;color:rgb(32,128,80)">0</span><span class="gmail-p" style="box-sizing:border-box">]</span></pre><br><div class="gmail_extra">Thanks again, </div><div class="gmail_extra">Adela</div><div class="gmail_extra"><br><div class="gmail_quote">On 10 May 2018 at 08:37, <span dir="ltr"><<a href="mailto:mne_analysis-request@nmr.mgh.harvard.edu" target="_blank">mne_analysis-request@nmr.mgh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
1. Re: How to obtain MNI coords using mne.vertex_to_mni (newbie)<br>
(Alexandre Gramfort) </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> ---------- <br>
From: Alexandre Gramfort <<a href="mailto:alexandre.gramfort@inria.fr">alexandre.gramfort@inria.fr</a>><br>
Subject: Re: [Mne_analysis] How to obtain MNI coords using<br>
mne.vertex_to_mni (newbie)<br>
To: Discussion and support forum for the users of MNE Software<br>
<<a href="mailto:mne_analysis@nmr.mgh.harvard.edu">mne_analysis@nmr.mgh.harvard.<wbr>edu</a>><br>
Message-ID:<br>
<<wbr>CADeotZr4Z0oa7QWVitPPGRCzaKBe-<wbr>ju7ngOckTUSL=<a href="mailto:N0fOqxhw@mail.gmail.com">N0fOqxhw@mail.<wbr>gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
External Email - Use Caution <br>
<br>
hi,<br>
<br>
what do you mean your MEG data?<br>
<br>
vertices here are SourceEstimate (aka stc) vertices.<br>
<br>
<br>
HTH<br>
Alex<br>
<br>
<br>
On Thu, May 10, 2018 at 2:14 AM, Adela Glez. <<a href="mailto:adelaglezcom@gmail.com">adelaglezcom@gmail.com</a>> wrote:<br>
<br>
> External Email - Use Caution<br>
><br>
> Hi,<br>
><br>
> In order to obtain the MNI coordinates of my MEG data, I have to use mne.vertex_to_mni.<br>
> Could someone give me an example of its usage?<br>
><br>
> As for the first argument, how to obtain the vertex numbers of my data?<br>
> I'm new in Python. Then, second argument, I can't find what code is right<br>
> or left hemisphere. Is there a way to get in one output both hemispheres<br>
> (=the whole brain)?<br>
><br>
> Thank you,<br>
> Adela<br>
><br>
> This is the help of the function:<br>
><br>
> mne.vertex_to_mni(*vertices*, *hemis*, *subject*, *subjects_dir=None*,<br>
> *mode=None*, *verbose=None*)<br>
> [source]<br>
> <<a href="http://github.com/mne-tools/mne-python/blob/master/doc/%3Cstring%3E#L1129-L1187" rel="noreferrer" target="_blank">http://github.com/mne-tools/<wbr>mne-python/blob/master/doc/%<wbr>3Cstring%3E#L1129-L1187</a>><br>
> <<a href="https://martinos.org/mne/dev/generated/mne.vertex_to_mni.html#mne.vertex_to_mni" rel="noreferrer" target="_blank">https://martinos.org/mne/dev/<wbr>generated/mne.vertex_to_mni.<wbr>html#mne.vertex_to_mni</a>><br>
><br>
> Convert the array of vertices for a hemisphere to MNI coordinates.<br>
> Parameters: *vertices* : int, or list of int<br>
><br>
> Vertex number(s) to convert<br>
> *hemis* : int, or list of int<br>
><br>
> Hemisphere(s) the vertices belong to<br>
> *subject* : string<br>
><br>
> Name of the subject to load surfaces from.<br>
> *subjects_dir* : string, or None<br>
><br>
> Path to SUBJECTS_DIR if it is not set in the environment.<br><br></blockquote></div></div></div></div>