Repository navigation
feat: add invert option for N5 and zarr v2 sources - #37
Merged
Merged
Conversation
Adds an invert config key and --invert CLI flag that bitwise-invert voxel data before writing. The --optimize_reads and --invert flags now default to None, so a value from the config file is not overridden when the flag is not given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
save_chunk skips all-zero source chunks before it inverts, so with invert on those chunks read back as 0 instead of np.invert(0). Set the output fill_value to np.invert(0) when invert is on: skipped chunks then read as the inverted value, and empty regions are still not written. zarr3_spec gets a fill_value parameter for this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yuriyzubov
force-pushed
the
feat/invert
branch
from
October 28, 2026 19:49
d2b043a to
bbbe401
Compare
yuriyzubov
force-pushed
the
feat/blosc-options
branch
from
October 28, 2026 19:49
020dc66 to
498d76f
Compare
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.
Adds an option to bitwise-invert voxel data for N5 and zarr v2 sources.
Changes
invert(defaultfalse) and CLI flag--invert.N5Group.write_to_zarrandZarr2Group.write_to_zarrpassinverttosave_chunk. Before, N5 always usedinvert=False.invertis on, the outputfill_valueisnp.invert(0)(255 for uint8).save_chunkskips all-zero source chunks, and these chunks now read as the inverted value. Without this, they stayed 0 while zeros in other chunks became 255. Empty regions are still not written to disk.zarr3_spechas a newfill_valueparameter for this.--optimize_readsand--invertnow default toNone. The CLI dropsNonevalues before it merges the config, so a value in the config file is no longer overridden by the flag's defaultFalse.Tests:
tests/test_invert.pychecks invert on and off for zarr v2 and N5, an all-zero chunk with invert on, and that the CLI flags do not override config values when they are not given.Stack: 4 of 5. Base: #36.
🤖 Generated with Claude Code