scico.linop.xray.astra_cone

LinearOperator wrapping the ASTRA cone beam X-ray transform.

X-ray transform LinearOperator wrapping the cone beam projections in the ASTRA toolbox, which provides CUDA implementations of core functionality for cone beam geometries. Note that this interface involves GPU-host-GPU memory copies when transferring JAX arrays. Other JAX features such as automatic differentiation are not available.

The cone beam geometry uses the same coordinate system conventions as the parallel beam geometry. The volume is fixed with respect to the coordinate system, centered at the origin. Geometry axes z, y, and x correspond to volume array axes 0, 1, and 2 respectively. The projected array axes 0, 1, and 2 correspond respectively to detector rows, views, and detector columns.

Functions

angle_to_vector_cone(det_spacing, angles, ...)

Convert cone beam parameters to vector geometry specification.

Classes

XRayTransform3DCone(input_shape, det_count)

3D cone beam X-ray transform based on the ASTRA toolbox.

class scico.linop.xray.astra_cone.XRayTransform3DCone(input_shape, det_count, det_spacing=None, det_offset=None, angles=None, source_dist=None, det_dist=None, vectors=None)[source]

Bases: LinearOperator

3D cone beam X-ray transform based on the ASTRA toolbox.

Inheritance diagram of XRayTransform3DCone

Perform cone beam tomographic projection (also called X-ray projection) of a volume at specified angles, using the ASTRA toolbox. The 3D geometries “cone” and “cone_vec” are supported by this interface. Note that a CUDA GPU is required for the functionality of this class; if no GPU is available, initialization will fail with a RuntimeError.

The volume is fixed with respect to the coordinate system, centered at the origin. The voxel sides have unit length (in arbitrary units), which defines the scale for all other dimensions in the source-volume-detector configuration. Geometry axes z, y, and x correspond to volume array axes 0, 1, and 2 respectively. The projected array axes 0, 1, and 2 correspond respectively to detector rows, views, and detector columns.

In the “cone” case, the source and detector rotate clockwise about the z axis in the x-y plane. The source is positioned at distance source_dist from the origin, and the detector is at distance det_dist from the origin (making the source-detector distance source_dist + det_dist).

In the “cone_vec” case, each view is determined by the following vectors:

View definition vectors

\(\mb{s}\)

Position of the source

\(\mb{d}\)

Center of the detector

\(\mb{u}\)

Vector from detector pixel (0,0) to (0,1) (direction of increasing detector column index)

\(\mb{v}\)

Vector from detector pixel (0,0) to (1,0) (direction of increasing detector row index)

These vectors are concatenated into a single row vector \((\mb{s}, \mb{d}, \mb{u}, \mb{v})\) to form the full geometry specification for a single view.

Keyword arguments det_spacing, angles, source_dist, and det_dist should be specified to use the “cone” geometry, and keyword argument vectors should be specified to use the “cone_vec” geometry. These parameters are mutually exclusive.

Parameters:
  • input_shape (Tuple[int, ...]) – Shape of the input array.

  • det_count (Tuple[int, int]) – Number of detector elements (rows, columns) in the projection geometry.

  • det_spacing (Optional[Tuple[float, float]]) – Spacing between detector elements (row spacing, column spacing) in the projection geometry.

  • det_offset (Optional[Tuple[float, float]]) – Offset of the detector center as a tuple (horizontal shift, vertical shift). Negative/positive values correspond to left/right and up/down detector shifts (i.e. right/left and down/up shifts of the projection within the image) respectively.

  • angles (Optional[ndarray]) – Array of projection angles in radians. This parameter is mutually exclusive with vectors.

  • source_dist (Optional[float]) – Distance from the source to the origin (center of rotation). Required when using angles.

  • det_dist (Optional[float]) – Distance from the origin to the detector. Required when using angles.

  • vectors (Optional[ndarray]) – Array of ASTRA geometry specification vectors. This parameter is mutually exclusive with angles. Each row should contain 12 values: source position (3), detector center (3), u vector (3), v vector (3).

Raises:
  • RuntimeError – If a CUDA GPU is not available to the ASTRA toolbox.

  • ValueError – If invalid parameter combinations are provided.

static create_astra_geometry(input_shape, det_count, det_spacing=None, angles=None, source_dist=None, det_dist=None, vectors=None)[source]

Create ASTRA 3D cone beam geometry objects.

Keyword arguments det_spacing, angles, source_dist, and det_dist should be specified to use the “cone” geometry, and keyword argument vectors should be specified to use the “cone_vec” geometry. These parameters are mutually exclusive.

Parameters:
Return type:

Tuple[dict, dict]

Returns:

A tuple (vol_geom, proj_geom) of ASTRA volume geometry and projection geometry objects.

fdk(sino, **kwargs)[source]

Feldkamp-Davis-Kress (FDK) reconstruction.

Perform tomographic reconstruction using the Feldkamp-Davis-Kress (FDK)algorithm.

Parameters:
  • sino (Array) – Sinogram to reconstruct.

  • **kwargs – Specify algorithm options, described in in the ASTRA documentation.

Return type:

Array

Returns:

Reconstructed volume.

scico.linop.xray.astra_cone.angle_to_vector_cone(det_spacing, angles, source_dist, det_dist)[source]

Convert cone beam parameters to vector geometry specification.

Convert detector spacing, angles, and distances to ASTRA “cone_vec” geometry specification vectors.

Parameters:
  • det_spacing (Tuple[float, float]) – Spacing between detector elements (row spacing, column spacing). See the astra documentation for more information.

  • angles (ndarray) – Array of projection angles in radians.

  • source_dist (float) – Distance from the source to the origin.

  • det_dist (float) – Distance from the origin to the detector.

Return type:

ndarray

Returns:

Array of geometry specification vectors with shape (num_angles, 12). Each row contains: source position (3), detector center (3), u vector (3), v vector (3).