# australiansynchrotron/bctppl architecture

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

- Interactive diagram: https://gitdiagram.com/australiansynchrotron/bctppl
- Repository: https://github.com/australiansynchrotron/bctppl

## Overview

This repository is a small-toolkit BCT image-processing pipeline, but its README names no stages or workflow. The graph therefore presents the distinct processing and model components visible in the tree without asserting an unsupported sequence between them. Shared HDF5/TIFF input-output helpers and SSIM support form the internal layer. The sampled excerpts establish some imports and CLI entry points; many scripts and model connections remain unverified.

Main entry points: [`commonsource.py`](https://github.com/australiansynchrotron/bctppl/blob/main/commonsource.py) (Image and HDF I/O), [`patchMe.py`](https://github.com/australiansynchrotron/bctppl/blob/main/patchMe.py) (Patch and stitch), [`models/model2/sinogap_module.py`](https://github.com/australiansynchrotron/bctppl/blob/main/models/model2/sinogap_module.py) (Model 2 networks), [`ssim.py`](https://github.com/australiansynchrotron/bctppl/blob/main/ssim.py) (SSIM metrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_processing["Image processing"]
  node_align["Image alignment<br/>[align.cpp]"]
  node_pairshift["Pair shifts<br/>[pairShift.py]"]
  node_patch["Patch and stitch<br/>[patchMe.py]"]
  node_ring["Ring correction<br/>[ring.py]"]
end

subgraph group_tracking["Tracking and analysis"]
  node_track["Ball tracking<br/>[trackme.py]"]
  node_streamanalysis["Stream analysis<br/>[analyzeStream.py]"]
  node_trackanalysis["Track analysis<br/>[analyzeTrack.py]"]
end

subgraph group_gapmodels["Gap repair models"]
  node_sinogap["Sinogram gap repair<br/>[sinogapme.py]"]
  node_model2loader["Model 2 loader<br/>[loadMe.py]"]
  node_model2core["Model 2 networks<br/>[sinogap_module.py]"]
  node_model3loader["Model 3 loader<br/>[loadMe.py]"]
  node_model3core["Model 3 networks<br/>[sinogap_module.py]"]
  node_model4loader["Model 4 loader<br/>[loadMe.py]"]
  node_model4core["Model 4 networks<br/>[sinogap_module.py]"]
  node_shiftloader["Shift-patch loader<br/>[loadMe.py]"]
  node_genericloader["Generic patch loader<br/>[loadMe.py]"]
  node_shiftcore["Generic patch network"]
end

subgraph group_shared["Shared utilities"]
  node_common["Image and HDF I/O<br/>[commonsource.py]"]
  node_ssim["SSIM metrics<br/>[ssim.py]"]
end

node_user(("Operator"))

node_user -->|"runs"| node_track
node_user -->|"runs"| node_patch
node_track -->|"uses I/O"| node_common
node_pairshift -->|"uses I/O"| node_common
node_patch -->|"uses I/O"| node_common
node_patch -->|"loads model"| node_genericloader
node_sinogap -->|"uses I/O"| node_common
node_sinogap -->|"loads model"| node_model4loader
node_model2loader -->|"uses network base"| node_model2core
node_model3loader -->|"uses network base"| node_model2core
node_model4loader -->|"uses network base"| node_model2core
node_model4core -->|"uses metrics"| node_ssim
node_shiftcore -->|"uses metrics"| node_ssim
node_genericloader -.->|"uses network"| node_shiftcore
node_common -->|"imports"| node_ssim

click node_align "https://github.com/australiansynchrotron/bctppl/blob/main/align.cpp"
click node_pairshift "https://github.com/australiansynchrotron/bctppl/blob/main/pairShift.py"
click node_patch "https://github.com/australiansynchrotron/bctppl/blob/main/patchMe.py"
click node_ring "https://github.com/australiansynchrotron/bctppl/blob/main/ring.py"
click node_track "https://github.com/australiansynchrotron/bctppl/blob/main/trackme.py"
click node_streamanalysis "https://github.com/australiansynchrotron/bctppl/blob/main/analyzeStream.py"
click node_trackanalysis "https://github.com/australiansynchrotron/bctppl/blob/main/analyzeTrack.py"
click node_sinogap "https://github.com/australiansynchrotron/bctppl/blob/main/sinogapme.py"
click node_model2loader "https://github.com/australiansynchrotron/bctppl/blob/main/models/model2/loadMe.py"
click node_model2core "https://github.com/australiansynchrotron/bctppl/blob/main/models/model2/sinogap_module.py"
click node_model3loader "https://github.com/australiansynchrotron/bctppl/blob/main/models/model3/loadMe.py"
click node_model3core "https://github.com/australiansynchrotron/bctppl/blob/main/models/model3/sinogap_module.py"
click node_model4loader "https://github.com/australiansynchrotron/bctppl/blob/main/models/model4/loadMe.py"
click node_model4core "https://github.com/australiansynchrotron/bctppl/blob/main/models/model4/sinogap_module.py"
click node_shiftloader "https://github.com/australiansynchrotron/bctppl/blob/main/models/shiftpatch/loadMe.py"
click node_genericloader "https://github.com/australiansynchrotron/bctppl/blob/main/models/shiftpatch_generic/loadMe.py"
click node_shiftcore "https://github.com/australiansynchrotron/bctppl/blob/main/models/shiftpatch_generic/shiftpatch_module.py"
click node_common "https://github.com/australiansynchrotron/bctppl/blob/main/commonsource.py"
click node_ssim "https://github.com/australiansynchrotron/bctppl/blob/main/ssim.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_align,node_pairshift,node_patch,node_ring toneBlue
class node_track,node_streamanalysis,node_trackanalysis toneAmber
class node_sinogap,node_model2loader,node_model2core,node_model3loader,node_model3core,node_model4loader,node_model4core,node_shiftloader,node_genericloader,node_shiftcore toneMint
class node_common,node_ssim toneRose
class node_user toneIndigo
```

## Components

### Image processing

- [Image alignment](https://github.com/australiansynchrotron/bctppl/blob/main/align.cpp): `align.cpp`
- [Pair shifts](https://github.com/australiansynchrotron/bctppl/blob/main/pairShift.py): `pairShift.py`
- [Patch and stitch](https://github.com/australiansynchrotron/bctppl/blob/main/patchMe.py): `patchMe.py`
- [Ring correction](https://github.com/australiansynchrotron/bctppl/blob/main/ring.py): `ring.py`

### Tracking and analysis

- [Ball tracking](https://github.com/australiansynchrotron/bctppl/blob/main/trackme.py): `trackme.py`
- [Stream analysis](https://github.com/australiansynchrotron/bctppl/blob/main/analyzeStream.py): `analyzeStream.py`
- [Track analysis](https://github.com/australiansynchrotron/bctppl/blob/main/analyzeTrack.py): `analyzeTrack.py`

### Gap repair models

- [Sinogram gap repair](https://github.com/australiansynchrotron/bctppl/blob/main/sinogapme.py): `sinogapme.py`
- [Model 2 loader](https://github.com/australiansynchrotron/bctppl/blob/main/models/model2/loadMe.py): `models/model2/loadMe.py`
- [Model 2 networks](https://github.com/australiansynchrotron/bctppl/blob/main/models/model2/sinogap_module.py): `models/model2/sinogap_module.py`
- [Model 3 loader](https://github.com/australiansynchrotron/bctppl/blob/main/models/model3/loadMe.py): `models/model3/loadMe.py`
- [Model 3 networks](https://github.com/australiansynchrotron/bctppl/blob/main/models/model3/sinogap_module.py): `models/model3/sinogap_module.py`
- [Model 4 loader](https://github.com/australiansynchrotron/bctppl/blob/main/models/model4/loadMe.py): `models/model4/loadMe.py`
- [Model 4 networks](https://github.com/australiansynchrotron/bctppl/blob/main/models/model4/sinogap_module.py): `models/model4/sinogap_module.py`
- [Shift-patch loader](https://github.com/australiansynchrotron/bctppl/blob/main/models/shiftpatch/loadMe.py): `models/shiftpatch/loadMe.py`
- [Generic patch loader](https://github.com/australiansynchrotron/bctppl/blob/main/models/shiftpatch_generic/loadMe.py): `models/shiftpatch_generic/loadMe.py`
- [Generic patch network](https://github.com/australiansynchrotron/bctppl/blob/main/models/shiftpatch_generic/shiftpatch_module.py): `models/shiftpatch_generic/shiftpatch_module.py`

### Shared utilities

- [Image and HDF I/O](https://github.com/australiansynchrotron/bctppl/blob/main/commonsource.py): `commonsource.py`
- [SSIM metrics](https://github.com/australiansynchrotron/bctppl/blob/main/ssim.py): `ssim.py`

### Other components

- **Operator**

## Connections

- Operator → Ball tracking: runs (evidence: `trackme.py`)
- Operator → Patch and stitch: runs (evidence: `patchMe.py`)
- Ball tracking → Image and HDF I/O: uses I/O (evidence: `trackme.py`)
- Pair shifts → Image and HDF I/O: uses I/O (evidence: `pairShift.py`)
- Patch and stitch → Image and HDF I/O: uses I/O (evidence: `patchMe.py`)
- Patch and stitch → Generic patch loader: loads model (evidence: `patchMe.py`)
- Sinogram gap repair → Image and HDF I/O: uses I/O (evidence: `sinogapme.py`)
- Sinogram gap repair → Model 4 loader: loads model (evidence: `sinogapme.py`)
- Model 2 loader → Model 2 networks: uses network base (evidence: `models/model2/loadMe.py`)
- Model 3 loader → Model 2 networks: uses network base (evidence: `models/model3/loadMe.py`)
- Model 4 loader → Model 2 networks: uses network base (evidence: `models/model4/loadMe.py`)
- Model 4 networks → SSIM metrics: uses metrics (evidence: `models/model4/sinogap_module.py`)
- Generic patch network → SSIM metrics: uses metrics (evidence: `models/shiftpatch_generic/shiftpatch_module.py`)
- Generic patch loader → Generic patch network: uses network
- Image and HDF I/O → SSIM metrics: imports (evidence: `commonsource.py`)
