pytomography.transforms.shared.kem#

Module Contents#

Classes#

KEMTransform

Object to object transform used to take in a coefficient image \(\alpha\) and return an image estimate \(f = K\alpha\). This transform implements the matrix \(K\).

class pytomography.transforms.shared.kem.KEMTransform(support_objects, support_kernels=None, support_kernels_params=None, distance_kernel=None, distance_kernel_params=None, size=5)[source]#

Bases: pytomography.transforms.Transform

Object to object transform used to take in a coefficient image \(\alpha\) and return an image estimate \(f = K\alpha\). This transform implements the matrix \(K\).

Parameters:
  • support_objects (Sequence[torch.tensor]) – Objects used for support when building each basis function. These may correspond to PET/CT/MRI images, for example.

  • support_kernels (Sequence[Callable], optional) – A list of functions corresponding to the support kernel of each support object. If none, defaults to \(k(v_i, v_j; \sigma) = \exp\left(-\frac{(v_i-v_j)^2}{2\sigma^2} \right)\) for each support object. Defaults to None.

  • support_kernels_params (Sequence[Sequence[float]], optional) – A list of lists, where each sublist contains the additional parameters corresponding to each support kernel (parameters that follow the semi-colon in the expression above). As an example, if using the default configuration for support_kernels for two different support objects (say CT and PET), one could given support_kernel_params=[[40],[5]] If none then defaults to a list of N*[[1]] where N is the number of support objects. Defaults to None.

  • distance_kernel (Callable, optional) – Kernel used to weight based on voxel-voxel distance. If none, defaults to :math:`k(x_i, x_j; sigma) = expleft(-frac{(x_i-x_j)^2}{2sigma^2} right) Defaults to None.

  • distance_kernel_params (_type_, optional) – A list of parameters corresponding to additional parameters for the distance_kernel (i.e. the parameters that follow the semi-colon in the expression above). If none, then defaults to \(\sigma=1\). Defaults to None.

  • size (int, optional) – The size of each kernel. Defaults to 5.

forward(object)[source]#

Forward transform corresponding to \(K\alpha\)

Parameters:

object (torch.Tensor) – Coefficient image \(\alpha\)

Returns:

Image \(K\alpha\)

Return type:

torch.tensor

backward(object, norm_constant=None)[source]#

Backward transform corresponding to \(K^T\alpha\). Since the matrix is symmetric, the implementation is the same as forward.

Parameters:
  • object (torch.Tensor) – Coefficient image \(\alpha\)

  • norm_constant (torch.Tensor | None) –

Returns:

Image \(K^T\alpha\)

Return type:

torch.tensor