spacr.qt.widgets.external_mask_inputs¶
Editable image/mask detection table for the External Masks module.
Classes¶
Group dropped files and let the user correct every inferred role. |
Module Contents¶
- class spacr.qt.widgets.external_mask_inputs.ExternalMaskInputWidget(value: Any = None, parent=None)[source]¶
Bases:
PySide6.QtWidgets.QWidgetGroup dropped files and let the user correct every inferred role.
- Parameters:
value – the groups already saved.
Noneopens with none, which is the ordinary case: the groups are built by dropping files in.parent – parent widget.
Build the external-mask input table.
- Parameters:
value – the input groups to start with.
parent – parent widget, or
None.
- add_paths(paths: Iterable[Any]) int[source]¶
Detect and append one drag/drop or picker batch.
- Parameters:
paths – dropped or picked files and folders, grouped by
spacr.external_masks.detect_inputs(). A group already held gains the new paths and keeps the lower confidence.
- get_value() List[dict][source]¶
The groups worth saving, in the shape the settings dict wants.
Ignored groups are dropped: “Ignore” marks files that are not part of the run, so they are not written into the settings.
- Returns:
one dict per kept group.
- groups() List[spacr.external_masks.InputGroup][source]¶
Every group, ignored ones included.
- Returns:
the groups, in display order.
- set_group_object_type(row: int, object_type: Any) bool[source]¶
Correct one group’s object type.
An empty or unassigned value clears the type rather than storing a placeholder string, so the settings say “not chosen” rather than naming an object that does not exist.
- Parameters:
row – which group.
object_type – the object type, or None to clear it.
- Returns:
True when the row was valid.
- set_group_role(row: int, role: str) bool[source]¶
Correct one group’s inferred role.
An unknown role is refused rather than stored: the role decides how the files are read, and an unrecognised one would fail later, in the run, rather than here where the user can see what they typed.
- Parameters:
row – which group.
role – the role’s name.
- Returns:
True when the row and role were both valid.