API#

The miblab python package provides an API to miblab functionality that is relevant across applications such as retrieving data or models, generating pdf reports, or deploying pipelines.

This page provides an API reference guide for the package.

Reporting

To access these functions, miblab must be installed with the report option:

pip install miblab[report]

All reporting functionality is wrapped up in a single class:

Report(folder[, filename, title, subtitle, ...])

Generate pdf reports in miblab style.

Data

To access these functions, miblab must be installed with the data option:

pip install miblab[data]

APIs for upload and download to Zenodo and OSF:

zenodo_fetch(dataset, folder[, doi, ...])

Download a dataset from Zenodo.

osf_fetch(dataset, folder[, project, token, ...])

Download a dataset from OSF (Open Science Framework).

osf_upload(folder, dataset[, project, ...])

Upload a file to OSF (Open Science Framework) using osfclient.

rat_fetch([dataset, folder, unzip, convert, ...])

Download, recursively extract, and (optionally) convert TRISTAN rat MRI studies from Zenodo (record 15747417).

Deep-learning API

To access these functions, miblab must be installed with the dlseg option:

pip install miblab[dlseg]

Interfaces for deploying deep learning models.

totseg(vol[, cutoff])

Run totalsegmentator on one or more volumes.

kidney_pc_dixon(input_array[, device, ...])

Segment individual kidneys on post-contrast Dixon images.

The miblab[dlseg] option will be deprecated in future versions and all deep-learning models will be available via a dedicated package miblab-dl. At the moment this provides an API for the fat-water calculations:

pip install miblab-dl

fatwater(op_phase, in_phase[, te_o, te_i, ...])

Compute fat and water maps from opposed-phase and in-phase arrays