mne.preprocessing.maxwell_filter

mne.preprocessing.maxwell_filter(raw, origin='auto', int_order=8, ext_order=3, calibration=None, cross_talk=None, st_duration=None, st_correlation=0.98, coord_frame='head', destination=None, regularize='in', ignore_ref=False, bad_condition='error', verbose=None)

Apply Maxwell filter to data using multipole moments

Warning

Automatic bad channel detection is not currently implemented. It is critical to mark bad channels before running Maxwell filtering, so data should be inspected and marked accordingly prior to running this algorithm.

Warning

Not all features of Elekta MaxFilter™ are currently implemented (see Notes). Maxwell filtering in mne-python is not designed for clinical use.

Parameters:

raw : instance of mne.io.Raw

Data to be filtered

origin : array-like, shape (3,) | str

Origin of internal and external multipolar moment space in meters. The default is 'auto', which means (0., 0., 0.) for coord_frame='meg', and a head-digitization-based origin fit for coord_frame='head'.

int_order : int

Order of internal component of spherical expansion.

ext_order : int

Order of external component of spherical expansion.

calibration : str | None

Path to the '.dat' file with fine calibration coefficients. File can have 1D or 3D gradiometer imbalance correction. This file is machine/site-specific.

cross_talk : str | None

Path to the FIF file with cross-talk correction information.

st_duration : float | None

If not None, apply spatiotemporal SSS with specified buffer duration (in seconds). Elekta’s default is 10.0 seconds in MaxFilter™ v2.2. Spatiotemporal SSS acts as implicitly as a high-pass filter where the cut-off frequency is 1/st_dur Hz. For this (and other) reasons, longer buffers are generally better as long as your system can handle the higher memory usage. To ensure that each window is processed identically, choose a buffer length that divides evenly into your data. Any data at the trailing edge that doesn’t fit evenly into a whole buffer window will be lumped into the previous buffer.

st_correlation : float

Correlation limit between inner and outer subspaces used to reject ovwrlapping intersecting inner/outer signals during spatiotemporal SSS.

coord_frame : str

The coordinate frame that the origin is specified in, either 'meg' or 'head'. For empty-room recordings that do not have a head<->meg transform info['dev_head_t'], the MEG coordinate frame should be used.

destination : str | array-like, shape (3,) | None

The destination location for the head. Can be None, which will not change the head position, or a string path to a FIF file containing a MEG device<->head transformation, or a 3-element array giving the coordinates to translate to (with no rotations). For example, destination=(0, 0, 0.04) would translate the bases as --trans default would in MaxFilter™ (i.e., to the default head location).

regularize : str | None

Basis regularization type, must be “in” or None. “in” is the same algorithm as the “-regularize in” option in MaxFilter™.

ignore_ref : bool

If True, do not include reference channels in compensation. This option should be True for KIT files, since Maxwell filtering with reference channels is not currently supported.

bad_condition : str

How to deal with ill-conditioned SSS matrices. Can be “error” (default), “warning”, or “ignore”.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose)

Returns:

raw_sss : instance of mne.io.Raw

The raw data with Maxwell filtering applied.

Notes

New in version 0.11.

Some of this code was adapted and relicensed (with BSD form) with permission from Jussi Nurminen. These algorithms are based on work from [R20] and [R21].

Compared to Elekta’s MaxFilter™ software, our Maxwell filtering algorithm currently provides the following features:

  • Bad channel reconstruction
  • Cross-talk cancellation
  • Fine calibration correction
  • tSSS
  • Coordinate frame translation
  • Regularization of internal components using information theory

The following features are not yet implemented:

  • Not certified for clinical use
  • Raw movement compensation
  • Automatic bad channel detection
  • cHPI subtraction

Our algorithm has the following enhancements:

  • Double floating point precision
  • Handling of 3D (in additon to 1D) fine calibration files
  • Automated processing of split (-1.fif) and concatenated files
  • Epoch-based movement compensation as described in [R20] through mne.epochs.average_movements()
  • Experimental processing of data from (un-compensated) non-Elekta systems

Use of Maxwell filtering routines with non-Elekta systems is currently experimental. Worse results for non-Elekta systems are expected due to (at least):

  • Missing fine-calibration and cross-talk cancellation data for other systems.
  • Processing with reference sensors has not been vetted.
  • Regularization of components may not work well for all systems.
  • Coil integration has not been optimized using Abramowitz/Stegun definitions.

Note

Various Maxwell filtering algorithm components are covered by patents owned by Elekta Oy, Helsinki, Finland. These patents include, but may not be limited to:

  • US2006031038 (Signal Space Separation)
  • US6876196 (Head position determination)
  • WO2005067789 (DC fields)
  • WO2005078467 (MaxShield)
  • WO2006114473 (Temporal Signal Space Separation)

These patents likely preclude the use of Maxwell filtering code in commercial applications. Consult a lawyer if necessary.

References

[R20](1, 2, 3)

Taulu S. and Kajola M. “Presentation of electromagnetic multichannel data: The signal space separation method,” Journal of Applied Physics, vol. 97, pp. 124905 1-10, 2005.

http://lib.tkk.fi/Diss/2008/isbn9789512295654/article2.pdf

[R21](1, 2)

Taulu S. and Simola J. “Spatiotemporal signal space separation method for rejecting nearby interference in MEG measurements,” Physics in Medicine and Biology, vol. 51, pp. 1759-1768, 2006.

http://lib.tkk.fi/Diss/2008/isbn9789512295654/article3.pdf