pytomography.priors.smoothness#

Module Contents#

Classes#

SmoothnessPrior

Implementation of priors with gradients of the form

QuadraticPrior

Implentation of SmoothnessPrior where \(\phi\) is the identity function

LogCoshPrior

Implementation of SmoothnessPrior where \(\phi\) is the hyperbolic tangent function

class pytomography.priors.smoothness.SmoothnessPrior(beta, delta, phi, device='cpu')#

Bases: pytomography.priors.prior.Prior

Implementation of priors with gradients of the form \(\frac{\partial V}{\partial f_r}=\frac{\beta}{\delta}\sum_{r,s}w_{s}\phi\left(\frac{f_r-f_s}{\delta}\right)\) where \(V\) is from the log-posterior probability \(\log P(g | f) - \beta V(f)\).

Parameters:
  • beta (float) –

  • delta (float) –

  • phi (collections.abc.Callable) –

  • device (str) –

get_kernel()#

Obtains the kernel used to get \(\frac{\partial V}{\partial f_r}\) (this is an array with the same dimensions as the object space image)

Returns:

Kernel used for convolution (number of output channels equal to number of \(s\)), and array of weights \(w_s\) used in expression for gradient.

Return type:

(torch.nn.Conv3d, torch.tensor)

set_kernel(object_meta)#

Sets the kernel using get_kernel and the corresponding object metadata.

Parameters:

object_meta (_type_) – _description_

Return type:

None

forward()#

Computes the prior on self.object

Returns:

Tensor of shape [batch_size, Lx, Ly, Lz] representing \(\frac{\partial V}{\partial f_r}\)

Return type:

torch.tensor

class pytomography.priors.smoothness.QuadraticPrior(beta, delta=1, device='cpu')#

Bases: SmoothnessPrior

Implentation of SmoothnessPrior where \(\phi\) is the identity function

Parameters:
  • beta (float) –

  • delta (float) –

  • device (str) –

class pytomography.priors.smoothness.LogCoshPrior(beta, delta=1, device='cpu')#

Bases: SmoothnessPrior

Implementation of SmoothnessPrior where \(\phi\) is the hyperbolic tangent function

Parameters:
  • beta (float) –

  • delta (float) –

  • device (str) –