How laboratoryopticsbiosciences/flute works
Project type and purpose
• This is a Python desktop GUI application (“FLUTE”) for interactive phasor analysis of Fluorescence Lifetime Microscopy (FLIM) data.
• It loads a TIFF stack, lets users calibrate lifetimes, explore phasor plots, adjust parameters in real time, and export analysis results.
File structure
Top-level modules:
• main.py – application entrypoint, loads the main window UI and kicks off the Qt event loop
• Calibration.py – handles lifetime calibration routines
• DataWindows.py – manages secondary dialog windows (e.g. data entry, save dialogs)
• ImageHandler.py – loads TIFF stacks, extracts decay curves, prepares data arrays
• range_slider.py – custom slider widget for selecting phasor parameter ranges
• MplWidget.py – embeds a Matplotlib canvas in PyQt for phasor/graph plotting
UI definitions (ui files/*.ui): Qt Designer XML files for MainWindow, CalibrationWindow, Graph view, Picture view, SaveData dialog, BoundEntry, CloseWindow.
README for additional insights
• Built with PyQt5 (UI), NumPy/SciPy (numeric & phasor calculations), scikit-image/OpenCV (image I/O), Matplotlib (plotting)
• Supports stand-alone Windows exe via auto-py-to-exe
• Core workflow: load data → calibrate using reference fluorescein → compute phasor transform → interactive visualization → export results
Main components
a. UI Layer
• MainWindow (mainwindow.ui)
• CalibrationWindow
• GraphWindow (phasor plot)
• PictureWindow (image display)
• SaveData dialog / BoundEntry / CloseWindow
b. Controller / Logic Layer
• main.py orchestrates startup and signal-slot wiring
• DataWindows.py for pop-up dialogs
• Calibration.py implements calibration computations
• range_slider.py custom range selector
• ImageHandler.py for TIFF loading & data model
c. Visualization
• MplWidget.py integrates Matplotlib canvas for dynamic plotting
d. Data Persistence
• File system for input TIFF stacks
• Export module in DataWindows.py for CSV or image outputs
e. External libraries
• PyQt5 (Qt GUI framework)
• NumPy / SciPy (array math, phasor transforms)
• scikit-image / OpenCV (TIFF I/O)
• Matplotlib (plots)
Relationships & data flow
• User clicks “Load” in MainWindow → signal → ImageHandler loads TIFF → returns data array
• Data array → Calibration (if needed) → phasor math via SciPy → result array
• User opens SaveData dialog → DataWindows exports selected region data via NumPy → CSV/image → disk
Architectural patterns & design principles
• Model-View-Controller (MVC):
– Model: ImageHandler + calibration results
– View: .ui files + MplWidget visualizations
– Controller: main.py + module methods handling user actions
• Signal-Slot decoupling in Qt: GUI widgets emit signals, logic modules handle slots
• Modular separation: UI definitions (.ui) are distinct from processing logic (.py)