@@ -84,7 +84,7 @@ def load_ants_h5(filename: Path) -> nt.base.TransformBase:
84
84
msg += f'Found: { fixed_params } '
85
85
if not np .array_equal (fixed_params [6 :], FIXED_PARAMS [6 :]):
86
86
raise ValueError (msg )
87
- warnings .warn (msg )
87
+ warnings .warn (msg , stacklevel = 1 )
88
88
89
89
shape = tuple (fixed_params [:3 ].astype (int ))
90
90
warp = h ['TransformGroup' ]['2' ]['TransformParameters' ][:]
@@ -96,18 +96,5 @@ def load_ants_h5(filename: Path) -> nt.base.TransformBase:
96
96
warp_affine [:3 , 3 ] = fixed_params [3 :6 ]
97
97
lps_to_ras = np .eye (4 ) * np .array ([- 1 , - 1 , 1 , 1 ])
98
98
warp_affine = lps_to_ras @ warp_affine
99
- if np .array_equal (fixed_params , FIXED_PARAMS ):
100
- # Confirm that we construct the right affine when fixed parameters are known
101
- assert np .array_equal (
102
- warp_affine ,
103
- np .array (
104
- [
105
- [1.0 , 0.0 , 0.0 , - 96.0 ],
106
- [0.0 , 1.0 , 0.0 , - 132.0 ],
107
- [0.0 , 0.0 , 1.0 , - 78.0 ],
108
- [0.0 , 0.0 , 0.0 , 1.0 ],
109
- ]
110
- ),
111
- )
112
99
transforms .insert (0 , nt .DenseFieldTransform (nb .Nifti1Image (warp , warp_affine )))
113
100
return nt .TransformChain (transforms )
0 commit comments