:orphan:
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.
.. raw:: html
.. thumbnail-parent-div-open
.. thumbnail-parent-div-close
.. raw:: html
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.
.. raw:: html
.. thumbnail-parent-div-open
.. raw:: html
.. only:: html
.. image:: /auto_examples/01_pet_geometry/images/thumb/sphx_glr_01_run_regular_polygon_pet_scanner_thumb.png
:alt:
:doc:`/auto_examples/01_pet_geometry/01_run_regular_polygon_pet_scanner`
.. raw:: html
Regular polygon PET scanner geometry
.. raw:: html
.. only:: html
.. image:: /auto_examples/01_pet_geometry/images/thumb/sphx_glr_02_run_regular_polygon_pet_sino_thumb.png
:alt:
:doc:`/auto_examples/01_pet_geometry/02_run_regular_polygon_pet_sino`
.. raw:: html
LOR descriptors and sinogram definition
.. raw:: html
.. only:: html
.. image:: /auto_examples/01_pet_geometry/images/thumb/sphx_glr_03_run_block_scanner_thumb.png
:alt:
:doc:`/auto_examples/01_pet_geometry/03_run_block_scanner`
.. raw:: html
Modularized (block) PET scanner geometry
.. raw:: html
.. only:: html
.. image:: /auto_examples/01_pet_geometry/images/thumb/sphx_glr_04_run_michelogram_and_compression_thumb.png
:alt:
:doc:`/auto_examples/01_pet_geometry/04_run_michelogram_and_compression`
.. raw:: html
Michelograms and axial sinogram compression
.. raw:: html
.. only:: html
.. image:: /auto_examples/01_pet_geometry/images/thumb/sphx_glr_05_run_zigzag_comparison_thumb.png
:alt:
:doc:`/auto_examples/01_pet_geometry/05_run_zigzag_comparison`
.. raw:: html
Zig-zag sampling of LORs in a sinogram view
.. raw:: html
.. only:: html
.. image:: /auto_examples/01_pet_geometry/images/thumb/sphx_glr_06_run_sinogram_symmetries_thumb.png
:alt:
:doc:`/auto_examples/01_pet_geometry/06_run_sinogram_symmetries`
.. raw:: html
Sinogram symmetries
.. raw:: html
.. only:: html
.. image:: /auto_examples/01_pet_geometry/images/thumb/sphx_glr_07_run_detector_mashing_thumb.png
:alt:
:doc:`/auto_examples/01_pet_geometry/07_run_detector_mashing`
.. raw:: html
Detector mashing: fewer, bigger virtual detectors
.. raw:: html
.. only:: html
.. image:: /auto_examples/01_pet_geometry/images/thumb/sphx_glr_08_run_tof_bin_mashing_thumb.png
:alt:
:doc:`/auto_examples/01_pet_geometry/08_run_tof_bin_mashing`
.. raw:: html
TOF-bin mashing: fewer, wider time-of-flight bins
.. thumbnail-parent-div-close
.. raw:: html
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.
.. raw:: html
.. thumbnail-parent-div-open
.. raw:: html
.. only:: html
.. image:: /auto_examples/02_pet_sinogram_projections/images/thumb/sphx_glr_01_run_pet_non_tof_sinogram_projector_thumb.png
:alt:
:doc:`/auto_examples/02_pet_sinogram_projections/01_run_pet_non_tof_sinogram_projector`
.. raw:: html
PET non-TOF sinogram projector
.. raw:: html
.. only:: html
.. image:: /auto_examples/02_pet_sinogram_projections/images/thumb/sphx_glr_02_run_pet_tof_sinogram_projector_thumb.png
:alt:
:doc:`/auto_examples/02_pet_sinogram_projections/02_run_pet_tof_sinogram_projector`
.. raw:: html
PET TOF sinogram projector
.. raw:: html
.. only:: html
.. image:: /auto_examples/02_pet_sinogram_projections/images/thumb/sphx_glr_03_run_equalblock_projector_thumb.png
:alt:
:doc:`/auto_examples/02_pet_sinogram_projections/03_run_equalblock_projector`
.. raw:: html
Non-TOF and TOF projections using a modularized (block) PET scanner geometry
.. raw:: html
.. only:: html
.. image:: /auto_examples/02_pet_sinogram_projections/images/thumb/sphx_glr_04_run_pet_listmode_projector_thumb.png
:alt:
:doc:`/auto_examples/02_pet_sinogram_projections/04_run_pet_listmode_projector`
.. raw:: html
PET listmode projector (non-TOF and TOF)
.. raw:: html
.. only:: html
.. image:: /auto_examples/02_pet_sinogram_projections/images/thumb/sphx_glr_05_run_unlister_thumb.png
:alt:
:doc:`/auto_examples/02_pet_sinogram_projections/05_run_unlister`
.. raw:: html
Listmode to sinogram unlisting
.. thumbnail-parent-div-close
.. raw:: html
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.
.. raw:: html
.. thumbnail-parent-div-open
.. raw:: html
.. only:: html
.. image:: /auto_examples/03_algorithms/images/thumb/sphx_glr_00_run_mlem_osem_svrg_thumb.png
:alt:
:doc:`/auto_examples/03_algorithms/00_run_mlem_osem_svrg`
.. raw:: html
Convergence comparison: MLEM vs OSEM vs SVRG
.. raw:: html
.. only:: html
.. image:: /auto_examples/03_algorithms/images/thumb/sphx_glr_01_run_sgd_svrg_thumb.png
:alt:
:doc:`/auto_examples/03_algorithms/01_run_sgd_svrg`
.. raw:: html
Convergence comparison: SGD vs SVRG with logcosh regularization
.. raw:: html
.. only:: html
.. image:: /auto_examples/03_algorithms/images/thumb/sphx_glr_02_run_pdhg_spdhg_dtv_thumb.png
:alt:
:doc:`/auto_examples/03_algorithms/02_run_pdhg_spdhg_dtv`
.. raw:: html
PDHG and SPDHG for PET reconstruction with a directional TV prior
.. raw:: html
.. only:: html
.. image:: /auto_examples/03_algorithms/images/thumb/sphx_glr_03_run_fbp_thumb.png
:alt:
:doc:`/auto_examples/03_algorithms/03_run_fbp`
.. raw:: html
2D non-TOF filtered back projection (FBP) of Poisson data
.. raw:: html
.. only:: html
.. image:: /auto_examples/03_algorithms/images/thumb/sphx_glr_04_run_depierro_thumb.png
:alt:
:doc:`/auto_examples/03_algorithms/04_run_depierro`
.. raw:: html
DePierro's algorithm to optimize the Poisson logL with quadratic intensity prior
.. raw:: html
.. only:: html
.. image:: /auto_examples/03_algorithms/images/thumb/sphx_glr_05_run_tof_variance_thumb.png
:alt:
:doc:`/auto_examples/03_algorithms/05_run_tof_variance`
.. raw:: html
TOF vs non-TOF: variance reduction in a uniform cylinder
.. raw:: html
.. only:: html
.. image:: /auto_examples/03_algorithms/images/thumb/sphx_glr_06_run_osem_memmap_thumb.png
:alt:
:doc:`/auto_examples/03_algorithms/06_run_osem_memmap`
.. raw:: html
RAM-efficient OSEM with disk-backed TOF sinograms
.. raw:: html
.. only:: html
.. image:: /auto_examples/03_algorithms/images/thumb/sphx_glr_07_run_mlem_negpoissonlogl_modes_thumb.png
:alt:
:doc:`/auto_examples/03_algorithms/07_run_mlem_negpoissonlogl_modes`
.. raw:: html
Exact vs. "safe epsilon" mode of the negative Poisson log-likelihood
.. thumbnail-parent-div-close
.. raw:: html
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.
.. raw:: html
.. thumbnail-parent-div-open
.. raw:: html
.. only:: html
.. image:: /auto_examples/04_listmode_algorithms/images/thumb/sphx_glr_00_run_listmode_mlem_osem_svrg_thumb.png
:alt:
:doc:`/auto_examples/04_listmode_algorithms/00_run_listmode_mlem_osem_svrg`
.. raw:: html
Listmode MLEM, OSEM, and SVRG
.. raw:: html
.. only:: html
.. image:: /auto_examples/04_listmode_algorithms/images/thumb/sphx_glr_01_run_listmode_sgd_svrg_thumb.png
:alt:
:doc:`/auto_examples/04_listmode_algorithms/01_run_listmode_sgd_svrg`
.. raw:: html
Convergence comparison: SGD vs SVRG with regularization (sinogram and listmode)
.. raw:: html
.. only:: html
.. image:: /auto_examples/04_listmode_algorithms/images/thumb/sphx_glr_02_lm_spdhg_thumb.png
:alt:
:doc:`/auto_examples/04_listmode_algorithms/02_lm_spdhg`
.. raw:: html
PDHG and LM-SPDHG to optimize the Poisson logL and total variation
.. thumbnail-parent-div-close
.. raw:: html
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.
.. raw:: html
.. thumbnail-parent-div-open
.. raw:: html
.. only:: html
.. image:: /auto_examples/05_transmission/images/thumb/sphx_glr_00_mltr_sps_thumb.png
:alt:
:doc:`/auto_examples/05_transmission/00_mltr_sps`
.. raw:: html
Transmission reconstruction: MLTR, SPS and L-BFGS-B
.. raw:: html
.. only:: html
.. image:: /auto_examples/05_transmission/images/thumb/sphx_glr_01_os_mltr_svrg_thumb.png
:alt:
:doc:`/auto_examples/05_transmission/01_os_mltr_svrg`
.. raw:: html
Accelerating MLTR with ordered subsets (OS-MLTR) and SVRG
.. raw:: html
.. only:: html
.. image:: /auto_examples/05_transmission/images/thumb/sphx_glr_02_run_maptr_thumb.png
:alt:
:doc:`/auto_examples/05_transmission/02_run_maptr`
.. raw:: html
Penalised transmission reconstruction (MAPTR) with an edge-preserving prior
.. raw:: html
.. only:: html
.. image:: /auto_examples/05_transmission/images/thumb/sphx_glr_03_mlaa_thumb.png
:alt:
:doc:`/auto_examples/05_transmission/03_mlaa`
.. raw:: html
Joint activity and attenuation reconstruction (MLAA) for TOF PET
.. thumbnail-parent-div-close
.. raw:: html
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).
.. raw:: html
.. thumbnail-parent-div-open
.. raw:: html
.. only:: html
.. image:: /auto_examples/06_torch/images/thumb/sphx_glr_01_run_projection_layer_thumb.png
:alt:
:doc:`/auto_examples/06_torch/01_run_projection_layer`
.. raw:: html
pytorch parallelproj projection layer
.. thumbnail-parent-div-close
.. raw:: html
.. toctree::
:hidden:
:includehidden:
/auto_examples/01_pet_geometry/index.rst
/auto_examples/02_pet_sinogram_projections/index.rst
/auto_examples/03_algorithms/index.rst
/auto_examples/04_listmode_algorithms/index.rst
/auto_examples/05_transmission/index.rst
/auto_examples/06_torch/index.rst
.. only:: html
.. container:: sphx-glr-footer sphx-glr-footer-gallery
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download all examples in Python source code: auto_examples_python.zip `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download all examples in Jupyter notebooks: auto_examples_jupyter.zip `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery