Skip to main content

napari-flopa

License MIT npe2 PyPI Python Version

Work in progress — the plugin is functional but under active development. Expect breaking changes between versions.

A napari plugin for opening, processing and analysing FLIM (Fluorescence Lifetime Imaging Microscopy) data from .ptu files.

Feature panels

  • File
    • read a .ptu, display its header, reconstruct it into an xarray dataset (photon count, mean arrival time, phasor, TCSPC histogram)
    • supports multi-frame, multi-sequence (with line accumulation) and multi-detector data
    • bidirectional scans with an Alignment wizard for the line-marker delays
    • scan config with value provenance, saved/loaded as JSON
    • marker statistics
    • optional ROI mask to reconstruct only part of the field
    • Drag and drop — a .ptu or scan-config .json dropped onto napari opens in the File tab
  • Trace
    • photon-count time trace per detector over a chosen time window and bin width, with line/frame marker overlays
  • FLIM View (bottom dock)
    • intensity and lifetime display with histogram contrast sliders (Auto-once, Auto-live, Min-Max), smoothing
    • frame/sequence/detector selection or summing
    • lifetime Calibrated by the IRF delay from the phasor calibration
    • intensity, lifetime and combined masks as Labels layers
    • FLIM RGB composite
    • export to TIFF/PNG
  • Phasor
    • per-object or per-pixel phasor plot as scatter, intensity-weighted scatter or density (square or hex bins), smoothing
    • color by a Labels layer or use it as a filter
    • calibration from a reference lifetime or a custom factor
  • Decay
    • TCSPC decay curves with frame/sequence/detector aggregation, per-detector toggles, normalisation and log scale
  • Batch
    • process a folder (or selected files, opt. with sub-folders and label masks) with a shared scan config and calibration
    • export of images (FLIM RGB, intensity, lifetime), phasor tables per object or per pixel and decay tables (raw or normalised), per file or merged
  • Analyzer
    • explore phasor CSV tables (from Phasor or Batch)
    • color by any column
    • per-group density contours, mean/median and covariance ellipses
    • calibration
    • compute phase and modulation lifetimes
    • compute 2- and 3-component fractions
    • clustering (K-means, hierarchical; Gaussian mixture, DBSCAN, HDBSCAN with scikit-learn)
    • row filtering, regex grouping and column combining in Data tools

Screenshots

File: header and scan configuration
File: ptu reading, header and scan configuration
Trace: photon-count time trace with marker overlays
Trace: photon-count time trace with marker overlays
FLIM View: calibrated lifetime over intensity
FLIM View: lifetime over intensity visualization
Batch: scan configuration and export passes
Batch: batch processing with configurable outputs
Phasor per object, colored by a Labels layer
Phasor: per object, colored by a Labels layer
Phasor per pixel as density, filtered by a mask
Phasor: per pixel (here density color-coded & filtered by a mask)
Analyzer: two detectors as groups, with mean, median and 2σ ellipses
Analyzer: tabular phasor data visualization
Analyzer: 3-component fractions, colored by f3, mean per label
Analyzer: mono-exponential lifetime component fractions

Requirements

  • Python ≥ 3.11
  • napari with a Qt backend

Installation

From PyPI - options

pip install "napari-flopa[all]"           # plugin + napari + Qt
pip install napari-flopa                  # plugin only, install into an existing napari
pip install "napari-flopa[cluster]"       # plugin only + scikit-learn

The cluster extra adds scikit-learn for the Analyzer's Gaussian mixture, DBSCAN and HDBSCAN clustering (K-means and hierarchical work without it).

From source

git clone https://github.com/cockovaz/napari-flopa
cd napari-flopa
pip install -e ".[all]"      # editable install, napari + Qt included

Full install instructions

It is recommended to use virtual environment. See examples below.

uv

uv venv --python 3.11 .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
uv pip install "napari-flopa[all]"

conda

conda create -n flopa python=3.11
conda activate flopa
pip install "napari-flopa[all]"

pixi

pixi init flopa
cd flopa
pixi add python=3.11
pixi add --pypi "napari-flopa[all]"

