pytomography.likelihoods.likelihood#

Module Contents#

Classes#

Likelihood

Generic likelihood class in PyTomography. Subclasses may implement specific likelihoods with methods to compute the likelihood itself as well as particular gradients of the likelihood

class pytomography.likelihoods.likelihood.Likelihood(system_matrix, projections=None, additive_term=None, additive_term_variance_estimate=None)[source]#

Generic likelihood class in PyTomography. Subclasses may implement specific likelihoods with methods to compute the likelihood itself as well as particular gradients of the likelihood

Parameters:
  • system_matrix (SystemMatrix) – The system matrix modeling the particular system whereby the projections were obtained

  • projections (torch.Tensor | None) – Acquired data. If listmode, then this argument need not be provided, and it is set to a tensor of ones. Defaults to None.

  • additive_term (torch.Tensor, optional) – Additional term added after forward projection by the system matrix. This term might include things like scatter and randoms. Defaults to None.

  • additive_term_variance_estimate (Callable, optional) – Operator for variance estimate of additive term. If none, then uncertainty estimation does not include contribution from the additive term. Defaults to None.

_set_n_subsets(n_subsets)[source]#

Sets the number of subsets to be used when computing the likelihood

Parameters:

n_subsets (int) – Number of subsets

Return type:

None

_get_projection_subset(projections, subset_idx=None)[source]#

Method for getting projection subset corresponding to given subset index

Parameters:
  • projections (torch.Tensor) – Projection data

  • subset_idx (int) – Subset index

Returns:

Subset projection data

Return type:

torch.Tensor

_get_normBP(subset_idx, return_sum=False)[source]#

Gets normalization factor (back projection of ones)

Parameters:
  • subset_idx (int) – Subset index

  • return_sum (bool, optional) – Sum normalization factor from all subsets. Defaults to False.

Returns:

Normalization factor

Return type:

torch.Tensor

abstract compute_gradient(*args, **kwargs)[source]#

Function used to compute the gradient of the likelihood \(\nabla_{f} L(g|f)\)

Raises:

NotImplementedError – Must be implemented by sub classes

abstract compute_gradient_ff(*args, **kwargs)[source]#

Function used to compute the second order gradient (with respect to the object twice) of the likelihood \(\nabla_{ff} L(g|f)\)

Raises:

NotImplementedError – Must be implemented by sub classes

abstract compute_gradient_gf(*args, **kwargs)[source]#

Function used to compute the second order gradient (with respect to the object then image) of the likelihood \(\nabla_{gf} L(g|f)\)

Raises:

NotImplementedError – Must be implemented by sub classes

abstract compute_gradient_sf(*args, **kwargs)[source]#

Function used to compute the second order gradient (with respect to the object then additive term) of the likelihood \(\nabla_{sf} L(g|f,s)\)

Raises:

NotImplementedError – Must be implemented by sub classes