pytomography.projectors.PET.pet_sinogram_system_matrix#
Module Contents#
Classes#
System matrix for sinogram-based PET reconstruction. |
Functions#
|
Generates a sinogram system matrix from a listmode system matrix. This is used in the single scatter simulation algorithm. |
- class pytomography.projectors.PET.pet_sinogram_system_matrix.PETSinogramSystemMatrix(object_meta, proj_meta, obj2obj_transforms=[], attenuation_map=None, sinogram_sensitivity=None, scale_projection_by_sensitivity=False, N_splits=1, device=pytomography.device)[source]#
Bases:
pytomography.projectors.SystemMatrixSystem matrix for sinogram-based PET reconstruction.
- Parameters:
object_meta (ObjectMeta) – Metadata of object space, containing information on voxel size and dimensions.
proj_meta (PETSinogramPolygonProjMeta) – PET sinogram projection space metadata. This information contains the scanner lookup table and time-of-flight metadata.
obj2obj_transforms (list[Transform], optional) – Object to object space transforms applied before forward projection and after back projection. These are typically used for PSF modeling in PET imaging. Defaults to [].
attenuation_map (torch.tensor | None, optional) – Attenuation map used for attenuation modeling. If provided, all weights will be scaled by detection probabilities derived from this map. Note that this scales on top of
sinogram_sensitivity, so if attenuation is already accounted for there, this is not needed. Defaults to None.sinogram_sensitivity (torch.tensor | None, optional) – Normalization sinogram used to scale projections after forward projection. This factor may include detector normalization \(\eta\) and/or attenuation modeling \(\mu\). The attenuation modeling \(\mu\) should not be included if
attenuation_mapis provided as an argument to the function. Defaults to None.scale_projection_by_sensitivity (bool, optional) – Whether or not to scale the projections by \(\mu \eta\). This is not needed in reconstruction algorithms using a PoissonLogLikelihood. Defaults to False.
N_splits (int, optional) – Splits up computation of forward/back projection to save GPU memory. Defaults to 1.
device (str, optional) – The device for any objects in projection space projection space (what it outputs in forward projection and what it expects for back projection). This is seperate from
pytomography.devicesince the internal functionality may still use GPU even if this is CPU. This is used to save GPU memory since sinograms are often very large. Defaults to pytomography.device.
- _get_xyz_sinogram_coordinates(subset_idx=None)[source]#
Get the XYZ coordinates corresponding to the pair of crystals of the projection angle
- Parameters:
subset_idx (int, optional) – Subset index for ths sinogram. If None, considers all elements. Defaults to None.
- Returns:
XYZ coordinates of crystal 1 and XYZ coordinates of crystal 2 corresponding to all elements in the sinogram.
- Return type:
Sequence[torch.Tensor, torch.Tensor]
- _compute_atteunation_probability_projection(subset_idx)[source]#
Compute the probability of a photon not being attenuated for a certain sinogram element.
- Parameters:
subset_idx (torch.tensor) – Subset index for ths sinogram.
- Returns:
Probability sinogram
- Return type:
torch.tensor
- _compute_sensitivity_sinogram(subset_idx=None)[source]#
Computes the sensitivity sinogram \(\mu \eta\) that accounts for attenuation effects and normalization effects.
- Parameters:
subset_idx (int, optional) – Subset index for ths sinogram. If None, considers all elements. Defaults to None..
- Returns:
Sensitivity sinogram.
- Return type:
torch.Tensor
- set_n_subsets(n_subsets)[source]#
Returns a list where each element consists of an array of indices corresponding to a partitioned version of the projections.
- Parameters:
n_subsets (int) – Number of subsets to partition the projections into
- Returns:
List of arrays where each array corresponds to the projection indices of a particular subset.
- Return type:
list
- get_projection_subset(projections, subset_idx)[source]#
Obtains subsampled projections \(g_m\) corresponding to subset index \(m\). Sinogram PET partitions projections based on angle.
- Parameters:
projections (torch.Tensor) – total projections \(g\)
subset_idx (int) – subset index \(m\)
- Returns:
subsampled projections \(g_m\).
- Return type:
torch.Tensor
- get_weighting_subset(subset_idx)[source]#
Computes the relative weighting of a given subset (given that the projection space is reduced). This is used for scaling parameters relative to \(\tilde{H}_m^T 1\) in reconstruction algorithms, such as prior weighting \(\beta\)
- Parameters:
subset_idx (int) – Subset index
- Returns:
Weighting for the subset.
- Return type:
float
- compute_normalization_factor(subset_idx=None)[source]#
Computes the normalization factor \(H^T \mu \eta\)
- Parameters:
subset_idx (int, optional) – Subset index for ths sinogram. If None, considers all elements. Defaults to None..
- Returns:
Normalization factor.
- Return type:
torch.Tensor
- forward(object, subset_idx=None)[source]#
PET Sinogram forward projection
- Parameters:
object (torch.tensor) – Object to be forward projected
subset_idx (int, optional) – Subset index for ths sinogram. If None, considers all elements. Defaults to None.
scale_by_sensitivity (bool, optional) – Whether or not to scale the projections by \(\mu \eta\). This is not necessarily needed in reconstruction algorithms. Defaults to False.
- Returns:
Forward projection
- Return type:
torch.tensor
- backward(proj, subset_idx=None, force_scale_by_sensitivity=False, force_nonTOF=False)[source]#
PET Sinogram back projection
- Parameters:
proj (torch.tensor) – Sinogram to be back projected
subset_idx (int, optional) – Subset index for ths sinogram. If None, considers all elements. Defaults to None.
scale_by_sensitivity (bool, optional) – Whether or not to scale the projections by \(\mu \eta\). This is not necessarily needed in reconstruction algorithms. Defaults to False.
force_nonTOF (bool, optional) – Force non-TOF projection, even if TOF metadata is contained in the projection metadata. This is used for computing normalization factors (which don’t depend on TOF). Defaults to False.
- Returns:
Back projection.
- Return type:
torch.tensor
- pytomography.projectors.PET.pet_sinogram_system_matrix.create_sinogramSM_from_LMSM(lm_system_matrix, device='cpu')[source]#
Generates a sinogram system matrix from a listmode system matrix. This is used in the single scatter simulation algorithm.
- Parameters:
lm_system_matrix (SystemMatrix) – A listmode PET system matrix
device (str, optional) – The device for any objects in projection space projection space (what it outputs in forward projection and what it expects for back projection). This is seperate from
pytomography.devicesince the internal functionality may still use GPU even if this is CPU. This is used to save GPU memory since sinograms are often very large. Defaults to pytomography.device.
- Returns:
PET sinogram system matrix generated via a corresponding PET listmode system matrix.
- Return type: