Shortcuts

slideflow

about(console=None) None[source]

Print a summary of the slideflow version and active backends.

Example
>>> sf.about()
╭=======================╮
│       Slideflow       │
│    Version: 2.1.0     │
│  Backend: tensorflow  │
│ Slide Backend: cucim  │
│ https://slideflow.dev │
╰=======================╯
Parameters:

console (rich.console.Console, optional) – Active console, if one exists. Defaults to None.

create_project(root: str, cfg: Dict | str | None = None, *, download: bool = False, md5: bool = False, **kwargs) Project

Create a project at the existing folder from a given configuration.

Supports both manual project creation via keyword arguments, and setting up a project through a specified configuration. The configuration may be a dictionary or a path to a JSON file containing a dictionary. It must have the key ‘annotations’, which includes a path to an annotations file, and may optionally have the following arguments:

  • name: Name for the project and dataset.

  • rois: Path to .tar.gz file containing compressed ROIs.

  • slides: Path in which slides will be stored.

  • tiles: Path in which extracted tiles will be stored.

  • tfrecords: Path in which TFRecords will be stored.

import slideflow as sf

P = sf.create_project(
    root='path',
    annotations='file.csv',
    slides='path',
    tfrecords='path'
)

Annotations files are copied into the created project folder.

Alternatively, you can create a project using a prespecified configuration, of which there are three available:

  • sf.project.LungAdenoSquam

  • sf.project.ThyroidBRS

  • sf.project.BreastER

When creating a project from a configuration, setting download=True will download the annoations file and slides from The Cancer Genome Atlas (TCGA).

import slideflow as sf

project = sf.create_project(
    root='path',
    cfg=sf.project.LungAdenoSquam,
    download=True
)
Parameters:
  • root (str) – Path at which the Project will be set up.

  • cfg (dict, str, optional) – Path to configuration file (JSON), or a dictionary, containing the key “annotations”, and optionally with the keys “name”, “rois”, “slides”, “tiles”, or “tfrecords”. Defaults to None.

Keyword Arguments:
  • download (bool) – Download any missing slides from the Genomic Data Commons (GDC) automatically, using slide names stored in the annotations file.

  • md5 (bool) – Perform MD5 hash verification for all slides using the GDC (TCGA) MD5 manifest, which will be downloaded.

  • name (str) – Set the project name. This has higher priority than any supplied configuration, which will be ignored.

  • slides (str) – Set the destination folder for slides. This has higher priority than any supplied configuration, which will be ignored.

  • tiles (str) – Set the destination folder for tiles. This has higher priority than any supplied configuration, which will be ignored.

  • tfrecords (str) – Set the destination for TFRecords. This has higher priority than any supplied configuration, which will be ignored.

  • roi_dest (str) – Set the destination folder for ROIs.

  • dataset_config (str) – Path to dataset configuration JSON file for the project. Defaults to ‘./datasets.json’.

  • sources (list(str)) – List of dataset sources to include in project. Defaults to ‘MyProject’.

  • models_dir (str) – Path to directory in which to save models. Defaults to ‘./models’.

  • eval_dir (str) – Path to directory in which to save evaluations. Defaults to ‘./eval’.

Returns:

slideflow.Project

load_project(root: str, **kwargs) Project

Load a project at the given root directory.

Parameters:

root (str) – Path to project.

Returns:

slideflow.Project

getLoggingLevel()[source]

Return the current logging level.

setLoggingLevel(level)[source]

Set the logging level.

Uses standard python logging levels:

  • 50: CRITICAL

  • 40: ERROR

  • 30: WARNING

  • 20: INFO

  • 10: DEBUG

  • 0: NOTSET

Parameters:

level (int) – Logging level numeric value.