Coregistration of my electrode locations with individual MRI images

I can’t figure out how to perform coregistration with my own data using the mne coreg GUI. Is there some documentation or tutorial I’m missing? I’ve only found Source alignment and coordinate frames — MNE 1.0.3 documentation, which uses a preprocessed example data set.

I don’t even know what kind of data is required/expected when clicking on the “Load” button. Do I need to pass a BIDS folder? A T1 image? Freesurfer output? I tried all of these things, but the GUI crashes with a RuntimeError: No standard head model was found for subject and then a Fatal Python error: Aborted.

You have EEG data and individual MRI scans?

I’d long been planning to make a short tutorial video on this, maybe it’s finally time?

If you can share your data with me, I can actually use exactly that data. We’d need to anonymize it first, of course. But I can take care of this too. Maybe let’s discuss via email!

1 Like

Alright, so the GUI always crashes after I try to load a subject MRI. The error message is:

RuntimeError: No standard head model was found for subject

However, I already ran Freesurfer and mne watershed_bem, so the folders bem and surf are present in the subject directory (along with a bunch of other folders like label, mri, scripts, stats, tmp, touch, and trash). I tried selecting the subject folder, the bem folder, and the surf folder, but the GUI crashes with the mentioned error message no matter what I select.

I would always start the GUI with all required parameters pre-filled.

So something like:


mne.gui.coregistration(
    inst='path/to/eeg_recording.fif',
    subject='freesurfer-subject-name',
    subjects_dir='/freesurfer_dir/subjects',  # contains a sub-folder for subject
    head_high_res=True,
    # trans=None,  # only if you already have one
    interaction='terrain',
)

Can you try this? I believe it’s less of a chance to select the “wrong” inputs :slight_smile:

Yes, this works better – I can now actually select between the different subjects available in the folder. However, it seems like the function is looking for the bem folder in each subject directory. I think it was this information that I somehow missed. It’s not the T1 MRI that’s needed, but the BEM (which is computed by Freesurfer I believe).

You need to create the BEM surfaces based on FLASH or T1 MRI scans. The functions required to do this are part of FreeSurfer, but can be invoked through MNE’s Python API:

mne.bem.make_watershed_bem(  # for T1; for FLASH, use make_flash_bem instead
    subject=fs_subject,
    subjects_dir=fs_subjects_dir,
    copy=True,
    overwrite=True,
    show=True,
)

After that, create the scalp surfaces:

mne.bem.make_scalp_surfaces(
    subject=fs_subject,
    subjects_dir=fs_subjects_dir,
    no_decimate=True,
    force=True,
    overwrite=True,
)

and you should have everything you need.

And yes, this stuff will all end up inside the bem directory inside the respective FreeSurfer subject’s directory.

1 Like