Examples

These galleries progress from PET scanner geometry and projectors, through iterative reconstruction algorithms (sinogram and listmode), to transmission and joint activity/attenuation (MLAA) reconstruction, and finally PyTorch integration. If you are new to parallelproj, read the Quickstart first, then work through the galleries roughly in numerical order.

Every example selects its array backend and device through the helper suggest_array_backend_and_device from parallelproj._examples_utils – a private, examples-only module shipped inside parallelproj – so the same code runs on CPU or GPU with nothing extra to install or download.

PET scanner and sinogram geometry examples

These examples introduce the geometry objects that every projector is built from: cylindrical regular-polygon scanners and modular block scanners, how detector lines of response (LORs) map to sinogram bins, axial compression via the Michelogram (span and maximum ring difference), and sinogram symmetries. Start here to understand the building blocks used throughout the other galleries.

Regular polygon PET scanner geometry

Regular polygon PET scanner geometry

LOR descriptors and sinogram definition

LOR descriptors and sinogram definition

Modularized (block) PET scanner geometry

Modularized (block) PET scanner geometry

Michelograms and axial sinogram compression

Michelograms and axial sinogram compression

Zig-zag sampling of LORs in a sinogram view

Zig-zag sampling of LORs in a sinogram view

Sinogram symmetries

Sinogram symmetries

Detector mashing: fewer, bigger virtual detectors

Detector mashing: fewer, bigger virtual detectors

TOF-bin mashing: fewer, wider time-of-flight bins

TOF-bin mashing: fewer, wider time-of-flight bins

PET sinogram and listmode projector examples

Here you build projectors and run forward and back projections: non-TOF and TOF sinogram projectors for cylindrical scanners, the equal-block projector for modular scanners, the listmode projector, and the unlister that maps listmode events to sinograms. These examples show the core proj(image) / proj.adjoint(sinogram) interface that the reconstruction galleries rely on.

PET non-TOF sinogram projector

PET non-TOF sinogram projector

PET TOF sinogram projector

PET TOF sinogram projector

Non-TOF and TOF projections using a modularized (block) PET scanner geometry

Non-TOF and TOF projections using a modularized (block) PET scanner geometry

PET listmode projector (non-TOF and TOF)

PET listmode projector (non-TOF and TOF)

Listmode to sinogram unlisting

Listmode to sinogram unlisting

Emission tomography reconstruction algorithms (sinogram data)

A tour of reconstruction algorithms for the (regularised) Poisson problem, all built on the data-fidelity and prior objects in parallelproj.functions. Start with the MLEM / OSEM / SVRG convergence comparison, then explore the stochastic-gradient variants, PDHG / SPDHG with edge-preserving priors, filtered back projection, De Pierro’s MAP-EM, the effect of TOF on variance, and out-of-core (memory-mapped) OSEM.

Convergence comparison: MLEM vs OSEM vs SVRG

Convergence comparison: MLEM vs OSEM vs SVRG

Convergence comparison: SGD vs SVRG with logcosh regularization

Convergence comparison: SGD vs SVRG with logcosh regularization

PDHG and SPDHG for PET reconstruction with a directional TV prior

PDHG and SPDHG for PET reconstruction with a directional TV prior

2D non-TOF filtered back projection (FBP) of Poisson data

2D non-TOF filtered back projection (FBP) of Poisson data

DePierro’s algorithm to optimize the Poisson logL with quadratic intensity prior

DePierro's algorithm to optimize the Poisson logL with quadratic intensity prior

TOF vs non-TOF: variance reduction in a uniform cylinder

TOF vs non-TOF: variance reduction in a uniform cylinder

RAM-efficient OSEM with disk-backed TOF sinograms

RAM-efficient OSEM with disk-backed TOF sinograms

Exact vs. “safe epsilon” mode of the negative Poisson log-likelihood

Exact vs. "safe epsilon" mode of the negative Poisson log-likelihood

Emission tomography reconstruction algorithms (listmode data)

The same families of algorithms as the sinogram gallery, but operating directly on listmode (event-by-event) data through the listmode projector: listmode MLEM / OSEM / SVRG, stochastic-gradient variants, and listmode SPDHG. Listmode is the natural choice for sparse, high-resolution (e.g. TOF) data.

Listmode MLEM, OSEM, and SVRG

Listmode MLEM, OSEM, and SVRG

Convergence comparison: SGD vs SVRG with regularization (sinogram and listmode)

Convergence comparison: SGD vs SVRG with regularization (sinogram and listmode)

PDHG and LM-SPDHG to optimize the Poisson logL and total variation

PDHG and LM-SPDHG to optimize the Poisson logL and total variation

Transmission and joint activity/attenuation (MLAA) examples

Reconstruction of the attenuation image from transmission data using the exact Poisson model (no log-linearisation) with a strictly positive scatter background: MLTR and separable paraboloidal surrogates (SPS), their ordered-subset and SVRG variants, and penalised transmission reconstruction (MAPTR) with an edge-preserving prior. The final example extends these ideas to joint activity-and-attenuation estimation (MLAA) from a single TOF emission scan.

Transmission reconstruction: MLTR, SPS and L-BFGS-B

Transmission reconstruction: MLTR, SPS and L-BFGS-B

Accelerating MLTR with ordered subsets (OS-MLTR) and SVRG

Accelerating MLTR with ordered subsets (OS-MLTR) and SVRG

Penalised transmission reconstruction (MAPTR) with an edge-preserving prior

Penalised transmission reconstruction (MAPTR) with an edge-preserving prior

Joint activity and attenuation reconstruction (MLAA) for TOF PET

Joint activity and attenuation reconstruction (MLAA) for TOF PET

Custom parallelproj pytorch layer examples

How to wrap a parallelproj operator as a differentiable PyTorch layer, with an autograd-compatible forward and adjoint, so that projectors can be embedded in deep-learning reconstruction pipelines (e.g. unrolled / model-based networks).

pytorch parallelproj projection layer

pytorch parallelproj projection layer

Gallery generated by Sphinx-Gallery