pytomography.transforms.PET — PyTomography 0.8.0 documentation

Skip to main content
`Ctrl`+`K`

# `pytomography.transforms.PET`

## Submodules

- `pytomography.transforms.PET.attenuation`
- `pytomography.transforms.PET.psf`

## Package Contents

### Classes

`PETAttenuationTransform` | im2im mapping used to model the effects of attenuation in PET.
`PETPSFTransform` | im2im transform used to model the effects of PSF blurring in PET. The smoothing kernel is assumed to be independent of \(\theta\) and \(z\), but is dependent on \(r\).

class pytomography.transforms.PET.PETAttenuationTransform(CT)

  Bases: `pytomography.transforms.Transform`

  im2im mapping used to model the effects of attenuation in PET.

  Parameters:

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

    - device (str, optional) – Pytorch device used for computation. If None, uses the default device pytomography.device Defaults to None.

  configure(object_meta, image_meta)

    Function used to initalize the transform using corresponding object and image metadata

    Parameters:

      - object_meta (ObjectMeta) – Object metadata.

      - image_meta (ImageMeta) – Image metadata.

    Return type:

      None

  forward(image)

    Applies forward projection of attenuation modeling \(B:\mathbb{V} \to \mathbb{V}\) to a 2D PET image.

    Parameters:

      image (torch.Tensor) – Tensor of size [batch_size, Ltheta, Lr, Lz] which transform is appplied to

    Returns:

      Tensor of size [batch_size, Ltheta, Lr, Lz] corresponding to attenuation-corrected image.

    Return type:

      torch.Tensor

  backward(image, norm_constant=None)

    Applies back projection of attenuation modeling \(B^T:\mathbb{V} \to \mathbb{V}\) to a 2D PET image. Since the matrix is diagonal, its the `backward` implementation is identical to the `forward` implementation; the only difference is the optional `norm_constant` which is needed if one wants to normalize the back projection.

    Parameters:

      - image (torch.Tensor) – Tensor of size [batch_size, Ltheta, Lr, Lz] which transform is appplied to

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

    Returns:

      Tensor of size [batch_size, Ltheta, Lr, Lz] corresponding to attenuation-corrected image.

    Return type:

      torch.tensor

class pytomography.transforms.PET.PETPSFTransform(kerns)

  Bases: `pytomography.transforms.Transform`

  im2im transform used to model the effects of PSF blurring in PET. The smoothing kernel is assumed to be independent of \(\theta\) and \(z\), but is dependent on \(r\).

  Parameters:

    kerns (Sequence[callable]) – A sequence of PSF kernels applied to the Lr dimension of the image with shape [batch_size, Lr, Ltheta, Lz]

  configure(object_meta, image_meta)

    Function used to initalize the transform using corresponding object and image metadata

    Parameters:

      - object_meta (ObjectMeta) – Object metadata.

      - image_meta (ImageMeta) – Image metadata.

    Return type:

      None

  construct_matrix()

    Constructs the matrix used to apply PSF blurring.

  forward(image)

    Applies the forward projection of PSF modeling \(B:\mathbb{V} \to \mathbb{V}\) to a PET image.

    Parameters:

      image (torch.tensor]) – Tensor of size [batch_size, Ltheta, Lr, Lz] corresponding to the image

    Returns:

      Tensor of size [batch_size, Ltheta, Lr, Lz] corresponding to the PSF corrected image.

    Return type:

      torch.tensor

  backward(image, norm_constant=None)

    Applies the back projection of PSF modeling \(B^T:\mathbb{V} \to \mathbb{V}\) to a PET image.

    Parameters:

      - image (torch.tensor]) – Tensor of size [batch_size, Ltheta, Lr, Lz] corresponding to the image norm_constant (torch.tensor, optional): A tensor used to normalize the output during back projection. Defaults to None.

      - norm_constant (torch.Tensor | None) –

    Returns:

      Tensor of size [batch_size, Ltheta, Lr, Lz] corresponding to the PSF corrected image.

    Return type:

      torch.tensor