Convert image array to original svs format

冷暖自知 提交于 2019-12-11 16:55:02

问题


I'm trying to apply a foreground extraction to a SVS image (Whole Slide Image) usign OpenSlide library.

First, I converted my image to an array to work on my foreground extraction:

image = np.asarray(oslIm.read_region((0, 0), level, oslIm.level_dimensions[level]), dtype=np.uint8)[:, :, 0:3]

After that I generated my mask, which I applied to my converted image:

plt.imshow(image * final_mask[:, :, np.newaxis])
plt.xticks([])
plt.yticks([])
plt.savefig("./masks/ResultingImage.png", format='png', dpi=90, pad_inches=0.1, bbox_inches='tight');
plt.close()

What I want is to convert my image to svs again so I can work on the foreground of the original image and apply my patch extractor (tile the image in patches for annotation ease)

def sample_and_store_patches_by_row(
        file_name,
        pixel_overlap,
        patch_size=512,
        level=17,
):

How can I do that?

Regards

来源:https://stackoverflow.com/questions/53242599/convert-image-array-to-original-svs-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!