Describe the bug
When exporting a source space that is larger than the mri (i.e has clipping) the warning fails, with error KeyError: 'kind' from
File "***/mne-python/mne/source_space.py", line 517, in export_volume
warn(f'{n_diff} {src["kind"]} vertices lay outside of volume '
I think "kind" here should be "type"
n.b. this seems to have been introduced with #7888
Steps to reproduce
import mne
import nibabel as nb
import numpy as np
data_path= mne.datasets.data_path()
subjects_dir = f'{data_path}/subjects'
aseg_img=nb.load(f'{subjects_dir}/fsaverage/mri/aparc+aseg.mgz')
aseg_data=aseg_img.dataobj
aseg_affine=aseg_img.get_affine()
aseg_affine[:3,:3]*=0.7
new_aseg=nb.MGHImage(aseg_data,aseg_affine)
new_name=f'{subjects_dir}/fsaverage/mri/translated_aseg.mgz'
nb.save(new_aseg,new_name)
sphere = (0,0,0,0.2)
surface_src = mne.setup_source_space("fsaverage", spacing='oct6', surface='white',
subjects_dir=subjects_dir, add_dist=False)
lh_cereb = mne.setup_volume_source_space("fsaverage", mri=f'{subjects_dir}/fsaverage/mri/translated_aseg.mgz', sphere=sphere,
volume_label="Left-Cerebellum-Cortex", sphere_units="m")
src = surface_src + lh_cereb
nii_name="test.nii"
src.export_volume(nii_name, mri_resolution="sparse", use_lut=False, overwrite=True)
Expected results
expected it to report the clipped voxels as a warning
Actual results
Key error
Describe the bug
When exporting a source space that is larger than the mri (i.e has clipping) the warning fails, with error KeyError: 'kind' from
File "***/mne-python/mne/source_space.py", line 517, in export_volume
warn(f'{n_diff} {src["kind"]} vertices lay outside of volume '
I think "kind" here should be "type"
n.b. this seems to have been introduced with #7888
Steps to reproduce
Expected results
expected it to report the clipped voxels as a warning
Actual results
Key error