How to obtain MNI coords using mne.vertex_to_mni (newbie) (Eric Larson)

External Email - Use Caution

Thanks, Eric!
And I understand the vertices locations are unique for each subject, and
thus we need to include the subjects paths. Is this correct? What if it was
an averaged STC (if it can be)? What shall we use as the "subject path"
arguments?

Thank you,
Ade

----------------------------------------------------------------------

Message: 1
Date: Thu, 10 May 2018 09:29:22 -0400
From: Eric Larson <larson.eric.d at gmail.com>

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

> 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>(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>(vtx, 1, 'sample')[0]
>
>
> Thanks again,
> Adela
>
>
>>
>> 1. Re: How to obtain MNI coords using mne.vertex_to_mni (newbie)
>> (Alexandre Gramfort)
>
> ----------
>> From: Alexandre Gramfort <alexandre.gramfort at inria.fr>
>> Subject: Re: [Mne_analysis] How to obtain MNI coords using
>> mne.vertex_to_mni (newbie)
>> To: Discussion and support forum for the users of MNE Software
>> <mne_analysis at nmr.mgh.harvard.edu>
>> Message-ID:
>> <CADeotZr4Z0oa7QWVitPPGRCzaKBe-ju7ngOckTUSL=N0fOqxhw at mail.gm
>> ail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> External Email - Use Caution
>>
>> hi,
>>
>> what do you mean your MEG data?
>>
>> vertices here are SourceEstimate (aka stc) vertices.
>>
>>
>> HTH
>> Alex
>>
>>
>>
>> > External Email - Use Caution
>> >
>> > Hi,
>> >
>> > In order to obtain the MNI coordinates of my MEG data, I have to use
>> mne.vertex_to_mni.
>> > Could someone give me an example of its usage?
>> >
>> > As for the first argument, how to obtain the vertex numbers of my
data?
>> > I'm new in Python. Then, second argument, I can't find what code is
>> right
>> > or left hemisphere. Is there a way to get in one output both
hemispheres
>> > (=the whole brain)?
>> >
>> > Thank you,
>> > Adela
>> >
>> > This is the help of the function:
>> >
>> > mne.vertex_to_mni(*vertices*, *hemis*, *subject*, *subjects_dir=None*,
>> > *mode=None*, *verbose=None*)
>> > [source]
>> > <http://github.com/mne-tools/mne-python/blob/master/doc/<s
>> tring%3E#L1129-L1187>
>> > <https://martinos.org/mne/dev/generated/mne.vertex_to_mni.ht
>> ml#mne.vertex_to_mni>
>> >
>> > Convert the array of vertices for a hemisphere to MNI coordinates.
>> > Parameters: *vertices* : int, or list of int
>> >
>> > Vertex number(s) to convert
>> > *hemis* : int, or list of int
>> >
>> > Hemisphere(s) the vertices belong to
>> > *subject* : string
>> >
>> > Name of the subject to load surfaces from.
>> > *subjects_dir* : string, or None
>> >
>> > Path to SUBJECTS_DIR if it is not set in the environment.
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180529/705014fe/attachment-0001.html

External Email - Use Caution

And I understand the vertices locations are unique for each subject, and
thus we need to include the subjects paths. Is this correct?

Yes each subject's vertices can be in different locations, so you have to
morph from one to another to make them comparable.

What if it was an averaged STC (if it can be)?

If you want to average STCs, you need to morph them all to the same subject
with stc.morph or stc.morph_precomputed.

What shall we use as the "subject path" arguments?

This should correspond to whatever `subject` structural you used to
construct your source space, head<->MRI trans, BEM, etc.

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180529/fdc6762b/attachment.html