-
Notifications
You must be signed in to change notification settings - Fork 190
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
A thread to discuss inter-session alignment. #2626
Comments
I'm not doing this myself, but others in my group are so I really appreciate you starting this thread! I think these days there are plenty of people doing multiple recordings that would benefit from machinery in spikeinterface. I'll definitely be lurking on this thread :) |
And this could be a good project for the next hackthon in Edinburgh |
Very interesting thread! I think #2911 could be related to 1) if we try to compute the best unit matching possible across all sessions based on some kind of similarity metrics. |
Thanks everyone, I was thinking to get started on this soon. Please see below for a plan would be great to hear your thoughts.
The API here is inspired by the existing within-session This function would output a list of corrected motion recordings, using the existing The inter-session correct displacement function can also output a
It may be that for some cases interpolating the raw data is too heavy. Instead Alessio suggested interpolating only the templates before unit matching. Using the output
There is already some template-based unit matching in SpikeInterface and we have been working with UnitMatch who have kindly implemented a SpikeInterface data loader. So we could possibly merge these into some kind of Would be great to get feedback on this! Some notes on vocabulary (related @zm711 to our previous discussion) here 'drift' and 'motion' do not really feel like appropriate terms for inter-session changes in the probe position. I was thinking to always stick to 'displacement' in the context of inter-session displacement and reserve 'drift' and 'motion specifically for within-session alignment problems. |
Sounds like a great plan! I am less familiar with motion correction but definitely glad to help for the spikeinterface template-based unit matching. I would strongly suggest that alignment be an option so that we can 'skip' it when it is not needed. Ideally I would also like to be able to convert the Matching object to a Sorting one to postprocess it as usual with an (extended?) sorting (matching?) analyzer. And we should definitely implement some quality metrics on how good the unit matching is, I do not know if you have already some in mind. |
Hi @JoeZiminski. |
Thanks @samuelgarcia, that's okay, cool to hear about the future plans for including segment! For now each recording could just be handled as a separate session, and in future this extended to the multi-segment case along with the motion estimation? |
Another approach of interest here |
relevant: here |
Following a discussion on the Slack channel about inter-session alignment I thought I'd start an issue to summarise / discuss these things and come up with a plan on how this could be handled in Spikeinterface.
There are a couple of (not necessarily mutually exclusive) approaches:
1) post-hoc unit-matching
This approach matches units from independently sorted sessions. Current approaches includes Unitmatch. SI and Unitmatch teams are working together to ensure compatibility such that SI-sorted data can be easily read in Unitmatch. There is also the approach outlined in this paper which looks interesting. Typically the motion correction in these methods relies on putative matches between units across sessions, which may fail in the presence of large drift. Therefore alignment of either the traces (pre-sorting) or templates (post-sorting) across sessions, would compliment these methods.
2) Concatenating sessions and motion correcting
Another approach is to concatenate two sessions together and perform motion correction as if they were a single session, then sort. A concern is how current intra-session methods will perform in the presence of significant drift between sessions (manifesting as a sudden, large 'jump' in the middle of the concatenated recording). In the NP2 paper the Kilosort team suggest this approach does not work so well with the iterative template method*. In the Dredge paper this approach appears to be used successfully. It would be interesting to see at what level of inter-session drift (linear and nonlinear) this approach fails for the available methods. I guess the machinery for such tests has already been largely developed here.
3) Alignment of raw data pre-sorting
This approach is described in the NP2 paper, roughly it goes like 1) within-session motion correction for two sessions 2) compute drift between session and add compensation to within-session offsets 3) interpolate. In theory it should also be quite possible to do with the existing
correct_motion
machinery, just requiring some additional logical to incorporate inter-session registration offsets prior to interpolation.4) Alignment of template waveforms post-sorting
This approach is related to post-hoc unit matching (1) specifically. For these methods, instead of interpolating the raw data based on estimated inter-session drift prior to sorting, only the templates are shifted prior to unit-matching. (@alejoe91 I think this is the idea you had at the Unitmatch meeting, if I understood correctly). This should have the same effect as (3) for unit-matching but would be much faster.
In terms of action-points, to my knowledge (1) is actively being worked on but (3) and (4), as well as validation discussed in (2) are not. Therefore supporting these inter-session approaches in Spikeinterface might be a nice idea if others think they have utility.
* Kilosort team suggest this approach does not work well
from here.
The text was updated successfully, but these errors were encountered: