Skip to main content

bloodstream-docker

bloodstream-docker is a lightweight Python wrapper that turns a BIDS-App-like command line into the matching docker run — or apptainer run — invocation for bloodstream. Interactive Shiny mode is the default; use --automatic (or --mode non-interactive) to run the processing pipeline.

bloodstream-docker /path/to/bids /path/to/derivatives participant \
  --config /path/to/config.json \
  --analysis-foldername Model_AIF \
  --automatic

The command above runs:

docker run --rm --platform linux/amd64 -it \
  -v /path/to/bids:/data/bids_dir:ro \
  -v /path/to/derivatives:/data/derivatives_dir:rw \
  -v /path/to/config.json:/config.json:ro \
  mathesong/bloodstream:latest \
  --mode non-interactive --analysis_foldername Model_AIF --config /config.json

Installation

pip install bloodstream-docker

Run bloodstream-docker --help at any time to see all available options:

bloodstream-docker --help

Examples

Create a config file interactively, with no data at all — then open http://localhost:3838:

bloodstream-docker

Launch the app with data, so it can also run the pipeline:

bloodstream-docker /path/to/bids /path/to/derivatives participant

The three positional arguments follow the BIDS App convention:

bloodstream-docker <bids_dir> <output_dir> participant

The positional output_dir can be either the derivatives root or the final bloodstream output directory — these are equivalent:

bloodstream-docker /path/to/bids /path/to/derivatives participant
bloodstream-docker /path/to/bids /path/to/derivatives/bloodstream participant

Run the pipeline with a config file:

bloodstream-docker /path/to/bids /path/to/derivatives participant \
  --config /path/to/config.json \
  --automatic

Run the pipeline without one, which linearly interpolates the measured data:

bloodstream-docker /path/to/bids /path/to/derivatives participant --automatic

Give the analysis its own output folder, so several can sit side by side in derivatives/bloodstream/:

bloodstream-docker /path/to/bids /path/to/derivatives participant \
  --config /path/to/config.json \
  --automatic \
  --analysis-foldername Model_AIF

Print the command without running it:

bloodstream-docker /path/to/bids /path/to/derivatives participant --dry-run

Open a shell in the image:

bloodstream-docker --shell -i mathesong/bloodstream:latest

Apptainer

Pass --apptainer (or --container apptainer) to generate an apptainer run command instead, using bloodstream_latest.sif in the working directory by default:

apptainer build bloodstream_latest.sif docker://mathesong/bloodstream:latest

bloodstream-docker /path/to/bids /path/to/derivatives participant \
  --apptainer \
  --config /path/to/config.json \
  --automatic

which runs:

apptainer run --cleanenv \
  -B /path/to/bids:/data/bids_dir:ro \
  -B /path/to/derivatives:/data/derivatives_dir:rw \
  -B /path/to/config.json:/config.json:ro \
  -B /tmp:/tmp \
  bloodstream_latest.sif \
  --mode non-interactive --analysis_foldername Primary_Analysis --config /config.json

Point --image at another SIF file, or at a docker:// URI to let Apptainer pull it. On clusters where the runtime is still called singularity, use --container singularity.

Apptainer shares the host network, so there is no port to publish: the interactive app is reached on the port it reports (3838 by default, scanning upward if that one is taken). On a remote cluster, forward that port first:

ssh -L 3838:localhost:3838 username@servername

Patching a local bloodstream

Use --patch (or -f) to point the wrapper at a local bloodstream checkout and test your changes without rebuilding the image. The wrapper bind-mounts the source into the container, where it is reinstalled from source at startup so it overrides the bloodstream baked into the image:

bloodstream-docker /path/to/bids /path/to/derivatives participant \
  --patch /path/to/your/bloodstream/checkout

Because bloodstream is an R package it is reinstalled (not run directly from source), so the first few seconds of startup are spent installing the patched package. The patch works with every mode, including --shell.

Apple Silicon

The published bloodstream Docker images are currently linux/amd64 only. The wrapper therefore requests --platform linux/amd64 by default, which avoids Docker's platform-mismatch warning on Apple Silicon while running under emulation. If a native or multi-architecture image is published later, override the platform with --platform linux/arm64 or disable the explicit platform with --platform "".

Release files for bloodstream-docker 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bloodstream-docker 0.1.0
File Size Uploaded
bloodstream_docker-0.1.0.tar.gz 12.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bloodstream-docker 0.1.0
File Interpreter ABI Platform
bloodstream_docker-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.1 kB

Release files / bloodstream_docker-0.1.0.tar.gz

Download URL bloodstream_docker-0.1.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
07375e7c0055e504d377517f717c4bba578281a1d4382b30e933ecdd9b249d54
BLAKE2b-256 checksum
How to use checksums
fea3ece560b431cc303175d4413e02e5248bd0ad1a8b4651d6b3e70c18599c77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / bloodstream_docker-0.1.0-py3-none-any.whl

Download URL bloodstream_docker-0.1.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78f97815659f641042796d12312219109e89a9fe9e2d4653b3df1285a99ae0d9
BLAKE2b-256 checksum
How to use checksums
c16c4a9b38c3db5f16ea2c66810f36c4ecc6eab0b7cf6f2a865e5ed9a57aa1c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page