Plexora

register_datasource

Register an image and a flat cell table as a project, in one call.

Generated from Plexora 0.0.55View source
from plexora import register_datasource
register_datasource(
    name,
    image,
    features,
    x=None,
    y=None,
    segmentation=None,
    id_column=None,
    celltype_column=None,
    channel_names=None,
    copy=False,
    data_dir=None,
    segmentation_async=False,
    segmentation_mode=None,
    image_type=None,
    pyramidize=None,
)

Writes directly to Plexora's project registry -- no upload page needed. Coordinate, id and cell-type columns are guessed from the table's column names when not given, the same guess the classification screen makes.

When to use

plexora.create_project is the newer entry point: it needs only an image, and lets every other question -- the table, its columns, a mask -- be answered later with plexora.configure_project. register_datasource is the older, all-at-once form, and still reads naturally for a script that already has every path and column name in hand. Use plexora.register_anndata_datasource instead when the table is an AnnData (.h5ad) rather than a flat file.

Parameters

namestrrequired

The project's name.

imagestr | Pathrequired

The whole-slide image -- OME-TIFF/TIFF, DICOM, or a Zarr store (SpatialData or bioformats2raw). A web address is read in place.

featuresstr | Pathrequired

The cell table (CSV or Parquet).

xstrdefault None

The column holding each cell's X coordinate.

ystrdefault None

The column holding each cell's Y coordinate.

segmentationstr | Pathdefault None

The segmentation mask, if there is one.

id_columnstrdefault None

The column holding each cell's unique id.

celltype_columnstrdefault None

The column holding a cell type or phenotype label, if the table has one.

channel_nameslist[str]default None

A name for each image channel, in channel order. Taken from the table's marker columns when not given (padded with generic names if there are fewer markers than image channels).

copybooldefault False

Copy image, segmentation and features into the project's own folder instead of reading them where they are. Defaults to False.

data_dirstr | Pathdefault None

The data root to register the project under. By default the project is registered where new projects go (on your own computer, Documents/Plexora/projects, which the Plexora website opens too) and what registering builds is written to Plexora's configured data directory.

segmentation_asyncbooldefault False

Defer mask conversion to a background job and return immediately, leaving the returned entry's segmentation_status as "pending". Defaults to False, so a single call returns a fully-registered project.

segmentation_modestrdefault None

"filled" (the default) stores a filled label mask; "outlines" stores boundaries instead.

image_typestrdefault None

"brightfield" or "fluorescence", to override how the image is read. Defaults to None, which decides from the file.

pyramidizebool or strdefault None

What to do with a large multiplex TIFF that has no reduced-resolution levels. None (the default) and True write a pyramidized copy once, beside the original (or in the project's folder when that one is not writable), and open the copy; the original is never changed. A 16-bit image's copy is <name>.pyramid.approx, about 75% smaller than an exact copy with every pixel within its noise, unless the setting compress_pyramids is off; otherwise <name>.pyramid.ome.tiff. "compressed" or "exact" asks for that kind. False opens the original as it is.

Returns

dict

The project's saved config entry.

Examples

import plexora

plexora.register_datasource(
    "tonsil", image="slide.ome.tif", features="cells.csv",
    x="X_centroid", y="Y_centroid",
)

How is this different?

create_project or register_datasource?

create_project needs only an image and lets you answer the remaining questions later with configure_project. register_datasource is the older, all-at-once form: the image, the table and the coordinate columns in one call. New code should use create_project; register_datasource stays for scripts that already use it.

Guides

On this page