hms-dbmi / viv

Library for multiscale visualization of high-resolution multiplexed bioimaging data on the web. Directly renders Zarr and OME-TIFF.
http://avivator.gehlenborglab.org
MIT License
287 stars 46 forks source link

`zoomOffset` from `modelMatrix` in `MultiscaleImageLayer` might not be correct? #680

Open jeffpeck10x opened 1 year ago

jeffpeck10x commented 1 year ago

It looks like zoomOffset is coming from the scale of the incoming modelMatrix.

https://github.com/hms-dbmi/viv/blob/26e67bf6977a42227c151aed17b985063ad5eb6d/packages/layers/src/multiscale-image-layer/multiscale-image-layer.js#L144

This does not work as expected when the scale factor is two-dimensional (i.e. new Matrix4().scale([1, .5]).

But, I am also wondering if this is even necessary. Doesn't the deckgl TileLayer already account for this?

I have not had time to experiment with this, but even just observing the issue of two-dimensional scales, this should at least be updated to defer to whatever the smaller scale is for calculating offset.

ilan-gold commented 1 year ago

@jeffpeck10x Please play around and let me know. If you could share a screenshot that would be great. I actually just made a PR recently here for handling model matrices properly that are like you're describing but I didn't notice anything off at all, and the difference in scaling was much, much worse ([2, 38]). I'll have a think.

jeffpeck10x commented 1 year ago

Ok, I will see what I can find. Unfortunately, I cannot share the screenshots of data that I am noticing issues with this, but once I get a chance to play around, I can try it with something more generic.

What I have found is that it seems to be miscalculating the tiles that need to be rendered when you zoom in. I have noticed it even with [1, .99].

I am starting to wonder if it is indeed the TileLayer that is not working as expected. But, that it is working for you with an extreme scaling like [2, 38] perhaps means that I am doing something differently.

It probably won't be until mid-next week that I dig in further, but I will post here with whatever I find.