Skip to content

Add n5_label_multiset codec for N5 legacy label multiset payload - #56

Draft
mkitti wants to merge 1 commit into
zarr-developers:mainfrom
mkitti:mkitti-n5-label-multiset
Draft

Add n5_label_multiset codec for N5 legacy label multiset payload#56
mkitti wants to merge 1 commit into
zarr-developers:mainfrom
mkitti:mkitti-n5-label-multiset

Conversation

@mkitti

@mkitti mkitti commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Note

This is a draft PR pending review of #54 (n5_varlen). The n5_label_multiset codec is designed to be used as the inner array-to-bytes codec inside n5_varlen and depends on that codec being accepted first.

Summary

Registers the n5_label_multiset codec, which serializes label_multiset arrays using the N5 legacy binary format produced by imglib2-label-multisets (LabelUtils.serializeLabelMultisetTypes()).

Codec chain

n5_label_multiset is not used standalone. It lives inside n5_varlen's inner codec pipeline:

{
  "name": "n5_varlen",
  "configuration": {
    "codecs": [
      {"name": "n5_label_multiset"},
      {"name": "gzip", "configuration": {"level": 6}}
    ]
  }
}

n5_varlen handles the N5 block header; n5_label_multiset handles the payload serialization.

N5 legacy payload format

argMaxSize             (int32 BE, always 0)
argMax[argMaxSize]     (int64 BE each — legacy; skipped on read)
listEntryOffsets[N]    (int32 BE each)
listData               (all little-endian)

Note on byte-order asymmetry: argMaxSize, argMax, and listEntryOffsets are big-endian; listData is little-endian. This is a historical artifact of the original Java implementation.

Related PRs

Test plan

🤖 Generated with Claude Code

Defines an array-to-bytes codec that serializes label_multiset arrays
using the N5 legacy binary format from imglib2-label-multisets
(LabelUtils.serializeLabelMultisetTypes). Uses big-endian argMaxSize
and listEntryOffsets with little-endian listData. Intended to be used
as the inner array-to-bytes codec inside n5_varlen.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jbms

jbms commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

You also need to define a zarr data type for this.

@mkitti

mkitti commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

The data type is in #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants