pytomography.transforms.PET
#
Submodules#
Package Contents#
Classes#
im2im mapping used to model the effects of attenuation in PET. |
|
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)[source]#
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
- __call__(image, norm_constant=None, mode='forward_project')#
Applies attenuation modeling to a PET image.
- 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.
mode (str, optional) – Whether or not this is being used in forward (‘forward_project’) or backward projection (‘back_project’). Defaults to ‘forward_project’.
- Returns:
Tensor of size [batch_size, Ltheta, Lr, Lz] corresponding to attenuation-corrected image.
- Return type:
torch.tensor
- class pytomography.transforms.PET.PETPSFTransform(kerns)[source]#
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.
- __call__(image, mode='forward_project')#
Applies PSF modeling to the 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.
mode (str) – Whether or not this is being used in forward (‘forward_project’) or backward projection (‘back_project’). Defaults to ‘forward_project’
- Returns:
Tensor of size [batch_size, Ltheta, Lr, Lz] corresponding to the PSF corrected image.
- Return type:
torch.tensor