[Mne_analysis] make_watershed_bem() does not make a BEM usable by setup_volume_source_space()

Christian O'Reilly christian.oreilly at gmail.com
Fri Oct 4 19:20:20 EDT 2019
Search archives:

        External Email - Use Caution        

Hi,

At line 1182 of
https://github.com/mne-tools/mne-python/blob/maint/0.19/mne/bem.py
mne.bem.make_watershed_bem() is creating the BEM FIF file using
FIFF.FIFFV_BEM_SURF_ID_HEAD (==4). When using this BEM file for source
modeling mne.setup_volume_source_space() expect
FIFF.FIFFV_BEM_SURF_ID_BRAIN (==1) (line 1705
https://github.com/mne-tools/mne-python/blob/master/mne/source_space.py)
and then crash because this surface id is not found in the BEM (stack trace
below).

I used

mne.bem.make_watershed_bem(fs_subject, subjects_dir=subjects_dir,
                           overwrite=False, show=True)

to make the BEM and

vol_src = setup_volume_source_space(
    subject, mri=fname_aseg, pos=10.0, bem=fname_model,
    add_interpolator=False, volume_label=labels_vol,
subjects_dir=subjects_dir)

to build the source space. Do you think it is a bug (I'll make a ticker if
so), or does it look like I used these functions not correctly?

Best,

Christian

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-27-be76d29cf63d> in <module>
      4 vol_src = setup_volume_source_space(pos=10.0, bem=fname_model,
      5     add_interpolator=False,  # just for speed, usually use True
----> 6     mri=fname_aseg)
      7 # Generate the mixed source space
      8 src += vol_src

</home/oreillyc/mne-python/mne/externals/decorator.py:decorator-gen-90> in
setup_volume_source_space(subject, pos, mri, sphere, bem, surface, mindist,
exclude, subjects_dir, volume_label, add_interpolator, verbose)

~/mne-python/mne/utils/_logging.py in wrapper(*args, **kwargs)
     88             with use_log_level(verbose_level):
     89                 return function(*args, **kwargs)
---> 90         return function(*args, **kwargs)
     91     return FunctionMaker.create(
     92         function, 'return decfunc(%(signature)s)',

~/mne-python/mne/source_space.py in setup_volume_source_space(subject, pos,
mri, sphere, bem, surface, mindist, exclude, subjects_dir, volume_label,
add_interpolator, verbose)
   1704             # read bem surface in the MRI coordinate frame
   1705             surf = read_bem_surfaces(bem,
s_id=FIFF.FIFFV_BEM_SURF_ID_BRAIN,
-> 1706                                      verbose=False)
   1707             logger.info('Loaded inner skull from %s (%d nodes)'
   1708                         % (bem, surf['np']))

</home/oreillyc/mne-python/mne/externals/decorator.py:decorator-gen-50> in
read_bem_surfaces(fname, patch_stats, s_id, verbose)

~/mne-python/mne/utils/_logging.py in wrapper(*args, **kwargs)
     87             # set it back if we get an exception
     88             with use_log_level(verbose_level):
---> 89                 return function(*args, **kwargs)
     90         return function(*args, **kwargs)
     91     return FunctionMaker.create(

~/mne-python/mne/bem.py in read_bem_surfaces(fname, patch_stats, s_id,
verbose)
   1270             surf = [s for s in surf if s is not None]
   1271             if not len(surf) == 1:
-> 1272                 raise ValueError('surface with id %d not found' %
s_id)
   1273         else:
   1274             surf = list()

ValueError: surface with id 1 not found
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191004/7ad1e867/attachment.html 


More information about the Mne_analysis mailing list