Skip to main content

PRIMO: Panoramic Reconstruction with Integrated Microscopy-Specific Optimization

Python library and command-line tool for stitching a set of overlapping tiles into a single 2D panorama.

Installation

pip install primo-stitch
  • Python 3.10–3.14.
  • If you use a GPU, make sure you have a CUDA-enabled PyTorch (pytorch.org).
  • Model weights are downloaded on the first run — internet access is required.

Command-line usage

primo-stitch is the main entry point.

# minimal — stitch a folder of tiles into a panorama
primo-stitch --tile_dir path/to/tiles --output_file panorama.jpg

# advanced
primo-stitch \
  --tile_dir path/to/tiles \
  --output_file panorama.png \
  --matcher "efficient loftr" \
  --device cuda:0 \
  --blending_mode full \
  --inference_size 0.5 \
  --batch_size 8 \
  --logfile run.log

Options

Flag Default Description
--tile_dir (required) Directory with the input tiles
--output_file panorama.jpg Output panorama path (extension may be adjusted, e.g. .png when alpha is saved)
--cache_dir .cache/ Directory for intermediate results (created automatically, cleaned up after the run)
--matcher xfeat xfeat | efficient loftr | loftr
--device cpu cpu, cuda, cuda:0, ...
--blending_mode full collage — fast paste-over, no correction; mosaic — photocorrection + hard seams, no blending; full — photocorrection + seams + multiband blending
--inference_size 0.3 Matcher input scale relative to the original (0.25, 0.5, 1, ...)
--batch_size 1 Matcher batch size (higher = faster, more memory)
--save_alpha_channel / --no-save_alpha_channel off Save the transparency channel; forces .png output in full mode
--logfile (none) Write a debug log to this file

Python API

from primo import Matcher, Stitcher

matcher = Matcher(
    model='xfeat',            # 'xfeat' | 'efficient loftr' | 'loftr'
    device='cuda:0',          # or 'cpu'
    inference_size=0.5,
    batch_size=8,
)

# the alignment device is taken from the matcher
stitcher = Stitcher(
    matcher,
    blending_mode='full',     # 'collage' | 'mosaic' | 'full'
)

stitcher.stitch(
    input_dir='path/to/tiles',
    output_file='panorama.jpg',
)

Matcher and Stitcher expose additional keyword arguments (alignment, photometric correction, blending) — see their signatures for the full set.

Authors

  • Gleb Nikolaev — Lomonosov Moscow State University
  • Savelii Shashkov — Lomonosov Moscow State University
  • Dmitriy Korshunov — Geological Institute of the Russian Academy of Sciences
  • Andrey Krylov — Lomonosov Moscow State University
  • Alexander Khvostikov (corresponding author) — Lomonosov Moscow State University

Citation

A paper describing PRIMO is currently under review; full citation details (venue, year, DOI) will be added once it is published. Until then, please credit the authors:

@unpublished{primo,
  title  = {PRIMO: Panoramic Reconstruction with Integrated Microscopy-Specific Optimization},
  author = {Nikolaev, Gleb and Shashkov, Savelii and Korshunov, Dmitriy and Krylov, Andrey and Khvostikov, Alexander},
  year   = {2026},
  note   = {Manuscript under review}
}

License

Apache-2.0; bundled third-party components — see THIRD_PARTY_LICENSES.md.

Metadata

Release files for primo-stitch 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for primo-stitch 0.2.2
File Size Uploaded Provenance
primo_stitch-0.2.2.tar.gz 84.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for primo-stitch 0.2.2
File Interpreter ABI Platform
primo_stitch-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 189.1 kB

Release files / primo_stitch-0.2.2.tar.gz

Download URL primo_stitch-0.2.2.tar.gz
Size 84.2 kB
Tags Source
SHA-256 checksum
How to use checksums
56322902bdb0df56e9b4501f381cb626c6dc49e23676ff2e28b9c2c25303e1dc
BLAKE2b-256 checksum
How to use checksums
d29c0a7ab9e61a2c500be0e53f273e09ac916de4a6ff15fdfcf08d37c159585c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / primo_stitch-0.2.2-py3-none-any.whl

Download URL primo_stitch-0.2.2-py3-none-any.whl
Size 104.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4b9220376e6940b35e3967f352a9bcf2e0c21c1a80e8e67b0fe0d91ba6af583
BLAKE2b-256 checksum
How to use checksums
a8a9b968db116c57850f3ce8d84319162610fafeaf55eb448a30195ecf812892
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for primo-stitch 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page