HILIGTHer_FLIM_DigitalTwin

HILIGHTer Digital Twin

HILIGHTer is a Python-first FLIM engineering workspace. The main product is a Qt desktop application backed by a shared numerical engine, with additional HTTP, Python, desktop-automation, MCP (Model Context Protocol), and browser-frontend surfaces.

What You Get

Requirements

For the smoothest desktop install:

The desktop app also needs Qt/WebEngine dependencies, which are installed from python/desktop_requirements.txt.

The desktop launcher installs missing desktop dependencies into the active Python environment on first run. Using a dedicated virtual environment is strongly recommended.

Quick Start

  1. Clone this repository.
  2. Open a terminal in the repository root.
  3. Optional but recommended: create and activate a virtual environment.
  4. Launch the desktop app:
python -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
run_desktop.bat

If you prefer to preinstall desktop dependencies instead of letting the launcher do it:

python -m pip install -r python\desktop_requirements.txt
run_desktop.bat

What happens on first launch:

If the first launch needs to install packages, it can take a while.

Installation Profiles

Desktop-only install

Use this when you only need the main Qt application.

python -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -r python\desktop_requirements.txt
run_desktop.bat

Backend and API install

Use this when you want the FastAPI backend, scripts, or test toolchain without the full desktop stack.

python -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -r python\requirements.txt

Full local development install

Use this when you want the desktop app, backend/API tooling, and the browser frontend.

python -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -r python\desktop_requirements.txt
python -m pip install -r python\requirements.txt
cd python\frontend
npm install
cd ..\..
run_desktop.bat

Desktop Launch

Primary launcher:

run_desktop.bat

Direct launcher:

cd python
python desktop_app.py

The desktop manual is available from inside the app with Ctrl+H.

HTTP API

From the repository root:

python -m uvicorn python.backend.main:app --reload

Useful endpoints:

If you want the browser frontend as well:

cd python\frontend
npm run dev

The current frontend targets http://localhost:8000 and still uses a small set of compatibility routes in addition to the /api/v1/... endpoints.

MCP Server

The MCP server lives at:

It is a stdio server intended to be launched by an MCP host, not by opening it in a browser.

Smoke test:

python python\tools\mcp_smoke_test.py

Repository Layout

The repository no longer includes active MATLAB application code. The maintained runtime lives under python/.

Useful Commands

Syntax check:

python -m py_compile python\desktop_app.py python\gui\main_window.py python\backend\*.py

Run tests:

pytest python/tests

Run only the event-driven backend tests:

pytest python/tests/test_event_driven.py

MCP smoke test:

python python\tools\mcp_smoke_test.py

Installation Troubleshooting

The desktop app crashes during dependency import

Make sure the desktop environment matches the pinned requirements:

The current requirements files already pin those versions.

Versioning

The single source of truth for the project version is:

Policy:

run_desktop.bat keeps installing packages

That usually means the current Python environment is missing one or more required desktop modules. Creating a dedicated virtual environment usually fixes this.

uvicorn or FastAPI imports fail

Install the backend requirements into the same environment:

python -m pip install -r python\requirements.txt

The browser frontend cannot talk to the backend

Make sure both services are running from the repository root:

python -m uvicorn python.backend.main:app --reload
cd python\frontend
npm run dev

The frontend currently expects the backend at http://localhost:8000.

The app starts but feels slow

Possible causes:

The event-driven core is slower than the ideal Poisson core. Use modest image sizes and repeat counts when testing event-driven detector effects.

Notes For Detector/Event-Driven Users

Documentation

Main operator manual:

Architecture notes:

Module overview:

Optimisation notes:

Engineering Notes

This package originated as a MATLAB-to-Python port, but the active workspace is now fully Python-based. Some parity tests, replication reports, and compatibility shims still reference the earlier MATLAB baseline because they are validation artifacts rather than runtime dependencies.

We have used CODEX extensively for porting, improving the GUI, and adding many features. The users are expected to verify the results also with known cases and eventually measurements. However, here are the steps we implement for quality assurance:

Current status of auditing. We are proceeding with a new auditing cycle on the active beta line. The beta version is already publicly shared, and the remaining manual audit work is intended to strengthen scientific confidence before a later stable release.