A 3D/4D volume raytracer in spherical coordinates implemented in PyTorch.
Check examples/
for samples demonstrating forward raytracing and retrieval.
- 3D spherical raytracing with optional support for dynamic volume (4D)
- implemented purely in PyTorch for easy integration with PyTorch's optimization and machine learning capabilities
- support for square/circular detectors or other custom detector shapes
- optional retrieval framework for easily defining loss functions and parametric models (currently supports only static 3D volumes)
pip install -e .
python examples/single_vantage.py
python examples/static_retrieval.py
This library was uses only PyTorch array operations at the expense of memory consumption. The peak memory usage in GB can be approximated with examples/memory_usage.py
>>> %run ~/examples/memory_usage.py
--- Parameters ---
(50, 50, 50) volume
50 observations, 1 channels, (50, 100) sensor
--- Memory Usage ---
Ray coordinates memory: 4.25 GB
Density memory: 0.05 GB
Below is a list of modules in this package and their purpose:
Forward Raytracing
raytracer.py
- computation of voxel indices for intersecting rays, raytracing Operatorgeometry.py
- viewing geometry (detector) definitions, spherical grid definition
Retrieval
model.py
- parameterized models for representing a density. used in retrievalloss.py
- some loss functions to be used in retrievalretrieval.py
- retrieval algorithmsplotting.py
- functions for plotting stacks of images, retrieval losses
pytest sph_raytracer
tomosipo, which inspired parts of this library's interface.