Skip to content

Add multi-origin SSS method to Maxwell Filtering #13339

@xannnimal

Description

@xannnimal

Describe the new feature or enhancement

Modify the Maxwell Filtering process to include an option for multi-origin SSS calculation, dubbed the mSSS method, following the implementation and investigation in "Refinined SSS models for on-scalp MEG" McPherson et al. 2025. First, we propose a new function fit_spheres_to_mri based on @larsoner 's code for the manuscript that optimizes multiple origins for the mSSS basis. Then, we propose a modification/addition to the function maxwell_filter to take in the multiple origins to calculate the mSSS basis.

Describe your proposed implementation

  1. For the first step of calculating the optimized centers, I talked with @larsoner and we converged on an API like:
    def fit_spheres_to_mri(bem, trans, n_spheres=2): ... return spheres # ndarray, shape (n_spheres, 3)
    We have the code to implement this part, modified from the code written for the mSSS method paper modified to fit the proposed API. This code would include a warning that only the two-sphere case has been tested and investigated, we can allow the user to generate 3 centers, but could raise an error if any more are asked for.

  2. Next, to use the optimized spheres to calculate two different internal SSS basis sets, we propose modifying the 'maxwell_filter' to this API that takes in an array-like object of shape (n_spheres, 3):
    raw_sss = maxwell_filter(raw, ..., origin=((0., 0., 0.03), (0., 0.05, 0.02)), ...
    The internal change in maxwell_filter would be to make a new function called _sss_multi, like the function _sss_basic(exp,all_coils) , which takes the multiple origins and combines two interior basis sets using SVD. I have the code to do this calculation based on the implementation discussed in the paper

Describe possible alternatives

  1. The optimization of the centers has been tested/implemented by @larsoner and myself, and already functioned well for the purposes of the initial mSSS investigation. We suggested separating this step from the actually SSS calculations so that users could use any centers, not necessarily the optimized ones, in the mSSS calculation step if they wish.
  2. inside maxwell_filter, instead of making a new function, we could modify the existing _sss_basic function to take in an extra parameter pertaining to the multiple sensors. But, It would be clearer to create a new function as suggested previously to deal with the multi-SSS case, as two interior basis sets must be calculated, processed with SVD, and then combined with the typical exterior basis to form the mSSS method.

Additional context

The mSSS method specifically pertains to on-scalp MEG systems, like OPMs, where traditional SSS may fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions