0

I'm reading a tiff file using OpenSlide. Due to its large size, I'm planning to read the image by regions of 4k x 4k using read_region() function. After getting that region, I want to do the same process I have planned for the complete tiff file. To continue that process, I need the image read in OpenSlide. So I can use OpenSlide parameters. I tried to read the selected region using read_region with Openslide again as follows.

wsi = wsi.read_region((0,0),0,(4000,4000))
wsi = openslide.OpenSlide(wsi)

The issue was I could use parameters I usually get when reading a tiff file using OpenSlide. Does anyone know a way to solve this issue?

SjAnupa
  • 102
  • 10
  • `read_region` should return pixel data, don’t assign it to your `wsi` variable if you want to read other regions later. – Cris Luengo Sep 14 '21 at 19:05
  • @CrisLuengo I'm using a for loop to read other regions. But the problem is I need to do the operation to that selected region as an OpenSlide Object. Like using the level_dimentions, level_downsampling variables for this selected region in OpenSlide. – SjAnupa Sep 14 '21 at 19:20
  • You don't select a region with `read_region`, you simply read in those pixels. The `level_dimensions` and `level_downsamples` values are the same for all the regions, you get those values when you first open the image file, they never change. – Cris Luengo Sep 14 '21 at 19:40
  • 1
    Try to create a PIL Image object from the image array and wrap that as a [`openslide.ImageSlide(PilImageObject)`](https://openslide.org/api/python/#wrapping-a-pil-image). – cgohlke Sep 15 '21 at 02:42

0 Answers0