Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
apmellot opened this issue Mar 7, 2024 · 5 comments
Labels

Comments

@apmellot
Copy link

apmellot commented Mar 7, 2024

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

@apmellot apmellot added the ENH label Mar 7, 2024
Copy link

welcome bot commented Mar 7, 2024

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

@apmellot
Copy link
Author

apmellot commented Mar 7, 2024

@antoinecollas @agramfort

@larsoner
Copy link
Member

larsoner commented Mar 7, 2024

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

@larsoner
Copy link
Member

larsoner commented Mar 7, 2024

... specifically this proposal:

#9609 (comment)

@agramfort
Copy link
Member

+1 for interpolate_to method next to interpolate_bads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants