You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
smi_core.FindROI issue: multiple ROI candidates generated for single emitter #21
The box finder uses the operation pixel==maxpixel from a maximum pixel filter. In rare cases, much more likely in noise-free model data, there can be two identical pixels. Boxes will be returned for both. We should implement a localization combiner algorithm somewhere in LocalizeData.
Verified the issue still exists in current codebase (v1.3.1), but only in noise-free simulation data.
Test Results
Test Case
Input
Output
Status
32×32 noiseless
1 emitter
2 ROIs
✗ Duplicates
16×16 noiseless
1 emitter
1 ROI
✓ Correct
3 emitters noiseless
3 emitters
6 ROIs
✗ Duplicates
32×32 with Poisson noise
1 emitter
1 ROI
✓ Correct
Root Cause Confirmed
As noted in the original comment:
"The box finder uses the operation pixel==maxpixel from a maximum pixel filter. In rare cases, much more likely in noise-free model data, there can be two identical pixels."
When simulated Gaussian blobs create perfectly symmetric intensity profiles on a discrete pixel grid, multiple pixels can have identical maximum values, causing FindROI to identify multiple candidate positions.
Why It Doesn't Affect Real Data
Real camera data always has noise (Poisson shot noise, readout noise)
Breaking symmetry: Even small noise breaks the perfect symmetry that causes identical pixel values
Test with Poisson noise passed: Single emitter → single ROI detected
Recommendation
Keep open as low-priority enhancement with labels:
enhancement - Not a critical bug
simulation - Only affects simulation workflows
good first issue - Solution is well-defined
Proposed Solutions
From original comment: "We should implement a localization combiner algorithm somewhere in LocalizeData."
Option 1: Post-processing deduplication
In LocalizeData.genLocalizations(), merge localizations within distance threshold
Check if X, Y positions are identical or within ~0.5 pixels
Keep only one, average the parameters
Option 2: FindROI-level fix
After identifying local maxima, check for duplicate positions
Remove duplicates before creating ROI boxes
More efficient but requires modifying FindROI algorithm
Option 3: Add jitter to simulations
In GaussBlobs.gaussBlobImage(), add small random offset to positions
Prevents perfect pixel symmetry in simulations
Doesn't fix root cause but prevents issue in testing
Impact Assessment
Severity: Low - doesn't affect real experimental data
Frequency: Rare - only noise-free simulations
Workaround: Add poissrnd() to simulated data
Fix effort: Medium - requires deduplication logic
The issue is real but has minimal practical impact on actual SMLM workflows.
Activity
kalidke commentedon Dec 9, 2021
The box finder uses the operation pixel==maxpixel from a maximum pixel filter. In rare cases, much more likely in noise-free model data, there can be two identical pixels. Boxes will be returned for both. We should implement a localization combiner algorithm somewhere in LocalizeData.
kalidke commentedon Nov 4, 2025
Issue Status: Still Exists (Edge Case Only)
Verified the issue still exists in current codebase (v1.3.1), but only in noise-free simulation data.
Test Results
Root Cause Confirmed
As noted in the original comment:
When simulated Gaussian blobs create perfectly symmetric intensity profiles on a discrete pixel grid, multiple pixels can have identical maximum values, causing FindROI to identify multiple candidate positions.
Why It Doesn't Affect Real Data
Recommendation
Keep open as low-priority enhancement with labels:
enhancement- Not a critical bugsimulation- Only affects simulation workflowsgood first issue- Solution is well-definedProposed Solutions
From original comment: "We should implement a localization combiner algorithm somewhere in LocalizeData."
Option 1: Post-processing deduplication
LocalizeData.genLocalizations(), merge localizations within distance thresholdOption 2: FindROI-level fix
Option 3: Add jitter to simulations
GaussBlobs.gaussBlobImage(), add small random offset to positionsImpact Assessment
poissrnd()to simulated dataThe issue is real but has minimal practical impact on actual SMLM workflows.
Fix FindROI duplicate localizations from identical pixel maxima (Issue …
kalidke commentedon Nov 4, 2025
Fix Implemented ✓
Pull request #52 has been created to fix this issue.
Solution: Post-Processing Deduplication
Implemented intelligent duplicate merging in
LocalizeDataafter GaussMLE fitting:mergeDuplicateLocalizations()genLocalizations()after coordinate transformationWhy Post-Fix?
Test Results
All 5 comprehensive tests pass:
Root Cause Confirmed
When Gaussian blob centered at integer pixel coordinates (e.g., 16.0, 16.0), creates 2×2 block of identical pixel values:
CUDA kernel tolerance (
< 1e-6) flags all four, creating 4 ROI boxes (reduced to 2 after fitting).See PR #52 for full implementation details and testing documentation.