Description
Complete the integration between the detector system, pre/post-detection hooks, and the async acquisition pipeline via the sample state entity (embryos).
Current State
DetectionQueue processes volumes through detectors
- Callback chain exists: volume → detection → state update
- Sample state (embryos) stores detection results
- Pre/post hooks not fully implemented
Requirements
1. Pre-Detection Hooks
- Image preprocessing before detector runs
- Configurable per detector
- Examples: contrast enhancement, ROI extraction, temporal averaging
2. Post-Detection Hooks
- Actions triggered after detection fires
- Per-embryo state updates
- Interval rule adjustments
- Notification/logging
3. Sample State Connection
/embryos endpoint as central sample registry
- Detection results → embryo semantic state
- Acquisition parameters ← embryo requirements
- Bidirectional: detections inform acquisition, acquisition feeds detection
4. Hook Configuration
- Declarative hook definitions
- Chain multiple hooks
- Conditional execution
Technical Approach
- Extend
Detector class with pre/post hook lists
- Create hook base class with
execute(context) interface
- Connect to
EmbryoState.detection_results for state updates
- Add semantic state fields to
EmbryoState (developmental_stage, health_status)
Key Files
gently/agent/detector.py
gently/agent/detection_queue.py
gently/agent/state.py (EmbryoState)
gently/agent/timelapse_orchestrator.py
Description
Complete the integration between the detector system, pre/post-detection hooks, and the async acquisition pipeline via the sample state entity (embryos).
Current State
DetectionQueueprocesses volumes through detectorsRequirements
1. Pre-Detection Hooks
2. Post-Detection Hooks
3. Sample State Connection
/embryosendpoint as central sample registry4. Hook Configuration
Technical Approach
Detectorclass with pre/post hook listsexecute(context)interfaceEmbryoState.detection_resultsfor state updatesEmbryoState(developmental_stage, health_status)Key Files
gently/agent/detector.pygently/agent/detection_queue.pygently/agent/state.py(EmbryoState)gently/agent/timelapse_orchestrator.py