Commit 3e63002
Fix sCMOS scalar calibration and non-square image bug (Issue #37)
Allow sCMOS cameras to use scalar calibration values for modern uniform
sensors like Orca Fusion AND fix pre-existing bug preventing non-square
sCMOS images from being processed.
Issue #37 - Scalar Calibration:
When CameraType='SCMOS' with scalar gain/offset/readnoise and empty
CalibrationFilePath, sCMOS CUDA kernels expect 2D variance images to
index into, not scalars.
Pre-existing Bug - Non-Square sCMOS Images:
The gauss_sCMOS() function had incorrect dimension handling after
permutation, causing failures with non-square sCMOS data (e.g., 429×244
gattaquant beads). Bug was hidden with square images (256×256) where
transpose doesn't change dimensions. EMCCD worked fine (different code path).
Root cause: gauss_sCMOS used out-of-place pattern but referenced original
Stack dimensions after permuting working arrays, unlike gaussInPlace which
updates Stack reference and uses current dimensions.
Changes:
- FindROI.m constructor (lines 86-104): For sCMOS with scalar calibration,
expand scalars to 2D variance image matching Data dimensions.
- FindROI.gauss_sCMOS (lines 326-377): Refactored to match gaussInPlace
pattern - use working copy and reference current dimensions after
permutation, not original Stack dimensions. This fixes non-square bug
and improves code consistency.
- SingleMoleculeFitting.m: Update documentation to clarify sCMOS supports
both pixel-wise arrays and scalars (auto-expanded).
Why different filtering algorithms?
- EMCCD: Uniform noise → fast recursive Gaussian (Young & van Vliet 1995)
- sCMOS: Pixel-varying noise → variance-weighted convolution (Huang 2013)
This algorithmic difference is necessary. Dimension handling should be
consistent - now it is.
Testing verified:
- Non-square sCMOS + 2D arrays: ✓ (was broken, now fixed)
- Non-square sCMOS + scalars: ✓ (Issue #37)
- Square sCMOS: ✓ (backward compatible)
- DataToPhotons: ✓ (scalars handled correctly)
Fixes #37
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 7bef54a commit 3e63002
2 files changed
Lines changed: 51 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
87 | 105 | | |
88 | 106 | | |
89 | 107 | | |
90 | | - | |
| 108 | + | |
91 | 109 | | |
92 | 110 | | |
93 | 111 | | |
| |||
306 | 324 | | |
307 | 325 | | |
308 | 326 | | |
309 | | - | |
310 | | - | |
| 327 | + | |
| 328 | + | |
311 | 329 | | |
312 | | - | |
313 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
314 | 333 | | |
315 | | - | |
316 | | - | |
| 334 | + | |
317 | 335 | | |
318 | 336 | | |
319 | | - | |
| 337 | + | |
320 | 338 | | |
321 | 339 | | |
322 | | - | |
| 340 | + | |
323 | 341 | | |
324 | 342 | | |
325 | 343 | | |
326 | | - | |
| 344 | + | |
327 | 345 | | |
328 | 346 | | |
329 | 347 | | |
| |||
332 | 350 | | |
333 | 351 | | |
334 | 352 | | |
335 | | - | |
336 | | - | |
337 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
338 | 357 | | |
339 | 358 | | |
340 | 359 | | |
341 | 360 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
350 | 374 | | |
351 | 375 | | |
352 | 376 | | |
| |||
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
398 | 399 | | |
399 | 400 | | |
400 | 401 | | |
| |||
0 commit comments