Projection operators#

The two GPU operators every algorithm is built on. See Projection and backprojection for how they differ and why they are not an exact transpose pair.

tigre.Ax(img, geo, angles, projection_type='Siddon', **kwargs)#

Forward projection: simulate the projections of an image.

Computes \(A x\) on the GPU, where \(A\) is the system matrix of the scanner described by geo and angles.

Parameters:
  • img (numpy.ndarray) – Image, float32, shape geo.nVoxel ((z, y, x)).

  • 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.

  • projection_type ({"Siddon", "interpolated"}, optional) – "Siddon" (default; "ray-voxel" is an older name) adds up the exact length of each ray inside each voxel. "interpolated" samples the image along each ray every geo.accuracy voxels, with trilinear interpolation.

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

Returns:

numpy.ndarray – Projections, float32, shape (N, *geo.nDetector) ((angle, v, u)).

Raises:
  • TypeError – If img is not float32.

  • ValueError – If img does not have shape geo.nVoxel, or is complex.

See also

Atb

backprojection.

Notes

Atb is not the exact transpose of Ax; see Projection and backprojection.

Examples

>>> import numpy as np
>>> import tigre
>>> from tigre.utilities import sample_loader
>>> geo = tigre.geometry_default(high_resolution=False)
>>> angles = np.linspace(0, 2 * np.pi, 100, endpoint=False)
>>> img = sample_loader.load_head_phantom(geo.nVoxel)
>>> proj = tigre.Ax(img, geo, angles)
>>> proj.shape
(100, 128, 128)
tigre.Atb(projections, geo, angles, backprojection_type='FDK', **kwargs)#

Backprojection: spread projections back over the image.

Approximates \(A^T b\) on the GPU, where \(A\) is the system matrix of the scanner described by geo and angles.

Parameters:
  • projections (numpy.ndarray) – Projections, float32, shape (N, *geo.nDetector) ((angle, v, u)).

  • 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.

  • backprojection_type ({"FDK", "matched"}, optional) – "FDK" (default) uses the distance weights of the FDK algorithm. "matched" uses weights that make it close to the transpose of Ax(); the Krylov algorithms use it.

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

Returns:

numpy.ndarray – Image, float32, shape geo.nVoxel ((z, y, x)).

Raises:
  • TypeError – If projections is not float32.

  • ValueError – If projections does not have the expected shape, or is complex.

See also

Ax

forward projection.

Notes

Neither backprojector is the exact transpose of Ax(); see Projection and backprojection.