informatics-isi-edu / openseadragon-viewer

2D viewer with openseadragon
Apache License 2.0
5 stars 2 forks source link

Line thickness variation with zoom #37

Closed rastogi-bhavya closed 4 years ago

rastogi-bhavya commented 4 years ago

How should the line-thickness of SVG object be varied when we zoom in/out?

Current we are first setting a min-max range (X1.5 - X3.5). this range is mapped linearly to the min-max zoom levels of the OSD. On each zoom in the OSD zoom level is multiplied by 2 and on zoom out it is divided by 2.

rastogi-bhavya commented 4 years ago

The min zoom level and max zoom levels of OSD are obtained by calling the OSD APIs. There is no documentation available on how these two values are calculated, so I had do some of my own experimentation to figure that.

IH = image height IW = image width VH = osd viewport height VW = osd viewport width

From my understanding the maxZoom = IW/VW minZoom = IW/VW but in case of minZoom calculation there are 2 cases

  1. (VH/VW) > (IH/IW) minZoom = 1
  2. (VH/VW) < (IH/IW) minZoom = IW´/VW; IW´= (VH*IW)/IH

Since the min and max zoom is dependent on the viewport of the OSD, it is also dependent on the screen (display) resolution. Therefore a user on a higher resolution screen (4K) may only be able to zoom in once, whereas a user with a lower resolution screen (1080P) may be able to zoom in multiple times on the same image.

rastogi-bhavya commented 4 years ago

I tried a new method, in which case the change in thickness level was same for each case. To do this, I calculated the current line thickness based on the log values of maxZoom, minZoom and currentZoom of the OSD. Although this make the change uniform, there isn't much visible impact, because the output range is small (1.5-3.5).