GPU-accelerated 3D volumetric stitcher for tomographic and microscopy volumes.
Project description
TomoImageStitcher
A GPU-accelerated, sub-pixel accurate 3D volumetric stitcher for tomographic and large-volume microscopy datasets. TomoImageStitcher registers overlapping 3D sub-volumes acquired on a translation (and optionally rotation) stage and produces a single seamless volume with mask-aware blending and optional intensity equalisation.
Originally developed for stitching local X-ray tomography volumes for the Experiment at the DanMAX beamline, Sweden.
For a detailed step-by-step walkthrough of every pipeline stage with synthetic
data, see notebooks/02_full_pipeline.ipynb.
For the mathematical details of the registration, see [PUBLICATION].
What is it
TomoImageStitcher stitches together a set of overlapping 3D sub-volumes
(typically reconstructed tomography volumes) into one seamless volume.
Each stage is a Python call on the Stitcher object, so you can inspect and
re-run any stage on its own.
The pipeline runs in six stages:
| # | Stage | What it does |
|---|---|---|
| 1 | Organise sub-volumes | Classify into z-layers, compute global padding, find intersections. |
| 2 | Registration | ZNCC pixel search + IC-GN Lucas–Kanade refinement per pair. |
| 3 | Accumulate displacements | Chain per-pair shifts into a global warp graph (BFS). |
| 4 | Equalisation | Match intensities across overlaps via joint histograms. |
| 5 | Blending | Distance-map blending onto the global canvas, on the GPU. |
| 6 | Save and inspect | Write per-layer .h5 files with full pipeline metadata. |
The full per-stage walk-through with the code for every step lives in the detailed notebook linked above. The math behind the registration and blending lives in [PUBLICATION].
Where you can use it
- Stitching 3D X-ray tomography reconstructions from a multi-tile translation scan.
- Stitching raw projection volumes (radiographs) before reconstruction.
- Stitching 3D microscopy datasets (light-sheet, confocal) where individual tiles are too large to fit into memory.
- Multi-scan stitching where you have several scans with overlapping lateral extent.
- Stitching on a rotation stage (helical or tomographic) — see
notebooks/03_stitching_with_rotation.ipynb.
Install
TomoImageStitcher is on PyPI. A CUDA-capable GPU with the matching CuPy wheel is required for the GPU stages; everything else is plain Python.
# 1. (Recommended) a clean environment
python -m venv .venv && source .venv/bin/activate
# 2. Install with the notebook extras
pip install -U pip
pip install "tomo-image-stitcher[notebook,danmax]"
# 3. Install CuPy matching your CUDA version (CUDA 12.x shown)
pip install cupy-cuda12x
If you cannot install git, or you are behind a proxy that blocks it:
pip install https://github.com/indrajeettambe/TomoImageStitcher/archive/main.zip
For full instructions (drivers, conda env, troubleshooting) see
docs/installation.md.
Quick start
A minimal end-to-end example on synthetic data. The full version with
explanations and intermediate visualisations is in
notebooks/02_full_pipeline.ipynb.
import numpy as np
from tomo_image_stitcher import Stitcher
# 1. List of .h5 files and their motor positions in millimetres
file_paths = ["scan_001.h5", "scan_002.h5", "scan_003.h5"]
motor_coords = np.array([[ 0.0, 0.0, 0.0],
[ 0.8, 0.0, 0.0],
[ 1.6, 0.0, 0.0]])
mm_per_voxel = 0.0022 # 2.2 µm voxels
# 2. Initialise the stitcher
st = Stitcher(file_paths, motor_coords, mm_per_voxel,
x_y_z_correspondance=(-1, 3, 2))
# 3. Run the six stages
st.get_layers_in_z(tolerance_mm=4) # (1) Organise
st.get_padding()
st.get_intersections(check=True)
st.compute_shift_in_layers(downscale=4, downscale_stages=4, # (2) Registration
downscale_LC=True, mask=True, mask_radius=300)
st.get_displacement_pyramid(check=False)
st.accumulate_displacement(exclude_NCC=50) # (3) Accumulate
st.compose_final_displacements()
st.stitch_volumes_blend_equalize(...) # (4) + (5) Equalise + Blend
st.stitch_layers(path_save="output/") # (6) Save
# 4. Read the stitched volume
import h5py
with h5py.File("output/Stitched_layers/Layer_0.h5", "r") as f:
volume = f["stitched_data/stitched_image"][:]
Documentation
| Resource | Description |
|---|---|
notebooks/02_full_pipeline.ipynb |
Detailed step-by-step walkthrough of the full pipeline on synthetic data. Start here. |
notebooks/01_quickstart.ipynb |
Minimal 5-line end-to-end example. |
notebooks/03_stitching_with_rotation.ipynb |
Original DanMAX rotation-stage example (update paths before running). |
docs/architecture.md |
Data structures used between pipeline stages. |
docs/api.md |
Public classes, methods, and parameters. |
docs/quickstart.md |
More copy-paste recipes. |
docs/troubleshooting.md |
Common errors and how to recover. |
The mathematical details of the registration (ZNCC, IC-GN Lucas–Kanade, mask weighting) and blending (distance-map weighting) are described in [PUBLICATION].
Project layout
TomoImageStitcher/
├── src/tomo_image_stitcher/ Package source (Stitcher, RegistrationKIT, …)
├── notebooks/ Jupyter tutorials (start with 02_full_pipeline)
├── examples/ Standalone Python scripts
├── tests/ pytest test-suite
├── docs/ Architecture, API, troubleshooting
├── pyproject.toml Build & dependency metadata
├── LICENSE MIT
└── CITATION.cff Software citation
Citation
If you use TomoImageStitcher in your research, please cite it using the
metadata in CITATION.cff. A publication describing the
algorithm is in preparation and will be linked here when available
([PUBLICATION]).
License
MIT — see LICENSE.
Contributors
TomoImageStitcher was originally developed at the DanMAX beamline (MAX IV Laboratory, Sweden). See the git log for the full list of contributors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tomo_image_stitcher-0.2.0.tar.gz.
File metadata
- Download URL: tomo_image_stitcher-0.2.0.tar.gz
- Upload date:
- Size: 71.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7eb9fd878c1994ea519d923960f7fb8b9d6268a7203dc68a9c82ca9954ef09b9
|
|
| MD5 |
a5a73cb7746d1722183d7533a4e0704b
|
|
| BLAKE2b-256 |
e2c6785fdb3e2b11ab42d75ac108f776aa5da94372977802e3e57b8ee7956d23
|
Provenance
The following attestation bundles were made for tomo_image_stitcher-0.2.0.tar.gz:
Publisher:
publish-pypi.yml on indrajeettambe/TomoImageStitcher
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tomo_image_stitcher-0.2.0.tar.gz -
Subject digest:
7eb9fd878c1994ea519d923960f7fb8b9d6268a7203dc68a9c82ca9954ef09b9 - Sigstore transparency entry: 1739855106
- Sigstore integration time:
-
Permalink:
indrajeettambe/TomoImageStitcher@d9b33bac33e396d0c70b4fb0d3fd2dcb4b1f55e3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/indrajeettambe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@d9b33bac33e396d0c70b4fb0d3fd2dcb4b1f55e3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tomo_image_stitcher-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tomo_image_stitcher-0.2.0-py3-none-any.whl
- Upload date:
- Size: 67.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93f4f1d1fb5487fddcd65d396c9ed8b44d3cf12a5d942f0fc4ea4f85f33aa552
|
|
| MD5 |
e16d344ea9f1a83b616a9de75d52e20f
|
|
| BLAKE2b-256 |
b754f0c8bb5b9c63d1cda9fdb099702fb8b251520f391bd0964bae4c2498d4cd
|
Provenance
The following attestation bundles were made for tomo_image_stitcher-0.2.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on indrajeettambe/TomoImageStitcher
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tomo_image_stitcher-0.2.0-py3-none-any.whl -
Subject digest:
93f4f1d1fb5487fddcd65d396c9ed8b44d3cf12a5d942f0fc4ea4f85f33aa552 - Sigstore transparency entry: 1739855162
- Sigstore integration time:
-
Permalink:
indrajeettambe/TomoImageStitcher@d9b33bac33e396d0c70b4fb0d3fd2dcb4b1f55e3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/indrajeettambe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@d9b33bac33e396d0c70b4fb0d3fd2dcb4b1f55e3 -
Trigger Event:
push
-
Statement type: