Control software for Flamingo light sheet microscope systems. Communicates with microscope over TCP/IP, manages acquisition workflows, and displays images via PyQt5 GUI or Napari integration.
The Flamingo light sheet microscope was originally designed and developed by the Huisken Lab. This repository provides a Python-based control system for Flamingo microscopes, building upon the hardware and software architecture developed by the Huisken Lab. For more information about the microscope design, sample data, and scientific applications, visit the Huisken Lab Flamingo page.
# Create virtual environment
python -m venv .venv
# Activate (Linux/macOS)
source .venv/bin/activate
# Activate (Windows PowerShell)
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Set Python path and run
export PYTHONPATH=src # Linux/macOS
python -m py2flamingo
# Windows PowerShell
$env:PYTHONPATH="src"
python -m py2flamingoThe application will:
- Auto-discover microscope configurations from
microscope_settings/ - Display available microscopes in dropdown menu
- Test connection before connecting
- Load settings from configuration files
- Auto-discovery of microscope configurations
- Dropdown selector for easy microscope switching
- Connection testing before establishing full connection
- Settings display (microscope name, IP, port, laser power, etc.)
- Clean separation of concerns (Model-View-Controller)
- Type-safe code with full type hints
- Comprehensive testing (400+ tests, 95%+ coverage)
- Observable pattern for reactive UI updates
- Dependency injection for easy testing
- Internet + microscope subnet configuration
- Automatic routing through correct network interface
- Built-in diagnostics (
check_network.sh/check_network.ps1) - Connection testing to verify routing
- Standalone GUI - PyQt5 interface in its own window
- Napari integration - Dock widget with Napari canvas display
- Viewer abstraction - Easy to add new viewers
- INSTALLATION.md - Complete installation guide for all platforms
- DEVELOPER.md - Developer guide, architecture, testing
- CLAUDE.md - AI assistant guidance for code work
| Platform | Status | Installation Guide |
|---|---|---|
| Windows 10/11 | ✅ Fully Supported | INSTALLATION.md |
| Linux (Ubuntu 20.04+, Fedora 35+) | ✅ Fully Supported | INSTALLATION.md |
| macOS (10.15+) | ✅ Fully Supported | INSTALLATION.md |
Python Versions: 3.8, 3.9, 3.10, 3.11
- Python 3.8-3.11
- PyQt5, NumPy (installed via requirements)
- Optional: Napari (for viewer integration)
- Network connection to microscope (or mock server for testing)
- For dual-network setups: Two network adapters
microscope_settings/FlamingoMetaData.txt(or other config files)workflows/*.txt(workflow template files)
-
Launch application:
PYTHONPATH=src python -m py2flamingo
-
Select microscope from configuration dropdown
-
Test connection (optional but recommended)
-
Connect to microscope
-
Load/send workflows via GUI
# Specify IP and port directly
python -m py2flamingo --ip 10.129.37.22 --port 53717
# Enable debug logging
python -m py2flamingo --log-level DEBUG
# Legacy standalone mode (no Napari)
python -m py2flamingo --mode standalone
# Napari integration mode
python -m py2flamingo --mode napariThe application auto-discovers microscope configurations from microscope_settings/ directory:
Example configuration file:
<Instrument>
<Type>
Microscope name = n7
Microscope address = 10.129.37.22 53717
</Type>
</Instrument>Multiple configurations are supported - create one file per microscope.
Most deployments use two network interfaces:
- Internet connection (192.168.x.x or similar)
- Microscope subnet (10.129.37.0/24)
The operating system automatically routes traffic based on destination IP.
Windows:
.\check_network.ps1Linux/macOS:
./check_network.shExpected result: ✓✓✓ EXCELLENT
See INSTALLATION.md for detailed platform-specific network configuration instructions.
Use the mock server to test without a microscope:
# Terminal 1
python mock_server.pycat > microscope_settings/FlamingoMetaData_test.txt << 'EOF'
<Instrument>
<Type>
Microscope name = Mock Server
Microscope address = 127.0.0.1 53717
</Type>
</Instrument>
EOF# Terminal 2
PYTHONPATH=src python -m py2flamingoSelect "Mock Server" from dropdown and test connection.
Application (py2flamingo/__main__.py)
│
├── Models (Data structures, state)
├── Views (PyQt5 UI components)
├── Controllers (Business logic, coordination)
│
├── Services (Reusable business logic)
│ ├── ConfigurationManager (Config discovery)
│ ├── ConnectionService (TCP management)
│ └── WorkflowService (Workflow processing)
│
└── Core (Infrastructure)
├── TCPConnection (Low-level sockets)
├── ProtocolEncoder (Binary protocol)
└── QueueManager (Inter-thread communication)
- Models:
ConnectionModel,WorkflowModel,Position,Command - Views:
ConnectionView,WorkflowView,ViewerWidget - Controllers:
ConnectionController,WorkflowController,PositionController - Services:
ConfigurationManager,MVCConnectionService,MVCWorkflowService
See DEVELOPER.md for detailed architecture documentation.
# All unit tests
PYTHONPATH=src pytest tests/ --ignore=tests/integration -v
# Specific test
PYTHONPATH=src pytest tests/test_services.py -v
# With coverage
PYTHONPATH=src pytest tests/ --cov=src/py2flamingo --cov-report=html- Fork repository
- Create feature branch
- Write tests for new functionality
- Ensure tests pass
- Submit pull request
See DEVELOPER.md for detailed contribution guidelines.
"Connection timeout"
# Windows
Test-NetConnection -ComputerName 10.129.37.22 -Port 53717
# Linux/macOS
nc -zv 10.129.37.22 53717"Network configuration"
# Run diagnostic
.\check_network.ps1 # Windows
./check_network.sh # Linux/macOS# Verify PYTHONPATH is set
echo $PYTHONPATH # Linux/macOS
echo $env:PYTHONPATH # Windows PowerShell
# Should show: src# Enable debug logging
python -m py2flamingo --log-level DEBUGSee INSTALLATION.md for comprehensive troubleshooting guide.
Flamingo_Control/
├── src/
│ └── py2flamingo/
│ ├── __main__.py # Application entry point
│ ├── models/ # Data structures
│ ├── views/ # UI components (PyQt5)
│ ├── controllers/ # Business logic
│ ├── services/ # Reusable services
│ ├── core/ # TCP, protocol, infrastructure
│ └── utils/ # Utilities (parsers, etc.)
│
├── tests/ # Unit and integration tests
├── microscope_settings/ # Microscope configurations
├── workflows/ # Workflow template files
│
├── check_network.sh # Network diagnostic (Linux/macOS)
├── check_network.ps1 # Network diagnostic (Windows)
├── mock_server.py # Mock microscope for testing
│
├── README.md # This file
├── INSTALLATION.md # Installation guide
├── DEVELOPER.md # Developer guide
└── CLAUDE.md # AI assistant guidance
- ✅ Configuration management with auto-discovery
- ✅ Connection testing before connecting
- ✅ Comprehensive network diagnostics
- ✅ Full Windows 11 support
- ✅ MVC architecture refactoring complete
- ✅ 400+ tests with 95%+ coverage
- MVC interface implementation
- Napari integration
- Mock server for testing
- Legacy interface (still available)
- Flamingo firmware v2.16.2
- Network access (Morgridge network or VPN)
- Python 3.8-3.11
- Network connection to microscope subnet
- PyQt5 for GUI
- NumPy for image processing
- Optional: Napari for advanced visualization
- Installation Issues: See INSTALLATION.md
- Development Questions: See DEVELOPER.md
- Bug Reports: GitHub Issues
- Network Problems: Run diagnostic script (
check_network.sh/check_network.ps1)
See LICENSE file for details.
If you use Flamingo Control in your work, please cite the Huisken Lab resources and this repository.
Developed at the University of Wisconsin Laboratory for Optical and Computational Instrumentation (LOCI) for Flamingo light sheet microscope systems.
Repository: https://github.com/uw-loci/Flamingo_Control Last Updated: 2025-10-14 Status: Production Ready