feat(fill_holes_v2): true multi-label fill holes#10
Merged
william-silversmith merged 55 commits intomainfrom Oct 21, 2025
Merged
feat(fill_holes_v2): true multi-label fill holes#10william-silversmith merged 55 commits intomainfrom
william-silversmith merged 55 commits intomainfrom
Conversation
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.
A new implementation of fill_holes that finally treats fill_holes as a multi-label problem, accelerating hole filling one to two orders of magnitude. The problem this is attempting to solve is performing hole filling on an 813^3 u64 image could take multiple hours (doing it on a 513^2 image could take minutes to ~20 minutes). This new implementation can perform hole filling in seconds to about a minute.
One difference is that this implementation always returns an array of filled and holes whereas the original version would return filled and possible a fill count and a set of hole labels in the interests of memory efficiency. However, with the advent of crackle compressed arrays, concerns about memory usage can be dispensed with.
v2 also supports
fix_borderslike v1. Where v1 hasmorphological_closingwhich applies a dilation then an erosion after hole filling, which can change the contours of labels, v2 has amerge_thresholdbetween 0.0 to 1.0. Themerge_thresholdis the necessary ratio of the contact surface of a label over all contact surfaces to assign a parent label. 1.0 = only one parent is acceptable (same as standard hole filling). Asmerge_thresholddecreases from 1, holes that poke just through the surface (e.g. an organelle that brushes against the plasma membrane) can be merged into the parent label. This strategy has the advantage of not altering the shape of the base labels as well as being faster.The fill_holes_v2 interface is different, so to preserve backwards compatibility, we'll keep both for now with
fill_holesandfill_holes_v1aliases of each other.