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
geoandangles.- 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 everygeo.accuracyvoxels, 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
imgis not float32.ValueError – If
imgdoes not have shapegeo.nVoxel, or is complex.
See also
Atbbackprojection.
Notes
Atbis not the exact transpose ofAx; 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
geoandangles.- 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 ofAx(); 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
projectionsis not float32.ValueError – If
projectionsdoes not have the expected shape, or is complex.
See also
Axforward projection.
Notes
Neither backprojector is the exact transpose of
Ax(); see Projection and backprojection.