Control software for Flamingo light sheet systems. It communicates with the Flamingo ControlSystem over TCP, manages acquisition workflows, and can display images either in a standalone PyQt GUI or inside Napari as a dock widget.
Refactor status (updated 2025-08-11)
The codebase has been modularized (controllers/services/core/views). Napari remains an optional add‑on via a thin adapter. Legacy global queues/events are preserved via a compatibility layer.
- Intended for use with Zion (or compatible Flamingo systems).
- Requires Flamingo software v2.16.2 on the instrument side.
- Network access to the instrument (Morgridge network or VPN).
- Python 3.8–3.11 on the control computer.
- Optional: Napari (
pip install napari
) for the in‑viewer mode.
microscope_settings/FlamingoMetaData.txt
— contains IP/port; generated by the instrument during a workflow.workflows/Zstack.txt
— the default workflow file used to seed settings. Replace it to change defaults.
If any file is missing or malformed, the app will show a pop‑up explaining what to fix.
# (Recommended) create and activate a virtual environment
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
# From repo root, install runtime deps
pip install -r requirements.txt # if present
# Optional: Napari viewer
pip install napari
If you don’t have a
requirements.txt
, install PyQt5 and NumPy at minimum:
pip install PyQt5 numpy
(+ your image IO stack).
All commands assume you are in the repo’s src
directory:
cd Flamingo_Control/src
Runs the full PyQt GUI in its own window — closest to the classic behavior.
python -m py2flamingo --mode standalone
Starts Napari and adds Flamingo Control as a dock widget. Images render in the Napari canvas.
python -m py2flamingo --mode napari
Notes
- In Napari mode, the standalone GUI’s image label is hidden; display is via Napari layers.
- The viewer layer is abstracted; swapping to another viewer later requires only a new
ViewerInterface
implementation.
- Laser/microscope connection and Z‑search defaults are read from your workflow (
workflows/Zstack.txt
). - Beige coordinate fields: empty on first launch; fill manually.
- Cyan fields with buttons: trigger manual tasks or acquisitions.
- Cancel: stops current acquisition via the legacy
terminate_event
path; the app should return to IDLE.
If something doesn’t start, check that FlamingoMetaData.txt
and workflows/Zstack.txt
exist and are readable.
controllers/
— user actions and high‑level operations (e.g., snapshot, locate sample, multi‑angle).services/
— reusable logic (e.g., TCP connection, workflow assembly).core/
— application glue:queue_manager.py
,events.py
, andlegacy_adapter.py
.- Legacy names like
image_queue
,visualize_queue
,terminate_event
are re‑exported viapy2flamingo.global_objects
andcore/legacy_adapter.py
to maintain backward compatibility.
- Legacy names like
views/
— viewer abstraction (viewer_interface.py
) and integrations (e.g.,napari_view.py
), plus small UI widgets likeViewerWidget
.GUI.py
— the main control panel window in standalone mode.__main__.py
— entry point that accepts--mode standalone|napari
.
The refactor removes giant functions in favor of small, testable units. External partners integrating via queues/events should not need changes.
- Cancel leaves UI “busy”: ensure your instrument and the background threads are running, and that
terminate_event
is not stuck set. Use the GUI’s cancel, wait ~1 s, retry. If needed, restart only the control side. - No images in Napari: confirm Napari installed, and that images are being placed on
visualize_queue
/image_queue
(theViewerWidget
polls both). - Workflow format: if your instrument firmware doesn’t accept bundled workflows, controllers can still send stepwise commands for parity.
If you use Flamingo_Control in your work, please cite the Huisken Lab resources and this repository. See LICENSE for details.