SPIMpack is a standalone Python package for packaging/publishing SPIM datasets from existing microscopy source files into BIDS-structured output directories.
- Shared metadata/model layer for dataset manifests and validation
- Backend writer layer (pluggable)
- Initial backend: local symlink packaging
- CLI packaging workflow independent of SPIMprep internals and Snakemake
symlink writes:
- top-level
dataset_description.jsonwith auto-injected SPIMpackGeneratedByentry - sidecars named
*_SPIM.json - symlinks named
*_SPIM.ims
BIDS path structure is built from entities using pybids:
sub-{subject}/[ses-{session}/]micr/sub-{subject}[_ses-{session}][_sample-{sample}][_acq-{acquisition}]_SPIM.ims
Sidecars preserve metadata that cannot be embedded in Imaris assets, including required SPIM fields:
OrientationStringXYZSampleStaining- additional metadata fields from manifest input (and optional
RequiredMicroscopyFields)
Manifest input is YAML with optional TSV-driven asset rows.
dataset_description:
Name: My SPIM Dataset
BIDSVersion: 1.9.0
DatasetType: raw
License: CC-BY-4.0
Authors:
- Author Name 1
- Author Name 2
datasets_tsv: datasets.tsvThe writer automatically appends a GeneratedBy entry for SPIMpack if not already present.
Required:
| Column | Description |
|---|---|
dataset_id |
Logical dataset grouping key |
subject |
BIDS subject label (alphanumeric only) |
sample |
BIDS sample label (alphanumeric only) |
spim_path |
Absolute path to the source microscopy asset (e.g. .ims, .ome.zarr) |
orientation_string_xyz |
Image orientation (e.g. LPS) |
sample_staining |
Semicolon-separated channel names |
Optional (entity columns):
| Column | Description |
|---|---|
session |
BIDS session label (alphanumeric only) |
acquisition |
BIDS acquisition label, e.g. 4x |
Any additional columns are written into the sidecar JSON.
dataset_id subject session sample acquisition spim_path orientation_string_xyz sample_staining Species
cohort1 01 01 s01 4x1 /data/raw/sub01.ims RPI Abeta;YoPro;CD31 mouseBefore writing, SPIMpack validates:
- Required
dataset_descriptionfields:Name,BIDSVersion,DatasetType,License DatasetTypemust beraworderivativeAuthorsmust be a list if provided- BIDS entity values (
sub,ses,sample,acq) must be alphanumeric only (letters and numbers, no hyphens or special characters) - Required columns to map to BIDS sidecar metadata:
orientation_string_xyz,sample_staining - Source SPIM datasets (can be .ims, .ome.zarr, .ozx; any format ZarrNii supports) must exist
spimpack package \
--manifest /path/to/manifest.yml \
--output-dir /path/to/output \
--backend symlink \
[--relative-symlinks]Symlinks are absolute by default. Use --relative-symlinks to create relative symlinks.
SPIMpack ships with an optional Streamlit-based web UI that lets you define manifests and datasets tables without editing YAML or TSV files by hand.
Install SPIMpack with the ui extra to pull in Streamlit and Pandas:
pip install "spimpack[ui]"Or, when working from a clone:
pip install -e ".[ui]"Python version note: Streamlit requires Python ≥ 3.9 (matching the core package requirement) and Pandas ≥ 1.5. Both are available on Windows, macOS, and Linux.
streamlit run ui/app.pyA browser window opens automatically. You can also navigate to
http://localhost:8501 manually.
- Dataset Description – fill in the form fields (name, BIDS version, dataset type, license, authors).
- Datasets Table – use the interactive table to add one row per imaging
acquisition. Required columns are marked with
*; optional BIDS entity columns (ses,acq) can be left blank. Extra PascalCase columns are written to the sidecar JSON. - Validate & Download – any validation errors are shown inline. Once the
form is valid, download
manifest.ymlanddatasets.tsvwith the provided buttons. - Run the CLI as usual:
spimpack package \
--manifest manifest.yml \
--output-dir /path/to/output \
--backend symlinkThe package separates shared models/validation from writer backends so future writers can be added without major restructuring, e.g.:
- object-store Zarr backend
- portal metadata ingest backend