@@ -286,17 +286,27 @@ def test_densefield_map_against_ants(testdata_path, tmp_path):
286286 assert np .allclose (mapped , ants_pts , atol = 1e-6 )
287287
288288
289- def test_constant_field_vs_ants (tmp_path ):
289+ @pytest .mark .parametrize (
290+ "mat" ,
291+ [
292+ np .eye (3 ),
293+ np .diag ([- 1.0 , 1.0 , 1.0 ]),
294+ np .diag ([1.0 , - 1.0 , 1.0 ]),
295+ np .array ([[0.0 , 1.0 , 0.0 ], [1.0 , 0.0 , 0.0 ], [0.0 , 0.0 , 1.0 ]]),
296+ ],
297+ )
298+ def test_constant_field_vs_ants (tmp_path , mat ):
290299 """Create a constant displacement field and compare mappings."""
291300
292- # Create a reference centered at the origin
301+ # Create a reference centered at the origin with various axis orders/flips
293302 shape = (25 , 25 , 25 )
294- ref_affine = from_matvec (np .eye (3 ), - (np .array (shape ) - 1 ) / 2 )
303+ center = (np .array (shape ) - 1 ) / 2
304+ ref_affine = from_matvec (mat , - mat @ center )
295305
296306 field = np .zeros (shape + (3 ,), dtype = "float32" )
297307 field [..., 0 ] = - 5
298- field [..., 1 ] = 5
299- field [..., 2 ] = 0 # No flip in the third axis
308+ field [..., 1 ] = 2
309+ field [..., 2 ] = 0 # No displacement in the third axis
300310
301311 warpfile = tmp_path / "const_disp.nii.gz"
302312 itk_img = sitk .GetImageFromArray (field , isVector = True )
0 commit comments