Skip to content

Commit

Permalink
fix logic in matrix-only version of convert-ndims
Browse files Browse the repository at this point in the history
  • Loading branch information
jni committed Dec 12, 2023
1 parent c0a2b93 commit 9bff5c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/affinder/affinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def remove_pts_layers(viewer, layers):
def convert_affine_to_ndims(affine, target_ndim):
"""Either embed or slice an affine matrix to match the target ndims."""
affine = np.asarray(affine)
diff = affine.ndim - target_ndim
diff = affine.ndim + 1 - target_ndim
if diff == 0:
out = affine
if diff < 0:
elif diff < 0:
# target is larger, so embed
out = np.identity(target_ndim + 1)
out[-diff:, -diff:] = affine
Expand Down

0 comments on commit 9bff5c0

Please sign in to comment.