make_tissue_mask.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Camelyon17 作者: deepiano 项目源码 文件源码
def save_slide_cutting(file_path, save_location, level):

    slide = OpenSlide(file_path) 
    print('==> saving slide_lv_' + str(level) + ' at ' + save_location)

    x_lv_, y_lv_ = 0, 0
    w_lv_, h_lv_ = slide.level_dimensions[level]

    wsi_pil_lv_ = slide.read_region((0,0), level,\
        (w_lv_, h_lv_))

    wsi_ary_lv_ = np.array(wsi_pil_lv_)
    wsi_bgr_lv_ = cv2.cvtColor(wsi_ary_lv_, cv2.COLOR_RGBA2BGR)

    margin_top = int(round(h_lv_ / 12.))
    margin_bottom = int(round(h_lv_ / 32.))
    wsi_bgr_lv_[0:margin_top, :] = 255
    wsi_bgr_lv_[h_lv_ - margin_bottom:h_lv_, :] = 255

    cv2.imwrite(save_location, wsi_bgr_lv_)

#    plt.subplot(1,1,1), plt.imshow(wsi_bgr_lv_)
#    plt.xticks([]), plt.yticks([])
#    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号