Skip to content

Fix OME-Zarr physical scale metadata#845

Open
maxliebscher wants to merge 1 commit into
ScrollPrize:mainfrom
maxliebscher:codex-issue-497-omezarr-scale
Open

Fix OME-Zarr physical scale metadata#845
maxliebscher wants to merge 1 commit into
ScrollPrize:mainfrom
maxliebscher:codex-issue-497-omezarr-scale

Conversation

@maxliebscher

@maxliebscher maxliebscher commented Apr 29, 2026

Copy link
Copy Markdown

Summary

Fixes OME-Zarr physical scale metadata written by vc_render_tifxyz so rendered output stores the actual physical spacing for the generated Z/Y/X axes.

What changed

  • writeZarrAttrs now accepts separate physical sizes for Z and Y/X instead of one isotropic base voxel size.
  • vc_render_tifxyz computes output Y/X spacing from the selected source group and --scale.
  • Rendered Z spacing uses --slice-step and remains unchanged across output pyramid levels.
  • Pyramid metadata doubles only Y/X scale per downsampled output level.
  • TIFF DPI uses the rendered Y/X pixel size.
  • Added a focused doctest for anisotropic OME-Zarr scale metadata.

Why

The previous metadata path used one base voxel size for all output axes and levels. That loses the distinction between:

  • the source OME-Zarr group resolution,
  • the render pixel scale,
  • the rendered slice spacing along Z,
  • and the Y/X-only downsampling applied to output pyramid levels.

This can make downstream OME-Zarr consumers interpret rendered volumes with the wrong physical scale.

Validation

Rebased onto current main and ran in WSL2 Ubuntu 24.04:

git diff --check origin/main...HEAD
cmake -S volume-cartographer -B volume-cartographer/build/wsl-vc-pr845 -GNinja -DCMAKE_BUILD_TYPE=Release -DVC_TESTING=ON -DLAPACKE_INCLUDE_DIRS=/usr/include -DLAPACKE_LIBRARIES=/usr/lib/x86_64-linux-gnu/liblapacke.so
cmake --build volume-cartographer/build/wsl-vc-pr845 --target vc_render_tifxyz test_zarr_attrs -j2
ctest --test-dir volume-cartographer/build/wsl-vc-pr845 -R '^test_zarr_attrs$' --output-on-failure

Result:

100% tests passed, 0 tests failed out of 1

The generated build directory was removed after verification.

@vercel

vercel Bot commented Apr 29, 2026

Copy link
Copy Markdown

@maxliebscher is attempting to deploy a commit to the scroll Team on Vercel.

A member of the Team first needs to authorize it.

@maxliebscher maxliebscher marked this pull request as ready for review April 29, 2026 09:02
@maxliebscher

maxliebscher commented Apr 29, 2026

Copy link
Copy Markdown
Author

Quick note on the Vercel check: this PR only touches volume-cartographer C++/CMake test code. I validated the affected path locally in WSL2 by building vc_render_tifxyz and test_zarr_attrs, then running ctest -R test_zarr_attrs --output-on-failure. The Vercel preview is blocked because this comes from a fork and needs team authorization; I do not think it is relevant for this patch unless you want preview deployments enabled for it.

@maxliebscher maxliebscher force-pushed the codex-issue-497-omezarr-scale branch from 755bc16 to 7f9872f Compare May 7, 2026 07:28
@maxliebscher maxliebscher force-pushed the codex-issue-497-omezarr-scale branch from 7f9872f to d40e177 Compare May 25, 2026 08:34
@giorgioangel

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d40e177bf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const cv::Size& canvasSize, size_t CZ, size_t CH, size_t CW,
double baseVoxelSize = 1.0,
double zVoxelSize = 1.0,
double yxVoxelSize = 1.0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve existing writeZarrAttrs call sites

With yxVoxelSize inserted before voxelUnit, existing callers that pass only a voxel size and unit no longer compile: I checked repo-wide with rg "writeZarrAttrs\\(", and volume-cartographer/core/test/test_zarr.cpp:119 still calls writeZarrAttrs(..., 7.91, "um"), so the string literal is now bound to this new double parameter. Building the normal test_zarr target will fail unless that call is updated or a compatibility overload keeps the old (baseVoxelSize, voxelUnit) form working.

Useful? React with 👍 / 👎.

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