grabbing a region via python

Benjamin Gilbert bgilbert at cs.cmu.edu
Sun Feb 10 15:31:42 EST 2013


On 02/09/2013 03:36 PM, David Gutman wrote:
> So in my case--- if I did read_region I would grab layer 0.... and
> then say I get a 4K box with the upper left corner at 4096,4096.... I'd
> then have to decimate that image by a power of two to make it a "20X"
> tile...
>
> Or is there a function that will do this for me automatically..

OpenSlide only gives you the resolutions that are physically stored in 
the slide file.  If you want a different resolution you have to do the 
scaling yourself.

> In the second example...if I specified the upper coord of 10Kx10K...
> but used region 1 as the level to grab... I'd still get a 4Kx4K output
> but instead would be a lower resolution image... and go from
> 10,000,10000 --> 26384/26384 in "ref frame 0 coordinate) but in "ref
> frame 1" coordinates would be from 1024,1024 -> (5120,5120)

The level 1 coordinates would be ((2500, 2500), (6596, 6596)), assuming 
a 4x downsample, but the rest of that is right.

--Benjamin Gilbert



More information about the openslide-users mailing list