All MNE reader functions load a Raw
object, in which case the line you describe is not valid. However, reading an XDF file (with pyxdf
, not with mne
), you get a different data structure that should be (1) parsed and (2) provided to mne.create_info
and mne.io.RawArray
to create a Raw
object for MNE.
Next, mne.channels.make_standard_montage('standard_1020')
creates an ideal template 10/20 montage. There is no reason for this template to match the locations found in the XDF file, which can be either from (1) the same or a different template or (2) from an actual digitization measurement device (thus giving true electrode locations).
Next, there is no guarantee the locations in the XDF file are in the head coordinate frame. As a matter of fact, mne.channels.make_standard_montage('standard_1020')
does not create a montage in the head coordinate frame either.
from mne.channels import make_standard_montage
montage = make_standard_montage("standard_1020")
montage.dig
This code snippet outputs the lit of digitization points:
<DigPoint | LPA : (-80.6, -29.1, -41.3) mm : MRI (surface RAS) frame>,
<DigPoint | Nasion : (1.5, 85.1, -34.8) mm : MRI (surface RAS) frame>,
<DigPoint | RPA : (84.4, -28.5, -41.3) mm : MRI (surface RAS) frame>,
<DigPoint | EEG #1 : (-29.4, 83.9, -7.0) mm : MRI (surface RAS) frame>,
<DigPoint | EEG #2 : (0.1, 88.2, -1.7) mm : MRI (surface RAS) frame>,
<DigPoint | EEG #3 : (29.9, 84.9, -7.1) mm : MRI (surface RAS) frame>,
...
Which are in the MRI coordinate frame. Let’s now apply this montage to a Raw
object:
import numpy as np
from mne import create_info
from mne.channels import make_standard_montage
from mne.io import RawArray
montage = make_standard_montage("standard_1020")
info = create_info(montage.ch_names, sfreq=1000., ch_types="eeg")
raw = RawArray(np.zeros((len(montage.ch_names), 1000)), info)
raw.set_montage(montage)
raw.get_montage().dig
Again, we look at the list of digitization points:
<DigPoint | LPA : (-82.5, -0.0, 0.0) mm : head frame>,
<DigPoint | Nasion : (0.0, 114.0, 0.0) mm : head frame>,
<DigPoint | RPA : (82.5, 0.0, -0.0) mm : head frame>,
<DigPoint | EEG #1 : (-30.9, 114.6, 27.9) mm : head frame>,
<DigPoint | EEG #2 : (-1.3, 119.1, 32.9) mm : head frame>,
<DigPoint | EEG #3 : (28.4, 115.3, 27.7) mm : head frame>,
...
Now, the montage is in the head coordinate frame. Note that the X, Y, Z coordinate have ‘changed’, but in reality what changed is the position of the origin and the orientation of the X/Y/Z axis, i.e. the coordinate frame.
See also this tutorial about the coordinate frames: Source alignment and coordinate frames — MNE 1.7.1 documentation
I hope that answer your question, good luck!
Mathieu