Skip to content

API Reference

This section contains the reference documentation for all modules in the pipeline.

CoreCutter(margin=0, mask_value=0)

Extract rectangular or polygonal regions from images.

Create a new cutter.

Parameters:

Name Type Description Default
margin int

Padding to apply around each core.

0
mask_value int

Value used outside polygon masks.

0

extract_core(array, row)

Extract a single core from the given image.

Parameters:

Name Type Description Default
array ndarray | Array

Source image.

required
row Series

Metadata describing the core. Required fields include row_start, row_stop, column_start, column_stop and poly_type.

required

Returns:

Type Description
ndarray

numpy.ndarray: The extracted core image.

CoreAssembler(temp_dir, output_dir, max_pyramid_levels=4, downscale=2, allowed_channels=None, cleanup=False)

Assemble per-channel TIFFs into a SpatialData object.

Initialize the assembler.

Parameters:

Name Type Description Default
temp_dir str

Directory containing temporary per-core folders.

required
output_dir str

Location where .zarr outputs are written.

required
max_pyramid_levels int

Maximum number of multiscale levels. 0 disables pyramid creation.

4
downscale int

Downsampling factor per level.

2
allowed_channels list[str] | None

Restrict processing to these channels. If None all channels are used.

None
cleanup bool

Remove intermediate TIFFs when True.

False

assemble_core(core_id)

Assemble a single core from its per-channel TIFF images.

Parameters:

Name Type Description Default
core_id str

Identifier of the core's temporary folder.

required

Returns:

Name Type Description
str str

Path to the written .zarr dataset.

Raises:

Type Description
FileNotFoundError

If the temporary core folder is missing.

ValueError

If no TIFF files are found in the folder.

CorePreparationController(metadata_df, image_paths, temp_dir, output_dir, file_strategy, margin=0, mask_value=0, max_pyramid_levels=3, core_cleanup_enabled=True)

Coordinate cutting and assembly of cores from multiplex images.

Initialize the controller.

Parameters:

Name Type Description Default
metadata_df DataFrame

Table describing each core.

required
image_paths dict[str, str]

Mapping of channel names to image paths.

required
temp_dir str

Directory for temporary core files.

required
output_dir str

Destination for assembled .zarr outputs.

required
file_strategy FileAvailabilityStrategy

Strategy used to obtain image files.

required
margin int

Pixels of padding around each core.

0
mask_value int

Fill value for masked regions.

0
max_pyramid_levels int

Number of pyramid levels.

3
core_cleanup_enabled bool

Remove intermediate TIFFs after assembly.

True

cut_channel(channel, file_path)

Cut all cores from a single channel image.

Parameters:

Name Type Description Default
channel str

Name of the channel being processed.

required
file_path str | Path

Path to the OME-TIFF file.

required

run()

Process all channels and assemble cores.

This method blocks until all channels have been processed and the corresponding cores have been assembled.

try_assemble_ready_cores()

Assemble any cores whose channels are complete.