Skip to main content

mne_collect_transforms

Overview​

mne_collect_transforms collects the coordinate transforms that link MEG device, head, MRI, scanner RAS, MNI Talairach and FreeSurfer Talairach coordinates, prints them and optionally writes them to one FIFF file.

This is a C++ port of the original MNE-C tool by Matti Hämäläinen.

Usage​

mne_collect_transforms [options]

Options​

OptionDescription
--meas <name>MEG measurement file (device→head transform)
--mri <name>FIFF MRI description or -trans.fif file (MRI→head transform; without --mgh also the Talairach chain stored in it)
--mgh <name>mgh/mgz MRI volume; its centre and transforms/talairach.xfm next to it give the surface RAS→RAS→MNI→Talairach chain
--out <name>Output file name
--helpPrint help
--versionPrint version

At least one of --meas, --mri or --mgh must be specified.

Description​

The device→head transform comes from the measurement file and the MRI (surface RAS)→head transform from the coregistration. The remaining links follow MNE-C: surface RAS→RAS is a shift by the centre of the MRI volume, RAS→MNI Talairach is read from the subject's talairach.xfm, and MNI→FreeSurfer Talairach uses M. Brett's two fixed approximations, one above and one below the AC–PC plane. Composed, the chain maps head coordinates to MNI coordinates exactly as mne.head_to_mni does (FIFFLIB::FiffCoordTransSet).

Workflow Context​

Use this tool to gather transforms for visualization or when transforms need to be applied in scripts that combine MEG measurements with MRI data.

Example​

# Collect the full chain into one file
mne_collect_transforms --meas raw.fif --mri sample-trans.fif \
--mgh $SUBJECTS_DIR/sample/mri/T1.mgz --out transforms.fif

# Collect only the device-to-head transform
mne_collect_transforms --meas raw.fif --out dev_head.fif