Repository navigation
Add ByDimension.to_affine() - #93
Merged
Merged
Conversation
Combine the subtransforms' affines, placing each linear map and translation in the rows of its output axes and the columns of its input axes; None if any subtransform can't be converted to affine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks Joost! This will presumably be particularly important for multi-channel images. I'll get this released ASAP so that the downstream packages can update their dependency, as I'm sure some people would like to play with it this week! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add
ByDimension.to_affine()ByDimensioninheritsTransform.to_affine(), which returnsNone, so anyTransformSequencecontaining it can't be simplified to an affine. This shows up with OME-Zarr 0.6byDimensioncoordinate transformations: ome-zarr-py builds the scene graph with transformnd, and napari-ome-zarr'sSceneneedsseq.simplify().to_affine(), so it raises "Affine transformation could not be computed" for scenes usingbyDimension.This adds
ByDimension.to_affine(): each subtransform's linear map and translation are placed in the rows of its output axes and the columns of its input axes. It returnsNoneif any subtransform can't be converted to affine.Tests compare
to_affine().apply()withapply()for filled-in identity, map axis + scale, a sequence with translation onto swapped axes, and crossed axes. They also cover use within aTransformSequence, and theNonecase.With this change, a
byDimensionscene opens in napari-ome-zarr.🤖 Generated with Claude Code