-
Notifications
You must be signed in to change notification settings - Fork 29
Fix flood fill tool for coarse mags #8382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The 2D flood fill tool did not work properly when flood filling in a mag other than the finest one if the "third-dimension" coordinate was not divisible by the respective mag. This resulted in early-out flood fills only filling a single voxel. Also, this commit adjusts the flood fill maximum bounding size limits if the segmentation layer's finest mag is not 1. This allows to use the flood fill tool in coarser mags if the segmentation layer is properly mag-restricted.
Warning Rate limit exceeded@daniel-wer has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 46 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe pull request updates the flood fill functionality by refining bounding box calculations. In the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx (1)
44-55
: Add safety checks for the fillMode lookup.
If a fillMode key is missing inConstants.FLOOD_FILL_EXTENTS
,maximumBoundingBoxMag1
could beundefined
. Consider adding a fallback or assertion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
frontend/javascripts/oxalis/model/bucket_data_handling/data_cube.ts
(1 hunks)frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx
(6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: circleci_build
🔇 Additional comments (5)
frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx (4)
57-93
: Bounding box logic well-structured.
This updated approach correctly clamps the bounding box volume. Ensure the maximum bounding box calculation and volume check work as expected for large-scale data.
95-128
: Verify plane slices for 2D bounding box.
When applyingnumberOfSlices
, confirm that partial slices or offsets don’t require additional clipping, especially for min/max boundaries.
130-153
: Unified bounding box parameter usage looks good.
PassingfinestSegmentationLayerMag
streamlines bounding box calculations across restricted/unrestricted modes.
212-218
: Ensure existence of a valid finest magnification.
IfmagInfo.getFinestMag()
should always return a valid vector, handle corner cases if no magnifications are loaded. Otherwise, this looks fine.frontend/javascripts/oxalis/model/bucket_data_handling/data_cube.ts (1)
700-719
: Check alignment of per-voxel bounding box with global boundaries.
Creating a bounding box in mag1 space is a solid approach for correctly handling coarse-to-fine mapping. The off-by-one formax
is consistent with an exclusive boundary, but keep an eye on partial overlaps if any dimension is fractional or if the bounding box extends beyond dataset limits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome! testing went well 👍 thanks for looking into this. I only left 💅 feedback.
frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Philipp Otto <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx (3)
44-55
: Consider renaming the function to better reflect its return type.The function returns a Vector3 representing the maximum dimensions, not an actual bounding box. A more accurate name would be
getMaximumBoundingBoxDimensionsForFloodFill
.-function getMaximumBoundingBoxForFloodFill( +function getMaximumBoundingBoxDimensionsForFloodFill( fillMode: FillMode, finestSegmentationLayerMag: Vector3, ): Vector3 {
72-77
: Improve variable naming for clarity.The variable
maxBbox
represents the maximum dimensions, not an actual bounding box. A more descriptive name would bemaxDimensions
.- const maxBbox = yield* call( + const maxDimensions = yield* call( getMaximumBoundingBoxForFloodFill, fillMode, finestSegmentationLayerMag, ); - const maxBboxVolume = Constants.FLOOD_FILL_MULTIPLIER_FOR_BBOX_RESTRICTION * V3.prod(maxBbox); + const maxBboxVolume = Constants.FLOOD_FILL_MULTIPLIER_FOR_BBOX_RESTRICTION * V3.prod(maxDimensions);
101-106
: Improve variable naming for consistency.For consistency with the previous suggestions and to better reflect its purpose, rename
maxBoundingBox
tomaxDimensions
.- const maxBoundingBox = yield* call( + const maxDimensions = yield* call( getMaximumBoundingBoxForFloodFill, fillMode, finestSegmentationLayerMag, ); - const halfBoundingBoxSize = V3.scale(maxBoundingBox, 0.5); + const halfBoundingBoxSize = V3.scale(maxDimensions, 0.5);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx
(6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: circleci_build
🔇 Additional comments (1)
frontend/javascripts/oxalis/model/sagas/volume/floodfill_saga.tsx (1)
212-218
: LGTM! The changes correctly handle coarse magnifications.The code now properly handles flood fill at different magnifications by:
- Getting the finest magnification from magInfo
- Using it to scale the bounding box appropriately
I stumbled upon an unused import and wondered why biome doesn't fail. Turns out the rule was not explicitly enabled and seems to be turned off by default 🤷 Was automatically fixable, though :) |
yes, that rule got lost in a pr which enabled import sorting. i already readded it in my dtype pr. hopefully that one gets merged soon 🙈 |
The 2D flood fill tool did not work properly when flood filling in a mag other than the finest one if the "third-dimension" coordinate was not divisible by the respective mag. This resulted in early-out flood fills only filling a single or a few voxels.
Also, this commit adjusts the flood fill maximum bounding size limits if the segmentation layer's finest mag is not 1. This allows to use the flood fill tool in coarser mags if the segmentation layer is properly mag-restricted.
URL of deployed dev instance (used for testing):
Steps to test:
Issues:
(Please delete unneeded items, merge only when none are left open)