External Email - Use Caution
Hi all,
I would like to transfer all subjects? heads into the same position.
I have calculated an average head position across subjects, created a
transformation matrix and saved it as a trans.fif file (i.e. this is what
can be given as 'destination' in Maxwell Filter):
<Transform | MEG device->head>
[[ 1. 0. 0. 0. ]
[ 0. 1. 0. -0.04299995]
[ 0. 0. 1. 0.0547426 ]
[ 0. 0. 0. 1. ]]
Could someone please let me know how this information could be given in the
code Alex sent me in the previous mail of this discussion?
Here is yet the code:
def remap_evoked(evoked, info_to, mode='fast'):
# get info that should only differ in dev_head transform
from mne import pick_types, pick_info
from mne.forward import _map_meg_channels
picks = pick_types(evoked.info, meg=True, eeg=False, ref_meg=True)
info_from = pick_info(evoked.info, picks)
info_to = pick_info(info_to, picks)
mapping = _map_meg_channels(info_from, info_to, mode=mode)
evoked.copy()
evoked.info = info_to # update info
evoked.data[picks] = np.dot(mapping, evoked.data[picks])
return evoked
Best,
Maria
ke 3. lokak. 2018 klo 7.55 Hakonen Maria (maria.hakonen at aalto.fi) kirjoitti:
External Email - Use Caution
Thanks a lot!
Best,
Maria
________________________________________
L?hett?j?: mne_analysis-bounces at nmr.mgh.harvard.edu <
mne_analysis-bounces at nmr.mgh.harvard.edu> k?ytt?j?n Alexandre Gramfort <
alexandre.gramfort at inria.fr> puolesta
L?hetetty: 30. syyskuuta 2018 21:57:18
Vastaanottaja: Discussion and support forum for the users of MNE Software
Aihe: Re: [Mne_analysis] How to transfer the subjects? heads into
the same position?
External Email - Use Caution
hi Maria,
the following code snippet is fully tested but it should do in theory
do what you want.
It maps an evoked object to a new set of sensor locations:
---
def remap_evoked(evoked, info_to, mode='fast'):
# get info that should only differ in dev_head transform
from mne import pick_types, pick_info
from mne.forward import _map_meg_channels
picks = pick_types(evoked.info, meg=True, eeg=False, ref_meg=True)
info_from = pick_info(evoked.info, picks)
info_to = pick_info(info_to, picks)
mapping = _map_meg_channels(info_from, info_to, mode=mode)
evoked.copy()
evoked.info = info_to # update info
evoked.data[picks] = np.dot(mapping, evoked.data[picks])
return evoked
---
let's see if someone has the time to make it a proper MNE function.
HTH
Alex
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20181124/9f7ecece/attachment.html