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
|
Extended squared \(\ell_2\) loss with svmbir tomographic projector. |
|
Weighted squared \(\ell_2\) loss with svmbir tomographic projector. |
|
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.
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
whenSVMBIRSquaredL2Loss
is initialized with aXRayTransform
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.
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 forsvmbir.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
) – IfTrue
, 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_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.
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 ofscico.linop.Diagonal
. If \(W\) isNone
, it is set toscico.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
isTrue
, the reconstruction is computed over a masked region of the image as described in classXRayTransform
.Initialize a
SVMBIRExtendedLoss
object.- Parameters:
y – Sinogram measurement.
A – Forward operator.
scale (
float
) – Scaling parameter.prox_kwargs (
Optional
[dict
]) – Dictionary of arguments passed to thesvmbir.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. IfNone
, defaults toIdentity
.
- 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].
- class scico.linop.xray.svmbir.SVMBIRSquaredL2Loss(*args, prox_kwargs=None, **kwargs)[source]¶
Bases:
SVMBIRExtendedLoss
,SquaredL2Loss
Weighted squared \(\ell_2\) loss with svmbir tomographic projector.
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 ofscico.linop.Diagonal
. If \(W\) isNone
, it is set toscico.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 toIdentity
.prox_kwargs (
Optional
[dict
]) – Dictionary of arguments passed to thesvmbir.recon
prox routine. Defaults to {“maxiter”: 1000, “ctol”: 0.001}.