python通过slideio模块读取病理图像文件

721 阅读1分钟

一个例子:

import slideio
slide = slideio.open_slide(wsi_path, "SVS" if wsi_path.endswith('svs') else "GDAL")
scene = slide.get_scene(0)  # scene.size:(W,H)
image = scene.read_block(scene.rect, (scene.size[0], scene.size[1]))# H x W x 3

其中read_block函数参数如下:

图片2.png

如下图所示, rect 参数中的x, y, width, height关系如下: x,与width平行,y与height平行,(x,y)代表读取区域的左上角的位置,原图像左上角对应的位置为(0,0), size 参数对应resize后的(width',height')