Here is the source code of our pre-print paper ''SDF4CHD: Generative Modeling of Cardiac Anatomies with Congenital Heart Defects''.
Congenital heart disease (CHD) encompasses a spectrum of cardiovascular structural abnormalities, often requiring customized treatment plans for individual patients. CHDs are often rare, making it challenging to acquire sufficiently large patient cohorts for training such DL models. Generative modeling of cardiac anatomies has the potential to fill this gap via the generation of virtual cohorts. We have introduced a novel deep-learning approach that learns a CHD-type and CHD-shape disentangled representation of cardiac geometry for major CHD types. Our approach implicitly represents type-specific anatomies of the heart using neural SDFs and learns an invertible deformation for representing patient-specific shapes. In contrast to prior generative modeling approaches designed for normal cardiac topology, our approach accurately captures the unique cardiac anatomical abnormalities corresponding to various CHDs and provides meaningful intermediate CHD states to represent a wide CHD spectrum. When provided with a CHD-type diagnosis, our approach can create synthetic cardiac anatomies with shape variations, all while retaining the specific abnormalities associated with that CHD type. We demonstrated the ability to augment image-segmentation pairs for rarer CHD types to significantly improve cardiac segmentation accuracy for CHD patients. We can also generate synthetic CHD meshes for computational simulations and systematically explore the effects of structural abnormalities on cardiac functions.
The required packages are listed in `requirements.txt'. We used Python/3.7 to build our environment.
pip install -r requirements.txt
After setting up the environment, the following command can perform a simple test case to generate a spectrum of CHD anatomies between VSD+ToF and VSD+TGA. A pretrained model has been released in pretrained/sdf4chd_final
. You should be able to see meshes of the whole heart in .vtp
format as the output. These mesh files can be visualized in Paraview.
python test_gen.py --config config/gen_test_wh.yml --epoch 2000
Additional tests conducted in the paper can also be performed by modifying the field test_ops
in the config file.
To train the network on CHD segmentations, you need to specify the correct paths pointing to your training data by modifying the field data
in the config file. Other network and training settings can also be adjusted in the config file. The following command will either train a model from scratch if the model does not exist in the specified output directory, or continue to train a model if the model exists.
python train_gen.py --config config/gen_test_wh.yml
Here is a list of updates that I plan to include soon in this repository. Please open an issue if you suggest additional updates.
- Upload pre-processed segmentation data in
.pkl
format. - Upload template meshes used for CFD simulation.
- A tutorial for generating anatomies of specified CHD types.