Skip to main content

一个人工智能驱动的开源医学图像分析工具箱

项目描述

DOSMA:深度开源医学图像分析

许可证:GPL v3 GitHub 工作流状态 编解码器 文件状态

文档| 问卷| DOSMA 基础教程

DOSMA 是一个人工智能驱动的 Python 库,用于医学图像分析。这包括但不限于:

  • 图像处理(去噪、超分辨率、配准、分割等)
  • 定量拟合和图像分析
  • 解剖可视化和分析(髌骨倾斜、股骨软骨厚度等)

我们希望这个开源管道将对快速解剖/病理学分析有用,并将作为增加对分析不同解剖和扫描序列的支持的中心。

安装

DOSMA 需要 Python 3.6+。核心模块依赖于 numpy、nibabel、nipype、pandas、pydicom、scikit-image、scipy、PyYAML 和 tq​​dm。

通过安装 tensorflow 和 keras 可以解锁其他 AI 功能。要启用内置注册功能,请下载elastix。可以在设置文档中找到详细信息。

要安装 DOSMA,请运行:

pip install dosma

# To install with AI support
pip install dosma[ai]

如果您想为 DOSMA 做出贡献,我们建议您克隆存储库并pip以可编辑模式安装 DOSMA。

git clone git@github.com:ad12/DOSMA.git
cd DOSMA
pip install -e '.[dev,docs]'
make dev

要运行测试、构建文档和贡献,请运行

make autoformat test build-docs

特征

简化、高效的 I/O

DOSMA 为基于 nibabel 和 pydicom 构建的 DICOM 和 NIfTI 格式提供高效的阅读器。多切片 DICOM 数据可以与多个工作人员并行加载,并结构化为适当的 3D 体积。例如,多回波和动态对比增强 (DCE) MRI 扫描具有分别在不同回波时间和触发时间采集的多个体积。这些可以轻松加载到多个卷中:

import dosma as dm

multi_echo_scan = dm.load("/path/to/multi-echo/scan", group_by="EchoNumbers", num_workers=8, verbose=True)
dce_scan = dm.load("/path/to/dce/scan", group_by="TriggerTime")

数据嵌入医学图像

DOSMA 的MedicalVolume数据结构支持对医学图像进行类似数组的操作(算术、切片等),同时保留空间属性和随附的元数据。此结构支持 NumPy 互操作性、智能重新格式化、快速低级计算和原生 GPU 支持。例如,给定 MedicalVolumes mvAmvB我们可以执行以下操作:

# Reformat image into Superior->Inferior, Anterior->Posterior, Left->Right directions.
mvA = mvA.reformat(("SI", "AP", "LR"))

# Get and set metadata
study_description = mvA.get_metadata("StudyDescription")
mvA.set_metadata("StudyDescription", "A sample study")

# Perform NumPy operations like you would on image data.
rss = np.sqrt(mvA**2 + mvB**2)

# Move to GPU 0 for CuPy operations
mv_gpu = mvA.to(dosma.Device(0))

# Take slices. Metadata will be sliced appropriately.
mv_subvolume = mvA[10:20, 10:20, 4:6]

内置人工智能模型

DOSMA 旨在成为机器/深度学习模型的中心。可在此处找到模型和相应出版物的完整列表。我们可以使用其中一种膝盖分割模型来分割本地下载mv的 MedicalVolume和模型 :weights

from dosma.models import IWOAIOAIUnet2DNormalized

# Reformat such that sagittal plane is last dimension.
mv = mv.reformat(("SI", "AP", "LR"))

# Do segmentation
model = IWOAIOAIUnet2DNormalized(input_shape=mv.shape[:2] + (1,), weights_path=weights)
masks = model.generate_mask(mv)

可并行化操作

DOSMA 支持计算量大的操作的并行化,例如曲线拟合和图像配准。通过elastix/transformix库支持图像注册。例如,我们可以使用多个工作人员将体积注册到目标,并将注册的输出用于每个体素的单指数拟合:

# Register images mvA, mvB, mvC to target image mv_tgt in parallel
_, (mvA_reg, mvB_reg, mvC_reg) = dosma.register(
   mv_tgt,
   moving=[mvA, mvB, mvC],
   parameters="/path/to/elastix/registration/file",
   num_workers=3,
   return_volumes=True,
   show_pbar=True,
)

# Perform monoexponential fitting.
def monoexponential(x, a, b):
   return a * np.exp(b*x)

fitter = dosma.CurveFitter(
   monoexponential,
   num_workers=4,
   p0={"a": 1.0, "b": -1/30},
)
popt, r2 = fitter.fit(x=[1, 2, 3, 4], [mv_tgt, mvA_reg, mvB_reg, mvC_reg])
a_fit, b_fit = popt[..., 0], popt[..., 1]

引文

@inproceedings{desai2019dosma,
  title={DOSMA: A deep-learning, open-source framework for musculoskeletal MRI analysis},
  author={Desai, Arjun D and Barbieri, Marco and Mazzoli, Valentina and Rubin, Elka and Black, Marianne S and Watkins, Lauren E and Gold, Garry E and Hargreaves, Brian A and Chaudhari, Akshay S},
  booktitle={Proc 27th Annual Meeting ISMRM, Montreal},
  pages={1135},
  year={2019}
}

除了 DOSMA 之外,还请考虑引用介绍用于分析的方法的工作。

项目详情


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dosma-0.1.2.tar.gz (147.3 kB 查看哈希)

已上传 source

内置分布

dosma-0.1.2-py2.py3-none-any.whl (177.1 kB 查看哈希

已上传 py2 py3