# reconstruction: reconstruction algorithm¶

Warning

This module is known to be buggy in version 0.6: Do NOT use it without having checked it provides proper results

class ReconstructionAlgorithm(sino_shape, slice_shape=None, axis_position=None, angles=None, ctx=None, devicetype='all', platformid=None, deviceid=None, profile=False)[source]

A parent class for all iterative tomographic reconstruction algorithms

Parameters: sino_shape – shape of the sinogram. The sinogram is in the format (n_b, n_a) where n_b is the number of detector bins and n_a is the number of angles. slice_shape – Optional, shape of the reconstructed slice. By default, it is a square slice where the dimension is the “x dimension” of the sinogram (number of bins). axis_position – Optional, axis position. Default is (shape[1]-1)/2.0. angles – Optional, a list of custom angles in radian. ctx – actual working context, left to None for automatic initialization from device type or platformid/deviceid devicetype – type of device, can be “CPU”, “GPU”, “ACC” or “ALL” platformid – integer with the platform_identifier, as given by clinfo deviceid – Integer with the device identifier, as given by clinfo profile – switch on profiling to be able to profile at the kernel level, store profiling elements (makes code slightly slower)
proj(d_slice, d_sino)[source]

Project d_slice to d_sino

backproj(d_sino, d_slice)[source]

Backproject d_sino to d_slice

class SIRT(sino_shape, slice_shape=None, axis_position=None, angles=None, ctx=None, devicetype='all', platformid=None, deviceid=None, profile=False)[source]

A class for the SIRT algorithm

Parameters: sino_shape – shape of the sinogram. The sinogram is in the format (n_b, n_a) where n_b is the number of detector bins and n_a is the number of angles. slice_shape – Optional, shape of the reconstructed slice. By default, it is a square slice where the dimension is the “x dimension” of the sinogram (number of bins). axis_position – Optional, axis position. Default is (shape[1]-1)/2.0. angles – Optional, a list of custom angles in radian. ctx – actual working context, left to None for automatic initialization from device type or platformid/deviceid devicetype – type of device, can be “CPU”, “GPU”, “ACC” or “ALL” platformid – integer with the platform_identifier, as given by clinfo deviceid – Integer with the device identifier, as given by clinfo profile – switch on profiling to be able to profile at the kernel level, store profiling elements (makes code slightly slower)

Warning

This is a beta version of the SIRT algorithm. Reconstruction fails for at least on CPU (Xeon E3-1245 v5) using the AMD opencl implementation.

compute_preconditioners()[source]

Create a diagonal preconditioner for the projection and backprojection operator. Each term of the diagonal is the sum of the projector/backprojector along rows [1], i.e the projection/backprojection of an array of ones.

[1] Jens Gregor and Thomas Benson,
Computational Analysis and Improvement of SIRT, IEEE transactions on medical imaging, vol. 27, no. 7, 2008
run(data, n_it)[source]

Run n_it iterations of the SIRT algorithm.

class TV(sino_shape, slice_shape=None, axis_position=None, angles=None, ctx=None, devicetype='all', platformid=None, deviceid=None, profile=False)[source]

A class for reconstruction with Total Variation regularization using the Chambolle-Pock TV reconstruction algorithm.

Parameters: sino_shape – shape of the sinogram. The sinogram is in the format (n_b, n_a) where n_b is the number of detector bins and n_a is the number of angles. slice_shape – Optional, shape of the reconstructed slice. By default, it is a square slice where the dimension is the “x dimension” of the sinogram (number of bins). axis_position – Optional, axis position. Default is (shape[1]-1)/2.0. angles – Optional, a list of custom angles in radian. ctx – actual working context, left to None for automatic initialization from device type or platformid/deviceid devicetype – type of device, can be “CPU”, “GPU”, “ACC” or “ALL” platformid – integer with the platform_identifier, as given by clinfo deviceid – Integer with the device identifier, as given by clinfo profile – switch on profiling to be able to profile at the kernel level, store profiling elements (makes code slightly slower)

Warning

This is a beta version of the Chambolle-Pock TV algorithm. Reconstruction fails for at least on CPU (Xeon E3-1245 v5) using the AMD opencl implementation.

compute_preconditioners()[source]

Create a diagonal preconditioner for the projection and backprojection operator. Each term of the diagonal is the sum of the projector/backprojector along rows [2], i.e the projection/backprojection of an array of ones.

[2] T. Pock, A. Chambolle,
Diagonal preconditioning for first order primal-dual algorithms in convex optimization, International Conference on Computer Vision, 2011
run(data, n_it, Lambda, pos_constraint=False)[source]

Run n_it iterations of the TV-regularized reconstruction, with the regularization parameter Lambda.