Skip to content
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

consider mapping BinData to bytes #18

Open
jmuhlich opened this issue Jul 22, 2020 · 0 comments
Open

consider mapping BinData to bytes #18

jmuhlich opened this issue Jul 22, 2020 · 0 comments

Comments

@jmuhlich
Copy link
Collaborator

The BinData schema element is really just an XML-friendly encoding for a series of raw bytes, and the ideal Python type for that is bytes. If we make that change, the XML parsing process could perform the base64 decoding and any decompression, but I'm not sure what to do about the BigEndian flag. It would be instructive to look at BioFormats and OMERO code to see how BinData endianness is managed. Numpy users could be accommodated nicely with an __array__ method that returns the bytes object wrapped in np.frombuffer (zero-copy).

Also when we get to XML encoding, our API will need a way to declare what kind of compression the user wants (one setting for all BinData elements in the whole document is probably OK). The Length can be computed from the content, and we can pass along or arbitrarily choose the BigEndian value depending on how we manage it in the dataclass.

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

No branches or pull requests

1 participant