pytomography.projections#

Submodules#

Package Contents#

Classes#

ForwardProjectionNet

Implements a forward projection of mathematical form \(g_j = \sum_{i} c_{ij} f_i\) where \(f_i\) is an object, \(g_j\) is the corresponding image, and \(c_{ij}\) is the system matrix given by the various phenonemon modeled (e.g. atteunation/PSF).

BackProjectionNet

Implements a back projection of mathematical form \(f_i = \frac{1}{\sum_j c_{ij}}\sum_{j} c_{ij} g_j\). where \(f_j\) is an object, \(g_j\) is an image, and \(c_{ij}\) is the system matrix given by the various phenonemon modeled (e.g. atteunation correction/PSF). Subclass of the ProjectionNet class.

ProjectionNet

Abstract parent class for projection networks. Any subclass of this network must implement the forward method.

class pytomography.projections.ForwardProjectionNet(obj2obj_nets, im2im_nets, object_meta, image_meta, device='cpu')#

Bases: pytomography.projections.projection.ProjectionNet

Implements a forward projection of mathematical form \(g_j = \sum_{i} c_{ij} f_i\) where \(f_i\) is an object, \(g_j\) is the corresponding image, and \(c_{ij}\) is the system matrix given by the various phenonemon modeled (e.g. atteunation/PSF).

Parameters:
forward(object, angle_subset=None)#

Implements forward projection on an object

Parameters:
  • object (torch.tensor[batch_size, Lx, Ly, Lz]) – The object to be forward projected

  • angle_subset (list, optional) – Only uses a subset of angles (i.e. only certain values of \(j\) in formula above) when back projecting. Useful for ordered-subset reconstructions. Defaults to None,

  • used. (which assumes all angles are) –

Returns:

Forward projected image where Ltheta is specified by self.image_meta and angle_subset.

Return type:

torch.tensor[batch_size, Ltheta, Lx, Lz]

class pytomography.projections.BackProjectionNet(obj2obj_nets, im2im_nets, object_meta, image_meta, device='cpu')#

Bases: pytomography.projections.projection.ProjectionNet

Implements a back projection of mathematical form \(f_i = \frac{1}{\sum_j c_{ij}}\sum_{j} c_{ij} g_j\). where \(f_j\) is an object, \(g_j\) is an image, and \(c_{ij}\) is the system matrix given by the various phenonemon modeled (e.g. atteunation correction/PSF). Subclass of the ProjectionNet class.

Parameters:
forward(image, angle_subset=None, prior=None, normalize=False, return_norm_constant=False, delta=1e-11)#

Implements back projection on an image, returning an object.

Parameters:
  • image (torch.tensor[batch_size, Ltheta, Lr, Lz]) – image which is to be back projected

  • angle_subset (list, optional) – Only uses a subset of angles (i.e. only certain values of \(j\) in formula above) when back projecting. Useful for ordered-subset reconstructions. Defaults to None, which assumes all angles are used.

  • prior (Prior, optional) – If included, modifes normalizing factor to \(\frac{1}{\sum_j c_{ij} + P_i}\) where \(P_i\) is given by the prior. Used, for example, during in MAP OSEM. Defaults to None.

  • normalize (bool) – Whether or not to divide result by \(\sum_j c_{ij}\)

  • return_norm_constant (bool) – Whether or not to return \(1/\sum_j c_{ij}\) along with back projection. Defaults to ‘False’.

  • delta (float, optional) – Prevents division by zero when dividing by normalizing constant. Defaults to 1e-11.

Returns:

the object obtained from back projection.

Return type:

torch.tensor[batch_size, Lr, Lr, Lz]

class pytomography.projections.ProjectionNet(obj2obj_nets, im2im_nets, object_meta, image_meta, device='cpu')#

Bases: torch.nn.Module

Abstract parent class for projection networks. Any subclass of this network must implement the forward method.

Parameters:
initialize_correction_nets()#

Function that initializes all mapping networks with the required object and image metadata corresponding to the projection network.

abstract foward()#

Abstract method that must be implemented by any subclass of this class.