Skip to content

Raise clear error for 3D (z-stack) images and labels#675

Merged
timtreis merged 1 commit into
mainfrom
fix/issue-608
May 20, 2026
Merged

Raise clear error for 3D (z-stack) images and labels#675
timtreis merged 1 commit into
mainfrom
fix/issue-608

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented May 20, 2026

Summary

  • Closes render_images and render_labels give cryptic internal errors for 3D (z-stack) data #608. 3D z-stack inputs to render_images / render_labels previously crashed deep in matplotlib (Invalid shape) or numpy (concatenation error) with no mention of the unsupported dimensionality.
  • Adds an early guard in _render_images and _render_labels that raises a clear ValueError naming the element, z-size, and a concrete .isel(z=0) workaround.
  • Handles both DataArray and multiscale DataTree inputs via a small _get_top_data_array helper.

3D rendering remains unsupported (see #386)

3D z-stack inputs to render_images / render_labels previously crashed
deep in matplotlib ("Invalid shape") or numpy (concatenation error)
with no mention of the unsupported dimensionality. Add an early guard
on _render_images and _render_labels that raises a ValueError naming
the element, z-size, and a concrete .isel(z=0) workaround. Handles
both DataArray and multiscale DataTree inputs.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.72%. Comparing base (53421a5) to head (8280481).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #675      +/-   ##
==========================================
+ Coverage   77.66%   77.72%   +0.06%     
==========================================
  Files          11       11              
  Lines        3626     3637      +11     
  Branches      856      858       +2     
==========================================
+ Hits         2816     2827      +11     
  Misses        485      485              
  Partials      325      325              
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 87.27% <100.00%> (+0.16%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis merged commit 3ebefe1 into main May 20, 2026
7 of 8 checks passed
@timtreis timtreis deleted the fix/issue-608 branch May 20, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render_images and render_labels give cryptic internal errors for 3D (z-stack) data

2 participants