API Reference#

High-level Projector#

Projector

Project floating tensors along parallel, fan, cone, or parallel3d trajectories.

Projector takes trajectory tensors as described in Trajectories and Geometry. For multiple GPUs and nodes, see Multiple GPUs and Nodes. Each operation also accepts trajectory=... to replace the full trajectory for that call, preserving its view count and the constructor default.

detector_surface defines native pixel positions for both projection and matched backprojection. See Parameterized detector surfaces for its coordinate and shape contract, and Examples for a runnable cylindrical detector.

Native CPU data uses streamed CUDA execution; backend="torch" computes on its PyTorch device. precision selects fast FP32 or strict FP32/FP64. Leading batch/channel axes and per-axis voxel spacing are supported; see Precision, training and reconstruction. volume_chunk_shape, view_chunk_size and detector_chunk_shape specify optional limits; schedule allows operation-specific comparisons. partition="space" assigns rank-local volume slabs. See Large Volumes and Chunked Execution for memory, storage, geometry and autograd requirements, and Multiple GPUs and Nodes for ownership.

Complete Reconstruction Pipelines#

fbp

Differentiable parallel/fan FBP for fixed flat-detector geometry.

fdk

Differentiable flat-detector FDK; fixed geometry, approximate inversion.

fbp_into

Numerical streamed FBP into caller tensor/file storage; return output.

fdk_into

Numerical streamed FDK into caller tensor/file storage; return output.

helical_fdk

Approximate axial helical FDK with one complete angular turn per slice.

helical_view_weights

Return (slices,views) weights for complete slice-centered turns.

helical_weighted_backproject

Gather filtered cone data using replaceable (D,views) weights.

Numerical Solvers#

cgls

CGLS with a total iteration target, including resumed iterations.

sirt

Row/column-normalized SIRT, with optional nonnegative iterates.

tv_reconstruction

Adam on half the global mean squared data error plus physical mean TV.

cgls_into

CGLS into caller storage with mapped state and bounded block operations.

total_variation

Isotropic TV over every voxel, with physical forward differences.

Geometry Helpers#

3D trajectories

circular_trajectory_3d

Generate circular trajectory geometry for cone-beam CT.

circular_trajectory_3d_parallel

Lift the 2D parallel orbit into XY, with a vertical detector v axis.

random_trajectory_3d

Generate random trajectory geometry for cone-beam CT.

spiral_trajectory_3d

Generate spiral (helical) trajectory geometry for cone-beam CT.

sinusoidal_trajectory_3d

Generate sinusoidal trajectory geometry for cone-beam CT.

saddle_trajectory_3d

Generate saddle-shaped trajectory geometry for cone-beam CT.

custom_trajectory_3d

Generate custom trajectory geometry for cone-beam CT using user-defined function.

2D trajectories

circular_trajectory_2d_parallel

Generate circular trajectory geometry for 2D parallel-beam CT.

sinusoidal_trajectory_2d_parallel

Generate sinusoidal trajectory geometry for 2D parallel-beam CT.

custom_trajectory_2d_parallel

Generate custom trajectory geometry for 2D parallel-beam CT using user-defined functions.

circular_trajectory_2d_fan

Generate circular trajectory geometry for 2D fan-beam CT.

sinusoidal_trajectory_2d_fan

Generate sinusoidal trajectory geometry for 2D fan-beam CT.

custom_trajectory_2d_fan

Generate custom trajectory geometry for 2D fan-beam CT using user-defined function.

Rigid transforms

transform_trajectory

Apply p' = R p + t to points and d' = R d to directions.

Block stores and batched surfaces#

TensorStore

NpyStore

ParameterizedSurface

Sample local detector offsets from global CPU pixel/view coordinates.

project_into and backproject_into use caller-owned numerical outputs. ParameterizedSurface exposes mutable geometry as explicit tensor parameters and samples bounded global view/pixel rectangles. Legacy two-argument surface callbacks remain available. See Parameterized detector surfaces.

