plan_dataset
Work out which images, masks and tables under these folders belong together, without registering anything.
from plexora import plan_datasetplan_dataset(*roots, overrides=None, limits=None, node=None) -> dictWalks every folder under roots (names and file sizes first, then each
candidate's header), and groups what it finds into one project per image:
its segmentation mask, its cell table and its channel names, each with a
confidence and the reasons for it. The same plan the viewer's New Dataset
dialog shows, so a script and the dialog agree about a folder.
A match is high when it is strong and well clear of any other candidate,
medium when it is likely but worth a look, and anything less is left in
unassigned with its best suggestions rather than guessed.
The folders can be on this computer, on a data node (node=), on a
files-only server this Plexora is connected to (an sftp:// address), or
in a bucket (s3://lin-2023-orion-crc/data, gs://..., az://..., or a
web host that lists its folders). A folder holding one sample's images of
different kinds (a multiplex slide and its H&E) is one project, the others
its layers; a tree that sorts its samples into folders (CRC/,
Melanoma/) gives each project its group, and the plan its groups.
When to use
Use this to see what create_dataset_from_directory would make, or to
write the plan out as a spec file and edit it (see
plexora dataset create NAME --scan DIR --dry-run --json). Use
create_dataset when you already have the list of projects.
Parameters
*rootsOne or more folders to scan.
overridesdictkeyword-onlydefault NoneCorrections, as the dialog makes them --
\{"assign": [\{"path", "project", "slot"\}], "exclude": [path], "detach": [path], "new_project": [\{"image", "name"\}], "rename": \{project_id: name\}, "learn": [\{"path", "project"\}]\}.
limitsdictkeyword-onlydefault None{"max_depth": 8, "max_entries": 200000}.
nodestrkeyword-onlydefault NoneThe data node the folders are on.
Returns
dictThe plan: projects (each with image, mask, table,
channels, status), unassigned, unrecognised, duplicates,
counts, warnings and conventions.
Raises
ValueErrorIf a root is not a folder.
Examples
import plexora
plan = plexora.plan_dataset("/data/cohort")
for project in plan["projects"]:
print(project["name"], project["status"])Related
create_dataset_from_directory
Scan folders and register what they hold as one dataset.
create_dataset
Make a dataset, registering its projects if they are not there yet.