scico.linop.xray.svmbir#

X-ray transform LinearOperator wrapping the svmbir package.

X-ray transform LinearOperator wrapping the svmbir package. Since this package is an interface to compiled C code, JAX features such as automatic differentiation and support for GPU devices are not available.

Classes

SVMBIRExtendedLoss(*args[, scale, ...])

Extended squared \(\ell_2\) loss with svmbir tomographic projector.

SVMBIRSquaredL2Loss(*args[, prox_kwargs])

Weighted squared \(\ell_2\) loss with svmbir tomographic projector.

XRayTransform(input_shape, angles, num_channels)

X-ray transform based on svmbir.

class scico.linop.xray.svmbir.XRayTransform(input_shape, angles, num_channels, center_offset=0.0, is_masked=False, geometry='parallel', dist_source_detector=None, magnification=None, delta_channel=None, delta_pixel=None)[source]#

Bases: LinearOperator

X-ray transform based on svmbir.

Inheritance diagram of XRayTransform

Perform tomographic projection of an image at specified angles, using the svmbir package. The is_masked option selects whether a valid region for projections (pixels outside this region are ignored when performing the projection) is active. This region of validity is also respected by SVMBIRSquaredL2Loss.prox when SVMBIRSquaredL2Loss is initialized with a XRayTransform with this option enabled.

A brief description of the supported scanner geometries can be found in the svmbir documentation. Parallel beam geometry and two different fan beam geometries are supported.

../_images/geom-parallel.png

Fig 1. Parallel beam geometry.#

../_images/geom-fan.png

Fig 2. Curved fan beam geometry.#

The output of this linear operator is an array of shape (num_angles, num_channels) when input_shape is 2D, or of shape (num_angles, num_slices, num_channels) when input_shape is 3D, where num_angles is the length of the angles argument, and num_slices is inferred from the input_shape argument.

Most of the the following arguments have the same name as and correspond to arguments of svmbir.project. A brief summary of each is provided here, but the documentation for svmbir.project should be consulted for further details.

Parameters:
  • input_shape (Tuple[int, ...]) – Shape of the input array. May be of length 2 (a 2D array) or 3 (a 3D array). When specifying a 2D array, the format for the input_shape is (num_rows, num_cols). For a 3D array, the format for the input_shape is (num_slices, num_rows, num_cols), where num_slices denotes the number of slices in the input, and num_rows and num_cols denote the number of rows and columns in a single slice of the input. A slice is a plane perpendicular to the axis of rotation of the tomographic system. At angle zero, each row is oriented along the X-rays (parallel beam) or the X-ray beam directed toward the detector center (fan beam). Note that input_shape=(num_rows, num_cols) and input_shape=(1, num_rows, num_cols) result in the same underlying projector.

  • angles (Array) – Array of projection angles in radians, should be increasing.

  • num_channels (int) – Number of detector channels in the sinogram data.

  • center_offset (float) – Position of the detector center relative to the projection of the center of rotation onto the detector, in units of pixels.

  • is_masked (bool) – If True, the valid region of the image is determined by a mask defined as the circle inscribed within the image boundary. Otherwise, the whole image array is taken into account by projections.

  • geometry (str) – Scanner geometry, either “parallel”, “fan-curved”, or “fan-flat”. Note that the dist_source_detector and magnification arguments must be provided for then fan beam geometries.

  • dist_source_detector (Optional[float]) – Distance from X-ray focal spot to detectors in units of pixel pitch. Only used when geometry is “fan-flat” or “fan-curved”.

  • magnification (Optional[float]) – Magnification factor of the scanner geometry. Only used when geometry is “fan-flat” or “fan-curved”.

  • delta_channel (Optional[float]) – Detector channel spacing.

  • delta_pixel (Optional[float]) – Spacing between image pixels in the 2D slice plane.

class scico.linop.xray.svmbir.SVMBIRExtendedLoss(*args, scale=0.5, prox_kwargs=None, positivity=False, W=None, **kwargs)[source]#

Bases: Loss

Extended squared \(\ell_2\) loss with svmbir tomographic projector.

Inheritance diagram of SVMBIRExtendedLoss

Generalization of the weighted squared \(\ell_2\) loss for a CT reconstruction problem,

\[\alpha \norm{\mb{y} - A(\mb{x})}_W^2 = \alpha \left(\mb{y} - A(\mb{x})\right)^T W \left(\mb{y} - A(\mb{x})\right) \;,\]

where \(A\) is a XRayTransform, \(\alpha\) is the scaling parameter and \(W\) is an instance of scico.linop.Diagonal. If \(W\) is None, it is set to scico.linop.Identity.

The extended loss differs from a typical weighted squared \(\ell_2\) loss as follows. When positivity=True, the prox projects onto the non-negative orthant and the loss is infinite if any element of the input is negative. When the is_masked option of the associated XRayTransform is True, the reconstruction is computed over a masked region of the image as described in class XRayTransform.

Initialize a SVMBIRExtendedLoss object.

Parameters:
  • y – Sinogram measurement.

  • A – Forward operator.

  • scale (float) – Scaling parameter.

  • prox_kwargs (Optional[dict]) – Dictionary of arguments passed to the svmbir.recon prox routine. Defaults to {“maxiter”: 1000, “ctol”: 0.001}.

  • positivity (bool) – Enforce positivity in the prox operation. The loss is infinite if any element of the input is negative.

  • W (Optional[Diagonal]) – Weighting diagonal operator. Must be non-negative. If None, defaults to Identity.

__call__(x)[source]#

Evaluate this loss at point \(\mb{x}\).

Parameters:

x (Array) – Point at which to evaluate loss.

Return type:

float

prox(v, lam=1, **kwargs)[source]#

Scaled proximal operator of loss function.

Evaluate scaled proximal operator of this loss function, with scaling \(\lambda\) = lam and evaluated at point \(\mb{v}\) = v. If prox is not defined in a derived class, and if operator \(A\) is the identity operator, then the proximal operator is computed using the proximal operator of functional \(l\), via Theorem 6.11 in [7].

Parameters:
  • v (Array) – Point at which to evaluate prox function.

  • lam (float) – Proximal parameter \(\lambda\).

  • kwargs – Additional arguments that may be used by derived classes. These include x0, an initial guess for the minimizer in the defintion of \(\mathrm{prox}\).

Return type:

Array

class scico.linop.xray.svmbir.SVMBIRSquaredL2Loss(*args, prox_kwargs=None, **kwargs)[source]#

Bases: SVMBIRExtendedLoss, SquaredL2Loss

Weighted squared \(\ell_2\) loss with svmbir tomographic projector.

Inheritance diagram of SVMBIRSquaredL2Loss

Weighted squared \(\ell_2\) loss of a CT reconstruction problem,

\[\alpha \norm{\mb{y} - A(\mb{x})}_W^2 = \alpha \left(\mb{y} - A(\mb{x})\right)^T W \left(\mb{y} - A(\mb{x})\right) \;,\]

where \(A\) is a XRayTransform, \(\alpha\) is the scaling parameter and \(W\) is an instance of scico.linop.Diagonal. If \(W\) is None, it is set to scico.linop.Identity.

Initialize a SVMBIRSquaredL2Loss object.

Parameters:
  • y – Sinogram measurement.

  • A – Forward operator.

  • scale – Scaling parameter.

  • W – Weighting diagonal operator. Must be non-negative. If None, defaults to Identity.

  • prox_kwargs (Optional[dict]) – Dictionary of arguments passed to the svmbir.recon prox routine. Defaults to {“maxiter”: 1000, “ctol”: 0.001}.