# yalebioimaging/yrt-pet architecture

> Architecture diagram of the GitHub repository yalebioimaging/yrt-pet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yalebioimaging/yrt-pet
- Repository: https://github.com/yalebioimaging/yrt-pet
- Video tour (about a minute): https://gitdiagram.com/yalebioimaging/yrt-pet/video

## Overview

YRT-PET is a PET image-reconstruction toolkit centered on OSEM for list-mode and histogram data. Its principal workflow is to configure a scanner and projection input, run reconstruction with selected projectors and corrections, and produce reconstructed images; command-line tools also convert, forward-project, and backproject data. Python bindings expose library functionality. The graph preserves documented capabilities, while unsampled subsystem links are omitted where the excerpts and README do not establish a specific runtime call.

Main entry points: [`yrt-pet/src/recon/OSEM.cpp`](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/recon/OSEM.cpp) (OSEM reconstruction), [`yrt-pet/executables/recon/Reconstruct.cpp`](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/recon/Reconstruct.cpp) (OSEM CLI), [`yrt-pet/include/yrt-pet/datastruct/IO.hpp`](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/include/yrt-pet/datastruct/IO.hpp) (Data I/O), [`yrt-pet/include/yrt-pet/datastruct/PluginFramework.hpp`](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/include/yrt-pet/datastruct/PluginFramework.hpp) (Format plugins)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Application entry points"]
  node_reconstruct["OSEM CLI<br/>[Reconstruct.cpp]"]
  node_convert["Data conversion"]
  node_forward["Forward project<br/>[ForwardProject.cpp]"]
  node_backproject["Backproject<br/>[Backproject.cpp]"]
  node_argreader["Argument reader<br/>[ArgumentReader.cpp]"]
end

subgraph group_data["PET data model"]
  node_scanner["Scanner geometry"]
  node_projection["Projection data<br/>[ProjectionData.hpp]"]
  node_formats["Format plugins"]
  node_image["Image and NIfTI"]
  node_io["Data I/O<br/>[IO.hpp]"]
end

subgraph group_recon["Reconstruction engine"]
  node_osem["OSEM reconstruction<br/>[OSEM.cpp]"]
  node_corrections["Additive and attenuation corrections"]
  node_motion["Motion correction<br/>[LORMotion.cpp]"]
end

subgraph group_physics["Imaging operations"]
  node_projectors["Projectors and TOF"]
  node_psf["PSF operators"]
  node_scatter["Scatter estimation"]
end

subgraph group_interfaces["Language interfaces"]
  node_pybinding["Python bindings<br/>[pybind11.cpp]"]
  node_python_api["Python API<br/>[_pyyrtpet.py]"]
end

node_user(("PET researcher"))
node_cuda["NVIDIA CUDA"]
node_output["Reconstructed image"]

node_user -->|"runs"| node_reconstruct
node_reconstruct -->|"runs OSEM"| node_osem
node_reconstruct -->|"parses options"| node_argreader
node_reconstruct -->|"loads scanner"| node_scanner
node_reconstruct -->|"opens input"| node_io
node_io -->|"dispatches formats"| node_formats
node_formats -->|"creates projection data"| node_projection
node_osem -->|"uses projectors"| node_projectors
node_osem -->|"applies corrections"| node_corrections
node_osem -->|"supports event motion"| node_motion
node_osem -->|"supports PSF"| node_psf
node_osem -->|"supports scatter estimates"| node_scatter
node_osem -->|"produces image"| node_output
node_user -->|"converts data"| node_convert
node_user -->|"forward projects"| node_forward
node_user -->|"backprojects data"| node_backproject
node_osem -.->|"accelerates with"| node_cuda
node_user -->|"uses Python API"| node_python_api
node_python_api -.->|"exposes bindings"| node_pybinding
node_io -.->|"reads image data"| node_image

