@@ -35,17 +35,14 @@ def assert_all_in(in_shape, in_affine, out_shape, out_affine):
35
35
assert_true (np .all (out_grid < np .array (out_shape ) + TINY ))
36
36
37
37
38
- def test_vox2out_vox ():
39
- # Test world space bounding box
40
- # Test basic case, identity, no voxel sizes passed
41
- shape , aff = vox2out_vox (((2 , 3 , 4 ), np .eye (4 )))
42
- assert_array_equal (shape , (2 , 3 , 4 ))
43
- assert_array_equal (aff , np .eye (4 ))
38
+ def get_outspace_params ():
39
+ # Return in_shape, in_aff, vox, out_shape, out_aff for output space tests
40
+ # Put in function to use also for resample_to_output tests
44
41
# Some affines as input to the tests
45
42
trans_123 = [[1 , 0 , 0 , 1 ], [0 , 1 , 0 , 2 ], [0 , 0 , 1 , 3 ], [0 , 0 , 0 , 1 ]]
46
43
trans_m123 = [[1 , 0 , 0 , - 1 ], [0 , 1 , 0 , - 2 ], [0 , 0 , 1 , - 3 ], [0 , 0 , 0 , 1 ]]
47
44
rot_3 = from_matvec (euler2mat (np .pi / 4 ), [0 , 0 , 0 ])
48
- for in_shape , in_aff , vox , out_shape , out_aff in (
45
+ return ( # in_shape, in_aff, vox, out_shape, out_aff
49
46
# Identity
50
47
((2 , 3 , 4 ), np .eye (4 ), None , (2 , 3 , 4 ), np .eye (4 )),
51
48
# Flip first axis
@@ -81,7 +78,16 @@ def test_vox2out_vox():
81
78
# Number of voxel sizes matches length
82
79
((2 , 3 ), np .diag ([4 , 5 , 6 , 1 ]), (4 , 5 ),
83
80
(2 , 3 ), np .diag ([4 , 5 , 1 , 1 ])),
84
- ):
81
+ )
82
+
83
+
84
+ def test_vox2out_vox ():
85
+ # Test world space bounding box
86
+ # Test basic case, identity, no voxel sizes passed
87
+ shape , aff = vox2out_vox (((2 , 3 , 4 ), np .eye (4 )))
88
+ assert_array_equal (shape , (2 , 3 , 4 ))
89
+ assert_array_equal (aff , np .eye (4 ))
90
+ for in_shape , in_aff , vox , out_shape , out_aff in get_outspace_params ():
85
91
img = Nifti1Image (np .ones (in_shape ), in_aff )
86
92
for input in ((in_shape , in_aff ), img ):
87
93
shape , aff = vox2out_vox (input , vox )
0 commit comments