Mne coreg some confusions

Dear MNE users,

I have a problem to coregister headshape to meg sensors. i attached a plot, i get the head and the sensor not well alignment. i have tried many times but it did not work.

Here is the result of the alignment


  • MNE-Python version: 0.22.0
  • operating system: Linux18

I have a problem to coregister headshape to meg sensors. i attached a plot, i get the head and the sensor not well alignment. i have tried many times but it did not work.

mne coregā€™s job (assuming youā€™re not scaling an MRI) is to coregister the head coordinate frame (defined by nasion/LPA/RPA) to the mri coordinate frame. This is the -trans.fif output defines.

On top of this, there is an alignment between the head coordinate frame and the meg coordinate frame. This is typically defined/set up during the MEG acquisition itself via HPI coil coregistration, and ends up living in raw.info['dev_head_t'].

Either of these could be wrong in your case. Specifically I see three possible sources of error here:

  1. You might be assuming nasion was digitized in its typical/correct location, but if it was actually digitized for example at the top of the forehead during acquisition for whatever reason, then your mne coreg / -trans.fif should be adjusted accordingly.
  2. The info['dev_head_t'] was estimated incorrectly by the acquisition system. This is more annoying to fix because it requires digging into the acquisition files and trying to re-fit the transform somehow better than the acquisition machine did.
  3. Itā€™s possible the subject actually had their head tilted this far back during acquisition, and everything is actually okay (i.e., the assumption that this incorrectly reflects the acquisition which is problematic) .

For (2), which I think is the most likely culprit ā€“ if this is KIT data (it looks like it?) then you have to be careful because you might end up with raw.info['dev_head_t'] as an identity matrix if you donā€™t pass all the right options, which is almost never correct. Is it identity?

For (1) and (3), if you did not acquire these data, perhaps the person/people who did will know what the head alignment was actually like, and can rule out these possibilities so we can focus on (2).

1 Like

Actually from the show_axes=True I can see that the MEG and head coordinate frames are not identical, so we can rule out that raw.info['dev_head_t'] is identity. Letā€™s rule out (1) and (3) and if those canā€™t be it, then if you can share the MEG data (donā€™t need the MRI) then someone might be able to look to see if there is some information in the file that could help redo the MEG<->Head transformation.

2 Likes

Hi, Eric, thanks for you reply. It is CTF275 MEG data. I have read the raw.info [ā€˜dev_head_tā€™] of the raw data, and i think it might be right (or i donā€™t know how to judge whether it was estimated correctly).
1). I was confused that how can I align the head shape and MEG sensors. Although the information of relationship between head shape and MEG sensprs was stored in the raw.info [ā€˜dev_head_tā€™], i donnā€™t remember i have ever used this information. Here is my code of computing forward solution after ā€˜mne coregā€™:
mne_do_forward_solution --mindist 5 --spacing oct-6 \ --meas S01_raw_filterd.fif \ --mri S01_raw-trans.fif \ --bem S01-5120 --megonly \ --overwrite --fwd S01-meg-oct-6-fwd.fif
2). in the ā€˜mne coregā€™ step, i first edit the MRI fiducials and save it. Sencondly, i load the ā€˜S01_raw.fifā€™ file, and then fit fiducials. Then I saved the -trans.fif file. Is there any inappropriate about this steps?
3). I want to upload my S01_raw.fif file, but i donā€™t find any entrance to upload it.

Typically, people analyzing the acquired data do not need to do anything to align the MEG sensors with the head. This alignment is done during the MEG device during acquisition. Usually the people recording the data make sure the head position is estimated properly inside the helmet based on goodness of fit (among other things).

Is there any inappropriate about this steps?

This is the typical procedure. The only question is: did you put the MRI fiducials where the markers actually were during acquisition? In other words, during acquisition, if the nasion marker was not actually at the nasion but actually up on the forehead somewhere, it would explain this tilting problem.

Did you acquire the data? If not, I suggest you talk to whoever did and see if this is what they expect the alignment to look like. If itā€™s not, Iā€™d then check to make sure the nasion was actually digitized properly (i.e., at the nasion and not up on the forehead) during the acquisition.

If these questions donā€™t help, we can look at your file (you can upload it on your own DropBox, Google Drive, or whatever file-sharing service you want) but it is difficult to know the right way to fix a broken MEG<->head transform, and might not actually be possible.

Hi, here is the meg raw datanfile. S01_raw.fif

In addition, when I use the file to estimate source, i always get the Index error like this:

引ē”ØIndexError Traceback (most recent call last)
in
6 size=(800, 800), smoothing_steps=10)
7
----> 8 brain = stc_LFF6.plot(**surfer_kwargs)
9
10 brain.add_foci(vertno_max, coords_as_verts=True, hemi=ā€˜rhā€™, color=ā€˜blueā€™,

~/.local/lib/python3.7/site-packages/mne/source_estimate.py in plot(self, subject, surface, hemi, colormap, time_label, smoothing_steps, transparent, alpha, time_viewer, subjects_dir, figure, views, colorbar, clim, cortex, size, background, foreground, initial_time, time_unit, backend, spacing, title, show_traces, src, volume_options, view_layout, add_data_kwargs, verbose)
661 spacing=spacing, title=title, show_traces=show_traces,
662 src=src, volume_options=volume_options, view_layout=view_layout,
ā†’ 663 add_data_kwargs=add_data_kwargs, verbose=verbose)
664 return brain
665
~/anaconda3/lib/python3.7/site-packages/scipy/sparse/_index.py in _asindices(self, idx, length)
168 max_indx = x.max()
169 if max_indx >= length:
ā†’ 170 raise IndexError(ā€˜index (%d) out of rangeā€™ % max_indx)
171
172 min_indx = x.min()

IndexError: index (137932) out of range"

Do you have any idea where was wrong?
Thank you very much !

I suspect there is somewhere a mismatch of subject name and anatomies

are you sure you are plotting with the proper subject name?

Alex

Thanks for your reply, I have checked other subjects and their alignment shows well. Here is the alignment plot:

thanks very much