Plexora

Dataset

A named group of projects, and a handle for changing that group.

Generated from Plexora 0.0.55View source
from plexora import Dataset
Dataset(
    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

idstrrequired

The dataset's id. Stable even if the dataset is renamed.

namestrrequired

The 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.

namestrrequired

The 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.

Dataset

The dataset as it is now.

add

add(*names) -> 'Dataset'

Put projects into this dataset, taking them out of any other one.

*names

Project names, or a mix of names and lists of names.

Dataset

The updated dataset.

remove

remove(*names) -> 'Dataset'

Take projects out of this dataset. They are not deleted.

*names

Project names, or a mix of names and lists of names. Names not currently in this dataset are ignored.

Dataset

The updated dataset.

rename

rename(name) -> 'Dataset'

Rename this dataset.

namestrrequired

The new name.

Dataset

The renamed dataset.

describe

describe(text=None, **meta) -> 'Dataset'

Set the dataset's description, its metadata, or both.

textstrdefault None

The new description. Leave unset to keep the current one.

**meta

Metadata to merge into the dataset's existing meta.

Dataset

The updated dataset.

delete

delete() -> None

Delete 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() -> dict

What 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.

Guides

On this page