Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flimkit-web-ui

A browser front end for FLIMKit. Start FLIMKit, open http://127.0.0.1:8765, and every desktop mode is there in a web page: Single FOV, Tile Stitch, Phasor, Batch and the Machine IRF builder, plus the project browser, synthetic data generator, preferences and plugin manager.

It is an add-on, not a second copy of the app. The page drives the desktop window's own form variables and presses its own buttons, so a fit started from the browser runs through exactly the same code path as one started from the desktop, and the two stay in sync.

Install

pip install flimkit-web-ui

Install it into the same Python environment FLIMKit runs from. FLIMKit finds it through the flimkit.plugins entry point, so there is nothing else to wire up. On the next start the server comes up automatically and Tools > Open Web UI opens it in your browser.

Verify the install with:

python -c "import flimkit_web_ui; print('ok')"

Tested with FLIMKit 0.13.4.

What is in the page

Tab What you can do
Single FOV Pick a file or z-stack, all eight IRF methods, fit model and components, fit window, masking, pile-up and background correction, run and cancel the fit. The live preview shows intensity, lifetime, decay and residuals, with the colour scale, view and τ weighting controls and the z-slider.
ROI analysis Draw rectangle, ellipse, polygon and freehand regions straight onto the preview, rename, delete, import and export GeoJSON and CSV, and fit an ROI decay with the fit plot and table shown in the page.
Tile Stitch All four pipelines (stitch only, stitch and fit, per-tile fit, multidimensional series), per-pixel map exports, tile registration and per-tile IRFs.
Phasor Load a PTU or resume a session, click the phasor plot to place cursors, drag them, polygon cursors, radius and ratio, phasor filters, Find Peaks (with one-click cursors on each peak), FRET trajectory and donor FRET fit, cursor-gated decay fit, save the session.
Batch Multi-tile ROI, single FOV and timelapse batches, with every export option and the timelapse reference lifetimes.
Machine IRF Build a machine IRF from PTU and XLSX pairs and see the result plotted.
Results The run log, fit summary table and CSV, image export (PNG, OME-TIFF, OME-Zarr), the output image browser, session save and restore, and expert settings.
Tools Project folder browser and recent files, synthetic PTU generator, preferences, plugins, about, update check and error logs.

Files are chosen with a file browser in the page, which lists folders on the machine FLIMKit is running on. Anything the desktop would offer as a save dialog is either written to the path you give or downloaded by the browser.

How it behaves

  • One app, shared state. There is one FLIMKit window behind the page. Several tabs or people can open it, but they all control the same form and the same results, and the last edit wins. Only one fit runs at a time.
  • Dialogs move to the page while you use it. While a web page is open and has been used in the last 30 minutes, FLIMKit's desktop pop-ups (errors, warnings, "missing input", channel and frequency prompts) appear as notices in the page instead of blocking the desktop. Close the tab and the desktop behaves normally again.
  • Progress windows still appear on the desktop. The page mirrors their progress and can cancel them.

Security

By default the server listens on 127.0.0.1 only and has no password. Anyone who can reach it can browse your files and run FLIMKit, so set a password before exposing it to any network.

The address is read from the plugin:web_ui section of ~/.flimkit/config.json:

{
  "plugin:web_ui": {
    "host": "127.0.0.1",
    "port": 8765
  }
}

Running without a desktop (Docker, servers)

FLIMKit still needs an X display to start its Tk window, so run it under a virtual display such as Xvfb, and configure the web UI with environment variables. These override the config file.

Variable Effect
FLIMKIT_WEB_HOST Address to listen on, for example 0.0.0.0 inside a container
FLIMKIT_WEB_PORT Port to listen on
FLIMKIT_WEB_PASSWORD Require HTTP Basic authentication for every page and API call
FLIMKIT_WEB_USER The user name for that login, flimkit by default
FLIMKIT_WEB_HEADLESS Set to 1 when nobody can see the desktop, so every FLIMKit dialog goes to the web page instead of waiting on an invisible window

GET /healthz answers ok without a password once the server is up, for container health checks.

The FLIMKit Docker images are set up this way.

Working on it

pip install --no-deps 'flimkit @ git+https://github.com/FLIMKit/FLIMKit'
pip install -e '.[test]'
pytest -q

The tests are headless: they check the plugin registers, the dialog and threading bridge, the API helpers and the HTTP server against a stand-in app, so they need no display and no FLIMKit scientific stack.

File What it does
flimkit_web_ui/__init__.py Registers the startup hook that starts the server and the Tools > Open Web UI entry
flimkit_web_ui/server.py The HTTP server and its routes
flimkit_web_ui/bridge.py Runs calls on the Tk thread, routes desktop dialogs to the page, tracks progress windows and renders the desktop's figures
flimkit_web_ui/api.py Form fields, app state, Single FOV, ROIs, results and expert settings
flimkit_web_ui/api_modes.py Tile Stitch, Batch, Machine IRF, Phasor, projects and the tools menu
flimkit_web_ui/page.html, core.js, fov.js, modes.js The page

Releasing

Push a tag like v0.1.0. The publish workflow builds the package and uploads it to PyPI through trusted publishing, and the release workflow attaches the wheel and sdist to a GitHub release.

Licence

MIT, same as FLIMKit.

About

A browser front end for FLIMKit: every desktop mode, driven from a web page

Topics

Resources

Code of conduct

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages