Requires
What a datasource must offer before this plugin's tool can open.
from plexora.api import RequiresAlso available as plexora.api.plugin.Requires.
Requires(
table: bool = False,
segmentation: bool = False,
markers: bool = False,
features: bool = False,
roles: tuple[str, ...] = (),
optional: tuple[str, ...] = (),
excluded_image_kinds: tuple[str, ...] = ('rgb',),
layers: tuple[str, ...] = (),
optional_layers: tuple[str, ...] = (),
dims: tuple[str, ...] = ('2d',),
representations: tuple[str, ...] = ('plane',),
spacing: tuple[str, ...] = (),
time: str = 'frame',
)Passed as Plugin.requires. Two different questions are kept apart:
- Could this plugin ever work here? A flat RGB image has no channels, and no amount of uploading changes that, so a tool that needs channels is hidden entirely on such a project.
- Can it work right now? A project merely missing its feature table is a recoverable state: the tool stays listed, and opening it asks the user for whatever is missing.
Collapsing the two would hide a tool from a project that could use it after one upload -- which also hides the upload path itself.
Image data is never listed here, because every plugin gets it; that is the floor of the contract.
Fields
tablebooldefault FalseNeeds a feature table (CSV/AnnData/SpatialData). Acquirable.
segmentationbooldefault FalseNeeds a segmentation mask. Acquirable.
markersbooldefault FalseNeeds the marker/metadata split to have been established, so it can offer the user a marker list that is not a guess.
featuresbooldefault FalseReads the marker intensities themselves (raw or log-transformed), rather than just the table's other columns.
rolestuple[str, ...]default ()Column roles this plugin reads from the cell table -- the same roles
ProjectData.schema reports (cell_id, x, y, celltype,
image_id, or a role added later).
optionaltuple[str, ...]default ()Inputs to offer but never block on, named the same way ("segmentation",
"role:image_id"). The tool opens without them; it just does less.
excluded_image_kindstuple[str, ...]default ('rgb',)Image kinds this plugin cannot handle. 'rgb' is the flat quick-view path: no channels, so marker tools are meaningless there. Permanent.
layerstuple[str, ...]default ()Spatial layers this plugin needs, by modality ("transcripts",
"cell_boundaries", "visium_spots") or by kind ("kind:points").
The one requirement that is about the scene rather than the table.
optional_layerstuple[str, ...]default ()Layers to use when present and do without otherwise. Same vocabulary.
dimstuple[str, ...]default ('2d',)What the plugin's own code reads; see DIMS. ("3d",) alone hides it on
a planar image, where it could never work.
representationstuple[str, ...]default ('plane',)Which 2-D pictures of a volume its 2-D code may run on; see
REPRESENTATIONS. A plugin listing only plane is refused a slab.
spacingtuple[str, ...]default ()Calibrations it cannot run without; see SPACING_AXES.
timestrdefault 'frame'See TIME_MODES. Nothing shipped reads across time yet.
Examples
from plexora.api.plugin import Requires
requires = Requires(
table=True,
roles=("cell_id", "x", "y"),
optional=("segmentation",),
)Related
requirement
Build one requirement descriptor from its key alone.
layer_requirement
Build a requirement descriptor for a spatial layer.