Analytical Reconstruction Helpers#

These helpers build the pre-weights, angular weights, filter and weighted backprojection of an analytical FBP or FDK pipeline. The weighted backprojection helpers support sinogram autograd with dedicated transpose kernels, including higher derivatives. They use fixed geometry and reject geometry/isocenter gradients. The returned images are already scaled. See Differentiable analytical reconstruction for complete APIs and learnable filter/weight examples.

Analytical FBP and FDK assume a flat detector and an acquisition model. These helpers do not accept detector_surface. Native curved data must be resampled along matching rays onto a covered virtual flat detector before using these flat-detector helpers; resampling adds interpolation error. The native Projector forward/adjoint pair needs no such conversion. A non-circular trajectory does not make the result exact. The helpers accept the same per-view (src_pos, det_center, det_u[, det_v]) arrays as Projector.

Fan and cone backprojection accept a keyword-only isocenter vector in physical units. With None (default), it is estimated from the detector normals. Give it explicitly for non-circular or ambiguous geometry, including a single view. The three weighted backprojection helpers need at least two detector bins along each interpolated axis, including the cone detector’s v axis.

detector_coordinates_1d

Return detector cell centre coordinates along a 1D axis.

angular_integration_weights

Trapezoidal per-view integration weights for the analytical FBP/FDK sum.

fan_cosine_weights

Per-detector-cell cos(gamma) weight for fan-beam FBP.

cone_cosine_weights

Per-detector-cell cos(gamma_cone) weight for cone-beam FDK.

parker_weights

Parker redundancy weights for a circular fan-beam short scan.

ramp_filter_1d

Apply a finite discrete Ram-Lak filter along dim using FFT.

parallel_weighted_backproject

Voxel-driven parallel-beam FBP backprojection with analytical constant.

fan_weighted_backproject

Voxel-driven fan-beam FBP backprojection with analytical constant.

cone_weighted_backproject

Voxel-driven cone-beam FDK backprojection with analytical constant.

Ramp Filter Options#

ramp_filter_1d is the filter used by the analytical examples. Its signature is:

ramp_filter_1d(sinogram_tensor, dim=-1, sample_spacing=1.0,
               pad_factor=1, window=None, use_rfft=True)
sample_spacing

Physical detector-cell spacing along dim, for example du for cone beam. The output is in physical units. Pass 1.0 to work in sample units.

pad_factor

Zero-pads the signal to pad_factor * N samples along dim. Use 2 for cone-beam FDK. Use 4 when objects lie close to the detector edge.

use_rfft

Uses the real FFT for real inputs. Set False only to force the complex FFT path.

The window argument selects a window applied to the Ram-Lak ramp:

window

Effect

None or "ram-lak"

No window. Sharpest, with the most noise.

"cosine"

Half-cosine roll-off.

"shepp-logan"

Sinc roll-off. Classical choice.

"hamming"

Milder than Hann.

"hann" or "hanning"

Strongest high-frequency suppression.

Low-level Functions#

These autograd.Function wrappers take explicit trajectory tensors. Use the forward signature as the argument order for .apply(...). For new code, prefer Projector, which checks inputs and manages devices.

ParallelProjectorFunction

Summary PyTorch autograd function for differentiable 2D parallel beam forward projection.

ParallelBackprojectorFunction

Summary PyTorch autograd function for differentiable 2D parallel beam backprojection.

FanProjectorFunction

Summary PyTorch autograd function for differentiable 2D fan beam forward projection.

FanBackprojectorFunction

Summary PyTorch autograd function for differentiable 2D fan beam backprojection.

ConeProjectorFunction

Summary PyTorch autograd function for differentiable 3D cone beam forward projection.

ConeBackprojectorFunction

Summary PyTorch autograd function for differentiable 3D cone beam backprojection.