Architecture¶
OPTARI is a standalone desktop application, not a napari plugin. launcher.main() creates its
own napari.Viewer and wraps it in one OptariController. It follows a loose
Model-View-Controller split across four layers.
Layers¶
- UI layer (
widgets/): dock widgets built bycreate_*_dock()factories. A dock is a dataclass of Qt widget references and holds no logic. - Control layer (
controllers/): one controller per feature area, all owned byOptariController. - Utilities (
utils/): config, logging, presets, motion scoring, stateless helpers used by controllers. - External layer: PATATO (I/O, reconstruction, unmixing), napari (viewer/layers), ONNX Runtime (segmentation, DeepMB), PACFISH (IPASC). See Data & Integrations for the PATATO/IPASC boundary.
OptariController¶
- Session hub, holds the napari
Viewer, the openpa_data(PATATOPAData), the active image layers, and one instance of each task controller. - Controllers hold no references to each other. A controller reaches another only through
self.optari_controller.<name>_ctrl, and shared state (active_recon_layer,active_us_layer,derived_patato_objects, ...) lives onOptariControlleritself. UiManagerbuilds the docks and wires every Qt signal to a controller method.MenuManagerbuilds the menu bar and the Settings/Batch dialogs.ShortcutManagerbinds keyboard shortcuts.
Background work and Batch Mode¶
- Reconstruction, unmixing and segmentation each expose
prepare(params) -> BackgroundStepandpublish(result, params), run on a single shared background-task slot (utils/tasks.py) so the UI stays responsive and only one heavy operation runs at a time. - Batch mode (
batch/) builds the sameparamsobjects from a preset instead of dock widgets and uses the sameprepare/publish.
Configuration¶
config/config.pydefines aOptariConfig, loaded once from~/.optari/config/config.jsoninto the module-leveloptari.config.settings.- Reconstruction/unmixing/segmentation/ROI/batch presets are separate JSON files under
~/.optari/config/presets/, shipped with defaults and user-editable. See Presets. - A schema-version mismatch archives
~/.optari/config/and loads a new default one.
Deployment¶
- Packaged as a standalone executable via PyApp. First launch creates
~/.optarifrom the packaged defaults (utils/setup.get_user_dir()). - PATATO is installed from a custom fork as prebuilt, OS-specific wheels pinned by URL in
pyproject.toml, not from PyPI.