CarDpy
Cardiac Diffusion in Python: a toolbox that turns cardiac diffusion tensor imaging (cDTI) data into clinical maps (MD, FA, helix angle, E2A and more) with a single call.
Pipeline overview
https://github.com/user-attachments/assets/94ed65fc-ec80-4635-a24a-68b779b8f039
If the video doesn't play, open Figure 1 (pipeline overview).
Command-line demo
https://github.com/user-attachments/assets/d49ed1cd-8b80-441a-ae34-f27c8d6ec2c4
If the video doesn't play, open Figure 2a (command-line demo).
Updates in CarDpy 2.0
- Three shot rejection modes: Algorithmic (SSIM/NRMSE clustering, default), Manual (click-to-reject review window), and CNN-Reject (a bundled deep learning classifier).
- Automated segmentation with nnUNet-Segment: LV contours and RV insertion points without manual drawing, with an optional review step.
- Bootstrapped uncertainty: 95% intervals for MD and FA, and cone half-angles for E1/E2/E3.
- Redesigned GUIs: box cropping, spline contouring with zoom, and a manual shot rejection review window.
Install
conda create -n cardpy python=3.14 -y
conda activate cardpy
pip install "cardpy-cmr[macos]" # drop [macos] on Linux/Windows
The PyPI name is cardpy-cmr; the import name is cardpy.
- Install size: CarDpy 2.0 depends on
torch,nnunetv2,ultralyticsandhuggingface_hub, so you can expect a 1–2 GB install. - nnUNet-Segment weights (~4 GB) download on first use from the gated
Hugging Face repo
sash99666/cdti-lv-baseline. Request access on that page, then runhf auth loginonce. Manual segmentation needs neither.
Quick start
import copy
from cardpy.pipeline import process
from cardpy.config import DEFAULT_CONFIG
config = copy.deepcopy(DEFAULT_CONFIG)
config["dicom_subpath"] = "02_cDTI/SAX/your_series_folder_name"
config["slice_index"] = None # all slices, or e.g. [3, 4]
config["rejection"]["mode"] = "algorithm" # "algorithm" / "manual" / "ml" (CNN-Reject)
config["segmentation"]["mode"] = "manual" # "manual" / "auto" (nnUNet-Segment)
config["uncertainty"]["enabled"] = False # True adds bootstrapped uncertainty
results = process("/full/path/to/your/study_folder", config)
The GUIs open during the run when needed. When they're done, results holds
the DTI metrics, eigenvectors, cardiac metrics and mask, and every stage is
written to CarDpy_Output/ inside your study folder.
Step-by-step notebooks are in the repository: 01_Data_Processing,
02_Post-Processing, 03_Uncertainty and 04_Manual_Shot_Rejection.
A sample dataset, Healthy_Volunteer_007.zip, is included.
Full guide (every config option, outputs, GUIs, troubleshooting): HOW_TO_USE.md
Associated publication
Cork, T.E., Hannum, A.J., Loecher, M., Perotti, L.E., Ennis, D.B. (2025). Evaluating the Effect of Post-processing Steps When Analyzing Cardiac Diffusion Tensor Data. In: Functional Imaging and Modeling of the Heart (FIMH 2025). Lecture Notes in Computer Science, vol. 15673. Springer, Cham. https://doi.org/10.1007/978-3-031-94562-5_13
Credits and license
CarDpy was originally written by Tyler Cork (CMR Group, Stanford Radiological Sciences Laboratory).
nnUNet-Segment was developed by Sascha Stocker; its code is included in
cardpy/Data_Processing/nnunet_cdti/ under the Apache 2.0 license. CarDpy is
released under the GNU GPL v3.
Metadata
Release files for cardpy-cmr 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cardpy_cmr-0.2.0.tar.gz | 1.3 MB | With provenance | Details for cardpy_cmr-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cardpy_cmr-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cardpy_cmr-0.2.0-py3-none-any.whl |
Total release size: 2.6 MB
Release files / cardpy_cmr-0.2.0.tar.gz
| Download URL | cardpy_cmr-0.2.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ae92a2b461b74e9bc4a86fc9b99ce864175ad208833ee6224efa0ca4bfeb68e
|
|
BLAKE2b-256 checksum How to use checksums |
0fc61b4576d559145928030950c6524f6fab0789e9ccfe0d77032b4e3f03c68d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logRelease files / cardpy_cmr-0.2.0-py3-none-any.whl
| Download URL | cardpy_cmr-0.2.0-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0b36db504fd5bd380aabea239f7b6abf10e2ffb423fec7510b87c260232117c
|
|
BLAKE2b-256 checksum How to use checksums |
db72e2d64bdfbeb34e6c02e0cf4f2ce04de7cff9c146860a9cf563ca0ad057c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logSecurity for cardpy-cmr 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cardpy_cmr-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.