spacr.qt.widgets.primary_mask_selector

Choose a primary object class and mask source for secondary segmentation.

Primary masks load on a worker, with one queued replacement at most. A field or source change invalidates the old snapshot immediately; late results never become the source for another image. This widget reads masks and never saves.

Classes

PrimaryMaskSelector

Primary/secondary class selectors and an asynchronous primary-mask picker.

Module Contents

class spacr.qt.widgets.primary_mask_selector.PrimaryMaskSelector(parent=None)[source]

Bases: PySide6.QtWidgets.QWidget

Primary/secondary class selectors and an asynchronous primary-mask picker.

Parameters:

parent – owning detection settings group.

Variables:
  • snapshot – validated PrimaryMaskSource, or None while loading/invalid.

  • changed – emitted when the snapshot is invalidated or replaced.

Build class, file/folder and reload controls without reading a file.

bind_field(image_path, shape, output_path)[source]

Invalidate the previous field and resolve this image’s primary mask.

Parameters:
  • image_path – source image identifying the current queue entry.

  • shape – image height and width.

  • output_path – editable mask path, checked against source aliases.

clear_field()[source]

Drop a stale source when the image cannot be loaded or is closed.

reload(*_args)[source]

Invalidate first, then queue at most one replacement source read.

restore_source(record)[source]

Restore a saved primary-source ledger record for the current image.

Parameters:

record – mapping from PrimaryMaskSource.provenance. Its original image binding is retained; a wrong-field record is refused on read.

shutdown()[source]

Drain the active source worker before the owning screen is destroyed.