Skip to main content

DiffDRR Datasets

Open-source 2D/3D registration datasets and dataloaders for DiffDRR

CI Paper shield License: MIT Docs Code style: black

Install

pip install diffdrrdata

DiffDRR

DiffDRR is an differentiable X-ray renderer used for solving inverse problems in tomographic imaging. If you find DiffDRR useful in your work, please cite our paper:

@inproceedings{gopalakrishnan2022fast,
  title={Fast auto-differentiable digitally reconstructed radiographs for solving inverse problems in intraoperative imaging},
  author={Gopalakrishnan, Vivek and Golland, Polina},
  booktitle={Workshop on Clinical Image-Based Procedures},
  pages={1--11},
  year={2022},
  organization={Springer}
}

Datasets

We provide APIs to load the following open-source datasets into DiffDRR:

Dataset Anatomy # of Subjects # of 2D Images CTs X-rays GT Fiducials
DeepFluoro pelvis 6 366 ✅ ✅ ❌
Ljubljana neurovasculature 10 20 ✅ ✅ ✅

If you use any of these datasets, please cite the original papers.

DeepFluoro

DeepFluoro (Grupp et al., 2020) provides paired X-ray fluoroscopy images and CT volume of the pelvis. The data were collected from six cadaveric subjects at John Hopkins University. Ground truth camera poses were estimated with an offline registration process. A visualization of the X-ray / CT pairs in the DeepFluoro dataset is available here.

@article{grupp2020automatic,
  title={Automatic annotation of hip anatomy in fluoroscopy for robust and efficient 2D/3D registration},
  author={Grupp, Robert B and Unberath, Mathias and Gao, Cong and Hegeman, Rachel A and Murphy, Ryan J and Alexander, Clayton P and Otake, Yoshito and McArthur, Benjamin A and Armand, Mehran and Taylor, Russell H},
  journal={International journal of computer assisted radiology and surgery},
  volume={15},
  pages={759--769},
  year={2020},
  publisher={Springer}
}
import matplotlib.pyplot as plt
import torch
from diffdrr.drr import DRR
from diffdrr.visualization import plot_drr

from diffdrrdata.deepfluoro import DeepFluoroDataset, Transforms

# Load a subject from the DeepFluoroDataset
deepfluoro = DeepFluoroDataset(id_number=1)

# Initialize the DRR module
subsample = 4
drr = DRR(
    deepfluoro.subject,
    deepfluoro.focal_len,
    deepfluoro.height // subsample,
    deepfluoro.delx * subsample,
    x0=deepfluoro.x0,
    y0=deepfluoro.y0,
)
transform = Transforms(deepfluoro.height // subsample)

# Render a DRR from the ground truth camera pose
gt, pose = deepfluoro[0]
img = drr(pose)
gt, img = transform(gt), transform(img)
plot_drr(torch.concat([gt, img, gt - img]), title=["Downsampled X-ray", "DRR", "Difference"])
plt.show()

Ljubljana

Ljubljana (Mitrovic et al., 2013) provides paired 2D/3D digital subtraction angiography (DSA) images. The data were collected from 10 patients undergoing endovascular image-guided interventions at the University of Ljubljana. Ground truth camera poses were estimated by registering surface fiducial markers.

@article{pernus20133d,
  title={3D-2D registration of cerebral angiograms: A method and evaluation on clinical images},
  author={Mitrović, Uros˘ and S˘piclin, Z˘iga and Likar, Bos˘tjan and Pernus˘, Franjo},
  journal={IEEE transactions on medical imaging},
  volume={32},
  number={8},
  pages={1550--1563},
  year={2013},
  publisher={IEEE}
}
from diffdrrdata.ljubljana import LjubljanaDataset, Transforms

# Load a subject from the LjubljanaDataset
ljubljana = LjubljanaDataset(id_number=1)
gt, pose, focal_len, height, width, delx, dely, x0, y0 = ljubljana[0]

# Initialize the DRR module
subsample = 8
drr = DRR(
    ljubljana.subject,
    focal_len,
    height // subsample,
    delx * subsample,
    width // subsample,
    dely * subsample,
    x0=x0,
    y0=y0,
)
transform = Transforms(height // subsample, width // subsample)

# Render a DRR from the ground truth camera pose
img = drr(pose)
gt, img = transform(gt), transform(img)
plot_drr(torch.concat([gt, img, gt - img]), title=["Downsampled X-ray", "DRR", "Difference"])
plt.show()

Metadata

Release files for diffdrrdata 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for diffdrrdata 0.0.7
File Size Uploaded
diffdrrdata-0.0.7.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diffdrrdata 0.0.7
File Interpreter ABI Platform
diffdrrdata-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / diffdrrdata-0.0.7.tar.gz

Download URL diffdrrdata-0.0.7.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c86ba2eae194eaf8c6afc8a08235cd8de615fc50cb997fa67000f2aadaab2f0e
BLAKE2b-256 checksum
How to use checksums
ac34f2ab1a023344140aaae825d14828fbc54da631962be29fa998ed1768139b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / diffdrrdata-0.0.7-py3-none-any.whl

Download URL diffdrrdata-0.0.7-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43d74936baee081d23cfd6a719c6ecb85429a3b66dbe3e2ab5659fecd1190dc7
BLAKE2b-256 checksum
How to use checksums
a93c23b362887d02bc14ff959ad164b86e0cba23afde19b6a1389fc0e508ae3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page