参数化计算机断层成像模拟器
tomograph的Python项目详细描述
断层摄影-参数化计算机断层摄影模拟器
tomograph
是一个参数化的计算机断层成像模拟器,它可以作为
一个独立的脚本或作为模块包含在python程序中。它
实现radon和reverse radon转换。它目前有两种型号
光束投影类型:圆锥和平行。
依赖关系
当前tomograph
需要:
- 单击(
click
) - tqdm(
tqdm
) - numpy(
numpy
) - 图像处理科学工具包(
scikit-image
)
它们各自所需的版本可以在requirements.txt
文件中看到。
安装
只需运行:
pip install tomograph
tomograph支持python 3.5、python3.6和python3.7。
用法
tomograph
可以直接通过命令行界面使用,也可以作为python使用
模块:
命令行
使用命令行界面:
tomograph --model cone --detectors 256 --angle 150 --rotations 512 image.jpg
所有命令行参数都可以通过运行:
tomograph --help
模块
使用锥束模型进行radon变换的示例脚本:
from skimage.io import imsave
from tomograph.model import ConeTomograph
# variables
path = 'image.jpg'
detectors = 256
angle = 180
rotations = 512
# one scan per rotation
step = 360 / rotations
# perform Radon transform
tomograph = ConeTomograph(path, detectors, angle)
sinogram = []
for i in range(rotations):
tomograph.rotate(step) # rotate tomograph
scan = tomograph.scan() # do the scan
sinogram.append(scan)
imsave('radon.bmp', np.array(sinogram).T)
现场演示
Beam lines | Radon transform | reverse Radon transform |
---|---|---|