Commit 2801600
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 with non-square sCMOS images.
Issue #37 - Scalar Calibration:
When CameraType='SCMOS' with scalar gain/offset/readnoise and empty
CalibrationFilePath, the code failed because 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 dimensions after permutation,
causing failures with ANY non-square sCMOS data (429×244, etc.), even
with proper 2D calibration arrays. This was hidden when using square
images (256×256) where transpose doesn't change dimensions.
Changes:
- FindROI.m constructor (lines 86-104): For sCMOS with scalar
calibration, expand scalars to 2D variance image matching Data
dimensions. THIS IS THE ONLY PLACE SCALARS NEED EXPANSION.
- FindROI.gauss_sCMOS (lines 366-368): Fix output array dimensions
after permutation by allocating to match PermutedStack size, not
original Stack size.
- SingleMoleculeFitting.m: Update documentation to clarify sCMOS
supports both pixel-wise arrays and scalars (auto-expanded).
Why convertToPhotons doesn't need changes:
MATLAB handles scalar division correctly - the else branch at line 118
already works fine for scalars. Expansion is ONLY needed for sCMOS
variance image (Varim) used by CUDA kernels.
Testing:
- Non-square sCMOS with scalars: ✓ Works (429×244 verified)
- Non-square sCMOS with 2D arrays: ✓ Works (was broken, now fixed)
- Square sCMOS: ✓ Works (backward compatible)
- DataToPhotons unit tests: ✓ All pass (5/5)
Fixes #37 + non-square sCMOS bug
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 7bef54a commit 2801600
2 files changed
Lines changed: 30 additions & 9 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 | | |
| |||
344 | 362 | | |
345 | 363 | | |
346 | 364 | | |
347 | | - | |
348 | | - | |
349 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
350 | 370 | | |
351 | 371 | | |
352 | 372 | | |
| |||
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