Map Mode Internals¶
Context¶
Map mode stitches multiple FOVs into a single composite view and introduces spatial navigation challenges for plugins that assume per-FOV coordinates.
Key Decisions¶
VirtualMapLayerrenders stitched tiles by reusing existing single-FOV rendering paths.- Map mode is gated behind
ENABLE_MAP_MODE; single-FOV behavior is fully preserved when disabled. - FOV-local coordinates are resolved into stitched-map pixels for selection and navigation without mutating underlying data tables.
- A dedicated stitched-tile cache (keyed by channel and overlay state) avoids stale renders.
Coordinate Systems¶
| System | Description |
|---|---|
| FOV-local pixels | Pixel coordinates within a single FOV image |
| Stitched-canvas pixels | Pixel coordinates in the full stitched map canvas |
| Physical µm | Real-world coordinates from the map descriptor |
Conversion helpers:
resolve_cell_map_position()— FOV-local → stitched-canvasmap_bounds()→ physical µm bounds of the full mapbase_pixel_size_um()→ µm per pixel at base resolution
Tile Rendering¶
VirtualMapLayer.render()is called with the current viewport._collect_visible_tiles()returns tiles whose bounding boxes intersect the viewport.- Each tile is rendered via
render_fov_to_array()usingchannel_settingsfrom the marker profile (no UI widget reads). - Tiles are stitched onto the canvas via
_allocate_canvas()+_blit_tile(). - If the number of visible tiles exceeds
_RENDER_TILE_LIMIT, only the nearest tiles to the viewport center are rendered.
Plugin Map-Mode Hooks¶
All plugins inherit from PluginBase, which provides two lifecycle hooks:
on_map_mode_activate()— Called when map mode is enabled. Plugins should disable FOV-scope filters.on_map_mode_deactivate()— Called when map mode is disabled. Plugins restore normal behavior.
The active FOV is retrieved via get_active_fov(), which returns None in map mode to prevent stale widget reads.
Known Fixes¶
- Missing bounds offset (v0.3.1):
_export_map_roi_workernow appliesmap_bounds()origin offset to canvas-pixel → µm conversion. - Render suppression at startup:
_suspend_display_updatesprevents burst renders duringload_widget_states.