Algorithms#

In tigre.algorithms. All iterative algorithms are called as algorithm(proj, geo, angles, niter, **options); see Choosing an algorithm for which to choose.

fdk

FDK: filtered backprojection for cone-beam CT.

fbp

FBP: filtered backprojection for parallel-beam CT.

sart

SART: simultaneous algebraic reconstruction technique.

sirt

SIRT: simultaneous iterative reconstruction technique.

ossart

OS-SART: ordered-subsets SART.

sart_tv

SART with a total variation denoising step after every iteration.

ossart_tv

OS-SART with a total variation denoising step after every iteration.

cgls

CGLS: conjugate gradient for least squares.

lsqr

LSQR: least squares by Golub-Kahan bidiagonalisation.

lsmr

LSMR: least squares by minimising the normal-equation residual.

hybrid_lsqr

Hybrid LSQR: LSQR with Tikhonov regularisation of the projected problem.

ab_gmres

AB-GMRES: GMRES with the backprojector as a right preconditioner.

ba_gmres

BA-GMRES: GMRES with the backprojector as a left preconditioner.

irn_tv_cgls

IRN-TV-CGLS: total variation regularisation by iteratively reweighted norms.

hybrid_flsqr_tv

Hybrid flexible LSQR with total variation regularisation.

asd_pocs

ASD-POCS: adaptive steepest descent, projection onto convex sets.

os_asd_pocs

OS-ASD-POCS: ASD-POCS with ordered subsets of projections in the data step.

awasd_pocs

AwASD-POCS: ASD-POCS with adaptive-weighted (edge-preserving) total variation.

os_awasd_pocs

OS-AwASD-POCS: adaptive-weighted ASD-POCS with ordered subsets.

pcsd

PCSD: projection-controlled steepest descent.

os_pcsd

OS-PCSD: PCSD with ordered subsets of projections in the data step.

aw_pcsd

AwPCSD: PCSD with adaptive-weighted (edge-preserving) total variation.

os_aw_pcsd

OS-AwPCSD: adaptive-weighted PCSD with ordered subsets.

piccs

PICCS: prior image constrained compressed sensing.

os_piccs

OS-PICCS: PICCS with ordered subsets of projections in the data step.

fista

FISTA: fast iterative shrinkage-thresholding with a TV proximal step.

ista

ISTA: iterative shrinkage-thresholding with a TV proximal step.

mlem

MLEM: maximum-likelihood expectation maximisation.

Filtered backprojection#

tigre.algorithms.fdk(proj, geo, angles, **kwargs)#

FDK: filtered backprojection for cone-beam CT.

The Feldkamp-Davis-Kress algorithm. One pass, so it is fast, and usually the best choice for well-sampled circular scans. Available as tigre.algorithms.fdk.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry (cone beam).

  • angles (numpy.ndarray) – Projection angles in radians, shape (N,). FDK assumes a circular trajectory, so do not use it with arbitrary rotation axes.

  • filter ({"ram_lak", "shepp_logan", "cosine", "hamming", "hann"}, optional) – Filter applied to the projections. Default "ram_lak". Smoother filters reduce noise at the cost of resolution.

  • parker (bool or float, optional) – Parker weights for short scans, so that rays measured twice are not counted twice. Default: on when the scan is circular and covers less than a full circle (the same rule as MATLAB). A number sets the smoothing parameter q of Wesarg et al. (True means q=1).

  • dowang (bool, optional) – Wang weights for a detector shifted with geo.offDetector (half-fan scans). Default True; skipped on short scans.

  • workers (int, optional) – CPU threads used to filter the projections. Default: chosen automatically.

  • verbose (bool, optional) – Print progress. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

numpy.ndarray – The reconstruction, float32, shape geo.nVoxel.

See also

fbp

the parallel-beam version.

Examples

>>> import numpy as np
>>> import tigre
>>> import tigre.algorithms as algs
>>> from tigre.utilities import sample_loader
>>> geo = tigre.geometry_default(high_resolution=False)
>>> angles = np.linspace(0, 2 * np.pi, 100, endpoint=False)
>>> proj = tigre.Ax(sample_loader.load_head_phantom(geo.nVoxel), geo, angles)
>>> img = algs.fdk(proj, geo, angles, filter="hann")
tigre.algorithms.fbp(proj, geo, angles, **kwargs)#

FBP: filtered backprojection for parallel-beam CT.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry; geo.mode must be "parallel".

  • angles (numpy.ndarray) – Projection angles in radians, shape (N,).

  • filter ({"ram_lak", "shepp_logan", "cosine", "hamming", "hann"}, optional) – Filter applied to the projections. Default "ram_lak".

  • workers (int, optional) – CPU threads used to filter the projections. Default: chosen automatically.

  • verbose (bool, optional) – Print progress. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

