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
Adds a new command QuerySubBlockDirectory(handle, [filter]) which returns information about the subblocks in the subblock directory without reading any subblock data. This allows e.g. reconstructing the dimensional order of a file and loading bitmaps on demand using the returned Index.
Filter (optional struct): Coordinate (struct: dimension letter -> set of values), Roi ([x y w h]), OnlyLayer0.
Result: a 1x1 struct of arrays (there may be millions of subblocks): Index, Mode, Pixeltype (numeric enum codes, documented), CoordinateDimensions (shared string, e.g. 'ZCT'), Coordinate (N x D int32), LogicalRect, PhysicalSize, MIndex. Missing dimensions / invalid M-index are intmin('int32'). No ordering is guaranteed.
Notes:
Docs added to doc/commands.markdown; MATLAB and Octave tests added.
Unknown filter fields are silently ignored, as the app API cannot enumerate struct field names.
Returns information about all (or a filtered subset of) subblocks as a
struct of arrays, without reading the subblocks from the file. Filter
supports coordinate sets, ROI and pyramid-layer-0.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
TryGetInt32 rounds floating-point inputs with lrint/lrintf rather than checking integrality (argsutils.cpp:152–175). Consequently, Coordinate.C = 0.6 silently selects channel 1, although 1 is not in the supplied set. Reject floating-point elements that differ from their converted integer values, and add regression tests for fractional double and single coordinates.
OnlyLayer0 accepts arrays even though it requires a scalar, and neither branch rejects sparse storage before reading element zero. For example, sparse([0 1]) reads the stored 1 rather than the leading zero, silently enabling layer-0 filtering. An all-zero sparse input has no stored element to interpret this way. Require exactly one element and reject sparse inputs before either typed getter. Add regression tests for sparse and nonscalar values.
Sparse double handles pass this check, but Execute calls TryGetInt32, which reads the first stored value without accounting for sparse indices (argsutils.cpp:29–39). A sparse array with a leading zero can therefore be interpreted as a different handle, while an all-zero sparse input has no stored element to read. Reject sparse handles before conversion and add a regression test.
single(2147483648) passes this integral check, and the indexed TryGetInt32 also accepts it because its float upper bound rounds INT_MAX up to 2147483648 (argsutils.cpp:170). The value cannot be represented in int32, so a coordinate filter or ROI origin can change instead of being rejected. Check the bounds in double precision before conversion, and add regression tests for this boundary in both MATLAB and Octave.
Coordinate lookups are quadratic due to repeated linear scans
lib/src/implementation/CziReader.cpp:668
Each coordinate-set lookup scans the entire vector, and this predicate runs in both directory passes. With 100,000 subblocks at distinct T coordinates and Coordinate.T = 0:99999, the query performs about 10 billion comparisons despite reading no image data. Please pre-index each filter set once (for example, sort it during parsing and use binary search here) so large coordinate selections do not make this directory-only query quadratic.
Use dimension bounds that ignore missing coordinates, derive output dimensions from reader statistics, and streamline two-pass result construction while preserving ROI and layer filtering.
Updated the description of 'CoordinateDimensions' to clarify its independence from the filter and subblock matching.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
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.
Addresses #18.
Adds a new command
QuerySubBlockDirectory(handle, [filter])which returns information about the subblocks in the subblock directory without reading any subblock data. This allows e.g. reconstructing the dimensional order of a file and loading bitmaps on demand using the returnedIndex.Filter (optional struct):
Coordinate(struct: dimension letter -> set of values),Roi([x y w h]),OnlyLayer0.Result: a 1x1 struct of arrays (there may be millions of subblocks):
Index,Mode,Pixeltype(numeric enum codes, documented),CoordinateDimensions(shared string, e.g. 'ZCT'),Coordinate(N x D int32),LogicalRect,PhysicalSize,MIndex. Missing dimensions / invalid M-index are intmin('int32'). No ordering is guaranteed.Notes: