This is the code repository of our paper Deep-learning based extraction of circle of Willis Topology with anatomical priors.
We extract a graph representation from the circle of Willis topology from 3D TOF-MRA scans. A complete circle of Willis is used as an anatomical prior of these graphs. Therefore, we connect automatically detected bifurcation points in these scans using a shortest path algorithm, that depends on a cost function
The conda environment can be created through the environment.yml
file:
conda env create -f environment.yml -n cow_extraction
In addition, we need the gauge-equivariant mesh convolution library (as SIRE depends on it):
git clone https://github.com/Qualcomm-AI-research/gauge-equivariant-mesh-cnn.git
cd gauge-equivariant-mesh-cnn
pip install .
If you get an error regarding OpenMesh, try
conda install -c conda-forge openmesh-python
then try to pip install again.
Data is stored in the /data
directory, with the following structure:
/data
/scans
/<Patient ID>.nii.gz
/bifurcations
/<Patient ID>.npy
/sire-weights
/model-weights.pt
/train.yml
SIRE model weights and the parameters in /train.yml
can be downloaded from here.
The code for automatic topology extraction is in /scripts/extract_topology.py
. Patient ID and parameters are hardcoded in this script and can be changed there.
The figure below gives an overview of the method. extract_topology.py
saves both the paths found by Dijkstra's algorithm (as a dictionary where the world-coordinates can be accessed through the key 'world'
). This script also saves the result of the SIRE preprocessing filter as a 9D vectorfield, with the following contents:
Results are automatically saved in the /results
folder after running /scripts/extract_topology.py
. The SIRE vectorfields are saved as .npy
files in /results/SIRE_filtered
and a minimal intensity projection as well as the coordinates of the paths are saved as .png
and .pkl
files respectively under /results/paths
.