mne.dig_mri_distances(info, trans, subject, subjects_dir=None, dig_kinds='auto', exclude_frontal=False, on_defects='raise', verbose=None)[source]#

Compute distances between head shape points and the scalp surface.

This function is useful to check that coregistration is correct. Unless outliers are present in the head shape points, one can assume an average distance around 2-3 mm.


The mne.Info object with information about the sensors and methods of measurement. Must contain the head shape points in info['dig'].

transstr | instance of Transform

The head<->MRI transform. If str is passed it is the path to file on disk.


The name of the subject.

subjects_dirstr | None

Directory containing subjects data. If None use the Freesurfer SUBJECTS_DIR environment variable.

dig_kindslist of str | str

Kind of digitization points to use in the fitting. These can be any combination of (‘cardinal’, ‘hpi’, ‘eeg’, ‘extra’). Can also be ‘auto’ (default), which will use only the ‘extra’ points if enough (more than 4) are available, and if not, uses ‘extra’ and ‘eeg’ points.


If True, exclude points that have both negative Z values (below the nasion) and positive Y values (in front of the LPA/RPA). Default is False.

on_defects‘raise’ | ‘warn’ | ‘ignore’

What to do if the surface is found to have topological defects. Can be 'raise' (default) to raise an error, 'warn' to emit a warning, or 'ignore' to ignore when one or more defects are found. Note that a lot of computations in MNE-Python assume the surfaces to be topologically correct, topological defects may still make other computations (e.g., mne.make_bem_model and mne.make_bem_solution) fail irrespective of this parameter.

New in v1.0.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

distsarray, shape (n_points,)

The distances.


New in v0.19.

Examples using mne.dig_mri_distances#

Source alignment and coordinate frames

Source alignment and coordinate frames