numpy.ndarray – The reconstruction, float32, shape geo.nVoxel.

Raises:

ValueError – If geo.mode is not "parallel".

See also

fdk

the cone-beam version.

SART family#

tigre.algorithms.sart(proj, geo, angles, niter, **kwargs)#

SART: simultaneous algebraic reconstruction technique.

Updates the image after each single projection. Converges in the fewest iterations of the SART family, but each iteration is the slowest.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • lmbda (float, optional) – Relaxation parameter of the update. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 1.

  • OrderStrategy ({"ordered", "random", "angularDistance"}, optional) – Order in which the subsets of projections are used. Default: the order of angles.

  • noneg (bool, optional) – Set negative values to zero after every update. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

ossart, sirt

tigre.algorithms.sirt(proj, geo, angles, niter, **kwargs)#

SIRT: simultaneous iterative reconstruction technique.

Updates the image once per iteration, using all projections. Each iteration is fast, but many are needed.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • lmbda (float, optional) – Relaxation parameter of the update. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 1.

  • OrderStrategy ({"ordered", "random", "angularDistance"}, optional) – Order in which the subsets of projections are used. Default: the order of angles.

  • noneg (bool, optional) – Set negative values to zero after every update. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

ossart, sart

tigre.algorithms.ossart(proj, geo, angles, niter, **kwargs)#

OS-SART: ordered-subsets SART.

Updates the image after each subset of blocksize projections, between SART (one projection) and SIRT (all). Usually the best choice of the three.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • blocksize (int, optional) – Number of projections used in each update. Default 20.

  • lmbda (float, optional) – Relaxation parameter of the update. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 1.

  • OrderStrategy ({"ordered", "random", "angularDistance"}, optional) – Order in which the subsets of projections are used. Default: the order of angles.

  • noneg (bool, optional) – Set negative values to zero after every update. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

sart, sirt, ossart_tv

tigre.algorithms.sart_tv(proj, geo, angles, niter, **kwargs)#

SART with a total variation denoising step after every iteration.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • tviter (int, optional) – Iterations of TV denoising after each data step. Default 50.

  • tvlambda (float, optional) – Data-fidelity weight of the TV denoising: larger values keep the image closer to the data step’s result, so they denoise less. Default 50.

  • lmbda (float, optional) – Relaxation parameter of the update. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • OrderStrategy ({"ordered", "random", "angularDistance"}, optional) – Order in which the subsets of projections are used. Default: the order of angles.

  • noneg (bool, optional) – Set negative values to zero after every update. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

ossart_tv, asd_pocs

tigre.algorithms.ossart_tv(proj, geo, angles, niter, **kwargs)#

OS-SART with a total variation denoising step after every iteration.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • blocksize (int, optional) – Number of projections used in each update. Default 20.

  • tviter (int, optional) – Iterations of TV denoising after each data step. Default 50.

  • tvlambda (float, optional) – Data-fidelity weight of the TV denoising: larger values keep the image closer to the data step’s result, so they denoise less. Default 50.

  • lmbda (float, optional) – Relaxation parameter of the update. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • OrderStrategy ({"ordered", "random", "angularDistance"}, optional) – Order in which the subsets of projections are used. Default: the order of angles.

  • noneg (bool, optional) – Set negative values to zero after every update. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

sart_tv, os_asd_pocs

Krylov subspace methods#

tigre.algorithms.cgls(proj, geo, angles, niter, **kwargs)#

CGLS: conjugate gradient for least squares.

Solves \(\min_x \|Ax - b\|_2\).

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • restart (bool, optional) – When the residual grows (loss of orthogonality), restart from the current image instead of stopping. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

lsqr, lsmr, hybrid_lsqr

Notes

Krylov methods use the matched backprojector. They converge quickly but start to fit the noise after a while, so use few iterations (often 10 to 30) or a regularised variant. See Projection and backprojection for why the projector pair is not an exact transpose.

tigre.algorithms.lsqr(proj, geo, angles, niter, **kwargs)#

LSQR: least squares by Golub-Kahan bidiagonalisation.

Solves \(\min_x \|Ax - b\|_2\). Mathematically the same as CGLS, numerically more stable.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • restart (bool, optional) – When the residual grows (loss of orthogonality), restart from the current image instead of stopping. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

cgls, lsmr, hybrid_lsqr

Notes

