spacr.qt.widgets.host_pathogen_preview

Interactive per-vacuole results beside the measured field’s image.

Classes

HostPathogenPreviewPanel

Preview current Host–Pathogen settings on one field without saving.

Functions

build_host_pathogen_preview_card(host, *[, panel_later])

Declare a lazily built preview using the shared Live toggle/card.

fill_host_pathogen_preview_card(host, card)

Connect the preview to the form so Run preview uses current settings.

Module Contents

class spacr.qt.widgets.host_pathogen_preview.HostPathogenPreviewPanel(parent=None, *, threaded=True, settings_reader=None)[source]

Bases: spacr.qt.widgets.preview_contract.LivePreviewContract, PySide6.QtWidgets.QWidget

Preview current Host–Pathogen settings on one field without saving.

Image and table selection share vacuole labels. Unknown marker states are retained; displayed infection fractions use this field’s measured hosts.

Build controls without reading images, databases or the settings form.

Parameters:
  • parent – optional parent widget.

  • threaded – run preview work on background threads when true.

  • settings_reader – optional callable returning current form settings.

apply_settings(settings)[source]

Replace preview settings; stale results are discarded on a change.

Parameters:

settings – Host–Pathogen settings to copy into the preview.

closeEvent(event)[source]

Cancel pending work when the panel closes.

Parameters:

event – Qt close event forwarded to the parent implementation.

load_source_async(source)[source]

Refresh the field list and preview from the current form and source.

Parameters:

source – project or database source used for the refreshed preview.

Returns:

whether a preview was started or queued.

preview_running()[source]

Whether the preview runner still owns work whose result is current.

run_preview()[source]

Read a bounded field and calculate the same ratios/counts as Run.

shutdown()[source]

Retire background reads before the preview’s widgets disappear.

spacr.qt.widgets.host_pathogen_preview.build_host_pathogen_preview_card(host, *, panel_later=False)[source]

Declare a lazily built preview using the shared Live toggle/card.

Parameters:
  • host – application screen providing the current settings model.

  • panel_later – defer panel creation when true.

Returns:

optional preview panel and its containing card.

spacr.qt.widgets.host_pathogen_preview.fill_host_pathogen_preview_card(host, card)[source]

Connect the preview to the form so Run preview uses current settings.

Parameters:
  • host – application screen providing the current settings model.

  • card – card whose body receives the new preview panel.

Returns:

the attached preview panel.

Nested helpers

HostPathogenPreviewPanel.run_preview.work()

Read available fields and analyze the captured field and plane selection off the GUI thread.

spacr/qt/widgets/host_pathogen_preview.py:204