【问题标题】:Masking of MRI in Python在 Python 中屏蔽 MRI
【发布时间】:2021-02-01 02:46:56
【问题描述】:

我有两张图像,一张是二进制 dicom/nifti,一张是原始 dicom/nifti,我如何在原始图像上屏蔽二进制并从原始图像中获取屏蔽输出。图 1 是二进制的,图 2 是原始的,图 3 是我需要的输出样本。

二进制掩码

原创

我需要的输出

【问题讨论】:

    标签: python tensorflow anaconda mask image-segmentation


    【解决方案1】:

    你可以使用

    masked_img = cv2.bitwise_and(mask,orginal_img)

    获得屏蔽输出。 你的面具和 orginal_img 应该是一样大的!!

    (如果对你有用,请投票)

    【讨论】:

    • 感谢您的回复,Mahdi abbasi。你能告诉我一件事吗,当我尝试使用 nib.save(masked_img, 'main.nii') 保存它时,它给出了这个错误 AttributeError: 'numpy.ndarray' object has no attribute 'to_filename'
    • 简单的乘法可以得到更好的结果,比如 masked_img = mask*orginal_img
    • @Elliot 我没有使用 nib 。您可以使用 cv2.imwrite('img.jpg',img) 保存图像。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-30
    相关资源
    最近更新 更多