Krylov methods use the matched backprojector. They converge quickly but start to fit the noise after a while, so use few iterations (often 10 to 30) or a regularised variant. See Projection and backprojection for why the projector pair is not an exact transpose.

References

tigre.algorithms.lsmr(proj, geo, angles, niter, **kwargs)#

LSMR: least squares by minimising the normal-equation residual.

Solves \(\min_x \|Ax - b\|_2^2 + \lambda^2 \|x\|_2^2\). Its residuals decrease more smoothly than LSQR’s.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • lmbda (float, optional) – Damping (Tikhonov) parameter \(\lambda\). Default 0: plain least squares.

  • restart (bool, optional) – When the residual grows (loss of orthogonality), restart from the current image instead of stopping. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

lsqr, hybrid_lsqr

Notes

Krylov methods use the matched backprojector. They converge quickly but start to fit the noise after a while, so use few iterations (often 10 to 30) or a regularised variant. See Projection and backprojection for why the projector pair is not an exact transpose.

References

    1. C.-L. Fong and M. A. Saunders, “LSMR: An iterative algorithm for sparse least-squares problems”, SIAM J. Sci. Comput. 33 (2011). https://doi.org/10.1137/10079687X

tigre.algorithms.hybrid_lsqr(proj, geo, angles, niter, **kwargs)#

Hybrid LSQR: LSQR with Tikhonov regularisation of the projected problem.

Solves \(\min_x \|Ax - b\|_2^2 + \lambda^2 \|x\|_2^2\) in the Krylov subspace, choosing \(\lambda\) as it goes, which makes it much less sensitive to the number of iterations than LSQR. Keeps one image and one set of projections per iteration in memory.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • lmbda (float, optional) – Tikhonov regularisation parameter. If not given, it is chosen at every iteration: by the discrepancy principle if noiselevel is given, otherwise by generalised cross validation (GCV).

  • noiselevel (float, optional) – Relative noise level of the data, \(\|e\| / \|b\|\) (for example 0.02 for 2%), for the discrepancy principle.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

lsqr, hybrid_flsqr_tv

Notes

Krylov methods use the matched backprojector. They converge quickly but start to fit the noise after a while, so use few iterations (often 10 to 30) or a regularised variant. See Projection and backprojection for why the projector pair is not an exact transpose.

It stops early if the residual grows, which signals a loss of orthogonality.

tigre.algorithms.ab_gmres(proj, geo, angles, niter, **kwargs)#

AB-GMRES: GMRES with the backprojector as a right preconditioner.

Designed for projector/backprojector pairs that are not exact transposes of each other.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • backprojector ({"matched", "FDK"}, optional) – Backprojection used as the preconditioner: the matched backprojector (default) or the full FDK algorithm, filtering included.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

ba_gmres, cgls

tigre.algorithms.ba_gmres(proj, geo, angles, niter, **kwargs)#

BA-GMRES: GMRES with the backprojector as a left preconditioner.

Designed for projector/backprojector pairs that are not exact transposes of each other.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • backprojector ({"matched", "FDK"}, optional) – Backprojection used as the preconditioner: the matched backprojector (default) or the full FDK algorithm, filtering included.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

ab_gmres, cgls

tigre.algorithms.irn_tv_cgls(proj, geo, angles, niter, **kwargs)#

IRN-TV-CGLS: total variation regularisation by iteratively reweighted norms.

Approximates \(\min_x \|Ax - b\|_2^2 + \lambda\, \mathrm{TV}(x)\) by a sequence of weighted least-squares problems, each solved with CGLS. The total number of CGLS iterations is niter * niter_outer.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • lmbda (float, optional) – Weight of the TV term \(\lambda\). Default 10.

  • niter_outer (int, optional) – Number of reweighting steps. Default 4.

  • restart (bool, optional) – When the residual grows (loss of orthogonality), restart from the current image instead of stopping. Default True.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

tigre.algorithms.hybrid_flsqr_tv(proj, geo, angles, niter, **kwargs)#

Hybrid flexible LSQR with total variation regularisation.

A flexible Krylov method in which the TV regularisation acts as a preconditioner, with the regularisation parameter chosen as it goes.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • lmbda (float, optional) – Tikhonov regularisation parameter. If not given, it is chosen at every iteration: by the discrepancy principle if noiselevel is given, otherwise by generalised cross validation (GCV).

  • noiselevel (float, optional) – Relative noise level of the data, \(\|e\| / \|b\|\) (for example 0.02 for 2%), for the discrepancy principle.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

Notes

It stops early if the residual grows.

Total variation (POCS family)#

tigre.algorithms.asd_pocs(proj, geo, angles, niter, **kwargs)#

