Skip to content

ENH: add spline interpolation motion correction for fNIRS (motion_correct_spline)#13693

Draft
leonardozaggia wants to merge 8 commits intomne-tools:mainfrom
leonardozaggia:nirs-motion-spline
Draft

ENH: add spline interpolation motion correction for fNIRS (motion_correct_spline)#13693
leonardozaggia wants to merge 8 commits intomne-tools:mainfrom
leonardozaggia:nirs-motion-spline

Conversation

@leonardozaggia
Copy link

@leonardozaggia leonardozaggia commented Feb 25, 2026

Reference issue (if any)

Nonne (new feature)

What does this implement/fix?

Adds motion_correct_spline (alias spline) to mne.preprocessing.nirs for spline interpolation-based motion correction of fNIRS data.

For each detected motion-artifact segment the signal is detrended with a smoothing spline, then consecutive segments are baseline-shifted so they connect smoothly. Accepts a per-channel artifact mask tIncCh; when None, only spline detrending is applied with no baseline shifting.

Based on Homer3 v1.80.2 hmrR_tInc_baselineshift_Ch_Nirs (Huppert et al. 2009).

Additional information

@leonardozaggia leonardozaggia changed the title WIP: ENH: add spline interpolation motion correction for fNIRS (motion_cor… ENH: add spline interpolation motion correction for fNIRS (motion_correct_spline) Feb 25, 2026
@larsoner
Copy link
Member

@leonardozaggia I wonder if these should live in https://github.com/mne-tools/mne-nirs/tree/main/mne_nirs/preprocessing instead... we can iterate and release faster over in mne-nirs than we can here, and at some point I think decided we should try to put newer functionality there when possible. WDYT?

@leonardozaggia
Copy link
Author

@arsoner thanks for your feedback.
I considered this point when first working on this PR. At the end I opted for mne-python because the only other motion regression technique available - TDDR - lives here and thought it best for users to have the motion correction techniques in the same place.

@leonardozaggia
Copy link
Author

But of course, I am open to cancel my PR and submit a new one to the dedicated mne-nirs repo if you think it's best :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants