Fix BlobDetector round/channel assignment when is_volume=False#2160
Merged
shachafl merged 3 commits intocopilot/fix-blobdetector-resultsfrom Nov 24, 2025
Merged
Conversation
Co-authored-by: shachafl <[email protected]>
Co-authored-by: shachafl <[email protected]>
Copilot
AI
changed the title
[WIP] Fix incorrect rounds and channels in blobdetector results
Fix BlobDetector round/channel assignment when is_volume=False
Nov 24, 2025
shachafl
approved these changes
Nov 24, 2025
shachafl
added a commit
that referenced
this pull request
Nov 24, 2025
…across dimensionalities (#2154) * Fix BlobDetector 2D indexing bug causing incorrect y-values and radius * Squeeze singleton z-dimension before blob detection for consistency When data_image has shape (1, y, x), squeeze it to (y, x) before calling blob_log to ensure consistent results. This prevents blob_log from treating singleton z-dimensions as 3D, which produces slightly different detection results compared to true 2D images. After detection, restore the original shape for consistent intensity indexing. * Refactor singleton z-dimension handling for clarity Use separate variable data_image_for_detection to make it clearer that the squeezed data is only used for blob detection, while the original data_image is used for intensity extraction. This should make debugging easier and the code more maintainable. * Fix anisotropic sigma detection logic using data dimensionality Changed from using fitted_blobs_array.shape[1] to check data_image_for_detection.ndim to determine if 2D or 3D blob detection was performed. This correctly handles: - 3D with scalar sigma: (n, 4) = [z, y, x, sigma] - 2D with anisotropic sigma: (n, 4) = [y, x, sigma_y, sigma_x] - 3D with anisotropic sigma: (n, 6) = [z, y, x, sigma_z, sigma_y, sigma_x] For anisotropic sigma, radius is computed as average of sigma values. * Fix BlobDetector round/channel assignment when is_volume=False (#2160) --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: shachafl <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
BlobDetectorruns withis_volume=Falseand no reference image, spots are assigned to incorrect (round, channel) pairs. With 2 rounds and 3 channels, a spot at R0C1 gets assigned to R1C0 instead.Root cause: The code sorted merged
(round, ch)keys lexicographically then paired them by index with selectors from_iter_axes({ROUND, CH}). Since_iter_axes()iterates in channel-major order(c=0,r=0), (c=0,r=1), (c=1,r=0)...whilesorted()produces round-major order(r=0,c=0), (r=0,c=1), (r=1,c=0)..., the pairing mismatches.Changes:
_iter_axes({ROUND, CH})and look up each(r, ch)in the merged tables instead of sorting keysis_volume=True/FalseOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.