magland / sortingview

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

raster plot: increase thickness of individual events when zoomed in #183

Closed magland closed 2 years ago

magland commented 2 years ago

From Loren: For the raster display, would there be a way to increase the size of the individual ticks as one zooms in? The current size is great for long time windows, but things get hard to see on the ~100 ms timescale.

jsoules commented 2 years ago

This was discussed again today during our meeting. so I looked it up.

Right now, we draw each spike event as a line, with the x coordinate being the event time (scaled to the displayed window) and the y-coordinates being the height of the row allotted to that unit. The line is one pixel wide--the thinking was that it shouldn't actually have a width, it's just an instantaneous event; so it remains one pixel wide no matter how much you zoom in.

We could just use a thicker pen (2, 3, ...) pixels; or even set the pen width based on some formula.

We could also discretize the spike times in the train, based on e.g. the amount of time represented by each n pixels in the chart. That'd suggest a different way of constructing the graph; and would probably get faster rendering time (for high-frequency units) in exchange for more complex/time-consuming calculations & reduced expressivity of the visualization.

I think I would probably just go with increasing the drawing width to 3 pixels. Here's some before-and-after doing that (figurl: https://www.figurl.org/f?v=http://localhost:3000&d=3efdf652e24633ba8345fb6a02af9d01fc67e5d1&channel=flatiron1&label=SPANS_TEST): image image

After: image image

jsoules commented 2 years ago

The only real disadvantage of this is that at more zoomed-out scales, it winds up combining discrete firings into more continuous blocks. In this sample recording, it's not terrible, but it definitely isn't as crisp: image

I am sure there's a heuristic we can use to make this make more sense. Some options:

...the list goes on. I'm happy to explore this some more, but want to get a bit of input first to see if we even care.

@lfrank @khl02007

magland commented 2 years ago

I think the thicker pen makes it look a lot better. I'm not sure that the continuous block appearance is a problem.

As we discussed, I think it's better to draw the highlight behind the points (and behind the grid lines), rather than having it be semi-transparent.

I'll let @lfrank and @khl02007 comment.

lfrank commented 2 years ago

It would be helpful for me to see a zoomed view, but in general I also like the thicker pen and I think it will be much easier to see individual spikes. That said, an adaptive version might be nice if it’s easy to get the parameters right.

On Feb 28, 2022, at 1:09 PM, Jeremy Magland @.**@.>> wrote:

This Message Is From an External Sender This message came from outside your organization.

I think the thicker pen makes it look a lot better. I'm not sure that the continuous block appearance is a problem.

As we discussed, I think it's better to draw the highlight behind the points (and behind the grid lines), rather than having it be semi-transparent.

I'll let @lfrankhttps://urldefense.com/v3/__https://github.com/lfrank__;!!LQC6Cpwp!8erMHk6x4HZDqmrqQ7nCCxHAaScYd58pSlfmAhXZdQEgk0smiBsCMulFZaZsbzQMYA$ and @khl02007https://urldefense.com/v3/__https://github.com/khl02007__;!!LQC6Cpwp!8erMHk6x4HZDqmrqQ7nCCxHAaScYd58pSlfmAhXZdQEgk0smiBsCMulFZaavez-ZeA$ comment.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/magland/sortingview/issues/183*issuecomment-1054664441__;Iw!!LQC6Cpwp!8erMHk6x4HZDqmrqQ7nCCxHAaScYd58pSlfmAhXZdQEgk0smiBsCMulFZaZYGQdf5w$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABV4PSPWLJT5VG77UMAM3JDU5PQCDANCNFSM5OB54LMA__;!!LQC6Cpwp!8erMHk6x4HZDqmrqQ7nCCxHAaScYd58pSlfmAhXZdQEgk0smiBsCMulFZab658rwvw$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!LQC6Cpwp!8erMHk6x4HZDqmrqQ7nCCxHAaScYd58pSlfmAhXZdQEgk0smiBsCMulFZaZuLxXE4Q$ or Androidhttps://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!LQC6Cpwp!8erMHk6x4HZDqmrqQ7nCCxHAaScYd58pSlfmAhXZdQEgk0smiBsCMulFZaZPD5GAPQ$. You are receiving this because you were mentioned.

jsoules commented 2 years ago

@lfrank if it helps, you should be able to click the images above for a larger view. Or we can just install this one and you can see it live.

Since posting these images I also swapped the layer order of the highlight and raster content. I'm not a big fan of the effect, particularly with lighter-colored units--they wind up looking a bit like holes in the highlight--but legibility is more important than aesthetics. We can also try keeping the old order but using a more transparent setting; I had it set to 50% transparent but something like 25% or 20% might be more subtle.

magland commented 2 years ago

@jsoules One plus for putting the highlight behind the raster content is that then the colors for the different units don't change. But I do understand what you are saying about aesthetics. What if you were to use a lighter color blue for the highlight?

jsoules commented 2 years ago

I just pushed a new version of the branch (183-thicker-raster) to spikesortingview. I put the highlight spans in their own layer (so we can more easily swap back and forth) and dropped the alpha for the spans to 20% (so they're much lighter). (I should note I'm not at all attached to the color used for the highlight--I originally had the default as a purple color so it would contrast a bit with the row highlights for selected units--I just wound up picking this to make sure it would be visible when the spans were very narrow, but that was before I made the layer fully opaque for narrow highlight bands.)

Here's what it looks like with the highlight on top: image

vs. with the highlight below: image

As you can see, really subtle difference. There's some unit in the lower third of the image that is apparently mapped to white or something, which is very hard to see with the highlight on top; but on the other hand, I totally lose the unit just above that one (which I think is a light orange?) when the highlight is in a lower layer.

I think whatever we pick is going to have some drawbacks. Not sure if we need to go so far as to expose a color picker, but...

jsoules commented 2 years ago

Closed by SpikeSortingView PR #35.