图像分割(四)图像分割评价标准及代码

您所在的位置:网站首页 risc医学 图像分割(四)图像分割评价标准及代码

图像分割(四)图像分割评价标准及代码

2024-07-11 22:06:51| 来源: 网络整理| 查看: 265

强烈建议参考如下两篇文章

Performance measure characterization for evaluating neuroimage segmentation algorithms

Metrics for evaluating 3D medical imagesegmentation: analysis, selection, and tool

main function (输入图像SEG 和 GT 分别为算法分割结果图像、分割金标准图像。对于多类分割的图像,需要先取出SEG和GT中对应的各类,然后使用下述函数单独计算该类。):

% test all segmentation metric functions SEG = imread('0.png'); GT = imread('1.png'); % binarize SEG = im2bw(SEG, 0.1); GT = im2bw(GT, 0.1); dr = Dice_Ratio(SEG, GT) hd = Hausdorff_Dist(SEG, GT) jaccard = Jaccard_Index(SEG, GT) apd = Avg_PerpenDist(SEG, GT) confm_index = ConformityCoefficient(SEG, GT) precision = Precision(SEG, GT) recall = Recall(SEG, GT) Dice_Ratio:

function dr = Dice_Ratio(SEG, GT) % SEG, GT are the binary segmentation and ground truth areas, respectively. % dice ratio dr = 2*double(sum(uint8(SEG(:) & GT(:)))) / double(sum(uint8(SEG(:))) + sum(uint8(GT(:)))); end

Hausdorff_Dist (得到hd 之后,还需要乘以像素的物理距离,才是真正的 Hausdorff 距离)(update: 对于三维体数据中该距离的计算,ITK方面给出的计算流程是:先将体数据匹配到同一物理空间,然后进行计算,这就要求两个体数据必须具备相同的物理参数。所以本代码不适用于三维体数据的计算。):

function hd = Hausdorff_Dist(SEG, GT) % SEG, GT are the binary segmentation and ground truth areas, respectively. % erode element s = cat(3, [0 0 0 ; 0 1 0 ; 0 0 0], [0 1 0 ; 1 1 1 ; 0 1 0], [0 0 0 ; 0 1 0 ; 0 0 0]); % generate boundary Boundary_SEG = logical(SEG) & ~imerode(logical(SEG), s); Boundary_GT = logical(GT) & ~imerode(logical(GT), s); % distance to nearest boundary point Dist_SEG = bwdist(Boundary_SEG, 'euclidean'); Dist_GT = bwdist(Boundary_GT, 'euclidean'); % distance to another boundary min_S2G = sort(Dist_GT( Boundary_SEG(:) ), 'ascend'); min_G2S = sort(Dist_SEG( Boundary_GT(:) ), 'ascend'); % hausdorff distance hd = max(min_S2G(end), min_G2S(end)); end Jaccard_Index:

function jaccard = Jaccard_Index(SEG, GT) % SEG, GT are the binary segmentation and ground truth areas, respectively. % jaccard index jaccard = double(sum(uint8(SEG(:) & GT(:)))) / double(sum(uint8(SEG(:) | GT(:)))); end Avg_PerpenDist (得到 apd 之后,还需要乘以像素的物理距离,才是真正的 apd 值):

function apd = Avg_PerpenDist(SEG, GT) % SEG, GT are the binary segmentation and ground truth areas, respectively. % erode element s = cat(3, [0 0 0 ; 0 1 0 ; 0 0 0], [0 1 0 ; 1 1 1 ; 0 1 0], [0 0 0 ; 0 1 0 ; 0 0 0]); % generate boundary Boundary_SEG = logical(SEG) & ~imerode(logical(SEG), s); Boundary_GT = logical(GT) & ~imerode(logical(GT), s); % distance to nearest boundary point Dist_GT = bwdist(Boundary_GT, 'euclidean'); % distance to another boundary min_S2G = Dist_GT( Boundary_SEG(:) ); % average perpendicular distance from SEG to GT apd = sum(min_S2G(:)) / length(min_S2G(:)); end ConformityCoefficient:

function confm_index = ConformityCoefficient(SEG, GT) % SEG, GT are the binary segmentation and ground truth areas, respectively. % dice ratio dr = 2*double(sum(uint8(SEG(:) & GT(:)))) / double(sum(uint8(SEG(:))) + sum(uint8(GT(:)))); % conformity coefficient confm_index = (3*dr - 2) / dr; end Precision:

function precision = Precision(SEG, GT) % SEG, GT are the binary segmentation and ground truth areas, respectively. % precision precision = double(sum(uint8(SEG(:) & GT(:)))) / double(sum(uint8(SEG(:)))); end Recall:

function recall = Recall(SEG, GT) % SEG, GT are the binary segmentation and ground truth areas, respectively. % recall recall = double(sum(uint8(SEG(:) & GT(:)))) / double(sum(uint8(GT(:)))); end

关于precision 和 recall 的wikipedia补图:

转载于博客:https://blog.csdn.net/yangyangyang20092010/article/details/51637073


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