cardio
cardio is a simple web-based viewer for 3D and 4D ('cine') medical imaging data,
built primarily on trame,
vtk, and
itk. cardio can render sequences
of mesh files (e.g., *.obj files), segmentation files (e.g., *.nii.gz files with
discrete labels) and volume renderings of grayscale images (e.g., *.nii.gz files with
continuous values). cardio is launched from the commandline and may be configured via
commandline arguments, a static TOML configuration file, or a combination of the two.
Quickstart
Installation
$ cd /path/to/your/project
$ uv init
$ uv add cardio
$ . ./.venv/bin/activate
Snapping to a segmentation feature
The MPR views can lock onto a segmentation feature: the centroid of a group of
labels (label), the interface between two groups (interface), or a point along
the line joining two such interfaces (traverse). That selection can be made in
the Snap & Align panel, or written down so the app opens with it already applied:
[snap]
segmentation_label = "BL_Labels"
mode = "traverse"
labels_a = [1]
labels_b = [2]
labels_c = [3]
traverse = 50 # percent of the way from the A|B interface to B|C
locked = true # hold the origin on the feature, frame to frame
orientation_locked = true # hold the views in the fitted plane
The same fields are available on the commandline, either individually or as JSON:
$ cardio --snap.mode traverse --snap.labels_a '[1]' --snap.labels_b '[2]' --snap.labels_c '[3]'
$ cardio --snap '{"mode": "interface", "labels_a": [1], "labels_b": [2], "locked": true}'
Reset returns to this configuration rather than to an empty panel. A label that the segmentation does not contain is reported and dropped rather than refusing to start.
Opening in a particular view
The layout and theme the app opens in, and where the playback controls start:
[view]
layout = "tile" # quad (default), volume, axial, coronal, sagittal, tile
theme = "dark" # selects between the two [background] colours
camera_lock = "LL" # MPR view the volume rendering's camera follows, or "free"
drawer_sections = ["playback", "tiles"] # sections open on load
help_visible = false # open showing the shortcut reference
[playback]
bpm = 75 # playback speed, in beats per minute
bpr = 3 # cardiac cycles per full rotation of the camera
rotating = true # rotate the camera while playing
$ cardio --view.layout tile --playback.bpm 75
Tile view draws several cuts along the traverse path at once, so it wants a
[snap] block in traverse mode to have anything to show. Reset returns the
playback controls to whatever is written here.
The volume and tile layouts do not draw the three MPR views, so the slices
behind them are not resampled while either is on screen; they are brought up to
date on the way back.
Developing
Ensuring you have all required dependencies:
$ uv sync --all-extras
Pre-commit checklist:
$ ruff check --fix
$ ruff format
$ pytest -v
Uploading:
$ uv version --bump major # Year
$ uv version --bump minor # Month
$ uv version --bump patch $ Day
$ git tag -a $(cardio --version) -m "Release $(cardio --version)"
$ rm -rf dist/
$ uv build --no-sources
$ git push origin main --follow-tags
$ uv publish --token <pypi_api_key>
Release files for cardio 2026.9.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cardio-2026.9.3.tar.gz | 74.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cardio-2026.9.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 170.0 kB
Release files / cardio-2026.9.3.tar.gz
| Download URL | cardio-2026.9.3.tar.gz |
|---|---|
| Size | 74.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
deca889b73b4ec6fc6bac3528d9b3aaafea4965c043c6c24246bc3c1d522d3f5
|
|
BLAKE2b-256 checksum How to use checksums |
3cfc82dfc8fca6d039298abeee358dfae52f63832f230e403ae7e21bc770e9fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cardio-2026.9.3-py3-none-any.whl
| Download URL | cardio-2026.9.3-py3-none-any.whl |
|---|---|
| Size | 95.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e23c3c24f67b51f3beb71e4f007521dec911e9e8895278515e7d7c139ecc7a65
|
|
BLAKE2b-256 checksum How to use checksums |
8ea75c89ba7afb34ce54b3744108e6aaf27531c8920faf46567bed4d33383a58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|