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
perf(merge): ⚡ skip chunks that hold no labels, and size occupancy blocks
The per-tile counts already say which chunks are background, so the merge
need not touch them: an empty chunk is now neither read nor written. Zarr
leaves an unwritten chunk unmaterialised and reads it back as the fill value,
so on a sparse image this saves I/O *and* disk. Likewise a boundary column
next to an empty chunk cannot produce a touching pair, so the scan skips it.
On a one-blob test image that is 1 of 16 chunks relabelled and 0 of 24
boundary columns read.
Doing that exposed why skip_empty was doing nothing on smaller images: the
occupancy block defaulted to (1, 128, 128), which on a 128x128 image is one
block spanning the whole plane, so every tile over-covered it and tested
occupied. The map was right; the resolution was useless. block_for_tile sizes
the block to a quarter of the tile, and prepare/run_multi pass it. The same
test image goes from 16/16 tiles segmented to 1/16.
Two bugs in build_occupancy_map surfaced with it. overwrite=True built the
new map and then threw it away: the guard for "a concurrent run finished
first" fired unconditionally, so the stale map was returned. And a map built
with a different block was reused forever, so changing tile_shape silently
kept the old resolution. It now rebuilds when the block differs, and an
explicit overwrite clears the old directory first.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments