Skip to main content

Reusable PyQt6 browser dialog for Leica LIF, XLEF, and LOF image containers.

Project description

leica-browser-qt

Reusable PyQt6 dialog for browsing Leica .lif, .xlef, and standalone .lof files and returning selected image contexts to another application.

The browser is focused on browsing, previewing, metadata inspection, selection, and direct NumPy pixel reads. Conversion to OME-TIFF remains outside this package.

Install

pip install -e .

The Leica browser and preview backend is bundled from the browser/preview parts of NL-BioImaging/ConvertLeica-Docker. It uses the same underlying reader and preview functions that ConvertLeicaQT.py uses:

  • ReadLeicaLIF.read_leica_lif
  • ReadLeicaXLEF.read_leica_xlef
  • ReadLeicaLOF.read_leica_lof
  • CreatePreview.create_preview_image

Single Select

from PyQt6.QtWidgets import QApplication
from leica_browser_qt import LeicaBrowserDialog

app = QApplication([])
ctx = LeicaBrowserDialog.select_image_context(roots=[r"D:\data"])
if ctx is not None:
    print(ctx.name, ctx.container_path, ctx.internal_path)

Multi Select

from PyQt6.QtWidgets import QApplication
from leica_browser_qt import LeicaBrowserDialog

app = QApplication([])
contexts = LeicaBrowserDialog.select_image_contexts(
    roots=[r"D:\data\run1.lif", r"D:\data\experiment.xlef"],
)
for ctx in contexts:
    print(ctx.name, ctx.container_path, ctx.internal_path)

CLI

leica_browser D:\data
leica_browser file1.lif file2.xlef file3.lof --multi
python -m leica_browser_qt.cli file1.lof --single
leica_viewer
run_viewer.cmd
python -m leica_browser_qt.leica_viewer

The CLI prints selected contexts as JSON.

Leica Viewer

This package includes an OMERO-viewer-style Leica viewer adapted from omero-browser-qt. It opens the Leica browser, lets you choose one image, and shows a zoomable microscopy preview with channel toggles, contrast controls, Z/T controls, projection mode, metadata, and a scale bar when pixel size is available.

from PyQt6.QtWidgets import QApplication
from leica_browser_qt import LeicaViewerWindow

app = QApplication([])
win = LeicaViewerWindow()
win.show()
app.exec()

cideconvolve-style Integration

from leica_browser_qt import LeicaBrowserDialog


def open_leica_single(parent):
    ctx = LeicaBrowserDialog.select_image_context(parent=parent)
    if ctx is None:
        return None
    handle = ctx.open()
    return handle.read_array(), ctx.metadata  # TCZYX NumPy array


def open_leica_multiple(parent):
    contexts = LeicaBrowserDialog.select_image_contexts(parent=parent)
    results = []
    for ctx in contexts:
        handle = ctx.open()
        results.append((handle.read_array(), ctx.metadata))
    return results

Known Limitations

  • read_array() returns a full in-memory TCZYX NumPy array. For large Leica datasets, prefer read_plane() or read_stack() to avoid loading all timepoints and channels at once.
  • Tests use mocked parser output and fake Leica paths unless local Leica test data is supplied by a downstream project.

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

leica_browser_qt-0.3.0.tar.gz (59.5 kB view details)

Uploaded Source

Built Distribution

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

leica_browser_qt-0.3.0-py3-none-any.whl (71.5 kB view details)

Uploaded Python 3

File details

Details for the file leica_browser_qt-0.3.0.tar.gz.

File metadata

  • Download URL: leica_browser_qt-0.3.0.tar.gz
  • Upload date:
  • Size: 59.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for leica_browser_qt-0.3.0.tar.gz
Algorithm Hash digest
SHA256 22d89389e7339389db4c2532b78960aafcac17c4cc2e43269a79c639ababcc5b
MD5 4f3d4426c253dcf32e34d2483c31ce33
BLAKE2b-256 06a2ea9db3e28eede37a349e4e3f679c9ce76213355c8ebc2ca5d78beb5fb448

See more details on using hashes here.

File details

Details for the file leica_browser_qt-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for leica_browser_qt-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f51552a45228ab93f9bee324ad1748f9c4bc97c15efd9935e19dffbc01afe9cb
MD5 5c2945566968780e4f76d9eaadf563f7
BLAKE2b-256 d463ce7c5b161d26c2f7fb5a5920ce8a046c4683e20e6ba6b06dd3c263a4a6bc

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