Skip to content

ENH: add PCA-based motion correction for fNIRS (motion_correct_pca)#13691

Draft
leonardozaggia wants to merge 7 commits intomne-tools:mainfrom
leonardozaggia:nirs-motion-pca
Draft

ENH: add PCA-based motion correction for fNIRS (motion_correct_pca)#13691
leonardozaggia wants to merge 7 commits intomne-tools:mainfrom
leonardozaggia:nirs-motion-pca

Conversation

@leonardozaggia
Copy link

@leonardozaggia leonardozaggia commented Feb 25, 2026

Reference issue (if any)

What does this implement/fix?

Adds motion_correct_pca (alias pca) to mne.preprocessing.nirs for
PCA-based motion correction of fNIRS data.

The function extracts motion-artifact segments, performs SVD across all
fNIRS channels, removes the dominant principal components explaining the
top nSV fraction of variance, and reinserts the cleaned segments.

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

Returns the corrected Raw, the normalised singular values, and the number
of components removed.

Additional information

@leonardozaggia leonardozaggia changed the title WIP: ENH: add PCA-based motion correction for fNIRS (motion_correct_pca) ENH: add PCA-based motion correction for fNIRS (motion_correct_pca) Feb 25, 2026
@drammock
Copy link
Member

For us to incorporate this, I think we would need explicit permission from a Homer3 maintainer to relicense (the Homer3 software license agreement looks custom, mostly the same as BSD-2 but with an extra paragraph at the end).

When we incorporate BSD-licensed code we typically add names and link to the donor project inline in the source file(s) where the adapted/translated code ends up.

@leonardozaggia can you tag someone here with relevant authority to give that permission?

@leonardozaggia
Copy link
Author

@drammock thank you for the feedback! I think @dboas or @jayd1860 could help us with that.
I am now waiting to see if I should resubmit the nirs-motion-correctoin PRs to the dedicated mne-nirs dependency instead, as per discussed here: #13693

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