magland / sortingview

Web app for viewing results of ephys spike sorting
Apache License 2.0
25 stars 8 forks source link

Select units with a particular label #122

Open acomrie opened 3 years ago

acomrie commented 3 years ago

Potential feature request: select all units that have a certain label. Haven't run into a way to do this in sortingview yet. Would be nice to be able to easily highlight all units currently labeled as accepted, mua, noise, etc, especially when looking at views other than the units table.

jsoules commented 3 years ago

I can certainly see the utility of this.

I'm assuming this would be limited to views that show a unit selection table? I would imagine you would just click on a label to select all such units, but that obviously wouldn't work too well if there's no table & thus no displayed labels to click. (In those cases of course you can always get the effect by selecting them from the units table directly.)

To establish the scope a little more-- Would you need more sophisticated functionality--like shift-click to add labeled units to current selection, control-click to toggle selection of a particular label? The former would (among other things) let you manually do union of labels, the latter would let you select a lot of units and then exclude those with a particular label (so like, use other in-development features to select all units with a firing rate between 5 and 15 Hz, but then exclude everything with 'rejected' tag)...

Unfortunately I'm not seeing a way to use these mechanics to support selecting the intersection of tags (e.g. select everything marked as both noise and reject). Dunno if you need that, though.

acomrie commented 3 years ago

Thanks for your thoughts on this.

To say a bit more about what I was thinking originally - I was considering the case where I want to select all units of a particular label (usually via Units Table right now), then go inspect those units in another view (such as autocorrelograms or average waveforms, etc, that may or may not have its own table). Selecting from the Units Table is slow for large sorts for us at the moment, where we would first sort the Units Table by label, then select each unit of interest one by one and wait for them all to become highlighted, then could switch to another view to inspect that subset of units. Initially I was imagining buttons somewhere on the left selection panel so that this feature wouldn't be tied to the existence of a table in a particular view.

After reading your comment, though, I agree that the shift-click and control-click solution will functionally address this feature request. (I originally requested the shift-click feature and passed it on to Kyu, who kindly posted that issue on our behalf... so I have been following it). Both a select-by-label and shift-click feature would also speed up selection of subsets of data in general, because they avoid selecting units one by one -- and I think shift-click is the more generalizable solution, as you pointed out, because it can also be used to filter by metrics, etc.

I haven't run into a need to select by intersection of tags yet, but can keep an eye out for that as I continue working with sortingview. Shift-click would at least make that easier even if it can't be done in only one step. Seems alright to not worry about it for the time being.

My vote would be to prioritize moving ahead with the shift- and ctrl-click functionality, then deprioritize this issue for now, and only return to the select-by-label issue later if select-by-label still seems like it would be useful (after testing with shift-click enabled). What do you think?

Related feature request (happy to split into another issue, though) - would be to track the counts of each label and the number of selected units in the units table. Would probably make sense for the display to live over on the left menu panel somewhere. On large sorts I often find myself wondering how many units I have labeled as noise, say - are there 10 noise clusters and I have 10 units selected, did I catch them all? Or whether I have 72 selected units, 50 reject clusters, and 22 mua clusters, the latter two of which sum to the former? Particularly when there are hundreds of clusters, scrolling around to check how many are selected, or how many units have a particular label, can take a moment. These little summary stats would be user-friendly, I think - would they be difficult or complicated to display? Thanks as always!!

xlsun79 commented 3 years ago

@acomrie @emilymonroe95 and I have discussed this feature or something related. I was wondering if it's possible to add the curation labels to each unit in the waveform view (or just make the rejected units gray in the waveforms plot) to show whether we've labeled them as "noise","mua" etc. That way we could see clearly which units are already rejected or accepted by eyeballing them in the waveform view (which is the main metric we use to curate) and won't re-select units that were already curated in next steps of curating. Right now we need to refresh the page and reselect units in the units table before inspecting them in the waveform window, which could take a while to load. Thank you very much!