Projectors

mumott provides two different implementations of projectors suitable for SAXS tomography. While they should yield nearly equivalent results, they differ with respect to the resources they require.

SAXSProjectorCUDA and SAXSProjector implement an equivalent algorithm for GPU and CPU resources, respectively.

class mumott.methods.projectors.SAXSProjector(geometry)[source]

Projector for transforms of tensor fields from three-dimensional space to projection space using a bilinear interpolation algorithm that produces results similar to those of SAXSProjectorCUDA using CPU computation.

Parameters

geometry (Geometry) – An instance of Geometry containing the necessary vectors to compute forwared and adjoint projections.

adjoint(projections, indices=None)[source]

Compute the adjoint of a set of projections according to the system geometry.

Parameters
  • projections (ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]) – An array containing coefficients in its last dimension, from e.g. the residual of measured data and forward projections. The first dimension should match indices in size, and the second and third dimensions should match the system projection geometry. The array must be contiguous and row-major.

  • indices (Optional[ndarray[Any, dtype[int]]]) – A one-dimensional array containing one or more indices indicating from which projections the adjoint is to be computed.

Return type

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns

The adjoint of the provided projections. An array with four dimensions (X, Y, Z, P), where the first three dimensions are spatial and the last dimension runs over coefficients.

property dtype: Union[dtype[Any], None, type[Any], _SupportsDType[dtype[Any]], str, tuple[Any, int], tuple[Any, Union[SupportsIndex, collections.abc.Sequence[SupportsIndex]]], list[Any], _DTypeDict, tuple[Any, Any]]

Preferred dtype of this Projector.

forward(field, indices=None)[source]

Compute the forward projection of a tensor field.

Parameters
  • field (ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]) – An array containing coefficients in its fourth dimension, which are to be projected into two dimensions. The first three dimensions should match the volume_shape of the sample.

  • indices (Optional[ndarray[Any, dtype[int]]]) – A one-dimensional array containing one or more indices indicating which projections are to be computed. If None, all projections will be computed.

Return type

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns

An array with four dimensions (I, J, K, L), where the first dimension matches indices, such that projection[i] corresponds to the geometry of projection indices[i]. The second and third dimension contain the pixels in the J and K dimension respectively, whereas the last dimension is the coefficient dimension, matching field[-1].

property is_dirty: bool

Returns True if the system geometry has changed without the projection geometry having been updated.

property john_transform_parameters: tuple

Tuple of John Transform parameters, which can be passed manually to compile John Transform kernels and construct low-level pipelines. For advanced users only.

property number_of_projections: int

The number of projections as defined by the length of the Geometry object attached to this instance.

property projection_shape: Tuple[int]

The shape of each projection defined by the Geometry object attached to this instance, as a tuple.

property volume_shape: Tuple[int]

The shape of the volume defined by the Geometry object attached to this instance, as a tuple.

class mumott.methods.projectors.SAXSProjectorCUDA(geometry)[source]

Projector for transforms of tensor fields from three-dimensional space to projection space. Uses a projection algorithm implemented in numba.cuda.

Parameters

geometry (Geometry) – An instance of Geometry containing the necessary vectors to compute forwared and adjoint projections.

adjoint(projections, indices=None)

Compute the adjoint of a set of projections according to the system geometry.

Parameters
  • projections (ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]) – An array containing coefficients in its last dimension, from e.g. the residual of measured data and forward projections. The first dimension should match indices in size, and the second and third dimensions should match the system projection geometry. The array must be contiguous and row-major.

  • indices (Optional[ndarray[Any, dtype[int]]]) – A one-dimensional array containing one or more indices indicating from which projections the adjoint is to be computed.

Return type

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns

The adjoint of the provided projections. An array with four dimensions (X, Y, Z, P), where the first three dimensions are spatial and the last dimension runs over coefficients.

property dtype: Union[dtype[Any], None, type[Any], _SupportsDType[dtype[Any]], str, tuple[Any, int], tuple[Any, Union[SupportsIndex, collections.abc.Sequence[SupportsIndex]]], list[Any], _DTypeDict, tuple[Any, Any]]

Preferred dtype of this Projector.

forward(field, indices=None)

Compute the forward projection of a tensor field.

Parameters
  • field (ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]) – An array containing coefficients in its fourth dimension, which are to be projected into two dimensions. The first three dimensions should match the volume_shape of the sample.

  • indices (Optional[ndarray[Any, dtype[int]]]) – A one-dimensional array containing one or more indices indicating which projections are to be computed. If None, all projections will be computed.

Return type

ndarray[Any, dtype[TypeVar(_ScalarType_co, bound= generic, covariant=True)]]

Returns

An array with four dimensions (I, J, K, L), where the first dimension matches indices, such that projection[i] corresponds to the geometry of projection indices[i]. The second and third dimension contain the pixels in the J and K dimension respectively, whereas the last dimension is the coefficient dimension, matching field[-1].

property is_dirty: bool

Returns True if the system geometry has changed without the projection geometry having been updated.

property john_transform_parameters: tuple

Tuple of John Transform parameters, which can be passed manually to compile John Transform kernels and construct low-level pipelines. For advanced users only.

property number_of_projections: int

The number of projections as defined by the length of the Geometry object attached to this instance.

property projection_shape: Tuple[int]

The shape of each projection defined by the Geometry object attached to this instance, as a tuple.

property volume_shape: Tuple[int]

The shape of the volume defined by the Geometry object attached to this instance, as a tuple.