pytomography.callbacks
#
Callbacks can be used to compute various metrics on a reconstructed object throughout each iteration in an iterative reconstruction algorithm. For example, you may want to look at the noise in the liver as a function of iteration number in OSEM. A callback is simply a class which can take in an object and perform an operation. Callbacks are optional input to reconstruction algorithms; the run
method of a callback is called after each subiteration of an iterative reconstruction algorithm. All user-defined callbacks should inherit from the base class CallBack
. A subclass of this class could be used to compute noise-bias curves provided the __init__
method was redefined to take in some ground truth, and the run method was redefined to compare the obj to the ground truth.
Submodules#
Package Contents#
Classes#
Abstract class used for callbacks. Subclasses must redefine the |
|
Computes the log-liklihood \(\sum \left(g\log(Hf) - Hf - \beta V(f) \right)\) after a given iteration. |
- class pytomography.callbacks.Callback[source]#
Abstract class used for callbacks. Subclasses must redefine the
__init__
andrun
methods. If a callback is used as an argument in an iterative reconstruction algorihtm, the__run__
method is called after each subiteration.- abstract run(obj, n_iter)#
Abstract method for
run
.- Parameters:
obj (torch.tensor[batch_size, Lx, Ly, Lz]) – An object which one can compute various statistics from.
n_iter (int) – The iteration number
- class pytomography.callbacks.LogLiklihoodCallback(projections, system_matrix, prior=None)[source]#
Bases:
pytomography.callbacks.callback.Callback
Computes the log-liklihood \(\sum \left(g\log(Hf) - Hf - \beta V(f) \right)\) after a given iteration.
- Parameters:
projections (torch.tensor) – Data corresponding to measured projections
system_matrix (SystemMatrix) – System matrix of imaging system.
prior (Prior, optional) – Prior used in Bayesian algorithm. Defaults to None.
- run(object, n_iter)#
Method used to compute the log liklihood
- Parameters:
object (torch.tensor) – Object on which the liklihood is computed
n_iter (int) – Iteration number