-
Notifications
You must be signed in to change notification settings - Fork 7
Reshape codec #10
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
base: main
Are you sure you want to change the base?
Reshape codec #10
Conversation
@ldeakan this is an alternative to the previously discussed It should provide a lot of flexibility for using image codecs and zfp with zarr arrays containing an arbitrary number of dimensions. |
Tagging @LDeakin again, because the linking didn't seem to work. |
I do intend to implement it in tensorstore and neuroglancer. I've started the tensorstore implementation. There are some tradeoffs I made in designing this:
|
I will indeed implement it before switching to non-draft but also wanted to get feedback on it. |
There is no strict requirement to have an implementation when registering the name. It is recommended, though. |
`prod(B_shape[:i]) == prod(A_shape[input_dims[0]])` and | ||
`prod(B_shape[i+1:]) == prod(A_shape[input_dims[k-1]+1:])`. | ||
|
||
This two constraints ensure that if the size of output dimension `i` is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This two constraints ensure that if the size of output dimension `i` is | |
These two constraints ensure that if the size of output dimension `i` is |
For example, the array metadata below specifies that the compressor is the Zstd | ||
codec configured with a compression level of 1 and with the checksum stored: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this description does not match the JSON
specified above. | ||
|
||
As this codec does NOT alter the lexicographical order of elements, the contents | ||
of the output array `B` is related to the contents of the input array `A` by: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of the output array `B` is related to the contents of the input array `A` by: | |
of the output array `B` are related to the contents of the input array `A` by: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just some minor suggestions.
I implemented it in zarrs
: zarrs/zarrs#206
```. | ||
|
||
Specifying the corresponding `input_dims` rather than an explicit `size` is | ||
paticularly useful when using variable-size chunking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
particularly
|
||
``` | ||
B_shape[i] := prod(A_shape[input_dims]] | ||
```. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting issues here
} | ||
}, | ||
{ | ||
"name": "bytes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to demo high-dimensional zfp
since it is a motivating use case for this codec
satisfied: | ||
|
||
- the flattened list of input dimensions, over all elements of `shape`, must be | ||
in monotonically increasing order, i.e. `"shape": [[0, 1], 10, [3, 4]]` is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strictly monotonically
"type": "array", | ||
"items": { | ||
"oneOf": [ | ||
{"type": "integer", "minimum": -1}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 is not a valid integer
No description provided.