Skip to content

Add method for channel interpolation to predefined channel positions/montage #12486

@apmellot

Description

@apmellot

Describe the new feature or enhancement

I have recently been working with datasets with diverse montages and wanted to make them comparable by ensuring a consistent number and position of channels across datasets. Currently, achieving this requires hacking in MNE internal functions such as mne.channels.interpolation._map_meg_or_eeg_channels or mne.channels.interpolation._make_interpolation_matrix, and is not straightforward for users.
This new method would simplify the process. I believe a similar issue was raised in #12409.

Describe your proposed implementation

The proposed implementation involves introducing a new method, interpolate_to, to either the mne.io.Raw or mne.Epochs class. This method would:

  • Extract the existing channel positions from the input data.
  • Create a new info file with the desired final channel positions defined by the provided montage or template.
  • Use existing interpolation functions like mne.channels.interpolation._map_meg_or_eeg_channels or mne.channels.interpolation._make_interpolation_matrix to interpolate the existing channels to the desired positions.
    A possible API for this method is:
    epoch.interpolate_to(montage: DigMontage, method: str, reg: float)
    where montage is the desired final montage, method is the interpolation method to use (either spherical spline or field interpolation), and reg is the regularization parameter to pass to the chosen interpolation function.

Describe possible alternatives

The parameter montage could also be a list of str with the position names, or a str for the name of a template montage that would be defined in MNE.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions