You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add method for channel interpolation to predefined channel positions/montage #12486
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.
Activity
welcome commentedon Mar 7, 2024
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴
apmellot commentedon Mar 7, 2024
@antoinecollas @agramfort
larsoner commentedon 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 commentedon Mar 7, 2024
... specifically this proposal:
#9609 (comment)
agramfort commentedon Mar 7, 2024
+1 for interpolate_to method next to interpolate_bads
sappelhoff commentedon Jul 27, 2024
+1, this would be a cool feature