File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -111,20 +111,16 @@ def from_string(cls, string):
111
111
def to_ras (self , moving = None , reference = None ):
112
112
"""Return a nitransforms internal RAS+ matrix."""
113
113
# swapaxes is necessary, as axis 0 encodes series of transforms
114
+ retval = LPS @ np .swapaxes (self .structarr ["parameters" ].T , 0 , 1 ) @ LPS
115
+ reference = _ensure_image (reference )
116
+ if reference is not None and _is_oblique (reference .affine ):
117
+ retval = retval @ _cardinal_rotation (reference .affine , True )
114
118
115
- pre_rotation = post_rotation = np .eye (4 )
116
- if reference is not None and _is_oblique (ref_aff := _ensure_image (reference ).affine ):
117
- pre_rotation = _cardinal_rotation (ref_aff , True )
118
- if moving is not None and _is_oblique (mov_aff := _ensure_image (moving ).affine ):
119
- post_rotation = _cardinal_rotation (mov_aff , True )
119
+ moving = _ensure_image (moving )
120
+ if moving is not None and _is_oblique (moving .affine ):
121
+ retval = _cardinal_rotation (moving .affine , False ) @ retval
120
122
121
- return (
122
- post_rotation
123
- @ LPS
124
- @ np .swapaxes (self .structarr ["parameters" ].T , 0 , 1 )
125
- @ LPS
126
- @ pre_rotation
127
- )
123
+ return retval
128
124
129
125
130
126
class AFNILinearTransformArray (BaseLinearTransformList ):
You can’t perform that action at this time.
0 commit comments