register_datasource
Register an image and a flat cell table as a project, in one call.
from plexora import register_datasourceregister_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
namestrrequiredThe project's name.
imagestr | PathrequiredThe whole-slide image -- OME-TIFF/TIFF, DICOM, or a Zarr store (SpatialData or bioformats2raw). A web address is read in place.
featuresstr | PathrequiredThe cell table (CSV or Parquet).
xstrdefault NoneThe column holding each cell's X coordinate.
ystrdefault NoneThe column holding each cell's Y coordinate.
segmentationstr | Pathdefault NoneThe segmentation mask, if there is one.
id_columnstrdefault NoneThe column holding each cell's unique id.
celltype_columnstrdefault NoneThe column holding a cell type or phenotype label, if the table has one.
channel_nameslist[str]default NoneA 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 FalseCopy image, segmentation and features
into the project's own folder instead of reading them where
they are. Defaults to False.
data_dirstr | Pathdefault NoneThe 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 FalseDefer 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 NoneWhat 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
dictThe 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.
Related
create_project
Register one project and return its name.
register_anndata_datasource
Register an image and an AnnData-backed cell table as a project.