bounds outside level 0 width and height
Benjamin Gilbert
bgilbert at cs.cmu.edu
Mon Apr 9 02:57:13 EDT 2018
On Thu, Apr 05, 2018 at 04:52:13PM -0400, Ryan McLoughlin wrote:
> I've noticed that in some slides the "bounds" rectangle defined in the
> openslide properties does not fall cleanly inside the outer rectangle
> (defined by the slides' width and height properties). For example I have a
> MIRAX slide with:
>
> [...]
>
> Notice that bounds_x < 0 and also that bounds_y + bounds_height > height.
This is semi-intentional behavior, complicated by a bug or two. As a
general rule, OpenSlide uses the coordinate plane defined by the underlying
slide file. Unfortunately, some MIRAX slides have pixels which are outside
the bounds of that coordinate plane. If those pixels are on the right or
bottom edge of the slide, we arguably should extend the slide dimensions to
encompass the extra pixels, but we currently don't; however, OpenSlide will
allow you to read those pixels successfully. If the out-of-bounds pixels
are on the left or top edges of the slide, there's nothing we can do about
the coordinate plane, but we should still allow the pixels to be read from
negative coordinates; however, we currently don't due to a bug in the
generic API code.
> I noticed that when I used vips' autocrop feature to make a DZI file, like
> this:
>
> vips dzsave input.mrxs[autocrop] output
>
> the width and height of the DZI were 83730 and 117503, indicating that vips
> simply ignored the parts of the bounds that were outside the outer
> rectangle. Is this the right approach to take?
VIPS has explicit code to clip the slide bounds to the image size, which I'd
call a bug. Reading outside the image boundaries is a safe operation with
OpenSlide, even if it's not currently returning the desired pixels in all
cases.
--Benjamin Gilbert
More information about the openslide-users
mailing list