Understanding API openslide_read_region's arguments

Benjamin Gilbert bgilbert at cs.cmu.edu
Tue Nov 13 17:31:45 EST 2012


On 11/12/2012 07:57 PM, Sriram Somanchi wrote:
> Can someone explain me the API openslide_read_region’s arguments x and
> y? The documentation says that it is in reference to level0. Does it
> mean that if I am retrieving image data from higher levels I have to
> always map the coordinates to level0 and then make a call?

Yes.

> let’s say the downsample for level1 is 4. If I make a call
> openslide_read_region(slide, buf, 0, 0, 1, 1, 1) I know I will get an
> approximate aggregate of 4x4 grid of level 0 starting at 0, 0. However
> I’m not sure what will a call like openslide_read_region(slide, buf, 2,
> 2, 1, 1, 1)?

You'll get the average of the surrounding 2x2 pixels in level 1.  We 
place slide tiles at sub-pixel resolution; Cairo then renders them to 
real pixels.

Note that downsamples are not always integers.

--Benjamin Gilbert



More information about the openslide-users mailing list