Skip to content

Voxel driven projector - #18

Merged
nHackel merged 2 commits into
mainfrom
nh/voxeldriven
Nov 15, 2026
Merged

nHackel merged 2 commits into
mainfrom
nh/voxeldriven

Conversation

@nHackel

@nHackel nHackel commented Nov 11, 2026

Copy link
Copy Markdown
Member

Voxel-driven projector

Adds VoxelDrivenProjector, a fourth projector next to Siddon, Joseph and distance driven. It
works voxel by voxel: in every view the voxel center is projected onto the detector and the voxel
contributes to the 2 x 2 nearest cells, with bilinear interpolation weights. This is the method that
De Man & Basu (2004) and Miao (2013) call pixel driven and Zhuang et al. (1994) bilinear
interpolation; FDK implementations usually back project this way, which is the next step (FDK
with FFTL.jl).

What's in it

  • Projector (src/operators/voxeldriven/): one thread per voxel within the bounding box of the
    image mask, loop over the views. The back projection gathers (no atomics, deterministic), the
    forward projection scatters with atomic additions. Forward and back projection use the same
    weights, so the adjoint is exact. Image masks and ray masks are supported; MultiRay and
    RayList are rejected with an ArgumentError, since the method needs a detector.
  • Injectable scale: the weights are scaled per voxel and view by an AbstractVoxelScale
    (voxel_scale(scale, geometry, k, grid, hit), runs in the kernels).
    • LineIntegralScale (default): V (R/r)^2 / (a cos phi), so that the forward projection
      approximates the mean of the line integrals over a cell, like distance driven. 2D images use
      the fan-beam form with the cell width. The derivation (a change of variables) is ours; De Man &
      Basu name the factors but give no formula. It is written out on the docs page.
    • UnitScale: the plain interpolation weights.
  • Geometry: project_point(g, p, k) -> DetectorHit, the inverse of cell_ray, for ConeBeam,
    ArcConeBeam and ParallelBeam. It returns the detector position, magnification, row spacing
    and projection density. It is public, not exported.
  • Normal operator: no fused version (one thread per voxel); normalOperator returns the
    generic one.

Accuracy (measured)

  • Compared with distance driven: 2.7–7% relative difference for cells of at least one voxel, totals
    within 0.2%. With cells of half a voxel the difference is 23%, the known high-frequency artifact
    of the method when cells are smaller than the projected voxels.
  • Uniform disk, one parallel-beam view (shown on the docs page): 3.7 / 1.2 / 0.08 / 0.7% relative
    difference from distance driven for cells of 0.25 / 0.5 / 1 / 2 pixels.

Tests

  • New test/operators/voxeldriven.jl: operator contract, the mass of a single voxel, a ball
    compared with distance driven, 2D, UnitScale.
  • New test item "project_point": inverse of cell_ray, density against a finite-difference
    Jacobian.
  • The voxel-driven projector is added to the masks, device, launch, precision, LinearOperators,
    LinearOperatorCollection and Sinograms tests. The precision test bounds the error of atomic
    additions into Float16/BFloat16 data by the number of additions per cell (new Projections
    test snippet).
  • CPU: everything passes except 7 BFloat16 errors that also occur on main (Julia 1.13.3
    Core.BFloat16 with KernelAbstractions 0.10.4 on POCL: "unsupported use of bfloat value").
    This PR does not change them.
  • JLArrays: 1348/1348 pass. Aqua passes.
  • Not run on a GPU yet.

Docs

  • New explanation page Voxel-Driven Method: interactive figure of one pixel in a fan beam, the
    two factors of the weights, the derivation of the scale, a custom scale example, the disk check
    of small cells, coverage, properties, references.
  • System Matrix: voxel-driven row in the table, a new static figure of the pieces of a ray per
    principal axis; the interactive principal-axis figure shows only its left panel, so the page no
    longer hangs.
  • Comparing Projectors, README, index, API page and navigation list the new projector.

🤖 Generated with Claude Code

nHackel and others added 2 commits November 11, 2026 21:04
VoxelDrivenProjector projects each voxel center onto the detector and spreads it over the 2 x 2
nearest cells by bilinear interpolation (one thread per voxel, loop over the views); the back
projection gathers with the same weights, so it is the exact adjoint and needs no atomics. The
per-view scale of the weights is injectable (AbstractVoxelScale, voxel_scale); the default
LineIntegralScale makes the forward projection approximate the mean of the line integrals over each
cell, UnitScale keeps the plain interpolation weights.

Geometry: project_point(g, p, k) -> DetectorHit, the inverse of cell_ray, for ConeBeam, ArcConeBeam
and ParallelBeam, with magnification and projection density.

Tests: the projector (contract, mass of a voxel, comparison with distance driven, 2D, unit scale),
project_point (inverse of cell_ray, density against a finite-difference Jacobian), and the voxel-
driven projector in the masks, device, launch, precision and extension tests. The precision test
bounds the error of atomic additions in Float16/BFloat16 data by the number of additions per cell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New explanation page Voxel-Driven Method: an interactive figure of one pixel in a fan beam, the two
factors of the weights, the derivation of the line-integral scale (marked as ours, citing the weight
factors named by De Man & Basu 2004), the 2D form, a custom scale, a uniform-disk check of small
cells after Miao (2013), coverage, properties and references.

System Matrix: voxel-driven row in the table and a static figure of the pieces of a ray per
principal axis; the interactive principal-axis figure shows only its left panel, which keeps the
page responsive. Comparing Projectors, README, index, API page and navigation list the new
projector. Reviewed by two cold review agents; their findings are applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.30556% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.66%. Comparing base (9935b66) to head (7aad314).

Files with missing lines Patch % Lines
src/operators/voxeldriven/voxeldriven.jl 97.05% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #18      +/-   ##
==========================================
+ Coverage   97.39%   97.66%   +0.26%     
==========================================
  Files          26       28       +2     
  Lines         882     1026     +144     
==========================================
+ Hits          859     1002     +143     
- Misses         23       24       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nHackel
nHackel merged commit 7aad314 into main Nov 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant