Skip to content

read_block returns wrong image for czi images when retrieving reduced size

hi,

when trying to read a whole CZI image at a reduced size, an erroneous image is returned.

test_image: https://drive.google.com/file/d/1-EL1lBJr54AGrDuSiZI2xe7biNqb2Rxs/view?usp=sharing

code snippet how to reproduce the problem:

import cv2
import slideio

path = 'zeiss.czi'
slide = slideio.open_slide(path, driver='CZI')
scene = slide.get_scene(0)
img = scene.read_block(size=(scene.size[0]//2, scene.size[1]//2))

cv2.imwrite("/home/tom/img.jpg", img)

actual image looks like: img

however, the actual image should look like: Screenshot_2022-05-18_16-01-33 (this is just a screenshot, so the resolution is not correct...)

slideio version: 1.0.2.

Furthermore, I've got questions how slideio handles reading such large images:

  • does the czi format has some pyramidal structure for efficient retrieving the image at a lower resolution?
  • does slideio even support that?
  • is it possible to check if a CZI file contains such a pyramidal structure using slideio?

BR, Thomas

Edited by Thomas Ebner