Skip to content

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

Closed

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

Activity

  1. welcome commented on Mar 7, 2024

    @welcome

    Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴

  2. apmellot commented on Mar 7, 2024

    @apmellot
    Author
  3. larsoner commented on Mar 7, 2024

    @larsoner
    Member

    I think this can be tackled at the same time and using hopefully the same API as #9609, can you check?

  4. larsoner commented on Mar 7, 2024

    @larsoner
    Member

    ... specifically this proposal:

    #9609 (comment)

  5. agramfort commented on Mar 7, 2024

    @agramfort
    SponsorMember

    +1 for interpolate_to method next to interpolate_bads

  6. sappelhoff commented on Jul 27, 2024

    @sappelhoff
    Member

    +1, this would be a cool feature

  7. added this to the 1.9 milestone on Jul 27, 2024
  8. modified the milestones: 1.9, 1.10 on Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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