cytomine / Cytomine-Web-UI

The Cytomine-WebUI is the official front-end for Cytomine, developed in VueJS. You will find more information about the Cytomine project on our website.
https://www.cytomine.org
Apache License 2.0
20 stars 22 forks source link

Grid lines when displaying .svs images #30

Open alan-dot-oneill opened 4 years ago

alan-dot-oneill commented 4 years ago

When .svs images are displayed at lower magnification levels, they appear to have faint grid lines. I do not see these line when the magnification is increased to 5x or higher. The lines appear whether or not digital zoom is on. These lines don't appear when the image is in .ndpi or .jpg format. The images below are from screenshots of the browser taken at different magnification levels.

Magnification 0.63x magnification 0 63

Magnification 1.25x magnification 1 25

Magnification 2.5x magnification 2 5

Magnification 5x magnification 5

geektortoise commented 4 years ago

Thanks for the ticket. For information, these yellow lines are not displayed when you get tiles with the external clients (scripts).

urubens commented 4 years ago

Hi,

I've also noticed these lines with SVS files. IMHO, it's a backend-related issue. It would be great to check if the underlying tile images at problematic zoom levels have these yellow lines or not. An other interesting check would be to see if the tiles have the good size (256x256, except on borders).

According to https://openslide.org/formats/aperio/ SVS files uses 240x240 tiles and a zoom factor of 4 while Cytomine uses 256x256 tiles and a zoom factor of 2.

The computation of intermediate zoom levels are computed on the fly apparently here: https://github.com/cytomine/iipsrv/blob/c794ce2e89611504217eb386ae1bff312eb264dc/src/OpenSlideImage.cc#L277

Maybe a rounding issue ? Some overflow somewhere ? These are some tracks to investigate :-)

PeterCH-NY commented 3 years ago

Hope there can be a way to solve this problem

Aileron64 commented 2 years ago

I think I fixed it by updating line 232 of OpenSlideImage.cc https://github.com/cytomine/iipsrv/blob/c794ce2e89611504217eb386ae1bff312eb264dc/src/OpenSlideImage.cc#L232

    destPixel[0] = 255 * sourcePixel[2] / a;
    destPixel[1] = 255 * sourcePixel[1] / a;
    destPixel[2] = 255 * sourcePixel[0] / a;

However I don't have access to many other image types that it could possibly effect

geektortoise commented 2 years ago

Hello,

In the case of CMU-1.svs, the a value is 255 so not concerned by your fix https://github.com/cytomine/iipsrv/blob/c794ce2e89611504217eb386ae1bff312eb264dc/src/OpenSlideImage.cc#L220

On which image did you test ?

Aileron64 commented 2 years ago

Sorry, I've tested it on a lot of images, (including CMU-1.svs) at this point now with no issues, unfortunately if it doesn't work then I don't know enough about the logic to figure out why

Aileron64 commented 2 years ago

Is there a possibility that the alpha for the pixels on the edge of each segment in the grid is being miscalculated?