【SimpleITK】分割结果融合策略

前言

有时我们会有多个专家标注的结果或者是多个模型得到的结果,对所有的结果做一个融合,目前有两种主流做法:

  • 投票法 (majority vote)
  • STAPLE (Simultaneous Truth and Performance Level Estimation)

对多个专家的标注结果进行融合之后,我们得到的标注就可以作为ground truth参与到模型的分割训练;当然,对多模型的结果进行融合,同样可以得到更加鲁棒的结果。
此处针对的场景是医疗影像,所以我们使用SimpleITK相应的API来实现结果融合的功能。官方notebook可以参考:http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/Python_html/34_Segmentation_Evaluation.html

样例数据

数据

import SimpleITK as sitk
import numpy as np
import matplotlib.pyplot as plt
image = sitk.ReadImage("../Data/liverTumorSegmentations/Patient01Homo.mha")

segmentation_file_names = ["../Data/liverTumorSegmentations/Patient01Homo_Rad01.mha", 
                          "../Data/liverTumorSegmentations/Patient01Homo_Rad02.mha",
                          "../Data/liverTumorSegmentations/Patient01Homo_Rad03.mha"]
                          
segmentations = [sitk.ReadImage(file_name, sitk.sitkUInt8) for file_name in segmentation_file_names]

样例数据中有3个不同的标注,打印如下:

fig, (ax1, ax2, ax3, ax4) = plt.subplots(1, 4, figsize = (20, 10))
ax1.imshow(sitk.GetArrayFromImage(image)[75], cmap=plt.cm.bone)
ax1.set_title('image')
ax2.imshow(sitk.GetArrayFromImage(segmentations[0])[75])
ax2.set_title('label 1')
ax3.imshow(sitk.GetArrayFromImage(segmentations[1])[75])
ax3.set_title('label 2')
ax4.imshow(sitk.GetArrayFromImage(segmentations[2])[75])
ax4.set_title('label 3')

一幅图像,3个标注:
在这里插入图片描述

投票法

Use majority voting to obtain the reference segmentation.

API

  • sitk.LabelVoting
help(sitk.LabelVoting)

Help on function LabelVoting in module SimpleITK.SimpleITK:
LabelVoting(*args)

  • LabelVoting(VectorOfImage images, uint64_t labelForUndecidedPixels) -> Image

投票法无法处理ties?

labelForUndecidedPixels = 10
reference_segmentation_majority_vote = sitk.LabelVoting(segmentations, labelForUndecidedPixels)    

manual_plus_majority_vote = list(segmentations)  
# Append the reference segmentation to the list of manual bsegmentations
manual_plus_majority_vote.append(reference_segmentation_majority_vote)

显示:
在这里插入图片描述

STAPLE algorithm

# Use the STAPLE algorithm to obtain the reference segmentation. This implementation of the original algorithm
# combines a single label from multiple segmentations, the label is user specified. The result of the
# filter is the voxel's probability of belonging to the foreground. We then have to threshold the result to obtain
# a reference binary segmentation.
foregroundValue = 1
threshold = 0.95
reference_segmentation_STAPLE_probabilities = sitk.STAPLE(segmentations, foregroundValue) 
# We use the overloaded operator to perform thresholding, another option is to use the BinaryThreshold function.
reference_segmentation_STAPLE = reference_segmentation_STAPLE_probabilities > threshold

manual_plus_staple = list(segmentations)  
# Append the reference segmentation to the list of manual segmentations
manual_plus_staple.append(reference_segmentation_STAPLE)

显示:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tpzugI51-1579146091814)(./1579145875162.png)]

对比

显示对比:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ospU2fwm-1579146091815)(./1579145982153.png)]

发布了102 篇原创文章 · 获赞 221 · 访问量 23万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览