ASD-POCS: adaptive steepest descent, projection onto convex sets.

Minimises the total variation of the image subject to \(\|Ax - b\|_2 \le \epsilon\). Uses one projection per data step; os_asd_pocs uses subsets and is faster.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • alpha (float, optional) – Step size of the TV gradient descent. Default 0.002.

  • alpha_red (float, optional) – Factor by which alpha is reduced when needed. Default 0.95.

  • rmax (float, optional) – Maximum ratio between the TV step and the data step. Default 0.95.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\) (epsilon in the paper). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

References

tigre.algorithms.os_asd_pocs(proj, geo, angles, niter, **kwargs)#

OS-ASD-POCS: ASD-POCS with ordered subsets of projections in the data step.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • blocksize (int, optional) – Number of projections used in each update. Default 20.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • alpha (float, optional) – Step size of the TV gradient descent. Default 0.002.

  • alpha_red (float, optional) – Factor by which alpha is reduced when needed. Default 0.95.

  • rmax (float, optional) – Maximum ratio between the TV step and the data step. Default 0.95.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\) (epsilon in the paper). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

tigre.algorithms.awasd_pocs(proj, geo, angles, niter, **kwargs)#

AwASD-POCS: ASD-POCS with adaptive-weighted (edge-preserving) total variation.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • delta (float, optional) – Edge sensitivity of the adaptive weights: closer to 0 preserves more edges. Default -0.005.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • alpha (float, optional) – Step size of the TV gradient descent. Default 0.002.

  • alpha_red (float, optional) – Factor by which alpha is reduced when needed. Default 0.95.

  • rmax (float, optional) – Maximum ratio between the TV step and the data step. Default 0.95.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\) (epsilon in the paper). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

tigre.algorithms.os_awasd_pocs(proj, geo, angles, niter, **kwargs)#

OS-AwASD-POCS: adaptive-weighted ASD-POCS with ordered subsets.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • blocksize (int, optional) – Number of projections used in each update. Default 20.

  • delta (float, optional) – Edge sensitivity of the adaptive weights: closer to 0 preserves more edges. Default -0.005.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • alpha (float, optional) – Step size of the TV gradient descent. Default 0.002.

  • alpha_red (float, optional) – Factor by which alpha is reduced when needed. Default 0.95.

  • rmax (float, optional) – Maximum ratio between the TV step and the data step. Default 0.95.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\) (epsilon in the paper). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

tigre.algorithms.pcsd(proj, geo, angles, niter, **kwargs)#

PCSD: projection-controlled steepest descent.

A variant of ASD-POCS without the alpha, alpha_red and rmax parameters: the size of the TV step follows the current data error.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

os_pcsd, aw_pcsd, asd_pocs

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

tigre.algorithms.os_pcsd(proj, geo, angles, niter, **kwargs)#

OS-PCSD: PCSD with ordered subsets of projections in the data step.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • blocksize (int, optional) – Number of projections used in each update. Default 20.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

pcsd, os_aw_pcsd

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

tigre.algorithms.aw_pcsd(proj, geo, angles, niter, **kwargs)#

AwPCSD: PCSD with adaptive-weighted (edge-preserving) total variation.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • delta (float, optional) – Edge sensitivity of the adaptive weights: closer to 0 preserves more edges. Default -0.005.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

pcsd, os_aw_pcsd

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

tigre.algorithms.os_aw_pcsd(proj, geo, angles, niter, **kwargs)#

OS-AwPCSD: adaptive-weighted PCSD with ordered subsets.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • blocksize (int, optional) – Number of projections used in each update. Default 20.

  • delta (float, optional) – Edge sensitivity of the adaptive weights: closer to 0 preserves more edges. Default -0.005.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

aw_pcsd, os_pcsd

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

Prior image (PICCS)#

tigre.algorithms.piccs(proj, geo, angles, niter, **kwargs)#

PICCS: prior image constrained compressed sensing.

ASD-POCS in which the TV term also includes the difference to a prior image of the same object, such as a planning CT.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • prior (numpy.ndarray) – Prior image of the same object, shape geo.nVoxel. Required.

  • prior_ratio (float, optional) – Weight of the prior image term against the TV term. Default 0.2.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • alpha (float, optional) – Step size of the TV gradient descent. Default 0.002.

  • alpha_red (float, optional) – Factor by which alpha is reduced when needed. Default 0.95.

  • rmax (float, optional) – Maximum ratio between the TV step and the data step. Default 0.95.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\) (epsilon in the paper). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

os_piccs, asd_pocs

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

tigre.algorithms.os_piccs(proj, geo, angles, niter, **kwargs)#

