Skip to content

API Reference

This section contains the reference documentation for the controllers of the pipeline steps.


RoiPreparationController(metadata_df, file_strategy, temp_dir, output_dir, margin=0, mask_value=0, max_pyramid_levels=3, chunk_size=(1, 256, 256), downscale=2, temp_roi_delete=True)

Coordinate cutting and assembly of cores from multiplex images.

Initialize the RoiPreparationController.

Parameters:

Name Type Description Default
metadata_df DataFrame

DataFrame containing ROI metadata.

required
file_strategy FileAvailabilityStrategy

Strategy for retrieving image files.

required
temp_dir str

Directory for temporary core files.

required
output_dir str

Destination for assembled Zarr outputs.

required
margin int

Padding pixels around each core.

0
mask_value int

Fill value for masked regions.

0
max_pyramid_levels int

Number of pyramid levels for the output.

3
chunk_size tuple[int, int, int]

Chunk dimensions (C, Y, X) for the Zarr array.

(1, 256, 256)
downscale int

Downsampling factor between pyramid levels.

2
temp_roi_delete bool

Whether to delete intermediate TIFFs after assembly.

True

run()

Execute the ROI preparation pipeline.

Iterates through available channels, cuts ROIs, and assembles them into SpatialData Zarr stores.


ResourceBuildingController(builder, input_names, output_names, resolution_level=0, keep=False, overwrite=False, pyramid_levels=1, downscale=2, chunk_size=None)

Controls the execution of a builder op on a SpatialData object.

This class orchestrates the process of running a BaseOp subclass. It manages input validation, fetching data from the correct resolution, handling overwrites, executing the operation, and saving the results back into the SpatialData object.

Initializes the ResourceBuildingController.

Parameters:

Name Type Description Default
builder BaseOp

The processing operation instance (e.g., a filter).

required
input_names str | Sequence[str]

Name or sequence of names of input elements.

required
output_names str | Sequence[str]

Name or sequence of names for output elements.

required
resolution_level int

The resolution level to fetch input data from.

0
keep bool

Whether to save the generated element to disk.

False
overwrite bool

Whether to overwrite existing elements with the same name.

False
pyramid_levels int

The number of pyramid levels for the output.

1
downscale int

The downscaling factor between pyramid levels.

2
chunk_size Sequence[int] | None

The chunk size for the output Dask array.

None

validate_sdata_as_input(sdata)

Runs all input validation checks.

Parameters:

Name Type Description Default
sdata SpatialData

The SpatialData object to validate.

required

run(sdata)

Executes the full pipeline for the processor.

Starts with running validation of a compatibility of a processor with the sdata object to process.

Parameters:

Name Type Description Default
sdata SpatialData

The SpatialData object to process.

required

Returns:

Type Description
SpatialData

The processed SpatialData object.


QuantificationController(mask_keys, table_name='quantification', mask_to_annotate=None, markers_to_quantify=None, add_qc_masks=False, qc_prefix='qc_exclude', overwrite=False, morphological_properties=None, intensity_properties=None)

Orchestrates quantification of data within a SpatialData object.

Designed as a stateless service, this class configures and executes a quantification task, processing channels and masks from a SpatialData object.

Initializes the QuantificationController.

Parameters:

Name Type Description Default
mask_keys dict[str, str]

Maps a mask suffix to its sdata.labels key (e.g., {'cell': 'cell_mask'}). Assumes object labels correspond across masks.

required
table_name str

Name for the output AnnData table.

'quantification'
mask_to_annotate str | None

Label key to connect the resulting table to.

None
markers_to_quantify list[str] | None

List of markers/channels to quantify.

None
add_qc_masks bool

If True, runs QC masking after quantification.

False
qc_prefix str

Prefix for QC exclusion columns.

'qc_exclude'
overwrite bool

If True, allows overwriting an existing table.

False
morphological_properties list[str] | None

List of morphological properties to compute.

None
intensity_properties list[str] | None

List of intensity properties to compute.

None

validate_sdata_as_input(sdata)

Validates that required masks and channels exist in the SpatialData object.

Parameters:

Name Type Description Default
sdata SpatialData

The SpatialData object to validate.

required

Raises:

Type Description
ValueError

If a specified mask or channel key is missing.

run(sdata)

Executes the quantification pipeline.

Parameters:

Name Type Description Default
sdata SpatialData

The SpatialData object to process.

required