openslide_get_best_level_for_downsample and numeric stability

j.hudecek at nki.nl j.hudecek at nki.nl
Tue Dec 13 07:39:35 EST 2016


Hi,

I've noticed openslide_get_best_level_for_downsample doesn't always return the best level. I have an image with 4 levels:

{w:85655 h:42392}
{w:21413 h:10598}
{w:5353 h:2649}
{w:2676 h:1324}

So openslide_get_level_downsample for second level returns downsample value 4.0000700509036573.

When I call openslide_get_best_level_for_downsample(handle, 4) it returns 0. When I call it with 4.001 it returns 1 as expected.
I'm not sure what's best solution. Should get_best_level_for_downsample also "look" upwards - ie. if there is a level with a slightly larger downsample use it? Or should I just add epsilon (how big?) to the downsample before calling it myself?
I would like to avoid scaling the image 4x as it is a performance hit and completely unnecessary.

Regards,
Jan Hudecek

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/openslide-users/attachments/20161213/b6f848ed/attachment.html>


More information about the openslide-users mailing list