OS-PICCS: PICCS with ordered subsets of projections in the data step.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • blocksize (int, optional) – Number of projections used in each update. Default 20.

  • prior (numpy.ndarray) – Prior image of the same object, shape geo.nVoxel. Required.

  • prior_ratio (float, optional) – Weight of the prior image term against the TV term. Default 0.2.

  • lmbda (float, optional) – Step size of the data (SART-type) step. Default 1.

  • lmbda_red (float, optional) – Factor by which lmbda is multiplied after every iteration. Default 0.99.

  • alpha (float, optional) – Step size of the TV gradient descent. Default 0.002.

  • alpha_red (float, optional) – Factor by which alpha is reduced when needed. Default 0.95.

  • rmax (float, optional) – Maximum ratio between the TV step and the data step. Default 0.95.

  • maxl2err (float, optional) – Data error the image is allowed to keep, \(\|Ax - b\|_2\) (epsilon in the paper). Default: 20% of the data error of an FDK reconstruction.

  • tviter (int, optional) – TV gradient-descent steps per iteration. Default 20.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

piccs

Notes

The algorithm alternates a SART-type data step with TV gradient-descent steps, and stops early when the image no longer changes or the step size becomes too small.

Proximal methods#

tigre.algorithms.fista(proj, geo, angles, niter, **kwargs)#

FISTA: fast iterative shrinkage-thresholding with a TV proximal step.

Solves \(\min_x \tfrac{1}{2}\|Ax - b\|_2^2 + \lambda\, \mathrm{TV}(x)\) with accelerated proximal gradient steps.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • hyper (float or "auto", optional) – Lipschitz constant of the data term’s gradient (the largest eigenvalue of \(A^T A\)); the gradient step is 1/hyper. Default “auto”: estimated for this problem by power iteration.

  • tviter (int, optional) – Iterations of the TV proximal step. Default 20.

  • tvlambda (float, optional) – TV regularisation strength \(\lambda\). Default 0.1.

  • fista_p (float, optional) – Parameters of the momentum update. Default 1 and 1.

  • fista_q (float, optional) – Parameters of the momentum update. Default 1 and 1.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

ista, asd_pocs

References

    1. Beck and M. Teboulle, “A fast iterative shrinkage-thresholding algorithm for linear inverse problems”, SIAM J. Imaging Sci. 2 (2009). https://doi.org/10.1137/080716542

tigre.algorithms.ista(proj, geo, angles, niter, **kwargs)#

ISTA: iterative shrinkage-thresholding with a TV proximal step.

FISTA without the acceleration. Takes the same options.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • hyper (float or "auto", optional) – Lipschitz constant of the data term’s gradient. Default “auto”.

  • tviter (int, optional) – Iterations of the TV proximal step. Default 20.

  • tvlambda (float, optional) – TV regularisation strength. Default 0.1.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

fista

Statistical methods#

tigre.algorithms.mlem(proj, geo, angles, niter, **kwargs)#

MLEM: maximum-likelihood expectation maximisation.

Models the measurements as Poisson-distributed, which suits low-count data. The image stays non-negative. Starts from an image of ones unless init is given.

Parameters:
  • proj (numpy.ndarray) – Projections (line integrals), float32, shape (len(angles), *geo.nDetector).

  • geo (tigre.utilities.geometry.Geometry) – The scanner geometry.

  • angles (numpy.ndarray) – Projection angles in radians: shape (N,) for rotations around z, or (N, 3) for ZYZ Euler angles.

  • niter (int) – Number of iterations.

  • init ({None, "FDK", "multigrid"} or numpy.ndarray, optional) – Starting image: zeros (default), an FDK reconstruction, a multigrid initialisation (OS-SART on coarser grids), or an array of shape geo.nVoxel.

  • verbose (bool, optional) – Print progress and an estimate of the time left. Default True.

  • Quameasopts (str or list of str, optional) – Image quality measures to record at every iteration, comparing each iterate with the previous one, for example ["RMSE", "CC"]. See tigre.utilities.Measure_Quality.Measure_Quality().

  • computel2 (bool, optional) – Also record the data residual norm \(\|Ax - b\|_2\) at every iteration. Default False.

  • gpuids (tigre.utilities.gpu.GpuIds, optional) – GPUs to use. Default: all available.

Returns:

  • img (numpy.ndarray) – The reconstruction, float32, shape geo.nVoxel.

  • errors (numpy.ndarray) – Only returned when computel2=True or Quameasopts is given: one row per measure (the data residual norm first, if requested) and one column per iteration.

See also

ossart