click node_reconstruct "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/recon/Reconstruct.cpp"
click node_convert "https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/executables/conversion"
click node_forward "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/recon/ForwardProject.cpp"
click node_backproject "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/recon/Backproject.cpp"
click node_argreader "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/ArgumentReader.cpp"
click node_scanner "https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/src/datastruct/scanner"
click node_projection "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/include/yrt-pet/datastruct/projection/ProjectionData.hpp"
click node_formats "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/include/yrt-pet/datastruct/PluginFramework.hpp"
click node_image "https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/src/datastruct/image"
click node_io "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/include/yrt-pet/datastruct/IO.hpp"
click node_osem "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/recon/OSEM.cpp"
click node_corrections "https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/include/yrt-pet/recon"
click node_motion "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/datastruct/projection/LORMotion.cpp"
click node_projectors "https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/src/operators"
click node_psf "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/operators/ProjectionPsfManager.cpp"
click node_scatter "https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/src/scatter"
click node_pybinding "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/pybind11.cpp"
click node_python_api "https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/python/pyyrtpet/_pyyrtpet.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_reconstruct,node_convert,node_forward,node_backproject,node_argreader toneBlue
class node_scanner,node_projection,node_formats,node_image,node_io toneAmber
class node_osem,node_corrections,node_motion toneMint
class node_projectors,node_psf,node_scatter toneRose
class node_pybinding,node_python_api,node_user,node_cuda,node_output toneIndigo
```

## Components

### Application entry points

- [OSEM CLI](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/recon/Reconstruct.cpp): `yrt-pet/executables/recon/Reconstruct.cpp`
- [Data conversion](https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/executables/conversion): `yrt-pet/executables/conversion`
- [Forward project](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/recon/ForwardProject.cpp): `yrt-pet/executables/recon/ForwardProject.cpp`
- [Backproject](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/recon/Backproject.cpp): `yrt-pet/executables/recon/Backproject.cpp`
- [Argument reader](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/executables/ArgumentReader.cpp): `yrt-pet/executables/ArgumentReader.cpp`

### PET data model

- [Scanner geometry](https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/src/datastruct/scanner): `yrt-pet/src/datastruct/scanner`
- [Projection data](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/include/yrt-pet/datastruct/projection/ProjectionData.hpp): `yrt-pet/include/yrt-pet/datastruct/projection/ProjectionData.hpp`
- [Format plugins](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/include/yrt-pet/datastruct/PluginFramework.hpp): `yrt-pet/include/yrt-pet/datastruct/PluginFramework.hpp`
- [Image and NIfTI](https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/src/datastruct/image): `yrt-pet/src/datastruct/image`
- [Data I/O](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/include/yrt-pet/datastruct/IO.hpp): `yrt-pet/include/yrt-pet/datastruct/IO.hpp`

### Reconstruction engine

- [OSEM reconstruction](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/recon/OSEM.cpp): `yrt-pet/src/recon/OSEM.cpp`
- [Additive and attenuation corrections](https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/include/yrt-pet/recon): `yrt-pet/include/yrt-pet/recon`
- [Motion correction](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/datastruct/projection/LORMotion.cpp): `yrt-pet/src/datastruct/projection/LORMotion.cpp`

### Imaging operations

- [Projectors and TOF](https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/src/operators): `yrt-pet/src/operators`
- [PSF operators](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/operators/ProjectionPsfManager.cpp): `yrt-pet/src/operators/ProjectionPsfManager.cpp`
- [Scatter estimation](https://github.com/yalebioimaging/yrt-pet/tree/main/yrt-pet/src/scatter): `yrt-pet/src/scatter`

### Language interfaces

- [Python bindings](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/src/pybind11.cpp): `yrt-pet/src/pybind11.cpp`
- [Python API](https://github.com/yalebioimaging/yrt-pet/blob/main/yrt-pet/python/pyyrtpet/_pyyrtpet.py): `yrt-pet/python/pyyrtpet/_pyyrtpet.py`

### Other components

- **PET researcher**
- **NVIDIA CUDA**
- **Reconstructed image**

## Connections

- PET researcher → OSEM CLI: runs
- OSEM CLI → OSEM reconstruction: runs OSEM
- OSEM CLI → Argument reader: parses options (evidence: `yrt-pet/executables/recon/Reconstruct.cpp`)
- OSEM CLI → Scanner geometry: loads scanner (evidence: `yrt-pet/executables/recon/Reconstruct.cpp`)
- OSEM CLI → Data I/O: opens input (evidence: `yrt-pet/executables/recon/Reconstruct.cpp`)
- Data I/O → Format plugins: dispatches formats (evidence: `yrt-pet/include/yrt-pet/datastruct/IO.hpp`)
- Format plugins → Projection data: creates projection data (evidence: `yrt-pet/include/yrt-pet/datastruct/PluginFramework.hpp`)
- OSEM reconstruction → Projectors and TOF: uses projectors
- OSEM reconstruction → Additive and attenuation corrections: applies corrections (evidence: `yrt-pet/src/recon/OSEM.cpp`)
- OSEM reconstruction → Motion correction: supports event motion
- OSEM reconstruction → PSF operators: supports PSF
- OSEM reconstruction → Scatter estimation: supports scatter estimates
- OSEM reconstruction → Reconstructed image: produces image
- PET researcher → Data conversion: converts data
- PET researcher → Forward project: forward projects
- PET researcher → Backproject: backprojects data
- OSEM reconstruction → NVIDIA CUDA: accelerates with
- PET researcher → Python API: uses Python API
- Python API → Python bindings: exposes bindings
- Data I/O → Image and NIfTI: reads image data
