CMR Innovations
Tyler E. Cork, MSc
PhD Candidate
Stanford University
Tyler E. Cork, MSc
PhD Candidate
Stanford University
Ariel J. Hannum, MSc
PhD Candidate
Stanford University
Michael Loecher, PhD
Research Scientist
Stanford University
Daniel B. Ennis, PhD
Professor
Stanford University
Cardiac Diffusion in Python (CarDpy) is an open-source software package developed in Python (v3.9.12) to simplify data processing for cardiac diffusion tensor imaging (cDTI) and cardiac diffusion-weighted imaging (cDWI). CarDpy accepts the inputs of DICOMs (Siemens) and 4D NifTi files with comma separated value files for the b-values and b vectors. CarDpy adopts Dipy [1], a neuro-based diffusion tensor imaging (DTI) Python software, as the main framework for the code, but is tailored to applications in the heart. CarDpy is comprised of a series of modules that improve the image quality of the reconstructed data. All modules support magnitude and complex datatypes unless otherwise specified. The current CarDpy modules (Fig 1) include the following:
1. Gibbs ringing correction [2]
2. Shot-rejection
CarDpy supports diffusion tensor imaging (DTI) reconstructions (Fig 2) to obtain the mean diffusivity (MD), fractional anisotropy (FA), mode (MO), helix angle (HA, derived from the primary eigenvector), E2 angle (E2A, derived from the secondary eigenvector), and transverse angle (TA, derived from the primary eigenvector). Within CarDpy, there is a customized graphical user interfaces (GUI) for left ventricular segmentation (Fig 3). The segmentation GUI presents several cDTI contrasts to help inform the user during left ventricular segmentation of the epicardial and endocardial borders in additional to the placement of the right ventricle insertion points for regional analysis using the American Heart Association 16-segment model [4].
Open-source software access instructions:
Repository Access:
CarDpy can be accessed from the Stanford Cardiac MRI Research (CMR) group Software page. This webpage includes a brief description of the software in addition to a link to the GitHub software repository. Potential users can download this repository directly from GitHub or through the command line by using git clone (Mac and Linux) or git bash (Windows):
git clone https://github.com/tecork/CarDpy.git
git bash https://github.com/tecork/CarDpy.git
Repository Samples:
CarDpy includes one deidentified example human subject dataset (IRB approved with consent) to familiarize users with the CarDpy software. The example dataset is from an in vivo cardiac diffusion tensor imaging exam using a free-breathing, M0M1M2 compensated spin-echo with a single-shot echo-planar imaging readout. This example dataset can be used with the two provided Jupyter notebook scripts. The first script, 01_Data_Processing .ipynb, is a pipeline for data processing to improve the image quality. The second script, 02_Post-Processing.ipynb, is for signal modeling to calculate cDTI metrics, plus the integrated segmentation GUI. Visualization of cDTI metrics are automatically generated in this script for an easy user experience.