google / neuroglancer

WebGL-based viewer for volumetric data
Apache License 2.0
1.09k stars 299 forks source link

Scrolling in higher mip levels #269

Open cnzqy1 opened 3 years ago

cnzqy1 commented 3 years ago

I noticed that at non-zero mip levels every movement in z (either using mouse wheel or keyboard shortcut) still corresponds to movement of one slice at mip 0. This makes scrolling choppy at higher mip levels if the volume is downsampled isotropically. Would be possible to provide a configuration option to allow scrolling current_res/full_res number of full-resolution slices (i.e. always one voxel per scroll regardless of voxel resolution) at a time so that scrolling will be smooth?

jbms commented 3 years ago

Currently arrow keys and mousewheel all move by 1 voxel (in the global coordinate space). Shift+mousewheel and shift+arrow keys move by 10 voxels. I have indeed found this to sometimes move too slowly when zoomed out. In principle it would be possible to instead take the current zoom factor into account, but it seems like it may be a bit tricky to define exactly what the behavior should be in a consistent way, and there would also need to be some key/mouse binding for enabling it, unless it were a global toggle.

While your suggestion to effective move by one voxel in whatever downsample level is currently being displayed makes sense in the common case where you have a common set of downsample levels for all layers, note that the precise downsample levels that are displayed is a rather low-level attribute of an individual view of a particular data source. In general each data source may be at different resolutions or be affine transformed, etc., which makes defining consistent movement behavior based on that tricky, though I suppose it could be possible to determine a minimum movement amount that would be noticeable given the currently displayed layers. Currently, all navigation in Neuroglancer is based on either the global voxel size or the continuous zoom factor, and it seems more natural to adjust the movement based on that, though.

cnzqy1 commented 3 years ago

Thanks for the reply! I think a global toggle is probably the simplest option without creating new key bindings, and users can simply turn it on or off depending on their particular needs (smooth scrolling vs. consistent scrolling speed).

Layers with different voxel sizes are indeed a complication. Using the continuous zoom factor seems complicated, so maybe it's the simplest to just ensure that each scroll moves at least one voxel in at least one visible layer.