pytomography.callbacks.callback#
Module Contents#
Classes#
Abstract class used for callbacks. Subclasses must redefine the |
|
Class for combining multiple callbacks into a single callback. This is useful for passing multiple callbacks to an iterative reconstruction algorithm. |
- class pytomography.callbacks.callback.Callback[source]#
Abstract class used for callbacks. Subclasses must redefine the
__init__andrunmethods. If a callback is used as an argument in an iterative reconstruction algorihtm, the__run__method is called after each subiteration.- abstract run(object, n_iter)[source]#
Abstract method for
run.- Parameters:
object (torch.Tensor[Lx, Ly, Lz]) – Object at current iteration/subset in the reconstruction algorithm
n_iter (int) – The iteration number
- Returns:
Modified object from callback. This must be returned by all callbacks (if the callback doesn’t change the object, then the passed object is returned)
- Return type:
torch.Tensor
- class pytomography.callbacks.callback.MultiCallback(callbacks)[source]#
Bases:
CallbackClass for combining multiple callbacks into a single callback. This is useful for passing multiple callbacks to an iterative reconstruction algorithm.
- Parameters:
callbacks (list[Callback]) –
- run(object, n_iter, n_subset)[source]#
Runs the callbacks sequentially
- Parameters:
object (torch.Tensor) – Object at current iteration/subset in the reconstruction algorithm
n_iter (int) – Iteration number
n_subset (int) – Subset number
- Returns:
Modified object from callback. This must be returned by all callbacks (if the callback doesn’t change the object, then the passed object is returned)
- Return type:
torch.Tensor