Skip to content

Source space & forward solution

mri_t1_path_generator module-attribute

Python
mri_t1_path_generator: Callable[[BIDSPath], BIDSPath] | None = None

To perform source-level analyses, the Pipeline needs to generate a transformation matrix that translates coordinates from MEG and EEG sensor space to MRI space, and vice versa. This process, called "coregistration", requires access to both, the electrophyisiological recordings as well as T1-weighted MRI images of the same participant. If both are stored within the same session, the Pipeline (or, more specifically, MNE-BIDS) can find the respective files automatically.

However, in certain situations, this is not possible. Examples include:

  • MRI was conducted during a different session than the electrophysiological recording.
  • MRI was conducted in a single session, while electrophysiological recordings spanned across several sessions.
  • MRI and electrophysiological data are stored in separate BIDS datasets to allow easier storage and distribution in certain situations.

To allow the Pipeline to find the correct MRI images and perform coregistration automatically, we provide a "hook" that allows you to provide a custom function whose output tells the Pipeline where to find the T1-weighted image.

The function is expected to accept a single parameter: The Pipeline will pass a BIDSPath with the following parameters set based on the currently processed electrophysiological data:

  • the subject ID, BIDSPath.subject
  • the experimental session, BIDSPath.session
  • the BIDS root, BIDSPath.root

This BIDSPath can then be modified – or an entirely new BIDSPath can be generated – and returned by the function, pointing to the T1-weighted image.

Info

The function accepts and returns a single BIDSPath.

Example

The MRI session is different than the electrophysiological session:

Python
def get_t1_from_meeg(bids_path):
    bids_path.session = 'MRI'
    return bids_path


mri_t1_path_generator = get_t1_from_meeg

The MRI recording is stored in a different BIDS dataset than the electrophysiological data:

Python
def get_t1_from_meeg(bids_path):
    bids_path.root = '/data/mri'
    return bids_path


mri_t1_path_generator = get_t1_from_meeg

Pipeline steps using this setting

The following steps are directly affected by changes to mri_t1_path_generator:

  • source/_04_make_forward

mri_landmarks_kind module-attribute

Python
mri_landmarks_kind: Callable[[BIDSPath], str] | None = None

This config option allows to look for specific landmarks in the json sidecar file of the T1 MRI file. This can be useful when we have different fiducials coordinates e.g. the manually positioned fiducials or the fiducials derived for the coregistration transformation of a given session.

Example

We have one MRI session and we have landmarks with a kind indicating how to find the landmarks for each session:

Python
def mri_landmarks_kind(bids_path):
    return f"ses-{bids_path.session}"
Pipeline steps using this setting

The following steps are directly affected by changes to mri_landmarks_kind:

  • source/_04_make_forward

spacing module-attribute

Python
spacing: Literal['oct5', 'oct6', 'ico4', 'ico5', 'all'] | int = 'oct6'

The spacing to use. Can be 'ico#' for a recursively subdivided icosahedron, 'oct#' for a recursively subdivided octahedron, 'all' for all points, or an integer to use approximate distance-based spacing (in mm). See (the respective MNE-Python documentation) [https://mne.tools/dev/overview/cookbook.html#setting-up-the-source-space] for more info.

Pipeline steps using this setting

The following steps are directly affected by changes to spacing:

  • source/_03_setup_source_space
  • source/_04_make_forward

mindist module-attribute

Python
mindist: float = 5

Exclude points closer than this distance (mm) to the bounding surface.

Pipeline steps using this setting

The following steps are directly affected by changes to mindist:

  • source/_04_make_forward