pytomography.corrections - PyTomography 0.1 documentation

Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# `pytomography.corrections`

## Submodules

- `pytomography.corrections.correction`
- `pytomography.corrections.ct_correction`
- `pytomography.corrections.psf_correction`

## Package Contents

### Classes

`CorrectionNet` | Correction net is the parent class for all correction networks used in reconstruction. Subclasses must implement the `forward` method.
`CTCorrectionNet` | Correction network used to correct for attenuation correction in projection operators. In particular, this network is used with other correction networks to model \(c\) in \(\sum_i c_{ij} a_i\) (forward projection) and \(\sum c_{ij} b_j\) (back projection).

class pytomography.corrections.CorrectionNet(device='cpu')

  Bases: `torch.nn.Module`

  Correction net is the parent class for all correction networks used in reconstruction. Subclasses must implement the `forward` method.

  Parameters:

    device (str) – Pytorch device used for computation

  initialize_network(object_meta, image_meta)

    Initalizes the correction network using the object/image metadata

    Parameters:

      - object_meta (ObjectMeta) – Object metadata.

      - image_meta (ImageMeta) – Image metadata.

    Return type:

      None

  abstract forward(x)

    Abstract method; must be implemented in subclasses to apply a correction to an object/image and return it

    Parameters:

      x (torch.tensor) –

class pytomography.corrections.CTCorrectionNet(CT, device='cpu')

  Bases: `pytomography.corrections.CorrectionNet`

  Correction network used to correct for attenuation correction in projection operators. In particular, this network is used with other correction networks to model \(c\) in \(\sum_i c_{ij} a_i\) (forward projection) and \(\sum c_{ij} b_j\) (back projection).

  Parameters:

    - CT (torch.tensor) – Tensor of size [batch_size, Lx, Ly, Lz] corresponding to the attenuation coefficient in \({\text{cm}^{-1}}\) at the photon energy corresponding to the particular scan

    - device (str, optional) – Pytorch computation device. Defaults to ‘cpu’.

  forward(object_i, i, norm_constant=None)

    Applies attenuation correction to an object that’s being detected on the right of its first axis.

    Parameters:

      - object_i (torch.tensor) – Tensor of size [batch_size, Lx, Ly, Lz] being projected along `axis=1`.

      - i (int) – The projection index: used to find the corresponding angle in image space corresponding to `object_i`. In particular, the x axis (tensor axis=1) of the object is aligned with the detector at angle i.

      - norm_constant (torch.tensor, optional) – A tensor used to normalize the output during back projection. Defaults to None.

    Returns:

      Tensor of size [batch_size, Lx, Ly, Lz] such that projection of this tensor along the first axis corresponds to an attenuation corrected projection.

    Return type:

      torch.tensor