【发布时间】:2019-01-20 07:25:28
【问题描述】:
我有大量图像切片及其相应的蒙版。我一直在尝试使用skimage.segmentation 库根据其掩码为每个切片标记记住的对象。
import numpy as np
from skimage.segmentation import mark_boundaries
import matplotlib.pyplot as plt
def plot_marked_volume(marked_image_volume, mask):
for slice in range(len(marked_image_volume)):
if np.count_nonzero(mask[slice,:,:]):
plt.figure(figsize=(10,10))
edges_pz = mark_boundaries(marked_image_volume[slice,:,:], mask[slice].astype(np.int),
color=(1,0,0), mode='thin')
plt.imshow(edges_pz)
plt.title('slice ' + str(slice))
plt.show()
这是一个示例图像和蒙版切片:
我期待如下黄色 boundAry 的输出(忽略“CG”):
感谢您对可能出现的问题提出任何想法和建议。
【问题讨论】:
-
您的预期结果是什么?
-
@user2906838 添加在帖子末尾:)
-
能否请您分享您的输入数据以调用该方法,以便我可以重现它,您只需替换原始绘制maks的像素值。
-
@user2906838 请在此处找到卷:transfernow.net/4195b0b9cw4n
标签: python numpy image-segmentation scikit-image