Skip to content

bugfix/preserve-xarray-metadata - #236

Closed
rpinho wants to merge 3 commits into
bioio-devs:mainfrom
rpinho:fix-xarray-metadata
Closed

rpinho wants to merge 3 commits into
bioio-devs:mainfrom
rpinho:fix-xarray-metadata

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026 •

Copy link
Copy Markdown

Link to Relevant Issue

No existing issue.

Description of Changes

Passing an image DataArray to BioImage can replace its metadata with a reference to its own attributes. Read dims_t3c2y32x32.nd2 with BioIO's ND2 reader and pass its xarray_data to a second BioImage. The patch preserves metadata attached to the input and copies plain attributes when a metadata entry is needed. The tests check both inputs and verify that the pixels remain equal.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

assert image.metadata == metadata
assert source.attrs == attrs
np.testing.assert_array_equal(image.get_image_data("YX"), source.values)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Line 28 seems like it test something besides the metadata; cheap and simple enough to keep it though.

@toloudis

toloudis commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

there is one linter error to fix... ( a missing mypy type )

@rpinho

rpinho commented Nov 30, 2026

Copy link
Copy Markdown
Author

Thanks! I've done this.

@BrianWhitneyAI BrianWhitneyAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@rpinho rpinho closed this Dec 3, 2026
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.

4 participants