Skip to content

Nh/masks - #10

Merged
nHackel merged 6 commits into
mainfrom
nh/masks
Nov 2, 2026
Merged

nHackel merged 6 commits into
mainfrom
nh/masks

Conversation

@nHackel

@nHackel nHackel commented Nov 2, 2026

Copy link
Copy Markdown
Member

Adds masks to the projectors: an image mask (the voxels that are reconstructed) and a ray mask (the rays whose data are used).

image = ImageGeom(MaskCircle(); dims=(256, 256, 256), deltas=(1.0, 1.0, 1.0))
op = JosephProjector(image, geometry; raymask)   # raymask[u, v, view], true = used
  • Generic layer: mul! applies the masks around forward! and backward! (src/operators/masks.jl). Every AbstractCTOperator therefore gets these semantics. A subtype of AbstractProjector from another package gets the image mask of its ImageGeom without any changes.
  • Siddon and Joseph:
    • They skip masked rays in their kernels; the trait handles_raymask tells the generic layer not to multiply by the ray mask again.
    • They clip every ray to the bounding box of the image mask (VoxelGrid fields lo/hi); Joseph widens the box by half a voxel for its interpolation.
  • Storage: masks are Bool arrays on the operator's device, whatever its element type. A raymask from any device, of the data size or as a vector, is copied there.
  • subset and adapt: subset(op, views) keeps the views' part of the ray mask, and adapt moves both masks. A projector that stores a ray mask accepts raymask in similar_projector.
  • Exports: MaskCircle, MaskEllipse and MaskAllButEdge are re-exported from ImageGeoms.

nHackel and others added 6 commits November 2, 2026 18:05
bench.jl --device N runs the GPU libraries on the N-th GPU (KernelAbstractions' device! for
CTOperators, CuPy for parallelproj), e.g. a free one on a shared machine. The guide "Run on a GPU"
explains selecting the GPU before creating a projector.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tune_launch.jl times a projector on one GPU (CUDA or ROCm, device selectable) for workgroup sizes
and tiles of detector cells, the device's defaults first, and lists the fastest configurations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new explanation page builds a scan up from one ray to a helical cone-beam scan and introduces
the parameters of the trajectory functions where they appear (angles, dso, dsd, nu, nv, du, dv,
pitch, z0), with a figure per step. Getting Started lists the parameters and links to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kernel and launch comments keep the reasons and invariants; how they were found and the measured
numbers are left to the commit log and benchmark/README.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Projectors apply M_rays A M_image and its exact adjoint. The generic layer applies the masks
around forward!/backward!, so every operator gets these semantics; Siddon and Joseph skip masked
rays in their kernels (trait handles_raymask) and clip rays to the bounding box of the image mask
(VoxelGrid lo/hi). subset and adapt keep the masks. Re-exports the mask types of ImageGeoms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
How-to "Use Masks" (circular field of view, defective detector cells, region of interest) and
explanation "Masks" (semantics, adjointness, where masks save time, masks for other operators),
a section on masks in the implementation guide, and GPU timings with masks in the benchmark
README. The navigation collapses to the first level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nHackel
nHackel merged commit e068fa2 into main Nov 2, 2026
4 checks passed
@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.30%. Comparing base (38c5ad8) to head (927fa79).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/image/voxelgrid.jl 80.00% 3 Missing ⚠️
src/operators/masks.jl 89.28% 3 Missing ⚠️
src/operators/joseph/joseph.jl 85.71% 1 Missing ⚠️
src/operators/siddon/siddon.jl 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
- Coverage   98.15%   96.30%   -1.85%     
==========================================
  Files          18       19       +1     
  Lines         489      542      +53     
==========================================
+ Hits          480      522      +42     
- Misses          9       20      +11     

☔ 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.

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