Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error message when conversion of EEG locs to head space fails #11080

Merged
merged 4 commits into from
Aug 26, 2022

Conversation

wmvanvliet
Copy link
Contributor

When calling .set_montage(), all digitized points are transformed into head coordinate space if possible. This is not possible when there are no fiducials and the original points are not in head space already. MNE-Python is lenient when the coordinate space of the original points is marked as "unknown", assuming they are in head space. However, when the points are explicitly marked as being in some other space (e.g. MRI), then they will not get converted without fiducials.

Since MNE-Python requires all EEG channel positions to be in head space, we should raise an error when .set_montage() fails to do this.

Fixes #10946.

When calling `.set_montage()`, all digitized points are transformed into
head coordinate space if possible. This is not possible when there are
no fiducials and the original points are not in head space already.
MNE-Python is lenient when the coordinate space of the original points
is marked as "unknown", assuming they are in head space. However, when
the points are explicitly marked as being in some other space (e.g.
MRI), then they will not get converted without fiducials.

Since MNE-Python requires all EEG channel positions to be in head space,
we should raise an error when `.set_montage()` fails to do this.

Fixes mne-tools#10946.
@larsoner
Copy link
Member

Can you add a test? I think the RuntimeError must not be covered, right?

@larsoner larsoner merged commit bdc435d into mne-tools:main Aug 26, 2022
@larsoner
Copy link
Member

Thanks @wmvanvliet !

@wmvanvliet
Copy link
Contributor Author

Let's revert this until we can get MNE-BIDS sorted.

wmvanvliet added a commit to wmvanvliet/mne-python that referenced this pull request Aug 28, 2022
larsoner added a commit to larsoner/mne-python that referenced this pull request Aug 29, 2022
* upstream/main: (366 commits)
  BUG: Spectrum deprecation cleanup [circle deploy] (mne-tools#11115)
  Add API entry list and map (mne-tools#10999)
  Add legacy decorator (mne-tools#11097)
  [ENH, MRG] Add time-frequency epoch source estimation (mne-tools#11095)
  Revert "Add error message when conversion of EEG locs to [circle deploy] (mne-tools#11104)
  MRG: Fixes for mne-tools#11090 (mne-tools#11108)
  add test for edf units param (mne-tools#11105)
  BUG: Improve logic for bti (mne-tools#11102)
  add spectrum class (mne-tools#10184)
  ENH : add units parameter to read_raw_edf in case units is missing from the file (mne-tools#11099)
  ENH: Add temperature and galvanic (mne-tools#11090)
  Add error message when conversion of EEG locs to head space fails (mne-tools#11080)
  DOC: removed unnecessary line in PSF example (mne-tools#11085)
  FIX: Update helmet during ICP (mne-tools#11084)
  Fix various typos (mne-tools#11086)
  DOC: Rel
  BUG: don't assume that channel info contains particular keys (mne-tools#11074)
  [BUG] Fix plot_topomap with sphere="eeglab" (mne-tools#11081)
  Add `vmin` and `vmax` specification to `mne.Evoked.animate_topomap` (mne-tools#11073)
  Add _on_missing functionality to UpdateChannelsMixin (mne-tools#11077)
  ...
larsoner added a commit to larsoner/mne-python that referenced this pull request Aug 30, 2022
* upstream/main: (25 commits)
  DOC: Exclude some implicit refs in doc build (mne-tools#10433)
  MAINT: Better issue forms (mne-tools#11101)
  [FIX] Typo in example (mne-tools#11118)
  [MRG] Improve interpolation of bridged electrodes (mne-tools#11094)
  BUG: Spectrum deprecation cleanup [circle deploy] (mne-tools#11115)
  Add API entry list and map (mne-tools#10999)
  Add legacy decorator (mne-tools#11097)
  [ENH, MRG] Add time-frequency epoch source estimation (mne-tools#11095)
  Revert "Add error message when conversion of EEG locs to [circle deploy] (mne-tools#11104)
  MRG: Fixes for mne-tools#11090 (mne-tools#11108)
  add test for edf units param (mne-tools#11105)
  BUG: Improve logic for bti (mne-tools#11102)
  add spectrum class (mne-tools#10184)
  ENH : add units parameter to read_raw_edf in case units is missing from the file (mne-tools#11099)
  ENH: Add temperature and galvanic (mne-tools#11090)
  Add error message when conversion of EEG locs to head space fails (mne-tools#11080)
  DOC: removed unnecessary line in PSF example (mne-tools#11085)
  FIX: Update helmet during ICP (mne-tools#11084)
  Fix various typos (mne-tools#11086)
  DOC: Rel
  ...
@wmvanvliet wmvanvliet deleted the to-head-error branch September 4, 2023 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Montage in MRI space converted to head when saving to epoch.fif
2 participants