Skip to content

3 detection filter upgrades - #4

Merged
jhohlbein merged 7 commits into
mainfrom
3-detection-filter-upgrades
Jul 27, 2026
Merged

3 detection filter upgrades#4
jhohlbein merged 7 commits into
mainfrom
3-detection-filter-upgrades

Conversation

@kjamartens

Copy link
Copy Markdown
Contributor

See issue #3

kjamartens and others added 6 commits July 27, 2026 12:15
Upon changes in fit/detection method, or upon changing the raw frame, detection/fit is run for this frame and displayed to the user.
Fit radius now dictates the detection-green-boxes in live preview
Scroll wheel now scrubs through data, ctrl+scroll wheel zooms.
Scroll wheel also works on the slider below.
Tested on windows+firefox
Threshold (k·sigma_noise) and Exact band-pass were shared across the
Wavelet and DoG filters even though they don't mean the same thing (or
apply at all) for each. Give each method its own field
(detection_wavelet_thr / detection_DoG_thr / detection_DoG_exactbp),
show only the relevant row for the selected filter, and thread the
rename through settings save/load and live-preview wiring. Prep work
for adding the Uniform Box Filter detection method.

Refs #3

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implements the box-averaging detection from Huang, Schwartz, Byars &
Lidke (2011): difference of two box filters sized off sigma_PSF,
thresholded on plain intensity rather than k*sigma, with local maxima
found via a sigma_PSF-sized square dilation instead of the fixed 3x3
window wave/dog use. detectSpots() is now the single dispatch point
(main thread + worker) picking band-pass + maxima-finder per method.

The dilation's sliding-max (maxH/maxV) initially recreated a closure
per row/column and used modulo in the hot loop, making box detection
much slower than DoG; rewrote it closure-free with persistent scratch
buffers, bringing it in line with DoG's per-frame cost.

Also documents the live-preview mechanism (showFrame/detectSpots reuse
for the real-time scrub preview) in CLAUDE.md.

Refs #3

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kjamartens kjamartens linked an issue Jul 27, 2026 that may be closed by this pull request
@kjamartens

Copy link
Copy Markdown
Contributor Author

Changed scroll and ctrl-scroll behavior as requested by JH

@jhohlbein jhohlbein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the full diff, syntax-checked the branch, numerically validated the new detection path, and checked for regressions. Solid, merge-ready.

Verified

  • Box-filter math is correct: boxH/boxV normalise (nm=1/(2r+1)), so uniformBP is a true difference of box means — strongly positive at spots, ~0 at background.
  • The deque dilation (maxH/maxV) is exact: matched a brute-force sliding-window max with 0 mismatches; findMaximaUniform found precisely the planted spot.
  • Worker gotcha handled: new state in WORKER_PRELUDE, all 8 new functions in workerSource(), and the ping self-test exercises detectSpots(...,'box',...) (so any stringification slip falls back cleanly).
  • Rename complete — no stale $('thr')/$('exactbp') references.
  • No conflict with 0.9.0: the ctrl+wheel scrub is inside if(!nav.full()), so it never fires while a histogram/profile plot owns the raw panel.
  • Full-file syntax OK; CLAUDE.md / help text / Huang 2011 reference all added well.

Minor (non-blocking) follow-ups

  1. SETTING_IDS dropped thr/exactbp, so a settings.json saved by ≤0.9.0 won't restore those two fields — consider aliasing the old keys on load.
  2. Box maxima are non-strict (filt[i]===dilation) vs. the strict > used by wavelet/DoG — theoretical plateau duplicates only (won't happen on real float data).
  3. Live preview re-detects+re-fits the whole frame on the main thread per scrub/setting change (incl. MLE); coalesced so it won't queue, but may feel heavy on dense stacks under MLE.

Approving.

@jhohlbein
jhohlbein merged commit 63eb601 into main Jul 27, 2026
jhohlbein added a commit that referenced this pull request Jul 27, 2026
…view)

Version bump + docs for the merged PR #4: adds a uniform box detection filter
(Huang et al. 2011) behind a single detectSpots() dispatch, per-method threshold
fields, a real-time scrubbed-frame preview toggle, and a raw-panel scroll rework
(wheel = zoom, ctrl+wheel = scrub). Patch release — no new DOI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jhohlbein added a commit that referenced this pull request Aug 8, 2026
…ic-aliasing note

- webSMLM.html: copyright/attribution "Johannes Hohlbein" -> "Hohlbein et al."
  (top-of-file comment, header, Help & guide License section); new
  Acknowledgements section in Help & guide crediting Koen J. A. Martens'
  verified PR #4 contributions (uniform box-filter detection, Real-time
  update toggle, wheel-zoom/ctrl+wheel-scrub scroll rework, ROI box sizing).
- experimental_data/README.md: note that FRC peaks at 40/20 nm on the
  GATTA-PAINT dataset are harmonics of the 80 nm ruler spacing, not a bug.
- README.md: fix stale button names (Run localisations -> Localize, Display
  table -> View data + filtering), same copyright change, mention the crop
  tool and temporal clustering (previously undocumented), qualify the single
  "~350k loc/s" figure as Phasor-specific and a ceiling not a typical rate.
- CLAUDE.md: correct line count (~4000 -> ~5800), drop the dead reference to
  REFACTOR_PLAN.md's removed "Shipped" table, drop the dangling reference to
  the removed Nile Red section.
- docs/REFACTOR_PLAN.md: drop the CSV-export-of-filtered-subset roadmap item
  (already shipped via renderLocs-based export), correct stale line count.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jhohlbein added a commit that referenced this pull request Aug 15, 2026
…l, FTM mobile-OOM fix

Clears the -dev marker (v0.10.2-dev · build 2026-08-15h -> v0.10.2) and
brings docs up to date for release:

- CHANGELOG.md gets the full 0.10.2 entry.
- docs/REFACTOR_PLAN.md's photon-calibration roadmap item trimmed: PCFO
  (single-image gain/offset estimation) shipped, per-pixel sCMOS
  calibration maps stays the open remainder.
- README.md gains a "What it does" bullet and reference for PCFO gain/offset
  estimation, and the ADU/gain known-limitation note now points to it.
- docs/DOCUMENTATION.md's line-reference note bumped to v0.10.2.
- In-app Help & guide: new References entry for the PCFO paper (Heintzmann,
  Relich, Nieuwenhuizen, Lidke & Rieger, arXiv:1611.05654 — verified title
  via the arXiv listing itself, not invented) and a second Acknowledgements
  line crediting Koen J. A. Martens' PR #5 contribution, alongside his
  existing PR #4 credit.
- CITATION.cff version/date-released bumped to 0.10.2 / 2026-08-15; authors
  list unchanged (Hohlbein only) — PR contributions are credited in
  Acknowledgements, not software citation authorship, matching the existing
  PR #4 precedent.

Verified end-to-end in a real browser after all doc/version edits: Simulate
-> Estimate -> Transfer estimates -> Localize (FTM on) completes cleanly,
version pill reads v0.10.2, no console/page errors.

Co-Authored-By: Koen J.A. Martens <32260034+kjamartens@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

Detection filter upgrades

2 participants