# mne coreg issues

**URL:** <https://mne.discourse.group/t/mne-coreg-issues/4699>\
**Category:** Support & Discussions\
**Tags:** coregistration\
**Created:** [April 12, 2022, 1:14pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699 "2022-04-12T13:14:45Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [April 12, 2022, 1:14pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/1 "2022-04-12T13:14:45Z")

</div>

Hi guys!

I recently updated to mne 1.0. After the update, the mne coreg is not working. I am getting this error text:

cmd: mne coreg

output:

```python
Using pyvistaqt 3d backend.

    Triangle neighbors and vertex normals...
Using high resolution head model in /media/dip_linux/Transcend/Visual_p3_data/3847/surf/lh.seghead
Traceback (most recent call last):
  File "/home/dip_linux/anaconda3/envs/mne/bin/mne", line 8, in <module>
    sys.exit(main())
  File "/home/dip_linux/anaconda3/envs/mne/lib/python3.10/site-packages/mne/commands/utils.py", line 107, in main
    cmd.run()
  File "/home/dip_linux/anaconda3/envs/mne/lib/python3.10/site-packages/mne/commands/mne_coreg.py", line 85, in run
    mne.gui.coregistration(
  File "<decorator-gen-558>", line 12, in coregistration
  File "/home/dip_linux/anaconda3/envs/mne/lib/python3.10/site-packages/mne/gui/ __init__.py", line 193, in coregistration
    return CoregistrationUI(
  File "<decorator-gen-570>", line 12, in __init__
  File "/home/dip_linux/anaconda3/envs/mne/lib/python3.10/site-packages/mne/gui/_coreg.py", line 238, in __init__
    self.coreg = Coregistration(
  File "/home/dip_linux/anaconda3/envs/mne/lib/python3.10/site-packages/mne/coreg.py", line 1371, in __init__
    self._setup_bem()
  File "/home/dip_linux/anaconda3/envs/mne/lib/python3.10/site-packages/mne/coreg.py", line 1426, in _setup_bem
    'mesh (%d vertices): %s' % (len(self._bem_high_res.surf.rr),
AttributeError: 'dict' object has no attribute 'surf'

```

# system info:

```python
Platform: Linux-5.13.0-39-generic-x86_64-with-glibc2.31
Python: 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:38:57) [GCC 10.3.0]
Executable: /home/dip_linux/anaconda3/envs/mne/bin/python
CPU: x86_64: 8 cores
Memory: 15.3 GB

mne: 1.0.0
numpy: 1.21.5 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy: 1.8.0
matplotlib: 3.5.1 {backend=QtAgg}

sklearn: 1.0.2
numba: 0.55.1
nibabel: 3.2.2
nilearn: 0.9.0
dipy: 1.5.0
cupy: Not found
pandas: 1.4.2
pyvista: 0.33.3 {OpenGL 3.3 (Core Profile) Mesa 21.2.6 via Mesa Intel(R) UHD Graphics (CML GT2)}
pyvistaqt: 0.8.0
ipyvtklink: 0.2.2
vtk: 9.1.0
PyQt5: 5.12.3
ipympl: 0.8.8
pooch: v1.6.0

mne_bids: Not found
mne_nirs: Not found
mne_features: 0.2
mne_qt_browser: 0.2.6
mne_connectivity: 0.3

```

any help would be appreciated.

best,  
Dip

---

<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:** [April 12, 2022, 1:39pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/2 "2022-04-12T13:39:33Z")

</div>

how did you update mne?

Alex

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [April 12, 2022, 1:43pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/3 "2022-04-12T13:43:01Z")

</div>

just: pip install mne==1.0

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [April 12, 2022, 1:46pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/4 "2022-04-12T13:46:49Z")

</div>

sorry, I set the mne environment from scratch using the instructions given in mne website. So technically I didn’t update if that answer your question 🙂

---

<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:** [April 12, 2022, 2:53pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/5 "2022-04-12T14:53:45Z")

</div>

I want to make sure that you installed with conda on a fresh env.

otherwise consider using the fully packaged installer

Alex

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [April 12, 2022, 3:48pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/6 "2022-04-12T15:48:36Z")

</div>

Hello @dasdiptyajit, I think this might be a bug in MNE-Python.

It should not occur if you have a low-resolution head surface available. I assume that if you look inside the FreeSurfer `subjects` folder for that particular subject, and then navigate to the `bem` sub-folder (i.e., `/media/dip_linux/Transcend/Visual_p3_data/3847/bem` in this particular case), there’s no `outer_skin.surf` file, right?

Running [`make_scalp_surfaces()`](https://mne.tools/stable/generated/mne.bem.make_scalp_surfaces.html) should fix this for you. Importantly, leave `no_decimate` at its default (`False`) so it will generate the low-resolution surface.

Please let me know how it goes,  
Richard

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [April 13, 2022, 7:14am UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/7 "2022-04-13T07:14:42Z")

</div>

@richard it works! cool 😃

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [April 13, 2022, 7:42am UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/8 "2022-04-13T07:42:46Z")

</div>

Thank you, I’ve reported the bug upstream: [Coreg GUI doesn't start if only high-resolution, but no low-resolution skin surface is not available · Issue #10520 · mne-tools/mne-python · GitHub](https://github.com/mne-tools/mne-python/issues/10520)

---

<div class="post-metadata">

**Author:** ![mschendel](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mschendel](https://mne.discourse.group/u/mschendel)\
**Post date:** [May 18, 2022, 3:47pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/9 "2022-05-18T15:47:02Z")

</div>

Hi all,  
I’m having this issue, too.

When I try mne.bem.make\_scalp\_surfaces I get an error for FREESURFER\_HOME not being set up. I have a working freesurfer distribution. What should the FREESUREFER\_HOME be and how do I set this variable for this module to work? Just making FREESURFER\_HOME= ‘/path\_to\_freesurfer/’ didn’t do anything.

Thanks for the help,  
Megan

---

<div class="post-metadata">

**Author:** ![mschendel](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mschendel](https://mne.discourse.group/u/mschendel)\
**Post date:** [May 18, 2022, 4:19pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/10 "2022-05-18T16:19:45Z")

</div>

Hi again,  
I figured out to use mne.set\_config(‘FREESURFER\_HOME’,FREESURFER\_HOME, set\_env=True), so I was able to use mne.bem.make\_scalp\_surfaces. I see a head-dense.fif, head-medium.fif, and a head-sparse.fif in the subject/bem/ directory.

However, when I try mne coreg, I still see output that it’s trying to use the high resolution head model and I see the same errors listed above in this topic.

I did a fresh mne install in a conda environment, and I’m using mne1.0 on Ubuntu 18.04.5 LTS.

I don’t know where it’s getting the subject from when I do mne coreg, but the output lists  
`Using high resolution head model in /export/research/analysis/unm_psych/dquinn/Navigate_20673/MEG_source_analysis/M87102616/bem/M87102616-head-dense.fif`

Thanks for any help,  
Megan

---

<div class="post-metadata">

**Author:** ![mschendel](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mschendel](https://mne.discourse.group/u/mschendel)\
**Post date:** [May 18, 2022, 4:30pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/11 "2022-05-18T16:30:33Z")

</div>

One more update…

I tried adding the -s -d and -f tags to the mne coreg command to explicitly set those variables, and then I use --low-res-head. But it is STILL trying to open the dense head surface and still throwing the no attribute ‘surf’ error!

Megan

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [May 18, 2022, 4:41pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/12 "2022-05-18T16:41:27Z")

</div>

Please post the complete command you’re using and the full error message, thank you.

---

<div class="post-metadata">

**Author:** ![mschendel](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mschendel](https://mne.discourse.group/u/mschendel)\
**Post date:** [May 18, 2022, 4:53pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/13 "2022-05-18T16:53:06Z")

</div>

Exactly as dasdiptyajit said…

Trial 1:

```python
(mne1.0_ubuntu) mschendel@mars:/export/research/analysis/unm_psych/dquinn/Navigate_20673/MEG_source_analysis/mne_source/python-scripts$ mne coreg
Using pyvistaqt 3d backend.

Using high resolution head model in /export/research/analysis/unm_psych/dquinn/Navigate_20673/MEG_source_analysis/M87102616/bem/M87102616-head-dense.fif
Traceback (most recent call last):
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/bin/mne", line 10, in <module>
    sys.exit(main())
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/commands/utils.py", line 107, in main
    cmd.run()
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/commands/mne_coreg.py", line 85, in run
    mne.gui.coregistration(
  File "<decorator-gen-558>", line 12, in coregistration
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/gui/ __init__.py", line 193, in coregistration
    return CoregistrationUI(
  File "<decorator-gen-570>", line 12, in __init__
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/gui/_coreg.py", line 238, in __init__
    self.coreg = Coregistration(
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/coreg.py", line 1371, in __init__
    self._setup_bem()
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/coreg.py", line 1426, in _setup_bem
    'mesh (%d vertices): %s' % (len(self._bem_high_res.surf.rr),
AttributeError: 'dict' object has no attribute 'surf'

```

Trial 2 with tags:

```python
(mne1.0_ubuntu) mschendel@mars:/export/research/analysis/unm_psych/dquinn/Navigate_20673/MEG_source_analysis/mne_source/python-scripts$ mne coreg -d '/export/research/analysis/unm_psych/dquinn/Navigate_20673/MEG_source_analysis/' -s 'M87102616' -f '/export/research/analysis/unm_psych/dquinn/Navigate_20673/MEG_AUTO_ANALYSIS/subjects/M87102616/M87102616_prosaccade_visit1_tsss_mc.fif' --low-res-head
Using pyvistaqt 3d backend.

Using high resolution head model in /export/research/analysis/unm_psych/dquinn/Navigate_20673/MEG_source_analysis/M87102616/bem/M87102616-head-dense.fif
Traceback (most recent call last):
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/bin/mne", line 10, in <module>
    sys.exit(main())
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/commands/utils.py", line 107, in main
    cmd.run()
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/commands/mne_coreg.py", line 85, in run
    mne.gui.coregistration(
  File "<decorator-gen-558>", line 12, in coregistration
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/gui/ __init__.py", line 193, in coregistration
    return CoregistrationUI(
  File "<decorator-gen-570>", line 12, in __init__
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/gui/_coreg.py", line 238, in __init__
    self.coreg = Coregistration(
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/coreg.py", line 1371, in __init__
    self._setup_bem()
  File "/export/research/analysis/human/jstephen/shared/programs/python/anaconda_072020/new/envs/mne1.0_ubuntu/lib/python3.10/site-packages/mne/coreg.py", line 1426, in _setup_bem
    'mesh (%d vertices): %s' % (len(self._bem_high_res.surf.rr),
AttributeError: 'dict' object has no attribute 'surf'

```

Thanks for taking a look,  
Megan

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [May 18, 2022, 4:54pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/14 "2022-05-18T16:54:20Z")

</div>

Are you sure you’re running the latest release of MNE-Python (1.0.3)? The problem should not occur there.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [May 18, 2022, 4:56pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/15 "2022-05-18T16:56:20Z")

</div>

I’m sorry, I was mistaken, this fix is only in the development version and was not backported to 1.0.x.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [May 18, 2022, 4:57pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/16 "2022-05-18T16:57:50Z")

</div>

Can you please share the contents (list of files and directories) inside the

```python
/export/research/analysis/unm_psych/dquinn/Navigate_20673/MEG_source_analysis/M87102616/bem

```

folder?

---

<div class="post-metadata">

**Author:** ![mschendel](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mschendel](https://mne.discourse.group/u/mschendel)\
**Post date:** [May 18, 2022, 5:01pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/17 "2022-05-18T17:01:33Z")

</div>

Ok, I’m using 1.0.0  
I’ll have to decide if I want to try the dev version or just use old tools.

I reread your instructions for the other user - should I have .surf files in the bem folder after using make\_scalp\_surfaces ? I only see the 3 head-\*.fif files and no .surf ones.

Thanks,  
Megan

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [May 18, 2022, 5:02pm UTC](https://mne.discourse.group/t/mne-coreg-issues/4699/18 "2022-05-18T17:02:12Z")

</div>

> [@mschendel](#):
>
> I reread your instructions for the other user - should I have .surf files in the bem folder after using make\_scalp\_surfaces ?

Yes, exactly, you should see those `.surf` files.
