Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INR for Cardiovascular Anatomies and Hemodynamic Fields

Code and data to reproduce the results of the paper: Jubilee Lee, Daniele E. Schiavazzi, On the accuracy of implicit neural representations for cardiovascular anatomies and hemodynamic fields.

Installation

Clone the repository from GitHub:

git clone git@github.com:desResLab/nrf.git

The code can be installed using different version of multiresolution hash encoding (MHE). To install a pytroch-compatible version of MHE that can run on CPUs, type:

pip install -e .

To use MHE from the NVIDIA PhysicsNeMo libray run:

pip install -e . [physicsnemo]

Finally, to use MHE from the tiny-CUDA-nn library, run:

pip install -e . [tcnn]

Features

The following type of implicit neural representations are currently supported:

  • Multiplicative filter networks - Link.
  • Multiresolution hash encoding (physicsnemo, tcnn and pure pytorch implementations) - Link.
  • MLP with various types of frequency-based positional encoding - Link.
  • SIREN networks - Link.
  • Modulated SIREN networks - Link.

Dataset

To reproduce the results in the paper, a Datasets can be downloaded from box. Create the ./data subfolder in the main project directory and download all the subfolders from box in this folder. The following datasets are currently available:

  • Two dimensional (XT or XY) datasets:
    • ./data/01_xt_pipe/xt_pipe.npz - Two-dimensional dataset (one-dimensional space and time) of centerline velocities and pressure in a cylindrical pipe.
    • ./data/02_xy_zebra/xt_zebra.npz - Two-dimensional zebra image dataset.
  • Three-dimensional (XYZ) datasets:
    • ./data/03_xyz_pipe/xyz_pipe.npz - Steady state three-dimensional hemodynamics in a cylindrical pipe.
    • ./data/04_xyz_aorta/xyz_aorta.npz - Steady state three-dimensional hemodynamics of a patient-specific aortic anatomy.
  • Four-dimensional (XYZT) datasets:
    • ./data/05_xyzt_pipe/xyzt_pipe.npz - Pulsatile four-dimensional hemodynamics in a pipe.
    • ./data/05_xyzt_pipe/xyzt_pipe_grid.npz - Regular validation grid for pulsatile four-dimensional hemodynamics in a pipe.
    • ./data/06_xyzt_aorta/xyzt_aorta.npz - Pulsatile four-dimensional hemodynamics in a patient-specific aortic anatomy.
  • Signed distance function (SDF) datasets:
    • ./data/10_xyz_sdf/sphere_XXX_YYY.sdf.npz - Ideal spherical geometry.
    • ./data/10_xyz_sdf/aorta_XXX_YYY.sdf.npz - Patient-specific aortic anatomy.
    • ./data/10_xyz_sdf/pulm_XXX_YYY.sdf.npz - Patient-specific pulmonary anatomy. Here XXX refers to the type of dataset (see paper) and can be either M_S_S, S_M_S, S_S_M. YYY refers to the size of the dataset and can be either large, or small.
  • Aortic Zoo dataset:
    • ./data/11_xyz_sdf_zoo/ - Contains various *.sdf.npz files with multiple patient-specific aortic anatomies from the vascular model repository.

Available functions

We provide python functions and scripts for the following tasks (use --help sfor a list of avaialble arguments):

  • python3 -m nrf.train - Train a neural field from a dataset.

Examle

python3 -m nrf.train --iterations 100 \
                     --exptype gabor \
                     --batch 2048 \
                     --dsfile './data/04_xyz_aorta/xyz_aorta.npz' \
                     --dstype xyz \
                     --param v_x v_y v_z p \
                     --output "checkpoint.pt"
  • python3 -m nrf.validation - Evaluate the trained NRF on the training data.

Examle

python3 -m nrf.validation --chkfile "checkpoint.pt" \
                          --validfile "./data/06_xyzt_aorta/xyzt_aorta.npz" \
                          --eval_mode output \
                          --output "output_file"
  • python3 -m nrf.validation_to_mesh - Convert validation data to VTK.

Examle

python3 -m nrf.validation_to_mesh --vtkfile "mesh_file.vtu" \
                                  --predfile "prediction_file.npy" \
                                  --output_prefix "output_file"
  • python3 -m nrf.tria_to_sdf - Create a training dataset for deep SDF from a triangulated surface model.

Examle

python3 -m nrf.tria_to_sdf --file "sphere.vtp" \
                           --total 100000 8000 8000 \
                           --output "sphere_M_S_S_small"
  • python3 -m nrf.eval_zerols_dist - Evaluate distance between a zero level set contour and an existing triangulated surface model.

Examle

python3 nrf/eval_zerols_dist.py --sdf "vtk_image.vti" \
                                --ref "surface_anatomy.vtp" \
                                --output "output.vtp" \
                                --distfile "distance_file"
  • python3 -m nrf.plot_loss - Plot loss profile from model checkpoint.

Examle

python3 -m nrf.plot_loss --input "checkpoint.pt"

Example training and validation scripts

Examples training and validation scripts can be found in the run_scripts folder.

Reference

Our work can be cited using the bibtex item below:

@article{lee2025accuracy,
  title={On the accuracy of implicit neural representations for cardiovascular anatomies and hemodynamic fields},
  author={Lee, Jubilee and Schiavazzi, Daniele E},
  journal={arXiv preprint arXiv:2510.20970},
  year={2025}
}

About

Implicit neural representations for cardiovascular hemodynamics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages