How live-image-tracking-tools/napari-geff works
Project Type and Purpose
• napari-geff is an open-source plugin for the napari visualization platform.
• It provides reader and writer functionality for the Graph Exchange File Format (GEFF), allowing users to drag a GEFF file (zarr store) into napari and view it as a Tracks layer, along with any associated image or label data.
File Structure Analysis
• Top-level metadata and CI/CD:
• .github/ contains issue and PR templates, Dependabot config, and a GitHub Actions workflow for testing and deployment.
• tox.ini, pyproject.toml, .pre-commit-config.yaml configure testing (pytest via tox), package metadata, formatting and linting.
• Examples:
• examples/graph_labels_seg.zarr/ holds a sample GEFF zarr store with nested groups for image, labels, tracks/nodes/edges, node properties, etc.
• Source code:
• src/napari_geff/napari.yaml: plugin registration file (entry points for napari).
• _reader.py: implements Reader hook for loading GEFF files into napari.
• _writer.py: implements Writer hook for exporting napari Tracks layers back to GEFF format.
• utils.py: shared helper functions (parsing zarr, mapping properties to napari metadata).
• _tests/: pytest tests for reader and writer, ensuring correct behavior.
• Packaging:
• MANIFEST.in, LICENSE, README.md for distribution; published on PyPI.
Key Insights from README
• Plugin hooks into napari’s I/O system: drag-and-drop or viewer.open(path, plugin='napari-geff').
• Loads directed graphs as Tracks layers, stores node properties as layer features, edge properties in metadata.
• Supports related image/label data per GEFF spec, loaded alongside Tracks.
• Written as a Python package following the napari-plugin-template structure.
Main Components
• Napari Core Application (external system)
• napari-geff Plugin System:
• Plugin Registration (napari.yaml)
• Reader Component (_reader.py)
• Writer Component (_writer.py)
• Utility Module (utils.py)
• GEFF Data Store (zarr directory on disk or remote)
• napari Data Structures:
• Tracks Layer
• Image/Labels Layers
• Tests & CI/CD (pytest via tox, GitHub Actions)
Relationships and Interactions
• User Action → Napari Core → Plugin Discovery (reads napari.yaml)
• Napari Core → invokes Reader on a GEFF path → Reader loads zarr store (via utils), constructs Tracks layer + optional image/labels layers → returns layers to Napari
• User edits or creates Tracks layer → Napari Core → invokes Writer → Writer extracts data from the Tracks layer (and metadata) → writes out GEFF-compliant zarr store on disk
• Tests drive Reader and Writer in isolation via pytest, verified in CI workflow.
Architectural Patterns and Principles
• Plugin-based architecture: decoupling core application from I/O implementations.
• Single Responsibility: Reader handles only loading, Writer only exporting, Utils for shared logic.
• Declarative registration: napari.yaml declares entry points without code changes in core.
• Test-driven development with clear test folder structure mirroring implementation modules.
Technologies and Frameworks
• Python packaging: pyproject.toml, setuptools
• napari plugin engine (npe2)
• zarr library (for GEFF zarr groups)
• pytest, tox for testing
• GitHub Actions for CI/CD
• pre-commit for code quality
Essential Elements to Capture
• Plugin registration and discovery mechanism
• Separation of Reader, Writer, Utils
• GEFF zarr store structure as the canonical external format
• napari data layer types (Tracks, Images, Labels)
• CI/CD pipeline as a supporting process ensuring code quality