生成具有现实性头部的虚拟医学图像数据,用于图像处理测试
项目描述
生成带有垃圾图像数据的虚拟医学图像,但具有现实性头部,以测试图像处理管道
安装
Medimage4tests可在PyPI上获取,因此要安装,只需使用pip
$ pip3 install medimages4tests
或者在您的包的test_requires中包含。
用法
创建一个pytest fixture,包含具有DICOM格式的场图元数据的虚拟图像
# Import medimages4tests generator functions
from medimages4tests.dummy.dicom.mri.fmap.ge.discovery_mr888.dv26_0_r05_2008a import get_image
# Return generated images in pytest fixtures (or alternative test framework)
@pytest.fixture()
def ge_dicom_fmap():
return get_image()
创建一个虚拟NIfTI图像
import numpy
# Import `get_image` function
from medimages4tests.dummy.nifti import get_image
# Create dummy nifti image of 10x10x10 containing all ones
@pytest.fixture()
def ones_nifti():
return get_image(
data=numpy.ones((10, 10, 10))
)
访问来自OpenNeuro.org的真实T1加权图像
from medimages4tests.mri.neuro.t1w import get_image
@pytest.fixture()
def t1w_nifti():
return get_image(sample="ds004130-ON01016")
致谢
作者感谢国家成像设施提供的设施和科学及技术支持,该设施是国家协作研究基础设施战略(NCRIS)的能力。