question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing `trans` to mne.gui.coregistration() should automatically derive the MRI fiducials

See original GitHub issue

Currently, the following code will estimate the fiducials from fsaverage and ask me to (re)place them; however, with a trans provided, deriving the MRI fiducials is very easy and is actually what I’d expect to be done automatically. I shouldn’t have to pick fiducials again if a trans has already been generated!

import os.path as op
import mne
from mne.io import read_info

data_path = mne.datasets.sample.data_path()
subjects_dir = op.join(data_path, 'subjects')
subject = 'sample'

fname_raw = op.join(data_path, 'MEG', subject, subject + '_audvis_raw.fif')
fname_trans = op.join(data_path, 'MEG', subject, 
                      f'{subject}_audvis_raw-trans.fif')

mne.gui.coregistration(
    subject='sample',
    subjects_dir=subjects_dir,
    inst=fname_raw,
    trans=fname_trans,
)

cc @GuillaumeFavelier

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:23 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
larsonercommented, Jan 20, 2022

We do not have a way to specify the path to load the fiducials in the command line with mne coreg right?

Correct, and YAGNI. The standard location SUBJECTS_DIR/SUBJECT/bem/SUBJECT-fiducials.fif should be enough in 99% of cases.

1reaction
larsonercommented, Jan 19, 2022

@GuillaumeFavelier Looking at the code, I believe the fiducials file is currently saved automatically once the fiducials have been placed, is this correct?

When I’ve run mne coreg multiple times with -s sample, it goes into fiducial-editing mode on startup every time. So it either isn’t saving it (to the right place), or it’s not detecting the presence of sample/bem/sample-fiducials.fif.

FWIW I don’t think it should auto-save – I think there should be a save button, the filename field should auto-populate with $SUBJECTS_DIR/$SUBJECT/bem/$SUBJECT-fiducials.fif, and if you click “save” and the file exists, you should get a popup prompt asking if you’re sure you want to overwrite. (This is one case where a file browser could potentially be used, but we really want people to stick with the standard filename so I’d rather not tempt them to use something else by making browsing/selecting something different easier.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.coreg.Coregistration — MNE 1.2.2 documentation
Compute distance between head shape points and MRI skin surface. fit_fiducials ([lpa_weight, nasion_weight, ...]) Find rotation and translation ...
Read more >
SPM12 Manual - Wellcome Centre for Human Neuroimaging
MRI images are typically registered to the first image. The more accurate way would be to use a two pass procedure, but this...
Read more >
News - Brainstorm - Biomedical Imaging Group
This can help identify and fix manually coregistration issues. ... Brainstorm is now fully interfaced with new programs for MRI processing and segmentation:....
Read more >
fMRI-based validation of continuous-wave fNIRS of ... - Nature
Compared to functional magnetic resonance imaging (fMRI), functional near infrared spectroscopy (fNIRS) has several advantages that make it ...
Read more >
Implementing source space analysis functionality in a GUI ...
MRI image reconstruction (see section 2.2) can take hours, while some steps in source analysis (when performed by MNE-Python methods) can ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found