Skip to content

Add compose() for image layer compositing - #17

Merged
kalidke merged 2 commits into
mainfrom
feature/compose-blending
Mar 10, 2026
Merged

kalidke merged 2 commits into
mainfrom
feature/compose-blending

Conversation

@kalidke

@kalidke kalidke commented Mar 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds compose(images...; blend=:additive) utility for compositing pre-rendered images
  • Two blend modes: :additive (sum, clamp) and :replace (later non-black pixels overwrite)
  • Decouples compositing from rendering — enables mixed-strategy overlays (e.g., Gaussian background + Circle overlay)
  • Motivated by BaGoL use case: gray localizations + red BaGoL emitters where additive blending washes out the overlay

Usage

(bg, _) = render(locs, strategy=GaussianRender(), color=:gray, zoom=20)
(fg, _) = render(bagol, strategy=CircleRender(), color=:red, zoom=20)
combined = compose(bg, fg, blend=:replace)

Changes

  • src/utils.jl — compose() implementation (varargs + Vector forms)
  • src/SMLMRender.jl — export compose
  • test/runtests.jl — tests for both blend modes, dimension mismatch, invalid mode
  • api_overview.md, docs/src/api.md, docs/src/examples.md — documentation

Test plan

  • All 80 tests pass
  • Additive blend sums layers and clamps
  • Replace blend overwrites non-black pixels, preserves black
  • Vector and varargs forms produce identical results
  • Assertion errors for dimension mismatch and invalid blend mode

🤖 Generated with Claude Code

kalidke and others added 2 commits March 6, 2026 13:43
Standalone utility that composites pre-rendered images, decoupling
compositing from rendering. Supports :additive (sum) and :replace
(later non-black pixels overwrite) blend modes. Enables mixed-strategy
overlays (e.g., Gaussian background + Circle overlay).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kalidke
kalidke force-pushed the feature/compose-blending branch from 8bb30fb to efb044a Compare March 6, 2026 20:43
@kalidke
kalidke merged commit f3eb8f9 into main Mar 10, 2026
4 checks passed
@kalidke
kalidke deleted the feature/compose-blending branch March 10, 2026 19:15
@kalidke kalidke mentioned this pull request Mar 10, 2026
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