Skip to main content

PRIMO: Panoramic Reconstruction with Integrated Microscopy-Specific Optimization

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

primo_stitch-0.2.1.tar.gz (84.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

primo_stitch-0.2.1-py3-none-any.whl (104.8 kB view details)

Uploaded Python 3

File details

Details for the file primo_stitch-0.2.1.tar.gz.

File metadata

  • Download URL: primo_stitch-0.2.1.tar.gz
  • Upload date:
  • Size: 84.1 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for primo_stitch-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5f247cccf00f17a409f277d39119cb0771b13673cf021cddf77027b0471d6b51
MD5 a2a11b7f0dfd2a990d1837f84d79a8dc
BLAKE2b-256 63a3d923b7b7534a8b64fa890ddfb7aafa16d6026ff91ab5471ec78de9ff41d1

See more details on using hashes here.

File details

Details for the file primo_stitch-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: primo_stitch-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 104.8 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for primo_stitch-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a835b32c474bbb7e8b0b4430da5f03b285462eedd58303c088ba8ec56e1ebdd
MD5 1e62bc358e390deeaf22009a2eb70600
BLAKE2b-256 8e4f614a6fc31def6c0f36775fc96ace59cbcb00f962097b4d8ed6eb35b3c774

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page