Getting started

  1. Open the plugin

    Start napari and choose Plugins → FLOPA → FLIM Analysis.

  2. Load a file

    In the File tab, click Load Demo for the bundled demo dataset, or Read PTU… for your own — or drop a .ptu onto the napari window.

    Note: the colored dot beside each field says where its value came from - file metadata, a default, an estimate, or your own edit.

  3. Set the scan geometry

    Frames, lines, pixels, sequences and accumulations must match how the image was actually acquired, because the raw file is a stream of photon and marker events with no image shape of its own. The header contains some information, fill in the rest. Demo dataset is loaded with the correct configuration set up.

    Marker Stats inspects the marker events and suggests dimensions. For bidirectional scans, the Alignment wizard estimates the line-marker delays.

  4. Reconstruct

    Pick what to compute under Output. Optionally pick an ROI Mask (a Labels layer or a mask file) to keep only the photons inside it.

    • Intensity — photon-count image only, the fastest
    • Int. + τ — adds the mean arrival time (lifetime) image
    • All — adds phasor coordinates per pixel and the global TCSPC decay (enables the Phasor and Decay tabs)
  5. Look at the result

    The FLIM View dock opens at the bottom, with a histogram for Intensity and one for Lifetime. Each has two sliders: the cyan one sets the display contrast, the red one a threshold range. → Generate Int./Lt. Mask turns that range into a napari Labels layer. Once a calibration is enabled in the Phasor tab, Calibrated shows the lifetime with the IRF delay subtracted (negative values are wrapped around by one period).

    Intensity, lifetime and the FLIM RGB composite can be exported from here.

  6. Analyze

    • Phasor plots g/s per object or per pixel — apply a calibration factor, pick a Labels layer to color by object or to restrict the plot to a region.
    • Decay plots the global TCSPC curves per slice. FLIM View shows only decay of slice configuration currently shown in FLIM View.
  7. Reuse the settings

    Use the Batch tab to run a whole folder of .ptu files with identical settings. Or export multiple slices of a single file. Each export pass picks frames, sequences and detectors as an index, * (all, one output per value) or a (aggregate).

Data model

Reading and reconstructing .ptu files is done by tttrkit (imported as tttrkit.ptuio), a separate package developed alongside this plugin. It is a normal dependency and is installed automatically — see tttrkit for the raw TTTR parsing, scan reconstruction and phasor maths that sit underneath the GUI.

Reconstruction produces a single xarray.Dataset holding up to five variables.

Four of them are images and share the dimensions (frame, sequence, line, pixel, channel): photon_count, mean_arrival_time, phasor_g and phasor_s. Here line and pixel are the spatial axes and channel is the detector axis.

The fifth, tcspc_histogram, is the global decay: its dimensions are (frame, channel, tcspc_channel) with no spatial axes.

Roadmap

Planned updates:

  • Interactive phasor — lasso a region of the plot and paint the matching pixels back into the image as a napari Labels layer
  • Decay fitting — extract lifetimes from the TCSPC curves
  • Region-wise decay — curves per mask and per object, not only per frame/detector
  • Wider import support — .ptu from further scanning systems, and other formats (.sdt, …)

License

Distributed under the terms of the MIT license. napari-flopa is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Metadata

Release files for napari-flopa 0.1.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 napari-flopa 0.1.2
File Size Uploaded Provenance Actions
napari_flopa-0.1.2.tar.gz 8.2 MB With provenance Details for napari_flopa-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for napari-flopa 0.1.2
File Interpreter ABI Platform Actions
napari_flopa-0.1.2-py3-none-any.whl Python 3 none any Details for napari_flopa-0.1.2-py3-none-any.whl

Total release size: 13.5 MB

Release files / napari_flopa-0.1.2.tar.gz

Download URL napari_flopa-0.1.2.tar.gz
Size 8.2 MB
Tags Source
SHA-256 checksum
How to use checksums
04084a081b45c90f80d7450cf94a7e459497ae945a0e4408260e311fab6798a5
BLAKE2b-256 checksum
How to use checksums
80fdba1da301122a0f0538f37bc22fb5be106645991ccbb493abcec1a3555f4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / napari_flopa-0.1.2-py3-none-any.whl

Download URL napari_flopa-0.1.2-py3-none-any.whl
Size 5.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
26481b9bd3659a18994c6c573076386535c103feab6985cdd04b33bd6965f13f
BLAKE2b-256 checksum
How to use checksums
2035314cb22a7e64258a2ff5a49c0341fec4b3aee9ad1524632ee929e12d998d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for napari-flopa 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for napari_flopa-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

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