<div dir="ltr">This is worth filing as an issue at <a href="https://github.com/openslide/openslide/issues/new">https://github.com/openslide/openslide/issues/new</a>.<div><br></div><div>It's a documentation issue, at least. But I suspect there is a subtle bug in OpenSlide that is causing this.</div><div><br></div><div><br></div><div>Adam</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 11, 2016 at 7:52 AM, Derek Magee via openslide-users <span dir="ltr"><<a href="mailto:openslide-users@lists.andrew.cmu.edu" target="_blank">openslide-users@lists.andrew.cmu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p class="MsoNormal" style="text-autospace:none">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
<span style="font-size:9.5pt;font-family:Consolas">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).<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">An example (level 1 is a downsample by a factor of 4):<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">openslide_read_region() 13200,9360,840,360,1<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">openslide_read_region() 14160,8400,840,840,1<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">I wrote a little matlab script to visualise the pixel differences in the overlapping area. The visualisation is below:<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span><img width="616" height="476" src="cid:image001.png@01D14C6D.97172E00"></span><span style="font-size:9.5pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">(while this looks bad, the range is scaled, and the max difference in any colour channel is actually +/-3, and it’s hard to find examples where it is greater
than +/-1). <u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">I then implemented a workaround that creates an arbitrary sub-image by loading appropriate 240x240 blocks on a regular grid and copying these over to a new image.
This solves the issue and every pixel is now identical. Obviously this is at the cost of extra calls to openslide_read_region().<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">If anyone is using openslide for image analysis it is worth bearing this in mind as I spent a good few hours trying to debug my image analysis routines which
were failing only rarely (due to this inconsistency), before realising there was no bug and it was the pixel values going in that were different.<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></span></p><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">Derek<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</font></span></div>
</div>
<br>_______________________________________________<br>
openslide-users mailing list<br>
<a href="mailto:openslide-users@lists.andrew.cmu.edu">openslide-users@lists.andrew.cmu.edu</a><br>
<a href="https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users" rel="noreferrer" target="_blank">https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users</a><br>
<br></blockquote></div><br></div>