-
Notifications
You must be signed in to change notification settings - Fork 2
feat: detect multiple zarr metadata verisons; set Neuroglancer link source #247
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
Conversation
- defaults to v3 when available
- during the refactor, this was incorrectly changed such that if thumbnailSrc didn't exist, layer was set to null. This resulted in Neuroglancer state being generated without a layer type and the user needing to manually select a image in the neuroglancer interface
mkitti
left a comment
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.
Sounds good to me. I will see if I can test it later.
krokicki
left a comment
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, I just made a few code structure suggestions.
frontend/src/queries/zarrQueries.ts
Outdated
| * Detects which Zarr versions are supported by checking for version-specific marker files. | ||
| * @returns Array of supported versions: ['v2'], ['v3'], or ['v2', 'v3'] | ||
| */ | ||
| export function detectZarrVersions(fileNames: string[]): ('v2' | 'v3')[] { |
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 is nice. Can it also replace uses of isZarrDirectory, which looks like it now duplicates a subset of this logic?
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.
frontend/src/queries/zarrQueries.ts
Outdated
| const availableVersions = detectZarrVersions(fileNames); | ||
|
|
||
| // Default to Zarr v3 when available | ||
| if (availableVersions.includes('v3') && zarrJsonFile) { |
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.
These if/else blocks are now duplicating the logic that checks for each file. I would refactor this slightly so that we first check the availableVersions, and if v3 is available only then get the zarr.json file. In the else block we can deal with the v2 uses cases in the same way.
It's always better to cover all if/else conditions when possible, that makes the code easier to follow and it's less likely to have hidden bugs.
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.
Made this change in commit 2e5d6e6
Clickup id: 86acggp4k
This PR adds support for detecting all available Zarr metadata versions in a Zarr directory and displaying this information in the Zarr metadata table. In addition, a version suffix is added to Neuroglancer links to specify what version metadata to use. In cases where both v2 and v3 metadata are available, the Neuroglancer source is set to zarr3.
Example dual Zarr path for testing:
/groups/liconn/liconn/data_internal/dual_metadata_test/20250903_FlyID08-01_2ndGel_10%_0.8%_1hr_Atto488_40XW_003_dual.zarrKey changes
src/queries/zarrQueries.ts: AddeddetectZarrVersions()function to identify available versions from file listsrc/hooks/useZarrMetadata.ts: sets effective Zarr version (defaults to zarr3 when both version 2 and 3 metadata are available) and generates version-specific Neuroglancer URLs. Also fixed a bug introduced in the migration to Tanstack query where the layer variable wasn't set to the default "image" in cases where a thumbnail wasn't available.src/omezarr-helper.ts: UpdatedgetNeuroglancerSource()to accept version parameter and generate appropriate source URL (|zarr2: or |zarr3:)src/components/ui/BrowsePage/ZarrMetadataTable.tsx: Display available versions in metadata tableTests
ZarrMetadataTabletests for version display behavior. This also required adding MSW handlers for multiple Zarr version scenarios and a mock helper to bypass theomezarr-helper.tsmodule