Dataset
A named group of projects, and a handle for changing that group.
from plexora import DatasetDataset(
id: str,
name: str,
description: str = '',
created_at: str = '',
projects: tuple[str, ...] = (),
meta: Mapping[str, Any] = dict(),
)Returned by create_dataset, dataset and list_datasets -- never
constructed directly. Supports len(ds), for name in ds and
"slide1" in ds over its project names.
Every method below returns a fresh Dataset rather than changing this
one in place: another process (the viewer, another notebook) can write to
the same dataset at any time, so a handle is a snapshot from the moment it
was read. Reassign the result to keep working with the current state, e.g.
cohort = cohort.add("slide3").
Fields
idstrrequiredThe dataset's id. Stable even if the dataset is renamed.
namestrrequiredThe dataset's name, as shown in the UI and passed to dataset.
descriptionstrdefault ''A free-text note about the dataset. Empty if none was set.
created_atstrdefault ''When the dataset was created, as an ISO timestamp.
projectstuple[str, ...]default ()The names of the projects currently in this dataset.
metaMapping[str, Any]default dict()Other metadata set with describe(**meta).
Methods
__len__
__len__()The number of projects in this dataset.
__iter__
__iter__()Iterate over the dataset's project names.
__contains__
__contains__(name)Whether name is one of this dataset's projects.
namestrrequiredThe project name to look for.
refresh
refresh() -> 'Dataset'Reload this dataset and return the current handle.
Picks up anything another process changed since this handle was made -- a project added from the viewer, say, while a notebook still holds the dataset from before that.
DatasetThe dataset as it is now.
add
add(*names) -> 'Dataset'Put projects into this dataset, taking them out of any other one.
*namesProject names, or a mix of names and lists of names.
DatasetThe updated dataset.
remove
remove(*names) -> 'Dataset'Take projects out of this dataset. They are not deleted.
*namesProject names, or a mix of names and lists of names. Names not currently in this dataset are ignored.
DatasetThe updated dataset.
rename
rename(name) -> 'Dataset'Rename this dataset.
namestrrequiredThe new name.
DatasetThe renamed dataset.
describe
describe(text=None, **meta) -> 'Dataset'Set the dataset's description, its metadata, or both.
textstrdefault NoneThe new description. Leave unset to keep the current one.
**metaMetadata to merge into the dataset's existing meta.
DatasetThe updated dataset.
delete
delete() -> NoneDelete this dataset.
The projects in it are not deleted -- they stay registered at the top level, exactly as deleting a folder in the UI leaves its files behind.
manifest
manifest() -> dictWhat every project in this dataset has, and what is still open.
The same per-project readiness check project_manifest makes, run
once for each project in the dataset.
dict{project_name: manifest}, one entry per project, in the
shape project_manifest returns.
Examples
import plexora
cohort = plexora.create_dataset("Melanoma Cohort", images=["slide.ome.tif"])
print(cohort.name, list(cohort))How is this different?
dataset or Dataset?
plexora.dataset(name) is the function that looks a dataset up.
plexora.Dataset is the class of what it returns. You rarely construct
a Dataset yourself.
Related
create_dataset
Make a dataset, registering its projects if they are not there yet.
dataset
Get one dataset, by name or by id.