File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -138,18 +138,15 @@ class AFNILinearTransformArray(BaseLinearTransformList):
138
138
def to_ras (self , moving = None , reference = None ):
139
139
"""Return a nitransforms' internal RAS matrix."""
140
140
141
- pre_rotation = None
142
- if reference is not None :
143
- ref_aff = _ensure_image (reference ).affine
144
- pre_rotation = _cardinal_rotation (ref_aff , True ) if _is_oblique (ref_aff ) else None
145
-
146
- post_rotation = None
147
- if moving is not None :
148
- mov_aff = _ensure_image (moving ).affine
149
- post_rotation = _cardinal_rotation (mov_aff , True ) if _is_oblique (mov_aff ) else None
141
+ pre_rotation = post_rotation = np .eye (4 )
142
+
143
+ if reference is not None and _is_oblique (ref_aff := _ensure_image (reference ).affine ):
144
+ pre_rotation = _cardinal_rotation (ref_aff , True )
145
+ if moving is not None and _is_oblique (mov_aff := _ensure_image (moving ).affine ):
146
+ post_rotation = _cardinal_rotation (mov_aff , True )
150
147
151
148
return np .stack ([
152
- xfm .to_ras (pre_rotation = pre_rotation , post_rotation = post_rotation )
149
+ post_rotation @ xfm .to_ras () @ pre_rotation
153
150
for xfm in self .xforms
154
151
])
155
152
You can’t perform that action at this time.
0 commit comments