Minor Downsampling bug? [Aperio svs images]
Derek Magee
D.R.Magee at leeds.ac.uk
Mon Jan 11 13:06:09 EST 2016
Yes, that sounds like the same issue. I've not got any other formats to try. One thing to say is I have never believed Aperio's non-integer downsamples were real. Ok, it reports some crazy downsample that is almost , but not quite 4 and 16, but I'm not convinced it isn't just a bug in Aperio's writing code. Image widths/heights can be non integer multiples as they all have to be integer, but full width/height don't have to be a power of 2. But do they really interpolate every pixel based on a non-symmetric neighbourhood? rather than just simple downsampling (averaging over 4x4 regions) and truncating the fractional pixel? I would seem an odd choice computationally and in terms of image quality to have downsampled pixels not lined up with native resolution pixels - although it is possible. If it's just a truncation then it is in fact integer, and they've mistakenly used the ratio of widths or heights not taking into account truncation of fractional pixels). I have no evidence either way though!
However, importantly, If you treat it as non-integer internally you'll always get this. Assuming it is integer, the location could also be wrong by up to 1 native pixel (0.25 px at downsample 4) towards the right/bottom. As the x,y input to openslide_read_region() is an integer you can't take the "it doesn't really matter I'll divide x,y through by the specified value 4.003, or whatever) approach as a user, you are always going to be interpolating a fractional pixel location, rather than just returning data. The fact is I AM using OpenSlide wrong as I'm dividing by 4 not 4.XXX of 3.99XXX or whatever it is (as is the person who reported issue 142) , but I couldn't use it right as I would get a floating point value which I'd have to round to an integer anyway creating a similar (if not identical) position error, just for a different reason.
What to do? Bug or feature? You decide? I'd ask Ole Endhorn (I haven't an up to date E-mail for him since he left Aperio, but could ask round a few folks) if it really is a non-integer downsample. If so, there isn't really anything you can do about it, unless you allow floating point x,y in openslide_read_region(). Even then there will be slight rounding errors. However, if it is in fact just a mis-reported integer downsample (as I suspect) then you can just fix it for Aperio images and use integer downsampling internally. Or, You could have an openslide_treat_levels_as_nearest_integer() (or power of 2) option, which would at least allow access to non-interpolated values (which you can't currently get, which is the cause of the problem).
In the meantime users treating it as integer downsampling and loading in blocks is at least exactly constant (if not necessarily exactly correct) so as not to cause problems with image analysis. The difference in location between integer and non-integer downsampling is tiny in practice for svs images.
HTH
Derek
-----Original Message-----
From: openslide-users [mailto:openslide-users-bounces+d.r.magee=leeds.ac.uk at lists.andrew.cmu.edu] On Behalf Of Benjamin Gilbert via openslide-users
Sent: 11 January 2016 17:12
To: openslide-users at lists.andrew.cmu.edu
Subject: Re: Minor Downsampling bug? [Aperio svs images]
Hi Derek,
On Mon, Jan 11, 2016 at 12:52:36PM +0000, Derek Magee via openslide-users wrote:
> I think I've just discovered a minor (but quite annoying, if you are
> doing image analysis) bug in OpenSlide. When you request two
> overlapping sub-regions of arbitrary offet using
> openslide_read_region() the values you get back are similar at the
> same global location, but can differ by (it seems) up to 1 value in
> each channel. While you can't tell the difference looking at the
> image, this can be annoying when doing image analysis on overlapping
> tiles. I've observed this at a non-native downsample level (I can't tell if it occurs at level 0).
Thanks for the report. This is probably the same issue:
https://github.com/openslide/openslide/issues/152
I haven't tracked this down, but I suspect the cause may be Aperio's non-integer downsamples. Are you able to reproduce this with other file formats?
--Benjamin Gilbert
_______________________________________________
openslide-users mailing list
openslide-users at lists.andrew.cmu.edu
https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users
More information about the openslide-users
mailing list