dsb_utils.py 文件源码

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

项目:diagnose-heart 作者: woshialex 项目源码 文件源码
def get_contour_portion(images,segb):
    ns = images.shape[0];
    nt = images.shape[1];
    portion = np.zeros((ns,nt));
    for s in range(ns):
        for t in range(nt):
            img = images[s,t,0];
            seg = segb[nt*s+t,0];
            if np.sum(seg)<10:
                portion[s,t] = 0.0;
                continue;
            mask = cv2.dilate(seg,np.ones((7,7)))-seg>0;
            z = img[mask];
            x,y = np.where(mask);
            lvinside = np.mean(img[seg>0]);
            lvoutside = np.percentile(z,20);
            ccut = lvinside * 0.3 + lvoutside * 0.7;
            cnt_sh = get_contour_shape(x,y,z);
            if cnt_sh is None:
                portion[s,t] = 0.0;
            else:
                res = get_eff_portion(cnt_sh,ccut);
                portion[s,t] = res;
    return portion;
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号