tomopy.recon.algorithm
¶
用于重建算法的模块。
Functions:
|
从投影数据重建对象。 |
- tomopy.recon.algorithm.recon(tomo, theta, center=None, sinogram_order=False, algorithm=None, init_recon=None, ncore=None, nchunk=None, **kwargs)[源代码]¶
从投影数据重建对象。
- 参数:
tomo ( ndarray )--3D断层扫描数据。
theta ( array )--以弧度为单位的投影角度。
center ( array, optional )--旋转轴的位置。
sinogram_order ( bool, optional )--确定数据是一堆正弦图形(True,y轴第一轴)还是一堆射线照片(False,theta第一轴)。
algorithm ( {str, function} )--以下字符串值之一。
- “艺术”
代数重建技术 [B2] 。
- “巴特”
块代数重建技术。
- ‘fBP’
滤波反投影算法。
- “GRADREC”
- ‘mlem’
最大似然期望最大化算法 [B3] 。
- 《奥塞姆》
有序子集期望最大化算法 [B18] 。
- 'ospml_hybrid'
加权线性惩罚和二次惩罚的有序子集惩罚最大似然算法。
- 'ospml_quad'
二次惩罚的有序子集惩罚最大似然算法。
- 'pml_hybrid'
加权线性和二次惩罚的惩罚最大似然算法 [B19] 。
- 'pml_quad'
带有二次惩罚的惩罚最大似然算法。
- “先生”
同步代数重建技术。
- “电视”
全变差重建技术 [B8] 。
- ‘Grad’
梯度下降法。
- ‘tikh’
具有单位Tikhonov矩阵的Tikhonov正则化。
num_gridx, num_gridy ( int, optional )-重建栅格中沿x轴和y轴的像素数。
filter_name ( str, optional )--用于分析重建的过滤器的名称。
- “无”
没有过滤器。
- “谢普”
谢普-洛根过滤器(默认)。
- “余弦”
余弦滤波。
- ‘Hann’
余弦滤波。
- 《汉明》
海明滤波器。
- “Ramlak”
Ram-LAK过滤器。
- “帕尔岑”
帕尔岑过滤器。
- 《巴特沃斯》
巴特沃斯过滤器。
- ‘风俗’
数量稀少的大小数组 next_power_of_2(num_detector_columns)/2 指定傅立叶域中的自定义筛选器。滤波器的第一个元件应该是零频分量。
- “Custom2d”
数量稀少的大小数组 num_projections*next_power_of_2(num_detector_columns)/2 指定傅立叶域中的自定义角度相关过滤器。每个滤波器的第一个元件应该是零频分量。
filter_par ( list, optional )--以列表形式过滤参数。
num_iter ( int, optional )--执行的算法迭代次数。
num_block ( int, optional )--用于中间更新对象的数据块数。
ind_block ( array of int, optional )--用于更新的投影顺序。
reg_par ( float, optional )-用于平滑的正则化参数。
init_recon ( ndarray, optional )--重建的初步猜测。
ncore ( int, optional )--将分配给作业的核心数量。
nchunk ( int, optional )--每个核心的区块大小。
- 返回:
ndarray --重建的3D对象。
警告
未对FBP实施过滤。
示例
>>> import tomopy >>> obj = tomopy.shepp3d() # Generate an object. >>> ang = tomopy.angles(180) # Generate uniformly spaced tilt angles. >>> sim = tomopy.project(obj, ang) # Calculate projections. >>> rec = tomopy.recon(sim, ang, algorithm='art') # Reconstruct object. >>> >>> # Show 64th slice of the reconstructed object. >>> import pylab >>> pylab.imshow(rec[64], cmap='gray') >>> pylab.show()
使用ASTRA工具箱进行重建的示例
有关更多信息,请参阅http://sourceforge.net/p/astra-toolbox/wiki/Home/和https://github.com/astra-toolbox/astra-toolbox.要使用CONDA安装ASTRA工具箱,请使用:
Conda Install-c https://conda.binstar.org/astra-toolbox Astra-工具箱
>>> import tomopy >>> obj = tomopy.shepp3d() # Generate an object. >>> ang = tomopy.angles(180) # Generate uniformly spaced tilt angles. >>> sim = tomopy.project(obj, ang) # Calculate projections. >>> >>> # Reconstruct object: >>> rec = tomopy.recon(sim, ang, algorithm=tomopy.astra, >>> options={'method':'SART', 'num_iter':10*180, >>> 'proj_type':'linear', >>> 'extra_options':{'MinConstraint':0}}) >>> >>> # Show 64th slice of the reconstructed object. >>> import pylab >>> pylab.imshow(rec[64], cmap='gray') >>> pylab.show()