read_block on a CZI-file fails with "Assertion failed" for certain downsample factors
Hi, I am having a large CZI image and want to retrieve downsampled versions of tiles.
The size of my input image is: 17498, 33745 (width, height)
Calling read_block with the following parameters
img = scene.read_block(
rect=(16128, 20160, 1370, 4096),
size=(171, 512))
results in the following error message:
RuntimeError: OpenCV(4.1.1) /root/.conan/data/opencv/4.1.1/slideio/stable/build/d2d7c166445ab3854d53f31fe8dffbc378a29414/source_subfolder/modules/core/src/matrix.cpp:465: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'
The tile that I want to retrieve should be still within the image. Reading the tile on the full resolution seems to work:
img = scene.read_block(
rect=(16128, 20160, 1370, 4096),
size=(1370, 4096))
Also If I slightly modify the size parameter it works:
img = scene.read_block(
rect=(16128, 20160, 1370, 4096),
size=(172, 512))
I guess this problem occurs, because there is a slightly different downsample-factor for x and y:
rect[2] / size[0], rect[3] / size[1]
Out[25]: (7.965116279069767, 8.0)
Best regards, Thomas