Skip to content

Commit

Permalink
fix: indeed, asaffine() had the reversed convention
Browse files Browse the repository at this point in the history
Thanks Chris for pointing this out.

Co-authored-by: Chris Markiewicz <[email protected]>
  • Loading branch information
oesteban and effigies committed Jul 19, 2022
1 parent 533a03d commit f8b592f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions nitransforms/manip.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,25 @@ def asaffine(self, indices=None):
[0., 0., 1., 0.],
[0., 0., 0., 1.]])
>>> chain = TransformChain(transforms=[
... Affine.from_matvec(vec=(1, 2, 3)),
... Affine.from_matvec(mat=[[0, 1, 0], [0, 0, 1], [1, 0, 0]]),
... ])
>>> chain.asaffine()
array([[0., 1., 0., 2.],
[0., 0., 1., 3.],
[1., 0., 0., 1.],
[0., 0., 0., 1.]])
Parameters
----------
indices : :obj:`numpy.array_like`
The indices of the values to extract.
"""
affines = self.transforms if indices is None else np.take(self.transforms, indices)
retval = affines[0]
for xfm in affines[1:]:
retval = affines[-1]
for xfm in reversed(affines[:-1]):
retval @= xfm
return retval

Expand Down

0 comments on commit f8b592f

Please sign in to comment.