python - 如何使用 SimpleITK 从 MR 图像中分割白质?
问题描述
谁能帮我理解下面的代码?最大的想法是识别 MR 图像(灰度)中的白质并用绿色突出显示它。但是我看不到这项工作是如何完成的,SimpleITK 的文档也不容易阅读。
import SimpleITK
# Step 1: segment white matter from MR image 'imgSmooth'
imgWhiteMatter = SimpleITK.ConnectedThreshold(image1 = imgSmooth,
seedList = [(150,75)],
lower = 130, upper = 190,
replaceValue = 1
)
# Step 2: manipulate 'imgSmooth' so as to prepare for the overlay
imgSmoothInt = SimpleITK.Cast(SimpleITK.RescaleIntensity(imgSmooth),
imgWhiteMatter.GetPixelID()
)
# Step 3: overlay manipulated 'imgSmooth' with 'imgWhiteMatter'
imgHightlight = SimpleITK.LabelOverlay(imgSmoothInt, imgWhiteMatter))
我至少有这些问题:
- 白质在哪一步以绿色突出显示?还是自动决定的?
- 本教程说
SimpleITK.RescaleIntensity()
将 RGB 转换为 0-255 范围,但“imgSmoothInt”的数组主要由 2 到 5.5 的数字组成,而“imgSmooth”的数组从 0 到 4。 - 做什么
SimpleITK.Cast()
? imgWhiteMatter.GetPixelID()
返回 1,但我不明白这意味着什么以及它在第 2 步中扮演的角色。它是否指定了一些内容以使“imgSmoothInt”与“imgWhiteMatter”兼容?
解决方案
推荐阅读
- php - 使用 Guzzle PHP 循环发送请求多次
- c# - Html.ValidationSummary 总是显示
- javascript - 如何通过javascript将视频添加到html页面
- javascript - Select2 未使用 Jquery 3.3.1 上的 jquery-validate 插件进行验证
- amazon-web-services - 是否有通过 CLI 启用 aws 守卫职责的脚本?
- java - 如何在不读取 Java 中的整个 JSON 文件的情况下仅获取特定键的值?
- angular - VS Code 中的 Angular:是否有任何自动重命名的方法?
- java - Tomcat 9 和 Java 11 上的 Soap Web 服务响应不同
- css - 将 css 应用于直接子元素
- java - File Writer写入方法期间发生java Stream closed异常