diff-fvr 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- diff_fvr-1.0.0/PKG-INFO +137 -0
- diff_fvr-1.0.0/README.md +114 -0
- diff_fvr-1.0.0/pyproject.toml +46 -0
- diff_fvr-1.0.0/setup.cfg +4 -0
- diff_fvr-1.0.0/src/diff_fvr.egg-info/PKG-INFO +137 -0
- diff_fvr-1.0.0/src/diff_fvr.egg-info/SOURCES.txt +25 -0
- diff_fvr-1.0.0/src/diff_fvr.egg-info/dependency_links.txt +1 -0
- diff_fvr-1.0.0/src/diff_fvr.egg-info/entry_points.txt +3 -0
- diff_fvr-1.0.0/src/diff_fvr.egg-info/requires.txt +8 -0
- diff_fvr-1.0.0/src/diff_fvr.egg-info/top_level.txt +1 -0
- diff_fvr-1.0.0/src/fvr/__init__.py +35 -0
- diff_fvr-1.0.0/src/fvr/articulated_spine.py +163 -0
- diff_fvr-1.0.0/src/fvr/cli.py +160 -0
- diff_fvr-1.0.0/src/fvr/core_engine.py +189 -0
- diff_fvr-1.0.0/src/fvr/dicom_loader.py +165 -0
- diff_fvr-1.0.0/src/fvr/diff_fvr.py +194 -0
- diff_fvr-1.0.0/src/fvr/fvr_engine.py +147 -0
- diff_fvr-1.0.0/src/fvr/gradient_optimizer.py +90 -0
- diff_fvr-1.0.0/src/fvr/gradients.py +135 -0
- diff_fvr-1.0.0/src/fvr/raycasting_drr.py +80 -0
- diff_fvr-1.0.0/src/fvr/registration_3d2d.py +161 -0
- diff_fvr-1.0.0/src/fvr/robust_registration.py +134 -0
- diff_fvr-1.0.0/src/fvr/rotation_2d.py +69 -0
- diff_fvr-1.0.0/tests/test_core_engine.py +81 -0
- diff_fvr-1.0.0/tests/test_gradient_numerical.py +61 -0
- diff_fvr-1.0.0/tests/test_gradient_optimizer.py +56 -0
- diff_fvr-1.0.0/tests/test_robust_engine.py +59 -0
diff_fvr-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: diff-fvr
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Dual-Domain Differentiable Fourier Volume Rendering for Ultra-Fast Biplanar 3D-2D Spine Registration
|
|
5
|
+
Author-email: Pareel Amre <pareel.amre@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: digitally-reconstructed-radiographs,fourier-volume-rendering,3d-2d-registration,spine-surgery,medical-imaging,image-guided-interventions
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: numpy>=1.24.0
|
|
16
|
+
Requires-Dist: scipy>=1.10.0
|
|
17
|
+
Requires-Dist: pandas>=2.0.0
|
|
18
|
+
Requires-Dist: matplotlib>=3.7.0
|
|
19
|
+
Requires-Dist: pillow>=9.5.0
|
|
20
|
+
Requires-Dist: pydicom>=2.4.0
|
|
21
|
+
Requires-Dist: simpleitk>=2.2.0
|
|
22
|
+
Requires-Dist: scikit-image>=0.20.0
|
|
23
|
+
|
|
24
|
+
# Dual-Domain Differentiable Fourier Volume Rendering (Diff-FVR) for Real-Time Biplanar 3Dโ2D Spine Registration
|
|
25
|
+
|
|
26
|
+
[](https://github.com/pareelamre/diff-fvr/actions/workflows/ci.yml)
|
|
27
|
+
[](https://pareelamre.github.io/diff-fvr/)
|
|
28
|
+
[](https://pareelamre.github.io/diff-fvr/)
|
|
29
|
+
[](LICENSE)
|
|
30
|
+
[](https://www.python.org/)
|
|
31
|
+
|
|
32
|
+
**Author:** Pareel Amre
|
|
33
|
+
**Affiliation:** Faculty of Computer Science, Technische Universitรคt Dresden (TU Dresden), 01062 Dresden, Germany
|
|
34
|
+
**Email:** `pareel.amre@gmail.com`
|
|
35
|
+
**Target Venue:** *IEEE Transactions on Medical Imaging* / *Medical Image Analysis*
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## ๐ฌ Scientific Overview
|
|
40
|
+
|
|
41
|
+
Intensity-based 3Dโ2D registration between pre-operative volumetric Computed Tomography (pCT) and intra-operative 2D fluoroscopy is essential for computer-assisted spine surgery (e.g. pedicle screw navigation). However, conventional ray-casting DRR synthesis scales cubically ($\mathcal{O}(N^3)$), requiring $> 1.0\text{ s}$ per projection on CPU.
|
|
42
|
+
|
|
43
|
+
**Diff-FVR** formulates Digitally Reconstructed Radiographs (DRRs) via the **continuous Fourier Projection-Slice Theorem**, reducing rendering complexity to $\mathcal{O}(N^2)$ frequency slice extraction:
|
|
44
|
+
|
|
45
|
+
$$
|
|
46
|
+
\mathcal{F}_{2D}\{\mathcal{P}[f(x,y,z)]\} = \mathcal{S}_{2D}\{\mathcal{F}_{3D}[f(x,y,z)]\}
|
|
47
|
+
$$
|
|
48
|
+
|
|
49
|
+
1. **Mathematical Anti-Aliasing:** Enforces $2\times$ spatial zero-padding bound ($Z_p = 2.0 \ge \sqrt{3}$) and $\text{sinc}^2$ spatial pre-multiplication to eliminate boundary wrap-around and peripheral roll-off.
|
|
50
|
+
2. **Exact 1:1 Scale Preservation:** Implements full-bandwidth frequency slicing to preserve physical anatomical scale.
|
|
51
|
+
3. **Normalized Spectral Cross-Correlation (Spectral-NCC):** Computes similarity directly in 2D Fourier space via Parseval's identity ($< 1.0\text{ ms}$ per pose) with **zero inverse Fourier transforms** inside the optimization loop.
|
|
52
|
+
4. **Articulated Multi-Vertebra Kinematics:** Models inter-vertebral flexion (L3โL4โL5) on surgical tables using Fourier linearity:
|
|
53
|
+
$$
|
|
54
|
+
\mathcal{F}\left\{\sum_i I_i\right\} = \sum_i S_i(\mathbf{k}, \mathbf{T}_i)
|
|
55
|
+
$$
|
|
56
|
+
5. **Robustness to Physical Failure Limits:** Automatic radio-opaque metal hardware saturation masking + Masked Spatial Loss (achieving $0.000\text{ mm}$ error under $30\%$ occlusion) and isocenter geometric calibration ($1/\text{mag} = \text{SAD}/\text{SDD}$).
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## ๐ Comprehensive Experimental Suite (23 Benchmarks)
|
|
61
|
+
|
|
62
|
+
| Experiment | Title | Key Quantitative Finding |
|
|
63
|
+
| :--- | :--- | :--- |
|
|
64
|
+
| **Exp 1** | O(Nยฒ) vs O(Nยณ) Asymptotic Complexity | **11.5ร to 72.5ร speedup** over spatial raycasting (1.38 ms DRR). |
|
|
65
|
+
| **Exp 2** | Rotational Invariance (72 Angles) | PSNR = 23.96 dB, SSIM = 0.9329, NCC = 0.9943 ยฑ 0.0007. |
|
|
66
|
+
| **Exp 3** | Zero-Padding & Sincยฒ Premultiplication | 2ร padding eliminates high-frequency wrap-around; roll-off removed. |
|
|
67
|
+
| **Exp 4** | Spectral-NCC 50-Trial Benchmark | 0.84 mm mTRE (98.0% success < 2.0 mm) in 1.82 s (212ร per-pose acceleration). |
|
|
68
|
+
| **Exp 5** | Energy Landscape & Capture Range | Smooth, strictly convex basin over ยฑ25ยฐ / ยฑ25 mm displacement. |
|
|
69
|
+
| **Exp 6** | Biplanar vs. Monoplanar 6-DoF | Depth error ฮtx reduced from 3.59 mm down to **0.03 ยฑ 0.04 mm**. |
|
|
70
|
+
| **Exp 7** | Real Hospital Patient DICOM CT Series | **mTRE = 0.020 mm** (Clean), **0.031 mm** (Low-Dose); 100% success. |
|
|
71
|
+
| **Exp 8** | Capture Basin Sensitivity Bounds | 100% success at ยฑ5ยฐ / ยฑ5 mm; 90% at ยฑ16ยฐ / ยฑ16 mm. |
|
|
72
|
+
| **Exp 9** | Cone-Beam Perspective Divergence | Identified 1.4ร magnification distortion; isocenter calibration cuts error by 89%. |
|
|
73
|
+
| **Exp 10** | Surgical Metal Hardware Occlusion | Automatic saturation threshold + Masked Spatial Loss drops error from 49.15 mm to 0.000 mm. |
|
|
74
|
+
| **Exp 11** | Radiation Exposure Starvation Sweep | Sub-0.05 mm mTRE maintained across 6 orders of magnitude (10โถ down to 10ยณ ph/px). |
|
|
75
|
+
| **Exp 12** | Multi-Center Kaggle Lumbar CT Cohort | **mTRE = 1.341 mm** (Clean), **1.351 mm** (Low-Dose); 85.0% success. |
|
|
76
|
+
| **Exp 13** | Multi-Center AMOS Cohort (NCT Dresden) | **mTRE = 1.118 mm** (Clean), **1.121 mm** (Low-Dose); 90.0% success. |
|
|
77
|
+
| **Exp 14** | Resolved Failure Limits Verification | Unit tests confirm 0.000 mm precision under 30% metal occlusion. |
|
|
78
|
+
| **Exp 15** | Articulated Multi-Vertebra Kinematics | Hierarchical L3-L4-L5 model recovers base pose (0.767 mm) and in-vivo flexion (ฮloss = โ54.7%). |
|
|
79
|
+
| **Exp 16** | Unified Multi-Center CED Benchmark | Standardized linear and logarithmic CED curves across all 3 independent cohorts. |
|
|
80
|
+
| **Exp 17** | Detector FOV Truncation & Clipping | 2D Tukey cosine tapering preserves 0.75 mm mTRE up to 30% clipping. |
|
|
81
|
+
| **Exp 18** | Non-Orthogonal C-Arm Angulations | Sub-millimeter (0.021โ0.055 mm) down to ฮฯ = 30ยฐ safe operating angle. |
|
|
82
|
+
| **Exp 19** | Polychromatic Beam Hardening & Soft Tissue | High-Pass Spectral-NCC achieves 100% sub-mm (0.028โ0.358 mm) across all tiers. |
|
|
83
|
+
| **Exp 20** | Intraoperative Respiratory Motion Blur | Phase invariance preserves sub-millimeter tracking across 0โ5 mm breathing smear. |
|
|
84
|
+
| **Exp 21** | Preoperative CT Anisotropic Slice Thickness | Biplanar decoupling preserves sub-millimeter precision (0.0008 mm) on 5.0 mm trauma slices. |
|
|
85
|
+
| **Exp 22** | Dynamic Streaming Fluoroscopy Tracking | Real-time video tracking across 60 frames with warm-start analytical gradients. |
|
|
86
|
+
| **Exp 23** | Joint Articulation + Metal Implants | Base mTRE 0.776 mm, cuts residual loss by 48.2%, recovers in-vivo flexion angles. |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## ๐ฎ Interactive Surgical Registration Cockpit
|
|
91
|
+
|
|
92
|
+
An interactive in-browser simulator demonstrating real-time 6-DoF biplanar registration, pedicle screw metal saturation, and physical breakdown regimes is live:
|
|
93
|
+
|
|
94
|
+
๐ **[Launch Interactive Cockpit](https://pareelamre.github.io/diff-fvr/)**
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## ๐ Installation & CLI Quick Start
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Install package in editable mode
|
|
102
|
+
pip install -e .
|
|
103
|
+
|
|
104
|
+
# 1. Synthesize a fast 2D DRR from 3D CT:
|
|
105
|
+
fvr-render --ct data/dicom --yaw 15.0 --pitch -5.0 --view ap --res 96 --out drr_ap.png
|
|
106
|
+
|
|
107
|
+
# 2. Run biplanar 6-DoF spine registration:
|
|
108
|
+
fvr-register --ct data/dicom --ap data/ap_xray.png --lat data/lat_xray.png --handle-metal --out pose_result.json
|
|
109
|
+
|
|
110
|
+
# 3. Run production integration test suite:
|
|
111
|
+
python tests/test_core_engine.py
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## ๐ Repository Structure
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
fft-drr-project/
|
|
120
|
+
โโโ data/
|
|
121
|
+
โ โโโ dicom/ # Real clinical hospital patient CT DICOM series
|
|
122
|
+
โ โโโ kaggle_lumbar/ # Multi-center Kaggle lumbar spine CT
|
|
123
|
+
โ โโโ amos/ # AMOS multi-organ abdominal CT cohort (NCT Dresden)
|
|
124
|
+
โโโ docs/ # GitHub Pages interactive surgical cockpit simulator
|
|
125
|
+
โโโ src/fvr/
|
|
126
|
+
โ โโโ core_engine.py # Production engine (calibration, metal masking, bounded search)
|
|
127
|
+
โ โโโ diff_fvr.py # Core Differentiable Fourier Volume Renderer
|
|
128
|
+
โ โโโ articulated_spine.py # Multi-body kinematic chain (L3-L4-L5)
|
|
129
|
+
โ โโโ gradients.py # Closed-form analytical Fourier phase & spectral gradients
|
|
130
|
+
โ โโโ robust_registration.py # Masked spatial loss engine
|
|
131
|
+
โ โโโ dicom_loader.py # DICOM series loader & Hounsfield-to-attenuation converter
|
|
132
|
+
โโโ experiments/ # Complete 23 benchmark experiment scripts
|
|
133
|
+
โโโ outputs/paper_figures/ # High-resolution 300 DPI publication figures & CSV tables
|
|
134
|
+
โโโ tests/ # Verification and regression test suite
|
|
135
|
+
โโโ main.tex # IEEE Transactions on Medical Imaging manuscript
|
|
136
|
+
โโโ paper_manuscript.md # Comprehensive audited research report
|
|
137
|
+
```
|
diff_fvr-1.0.0/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Dual-Domain Differentiable Fourier Volume Rendering (Diff-FVR) for Real-Time Biplanar 3Dโ2D Spine Registration
|
|
2
|
+
|
|
3
|
+
[](https://github.com/pareelamre/diff-fvr/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pareelamre.github.io/diff-fvr/)
|
|
5
|
+
[](https://pareelamre.github.io/diff-fvr/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.python.org/)
|
|
8
|
+
|
|
9
|
+
**Author:** Pareel Amre
|
|
10
|
+
**Affiliation:** Faculty of Computer Science, Technische Universitรคt Dresden (TU Dresden), 01062 Dresden, Germany
|
|
11
|
+
**Email:** `pareel.amre@gmail.com`
|
|
12
|
+
**Target Venue:** *IEEE Transactions on Medical Imaging* / *Medical Image Analysis*
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## ๐ฌ Scientific Overview
|
|
17
|
+
|
|
18
|
+
Intensity-based 3Dโ2D registration between pre-operative volumetric Computed Tomography (pCT) and intra-operative 2D fluoroscopy is essential for computer-assisted spine surgery (e.g. pedicle screw navigation). However, conventional ray-casting DRR synthesis scales cubically ($\mathcal{O}(N^3)$), requiring $> 1.0\text{ s}$ per projection on CPU.
|
|
19
|
+
|
|
20
|
+
**Diff-FVR** formulates Digitally Reconstructed Radiographs (DRRs) via the **continuous Fourier Projection-Slice Theorem**, reducing rendering complexity to $\mathcal{O}(N^2)$ frequency slice extraction:
|
|
21
|
+
|
|
22
|
+
$$
|
|
23
|
+
\mathcal{F}_{2D}\{\mathcal{P}[f(x,y,z)]\} = \mathcal{S}_{2D}\{\mathcal{F}_{3D}[f(x,y,z)]\}
|
|
24
|
+
$$
|
|
25
|
+
|
|
26
|
+
1. **Mathematical Anti-Aliasing:** Enforces $2\times$ spatial zero-padding bound ($Z_p = 2.0 \ge \sqrt{3}$) and $\text{sinc}^2$ spatial pre-multiplication to eliminate boundary wrap-around and peripheral roll-off.
|
|
27
|
+
2. **Exact 1:1 Scale Preservation:** Implements full-bandwidth frequency slicing to preserve physical anatomical scale.
|
|
28
|
+
3. **Normalized Spectral Cross-Correlation (Spectral-NCC):** Computes similarity directly in 2D Fourier space via Parseval's identity ($< 1.0\text{ ms}$ per pose) with **zero inverse Fourier transforms** inside the optimization loop.
|
|
29
|
+
4. **Articulated Multi-Vertebra Kinematics:** Models inter-vertebral flexion (L3โL4โL5) on surgical tables using Fourier linearity:
|
|
30
|
+
$$
|
|
31
|
+
\mathcal{F}\left\{\sum_i I_i\right\} = \sum_i S_i(\mathbf{k}, \mathbf{T}_i)
|
|
32
|
+
$$
|
|
33
|
+
5. **Robustness to Physical Failure Limits:** Automatic radio-opaque metal hardware saturation masking + Masked Spatial Loss (achieving $0.000\text{ mm}$ error under $30\%$ occlusion) and isocenter geometric calibration ($1/\text{mag} = \text{SAD}/\text{SDD}$).
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## ๐ Comprehensive Experimental Suite (23 Benchmarks)
|
|
38
|
+
|
|
39
|
+
| Experiment | Title | Key Quantitative Finding |
|
|
40
|
+
| :--- | :--- | :--- |
|
|
41
|
+
| **Exp 1** | O(Nยฒ) vs O(Nยณ) Asymptotic Complexity | **11.5ร to 72.5ร speedup** over spatial raycasting (1.38 ms DRR). |
|
|
42
|
+
| **Exp 2** | Rotational Invariance (72 Angles) | PSNR = 23.96 dB, SSIM = 0.9329, NCC = 0.9943 ยฑ 0.0007. |
|
|
43
|
+
| **Exp 3** | Zero-Padding & Sincยฒ Premultiplication | 2ร padding eliminates high-frequency wrap-around; roll-off removed. |
|
|
44
|
+
| **Exp 4** | Spectral-NCC 50-Trial Benchmark | 0.84 mm mTRE (98.0% success < 2.0 mm) in 1.82 s (212ร per-pose acceleration). |
|
|
45
|
+
| **Exp 5** | Energy Landscape & Capture Range | Smooth, strictly convex basin over ยฑ25ยฐ / ยฑ25 mm displacement. |
|
|
46
|
+
| **Exp 6** | Biplanar vs. Monoplanar 6-DoF | Depth error ฮtx reduced from 3.59 mm down to **0.03 ยฑ 0.04 mm**. |
|
|
47
|
+
| **Exp 7** | Real Hospital Patient DICOM CT Series | **mTRE = 0.020 mm** (Clean), **0.031 mm** (Low-Dose); 100% success. |
|
|
48
|
+
| **Exp 8** | Capture Basin Sensitivity Bounds | 100% success at ยฑ5ยฐ / ยฑ5 mm; 90% at ยฑ16ยฐ / ยฑ16 mm. |
|
|
49
|
+
| **Exp 9** | Cone-Beam Perspective Divergence | Identified 1.4ร magnification distortion; isocenter calibration cuts error by 89%. |
|
|
50
|
+
| **Exp 10** | Surgical Metal Hardware Occlusion | Automatic saturation threshold + Masked Spatial Loss drops error from 49.15 mm to 0.000 mm. |
|
|
51
|
+
| **Exp 11** | Radiation Exposure Starvation Sweep | Sub-0.05 mm mTRE maintained across 6 orders of magnitude (10โถ down to 10ยณ ph/px). |
|
|
52
|
+
| **Exp 12** | Multi-Center Kaggle Lumbar CT Cohort | **mTRE = 1.341 mm** (Clean), **1.351 mm** (Low-Dose); 85.0% success. |
|
|
53
|
+
| **Exp 13** | Multi-Center AMOS Cohort (NCT Dresden) | **mTRE = 1.118 mm** (Clean), **1.121 mm** (Low-Dose); 90.0% success. |
|
|
54
|
+
| **Exp 14** | Resolved Failure Limits Verification | Unit tests confirm 0.000 mm precision under 30% metal occlusion. |
|
|
55
|
+
| **Exp 15** | Articulated Multi-Vertebra Kinematics | Hierarchical L3-L4-L5 model recovers base pose (0.767 mm) and in-vivo flexion (ฮloss = โ54.7%). |
|
|
56
|
+
| **Exp 16** | Unified Multi-Center CED Benchmark | Standardized linear and logarithmic CED curves across all 3 independent cohorts. |
|
|
57
|
+
| **Exp 17** | Detector FOV Truncation & Clipping | 2D Tukey cosine tapering preserves 0.75 mm mTRE up to 30% clipping. |
|
|
58
|
+
| **Exp 18** | Non-Orthogonal C-Arm Angulations | Sub-millimeter (0.021โ0.055 mm) down to ฮฯ = 30ยฐ safe operating angle. |
|
|
59
|
+
| **Exp 19** | Polychromatic Beam Hardening & Soft Tissue | High-Pass Spectral-NCC achieves 100% sub-mm (0.028โ0.358 mm) across all tiers. |
|
|
60
|
+
| **Exp 20** | Intraoperative Respiratory Motion Blur | Phase invariance preserves sub-millimeter tracking across 0โ5 mm breathing smear. |
|
|
61
|
+
| **Exp 21** | Preoperative CT Anisotropic Slice Thickness | Biplanar decoupling preserves sub-millimeter precision (0.0008 mm) on 5.0 mm trauma slices. |
|
|
62
|
+
| **Exp 22** | Dynamic Streaming Fluoroscopy Tracking | Real-time video tracking across 60 frames with warm-start analytical gradients. |
|
|
63
|
+
| **Exp 23** | Joint Articulation + Metal Implants | Base mTRE 0.776 mm, cuts residual loss by 48.2%, recovers in-vivo flexion angles. |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## ๐ฎ Interactive Surgical Registration Cockpit
|
|
68
|
+
|
|
69
|
+
An interactive in-browser simulator demonstrating real-time 6-DoF biplanar registration, pedicle screw metal saturation, and physical breakdown regimes is live:
|
|
70
|
+
|
|
71
|
+
๐ **[Launch Interactive Cockpit](https://pareelamre.github.io/diff-fvr/)**
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## ๐ Installation & CLI Quick Start
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Install package in editable mode
|
|
79
|
+
pip install -e .
|
|
80
|
+
|
|
81
|
+
# 1. Synthesize a fast 2D DRR from 3D CT:
|
|
82
|
+
fvr-render --ct data/dicom --yaw 15.0 --pitch -5.0 --view ap --res 96 --out drr_ap.png
|
|
83
|
+
|
|
84
|
+
# 2. Run biplanar 6-DoF spine registration:
|
|
85
|
+
fvr-register --ct data/dicom --ap data/ap_xray.png --lat data/lat_xray.png --handle-metal --out pose_result.json
|
|
86
|
+
|
|
87
|
+
# 3. Run production integration test suite:
|
|
88
|
+
python tests/test_core_engine.py
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## ๐ Repository Structure
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
fft-drr-project/
|
|
97
|
+
โโโ data/
|
|
98
|
+
โ โโโ dicom/ # Real clinical hospital patient CT DICOM series
|
|
99
|
+
โ โโโ kaggle_lumbar/ # Multi-center Kaggle lumbar spine CT
|
|
100
|
+
โ โโโ amos/ # AMOS multi-organ abdominal CT cohort (NCT Dresden)
|
|
101
|
+
โโโ docs/ # GitHub Pages interactive surgical cockpit simulator
|
|
102
|
+
โโโ src/fvr/
|
|
103
|
+
โ โโโ core_engine.py # Production engine (calibration, metal masking, bounded search)
|
|
104
|
+
โ โโโ diff_fvr.py # Core Differentiable Fourier Volume Renderer
|
|
105
|
+
โ โโโ articulated_spine.py # Multi-body kinematic chain (L3-L4-L5)
|
|
106
|
+
โ โโโ gradients.py # Closed-form analytical Fourier phase & spectral gradients
|
|
107
|
+
โ โโโ robust_registration.py # Masked spatial loss engine
|
|
108
|
+
โ โโโ dicom_loader.py # DICOM series loader & Hounsfield-to-attenuation converter
|
|
109
|
+
โโโ experiments/ # Complete 23 benchmark experiment scripts
|
|
110
|
+
โโโ outputs/paper_figures/ # High-resolution 300 DPI publication figures & CSV tables
|
|
111
|
+
โโโ tests/ # Verification and regression test suite
|
|
112
|
+
โโโ main.tex # IEEE Transactions on Medical Imaging manuscript
|
|
113
|
+
โโโ paper_manuscript.md # Comprehensive audited research report
|
|
114
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "diff-fvr"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Dual-Domain Differentiable Fourier Volume Rendering for Ultra-Fast Biplanar 3D-2D Spine Registration"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Pareel Amre", email = "pareel.amre@gmail.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"digitally-reconstructed-radiographs",
|
|
17
|
+
"fourier-volume-rendering",
|
|
18
|
+
"3d-2d-registration",
|
|
19
|
+
"spine-surgery",
|
|
20
|
+
"medical-imaging",
|
|
21
|
+
"image-guided-interventions"
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 5 - Production/Stable",
|
|
25
|
+
"Intended Audience :: Science/Research",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"License :: OSI Approved :: MIT License"
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"numpy>=1.24.0",
|
|
32
|
+
"scipy>=1.10.0",
|
|
33
|
+
"pandas>=2.0.0",
|
|
34
|
+
"matplotlib>=3.7.0",
|
|
35
|
+
"pillow>=9.5.0",
|
|
36
|
+
"pydicom>=2.4.0",
|
|
37
|
+
"simpleitk>=2.2.0",
|
|
38
|
+
"scikit-image>=0.20.0"
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
fvr-render = "fvr.cli:main_render"
|
|
43
|
+
fvr-register = "fvr.cli:main_register"
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
where = ["src"]
|
diff_fvr-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: diff-fvr
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Dual-Domain Differentiable Fourier Volume Rendering for Ultra-Fast Biplanar 3D-2D Spine Registration
|
|
5
|
+
Author-email: Pareel Amre <pareel.amre@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: digitally-reconstructed-radiographs,fourier-volume-rendering,3d-2d-registration,spine-surgery,medical-imaging,image-guided-interventions
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: numpy>=1.24.0
|
|
16
|
+
Requires-Dist: scipy>=1.10.0
|
|
17
|
+
Requires-Dist: pandas>=2.0.0
|
|
18
|
+
Requires-Dist: matplotlib>=3.7.0
|
|
19
|
+
Requires-Dist: pillow>=9.5.0
|
|
20
|
+
Requires-Dist: pydicom>=2.4.0
|
|
21
|
+
Requires-Dist: simpleitk>=2.2.0
|
|
22
|
+
Requires-Dist: scikit-image>=0.20.0
|
|
23
|
+
|
|
24
|
+
# Dual-Domain Differentiable Fourier Volume Rendering (Diff-FVR) for Real-Time Biplanar 3Dโ2D Spine Registration
|
|
25
|
+
|
|
26
|
+
[](https://github.com/pareelamre/diff-fvr/actions/workflows/ci.yml)
|
|
27
|
+
[](https://pareelamre.github.io/diff-fvr/)
|
|
28
|
+
[](https://pareelamre.github.io/diff-fvr/)
|
|
29
|
+
[](LICENSE)
|
|
30
|
+
[](https://www.python.org/)
|
|
31
|
+
|
|
32
|
+
**Author:** Pareel Amre
|
|
33
|
+
**Affiliation:** Faculty of Computer Science, Technische Universitรคt Dresden (TU Dresden), 01062 Dresden, Germany
|
|
34
|
+
**Email:** `pareel.amre@gmail.com`
|
|
35
|
+
**Target Venue:** *IEEE Transactions on Medical Imaging* / *Medical Image Analysis*
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## ๐ฌ Scientific Overview
|
|
40
|
+
|
|
41
|
+
Intensity-based 3Dโ2D registration between pre-operative volumetric Computed Tomography (pCT) and intra-operative 2D fluoroscopy is essential for computer-assisted spine surgery (e.g. pedicle screw navigation). However, conventional ray-casting DRR synthesis scales cubically ($\mathcal{O}(N^3)$), requiring $> 1.0\text{ s}$ per projection on CPU.
|
|
42
|
+
|
|
43
|
+
**Diff-FVR** formulates Digitally Reconstructed Radiographs (DRRs) via the **continuous Fourier Projection-Slice Theorem**, reducing rendering complexity to $\mathcal{O}(N^2)$ frequency slice extraction:
|
|
44
|
+
|
|
45
|
+
$$
|
|
46
|
+
\mathcal{F}_{2D}\{\mathcal{P}[f(x,y,z)]\} = \mathcal{S}_{2D}\{\mathcal{F}_{3D}[f(x,y,z)]\}
|
|
47
|
+
$$
|
|
48
|
+
|
|
49
|
+
1. **Mathematical Anti-Aliasing:** Enforces $2\times$ spatial zero-padding bound ($Z_p = 2.0 \ge \sqrt{3}$) and $\text{sinc}^2$ spatial pre-multiplication to eliminate boundary wrap-around and peripheral roll-off.
|
|
50
|
+
2. **Exact 1:1 Scale Preservation:** Implements full-bandwidth frequency slicing to preserve physical anatomical scale.
|
|
51
|
+
3. **Normalized Spectral Cross-Correlation (Spectral-NCC):** Computes similarity directly in 2D Fourier space via Parseval's identity ($< 1.0\text{ ms}$ per pose) with **zero inverse Fourier transforms** inside the optimization loop.
|
|
52
|
+
4. **Articulated Multi-Vertebra Kinematics:** Models inter-vertebral flexion (L3โL4โL5) on surgical tables using Fourier linearity:
|
|
53
|
+
$$
|
|
54
|
+
\mathcal{F}\left\{\sum_i I_i\right\} = \sum_i S_i(\mathbf{k}, \mathbf{T}_i)
|
|
55
|
+
$$
|
|
56
|
+
5. **Robustness to Physical Failure Limits:** Automatic radio-opaque metal hardware saturation masking + Masked Spatial Loss (achieving $0.000\text{ mm}$ error under $30\%$ occlusion) and isocenter geometric calibration ($1/\text{mag} = \text{SAD}/\text{SDD}$).
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## ๐ Comprehensive Experimental Suite (23 Benchmarks)
|
|
61
|
+
|
|
62
|
+
| Experiment | Title | Key Quantitative Finding |
|
|
63
|
+
| :--- | :--- | :--- |
|
|
64
|
+
| **Exp 1** | O(Nยฒ) vs O(Nยณ) Asymptotic Complexity | **11.5ร to 72.5ร speedup** over spatial raycasting (1.38 ms DRR). |
|
|
65
|
+
| **Exp 2** | Rotational Invariance (72 Angles) | PSNR = 23.96 dB, SSIM = 0.9329, NCC = 0.9943 ยฑ 0.0007. |
|
|
66
|
+
| **Exp 3** | Zero-Padding & Sincยฒ Premultiplication | 2ร padding eliminates high-frequency wrap-around; roll-off removed. |
|
|
67
|
+
| **Exp 4** | Spectral-NCC 50-Trial Benchmark | 0.84 mm mTRE (98.0% success < 2.0 mm) in 1.82 s (212ร per-pose acceleration). |
|
|
68
|
+
| **Exp 5** | Energy Landscape & Capture Range | Smooth, strictly convex basin over ยฑ25ยฐ / ยฑ25 mm displacement. |
|
|
69
|
+
| **Exp 6** | Biplanar vs. Monoplanar 6-DoF | Depth error ฮtx reduced from 3.59 mm down to **0.03 ยฑ 0.04 mm**. |
|
|
70
|
+
| **Exp 7** | Real Hospital Patient DICOM CT Series | **mTRE = 0.020 mm** (Clean), **0.031 mm** (Low-Dose); 100% success. |
|
|
71
|
+
| **Exp 8** | Capture Basin Sensitivity Bounds | 100% success at ยฑ5ยฐ / ยฑ5 mm; 90% at ยฑ16ยฐ / ยฑ16 mm. |
|
|
72
|
+
| **Exp 9** | Cone-Beam Perspective Divergence | Identified 1.4ร magnification distortion; isocenter calibration cuts error by 89%. |
|
|
73
|
+
| **Exp 10** | Surgical Metal Hardware Occlusion | Automatic saturation threshold + Masked Spatial Loss drops error from 49.15 mm to 0.000 mm. |
|
|
74
|
+
| **Exp 11** | Radiation Exposure Starvation Sweep | Sub-0.05 mm mTRE maintained across 6 orders of magnitude (10โถ down to 10ยณ ph/px). |
|
|
75
|
+
| **Exp 12** | Multi-Center Kaggle Lumbar CT Cohort | **mTRE = 1.341 mm** (Clean), **1.351 mm** (Low-Dose); 85.0% success. |
|
|
76
|
+
| **Exp 13** | Multi-Center AMOS Cohort (NCT Dresden) | **mTRE = 1.118 mm** (Clean), **1.121 mm** (Low-Dose); 90.0% success. |
|
|
77
|
+
| **Exp 14** | Resolved Failure Limits Verification | Unit tests confirm 0.000 mm precision under 30% metal occlusion. |
|
|
78
|
+
| **Exp 15** | Articulated Multi-Vertebra Kinematics | Hierarchical L3-L4-L5 model recovers base pose (0.767 mm) and in-vivo flexion (ฮloss = โ54.7%). |
|
|
79
|
+
| **Exp 16** | Unified Multi-Center CED Benchmark | Standardized linear and logarithmic CED curves across all 3 independent cohorts. |
|
|
80
|
+
| **Exp 17** | Detector FOV Truncation & Clipping | 2D Tukey cosine tapering preserves 0.75 mm mTRE up to 30% clipping. |
|
|
81
|
+
| **Exp 18** | Non-Orthogonal C-Arm Angulations | Sub-millimeter (0.021โ0.055 mm) down to ฮฯ = 30ยฐ safe operating angle. |
|
|
82
|
+
| **Exp 19** | Polychromatic Beam Hardening & Soft Tissue | High-Pass Spectral-NCC achieves 100% sub-mm (0.028โ0.358 mm) across all tiers. |
|
|
83
|
+
| **Exp 20** | Intraoperative Respiratory Motion Blur | Phase invariance preserves sub-millimeter tracking across 0โ5 mm breathing smear. |
|
|
84
|
+
| **Exp 21** | Preoperative CT Anisotropic Slice Thickness | Biplanar decoupling preserves sub-millimeter precision (0.0008 mm) on 5.0 mm trauma slices. |
|
|
85
|
+
| **Exp 22** | Dynamic Streaming Fluoroscopy Tracking | Real-time video tracking across 60 frames with warm-start analytical gradients. |
|
|
86
|
+
| **Exp 23** | Joint Articulation + Metal Implants | Base mTRE 0.776 mm, cuts residual loss by 48.2%, recovers in-vivo flexion angles. |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## ๐ฎ Interactive Surgical Registration Cockpit
|
|
91
|
+
|
|
92
|
+
An interactive in-browser simulator demonstrating real-time 6-DoF biplanar registration, pedicle screw metal saturation, and physical breakdown regimes is live:
|
|
93
|
+
|
|
94
|
+
๐ **[Launch Interactive Cockpit](https://pareelamre.github.io/diff-fvr/)**
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## ๐ Installation & CLI Quick Start
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Install package in editable mode
|
|
102
|
+
pip install -e .
|
|
103
|
+
|
|
104
|
+
# 1. Synthesize a fast 2D DRR from 3D CT:
|
|
105
|
+
fvr-render --ct data/dicom --yaw 15.0 --pitch -5.0 --view ap --res 96 --out drr_ap.png
|
|
106
|
+
|
|
107
|
+
# 2. Run biplanar 6-DoF spine registration:
|
|
108
|
+
fvr-register --ct data/dicom --ap data/ap_xray.png --lat data/lat_xray.png --handle-metal --out pose_result.json
|
|
109
|
+
|
|
110
|
+
# 3. Run production integration test suite:
|
|
111
|
+
python tests/test_core_engine.py
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## ๐ Repository Structure
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
fft-drr-project/
|
|
120
|
+
โโโ data/
|
|
121
|
+
โ โโโ dicom/ # Real clinical hospital patient CT DICOM series
|
|
122
|
+
โ โโโ kaggle_lumbar/ # Multi-center Kaggle lumbar spine CT
|
|
123
|
+
โ โโโ amos/ # AMOS multi-organ abdominal CT cohort (NCT Dresden)
|
|
124
|
+
โโโ docs/ # GitHub Pages interactive surgical cockpit simulator
|
|
125
|
+
โโโ src/fvr/
|
|
126
|
+
โ โโโ core_engine.py # Production engine (calibration, metal masking, bounded search)
|
|
127
|
+
โ โโโ diff_fvr.py # Core Differentiable Fourier Volume Renderer
|
|
128
|
+
โ โโโ articulated_spine.py # Multi-body kinematic chain (L3-L4-L5)
|
|
129
|
+
โ โโโ gradients.py # Closed-form analytical Fourier phase & spectral gradients
|
|
130
|
+
โ โโโ robust_registration.py # Masked spatial loss engine
|
|
131
|
+
โ โโโ dicom_loader.py # DICOM series loader & Hounsfield-to-attenuation converter
|
|
132
|
+
โโโ experiments/ # Complete 23 benchmark experiment scripts
|
|
133
|
+
โโโ outputs/paper_figures/ # High-resolution 300 DPI publication figures & CSV tables
|
|
134
|
+
โโโ tests/ # Verification and regression test suite
|
|
135
|
+
โโโ main.tex # IEEE Transactions on Medical Imaging manuscript
|
|
136
|
+
โโโ paper_manuscript.md # Comprehensive audited research report
|
|
137
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/diff_fvr.egg-info/PKG-INFO
|
|
4
|
+
src/diff_fvr.egg-info/SOURCES.txt
|
|
5
|
+
src/diff_fvr.egg-info/dependency_links.txt
|
|
6
|
+
src/diff_fvr.egg-info/entry_points.txt
|
|
7
|
+
src/diff_fvr.egg-info/requires.txt
|
|
8
|
+
src/diff_fvr.egg-info/top_level.txt
|
|
9
|
+
src/fvr/__init__.py
|
|
10
|
+
src/fvr/articulated_spine.py
|
|
11
|
+
src/fvr/cli.py
|
|
12
|
+
src/fvr/core_engine.py
|
|
13
|
+
src/fvr/dicom_loader.py
|
|
14
|
+
src/fvr/diff_fvr.py
|
|
15
|
+
src/fvr/fvr_engine.py
|
|
16
|
+
src/fvr/gradient_optimizer.py
|
|
17
|
+
src/fvr/gradients.py
|
|
18
|
+
src/fvr/raycasting_drr.py
|
|
19
|
+
src/fvr/registration_3d2d.py
|
|
20
|
+
src/fvr/robust_registration.py
|
|
21
|
+
src/fvr/rotation_2d.py
|
|
22
|
+
tests/test_core_engine.py
|
|
23
|
+
tests/test_gradient_numerical.py
|
|
24
|
+
tests/test_gradient_optimizer.py
|
|
25
|
+
tests/test_robust_engine.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fvr
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Diff-FVR: Differentiable Fourier Volume Rendering for 3D-2D Registration.
|
|
3
|
+
Author: Pareel Amre, TU Dresden
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .fvr_engine import FourierVolumeRenderer
|
|
7
|
+
from .diff_fvr import DifferentiableFourierVolumeRenderer
|
|
8
|
+
from .core_engine import RobustDiffFVREngine, detect_radio_opaque_metal
|
|
9
|
+
from .gradients import SpectralGradientEngine
|
|
10
|
+
from .articulated_spine import ArticulatedSpineModel, VertebralSegment
|
|
11
|
+
from .raycasting_drr import raycast_drr
|
|
12
|
+
from .rotation_2d import rotate_2d_fft
|
|
13
|
+
from .dicom_loader import load_dicom_series, create_spine_phantom, hu_to_attenuation
|
|
14
|
+
from .registration_3d2d import compute_mtre_6dof
|
|
15
|
+
from .cli import main_render, main_register
|
|
16
|
+
|
|
17
|
+
__version__ = "1.0.0"
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"FourierVolumeRenderer",
|
|
21
|
+
"DifferentiableFourierVolumeRenderer",
|
|
22
|
+
"RobustDiffFVREngine",
|
|
23
|
+
"detect_radio_opaque_metal",
|
|
24
|
+
"SpectralGradientEngine",
|
|
25
|
+
"ArticulatedSpineModel",
|
|
26
|
+
"VertebralSegment",
|
|
27
|
+
"raycast_drr",
|
|
28
|
+
"rotate_2d_fft",
|
|
29
|
+
"load_dicom_series",
|
|
30
|
+
"create_spine_phantom",
|
|
31
|
+
"hu_to_attenuation",
|
|
32
|
+
"compute_mtre_6dof",
|
|
33
|
+
"main_render",
|
|
34
|
+
"main_register"
|
|
35
|
+
]
|