Skip to main content

OpenFocus

OpenFocus

Every focus plane. One all-in-focus image.

Ten fusion algorithms, three registration modes and a source-locked retouch workspace for macro, microscopy and industrial stacks. 16-bit end to end, a headless CLI, and a UI in twelve languages.

Release Stars License: MIT Python 3.10+

Windows 10/11 macOS Apple Silicon Linux CLI PyPI

Download · Docs · Changelog · DOI

English · 简体中文 · 日本語 · Español · Deutsch · Français · Русский · 한국어 · Português · Italiano · Nederlands · Polski

OpenFocus interface

📢 News

Earlier releases are in the Changelog.

Features

AI fusion: StackMFF V3

The default method classifies every pixel by its most probable source frame with a neural network. On the same registered stack it keeps letter edges crisper and surfaces cleaner than Guided Filter (Laplacian sharpness 27.1 vs 28.5), and it leads every method on PSNR and SSIM against synthetic ground truth — with fewer ghost pixels than any classical algorithm.

[StackMFF V3 →](https://github.com/Xinzhe99/StackMFF V3) · Benchmark →

StackMFF V3 versus Guided Filter on the same stack

Wipe compare

Drag the divider across a frame and the fused result to see exactly what the blend changed — alignment drift, haloed edges and lost detail are visible at a glance, at any zoom.

Manual →

A/B wipe between a source frame and the fused result

Method comparison

Render every method once, inspect them side by side at a shared crop, then adopt the winner as a new output or copy its parameters back to the main window.

Side-by-side comparison of eight fusion methods

Depth map & 3D

Per-pixel focus position from five focus measures, with research colour maps, physical Z calibration from TIFF metadata, and a textured OBJ export of the surface.

Depth map and 3D surface of the same stack

Source-locked retouch

Paint from the frames that actually produced the result: shared zoom and pan, a source-frame slider, soft brush, restore brush, whole-stroke undo and a "not exported" guard for new pixels.

Retouch workspace with source frame and result

Batch processing

Point it at a folder of stacks, choose a method and a destination, and walk away. Align-only runs write one folder per stack; fusion runs write the fused image and list exactly that.

Batch processing dialog

Publication scale bars

Calibrated from TIFF metadata or typed in, drawn with the real font at the real length, and burned into every export — single images, stacks, multi-page TIFF, GIF and batch output alike. A bar that cannot fit legibly says so instead of printing a length it does not draw.

Manual →

Scale bar dialog with a live preview

Captions and labels

Keep a managed list of captions, each with its own scope (source, aligned stack or a specific output), frame range and style. The preview and every export use the same target and frame number, so {value} reads the same in Save, Save As, drag-out and Export All.

Label manager with a live preview

Agent-drivable

Every window, widget and menu is addressable over a token-protected local channel: an agent loads a stack, renders, retouches, compares, solves depth, exports and answers dialogs — by typed command, by widget path, or with real mouse and keyboard events. No screen scraping, no OCR; a normal launch keeps the channel closed.

Protocol → · Skill →

An agent drives the live GUI: load, AI render, compare, retouch, wipe, depth, labels

Also in the box:

  • Focus-stack workflow — stack browser, sharpness curve, quick preview, ROI render, and per-method settings remembered across restarts.
  • Microscopy-ready — 16-bit end to end, µm/px from TIFF metadata, dust-map flat-field correction, multi-page TIFF Z-stacks, textured OBJ export.
  • Headless CLI — the same pipeline as openfocus, with batch mode, --dry-run, --resume and JSON output for scripting.
  • Agent-drivable — a token-protected local channel drives the live GUI (typed pipeline commands plus generic widget/menu/mouse/keyboard control), with a skill, a 14-check smoke runner and a full menu-action sweep.
  • Projects and recovery — .ofproj sessions, crash auto-recovery, undo/redo across stack edits and annotations.
  • Twelve UI languages — English, 中文, 日本語, Español, Deutsch, Français, Русский, 한국어, Português, Italiano, Nederlands, Polski. Auto-detected from the system locale; a new language is one locales_<code>.py file.
  • Light on memory — the neural stack is loaded only when the neural method is used, so a classical-method session idles around 110 MB instead of 260 MB.

⬇️ Install

No setup needed — grab a build from the Releases page:

Platform File Type
Windows 10/11 (64-bit) OpenFocus-*-setup.exe Installer (recommended)
Windows 10/11 (64-bit) OpenFocus-*-windows-x64.zip Portable (unzip and run)
macOS Apple Silicon (M1–M4) OpenFocus-*-macos.dmg Disk image (drag to Applications)
macOS Apple Silicon (M1–M4) OpenFocus-*-macos-arm64.zip Portable (unzip)

The app is unsigned, so the first launch may show a security prompt: Windows SmartScreen → "More info" → "Run anyway" (the first start may take 30–60 s); macOS right-click → Open, or run xattr -cr /Applications/OpenFocus.app in Terminal.

🤖 Agent integration

The desktop app can be driven by a local agent without screen scraping: openfocus gui --control opens a token-protected local command channel and openfocus ctl runs typed commands or generic UI actions against the live window. Agents can load stacks, render, export, open and fill every dialog, answer file pickers, send mouse/keyboard events and take screenshots.

Control is opt-in; a normal launch is unchanged.

💻 Command Line Usage

Or install the CLI on Windows, macOS and Linux — the same pipeline, no GUI stack:

pip install openfocus
openfocus -i ./stack_folder -o ./result/fused.png

The AI model, its weights, HEIC and camera-RAW decoding are all in that single install. dtcwt is skipped on Python 3.13+, where the DTCWT entry stays disabled with a tooltip.

Community & Support

Developing

Run from a checkout:

conda create -n openfocus python=3.10
conda activate openfocus
pip install -r requirements.txt
python main.py

Packaging with PyInstaller: docs/BUILD_COMMANDS.md.

Adding a fusion or registration algorithm: CONTRIBUTING.md. The extensibility specification defines the shared registration, parameter, execution and persistence contracts.

⭐ Star History

Star History Chart

Metadata

Release files for openfocus 1.73.0

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

Source distribution (sdist)

Source distribution for openfocus 1.73.0
File Size Uploaded Provenance Actions
openfocus-1.73.0.tar.gz 24.0 MB Without provenance Details for openfocus-1.73.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openfocus 1.73.0
File Interpreter ABI Platform Actions
openfocus-1.73.0-py3-none-any.whl Python 3 none any Details for openfocus-1.73.0-py3-none-any.whl

Total release size: 47.9 MB

Release files / openfocus-1.73.0.tar.gz

Download URL openfocus-1.73.0.tar.gz
Size 24.0 MB
Tags Source
SHA-256 checksum
How to use checksums
f812e93876785c36df9fcadad42646aa1e0fbc599b21077f753323e1b753d7ad
BLAKE2b-256 checksum
How to use checksums
5a47fe5caf6f0cd7ea3858b5e4b627039f0855fb919378df2eba6ac035983db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / openfocus-1.73.0-py3-none-any.whl

Download URL openfocus-1.73.0-py3-none-any.whl
Size 23.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8859a102e791cc25bf8056816d8540232b330227ac2823596876be2991b5a1d5
BLAKE2b-256 checksum
How to use checksums
9c72bee160f0057f6298960aeea8ca1547ca79f52f9a86c6711eaf1bbc700c49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for openfocus 1.73.0

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.

Release history Release notifications | RSS feed

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