Skip to content

Evidlo/tomosphero

Repository files navigation

TomoSphero

A differentiable 3D/4D volumetric tomographic projector in spherical coordinates.

Check the tutorial for instruction on using this library or examples for complete samples demonstrating forward raytracing and retrieval.

Features

TomoSphero was originally created for tomographic retrieval of planetary atmospheres, but is designed to work for any problem defined on a spherical grid. Some of its features are

  • 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
  • retrieval framework for easily defining loss functions and parametric models (currently supports only static 3D volumes)

Note that TomoSphero is a volumetric raytracer (i.e. not occlusions, shading, etc.).

Installation and Quickstart

# optional: pre-install appropriate PyTorch for your system (defaults to CUDA version)
# https://pytorch.org/get-started/locally/

pip install tomosphero[extras]
git clone https://github.com/evidlo/tomosphero && cd tomosphero
python examples/single_vantage.py

python examples/static_retrieval.py

python examples/dynamic_measurements.py

Memory Usage

This library uses only PyTorch array operations for implementation simplicity and speed at the expense of memory consumption. The peak memory usage in GB can be approximated with examples/memory_usage.py

$ python examples/memory_usage.py

--- Parameters ---

(50, 50, 50) object
50 observations, 1 channels, (50, 100) sensor

--- Memory Usage ---

Ray coordinates memory: 4.25 GB
Object memory: 0.05 GB

Architecture

Below is a list of modules in this package and their purpose:

Forward Raytracing

  • raytracer.py - computation of voxel indices for intersecting rays, raytracing Operator
  • geometry.py - viewing geometry (detector) definitions, spherical grid definition

Retrieval

  • model.py - parameterized models for representing an object. used in retrieval
  • loss.py - some loss functions to be used in retrieval
  • retrieval.py - retrieval algorithms
  • plotting.py - functions for plotting stacks of images, retrieval losses

Running Tests

pytest tomosphero

See Also

tomosipo, which inspired parts of this library's interface.

About

A fast differentiable raytracer in spherical coordinates

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors