# Source localization with MNE (combining sensor location and sMRI)

**URL:** <https://mne.discourse.group/t/source-localization-with-mne-combining-sensor-location-and-smri/3089>\
**Category:** Support & Discussions\
**Created:** [May 4, 2021, 7:00pm UTC](https://mne.discourse.group/t/source-localization-with-mne-combining-sensor-location-and-smri/3089 "2021-05-04T19:00:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyuwanchoi](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@kyuwanchoi](https://mne.discourse.group/u/kyuwanchoi)\
**Post date:** [May 4, 2021, 7:00pm UTC](https://mne.discourse.group/t/source-localization-with-mne-combining-sensor-location-and-smri/3089/1 "2021-05-04T19:00:40Z")

</div>

Hi MNE people, currently I am really enjoying MNE python. It is really nice tool.

I want to do source localization with EEG electrodes. When I did source localization several years ago, I needed EEG signals, position information of all EEG electrodes (at that time I used a positioning device to measure x,y,z position of each electrode), and structure MRI. When I look at MNE code, I cannot find the code to combine those three information. Could you explain me how MNE combines those three information? When can I find the example code?

Best,  
Kyu

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [May 5, 2021, 6:54am UTC](https://mne.discourse.group/t/source-localization-with-mne-combining-sensor-location-and-smri/3089/2 "2021-05-05T06:54:59Z")

</div>

have a look at

[https://mne.tools/stable/auto\_tutorials/inverse/70\_eeg\_mri\_coords.html](https://mne.tools/stable/auto_tutorials/inverse/70_eeg_mri_coords.html)

HTH  
Alex

---

<div class="post-metadata">

**Author:** ![kyuwanchoi](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@kyuwanchoi](https://mne.discourse.group/u/kyuwanchoi)\
**Post date:** [May 5, 2021, 9:13am UTC](https://mne.discourse.group/t/source-localization-with-mne-combining-sensor-location-and-smri/3089/3 "2021-05-05T09:13:26Z")

</div>

Hi Alex, thanks for your reply. In the example, I think EEG signals and MRI data are collected on the same day. But, usually we measure EEG and MRI on different day. In this case, do you measure x,y,z position of EEG electrodes using a positioning device (ex, polimus)? And, I would like to know how do you combine x,y,z positions of EEG electrodes with MRI.

Kyu

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [May 5, 2021, 12:54pm UTC](https://mne.discourse.group/t/source-localization-with-mne-combining-sensor-location-and-smri/3089/4 "2021-05-05T12:54:05Z")

</div>

what have you tried?

A

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [May 6, 2021, 3:24pm UTC](https://mne.discourse.group/t/source-localization-with-mne-combining-sensor-location-and-smri/3089/5 "2021-05-06T15:24:10Z")

</div>

There are many functions for reading digitized sensor locations, e.g., [mne.channels.read\_dig\_polhemus\_isotrak — MNE 0.23.0 documentation](https://mne.tools/stable/generated/mne.channels.read_dig_polhemus_isotrak.html). There is an extensive tutorial on coordinate frame alignment: [Source alignment and coordinate frames — MNE 0.23.0 documentation](https://mne.tools/stable/auto_tutorials/forward/20_source_alignment.html). There is an example showing alignment of EEG locations with the template `fsaverage` brain: [EEG forward operator with a template MRI — MNE 0.23.0 documentation](https://mne.tools/stable/auto_tutorials/forward/35_eeg_no_mri.html). Please study those, try it with your own data, and let us know exactly where you are getting stuck.
