Open AlexLepauvre opened 2 years ago
ok I looked a bit into it. The problem happens on write (not on read). Basically when we write dig points on epochs.save we just ignore the coord frame. We call write_dig_points without a coord_frame parameter. So on read it defaults to head...
I think it's something we can tackle during our sprint late August unless @larsoner is eager to fix it before.
Thanks @agramfort. In the mean time, is there any way I change the coordinate frame of the epochs object manually to override this issue? I am thinking something like:
for ch in montage.dig:
montage.dig[ch] = "5 (FIFFV_COORD_MRI)"
Kind regards,
Alex
you can hack it like this:
from mne.io.constants import FIFF for d in loaded_epochs.info["dig"]: d['coord_frame'] = FIFF.FIFFV_COORD_MRI
Message ID: @.***>
Converting to head space is actually intended behavior:
MNE-Python prefers to have EEG channel locations in head space, always. So .apply_montage
converts the montage to head space (if you get rid of the verbose='ERROR'
you can see the warning message saying there are no fiducials so an identity transform is assumed). We probably want to keep this. If we allow electrodes to be in all kinds of coordinate spaces, we have to verify the coordinate space every time we use channel locations.
What is the reason for wanting to store digitized channel locations in MRI space? It may be simpler not to try and fight MNE-Python on this.
Ahh, this is ECOG data, I see.
Reopening as this issue will exist until make a fix in MNE-BIDS
Describe the bug
Montage in MRI space gets transformed to head space when saving to an epochs .fif file. The issue seems to be due to the saving and not the loading, but not 100% clear. See here
Steps to reproduce
Expected results
Actual results
Additional information