File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
niworkflows/interfaces/tests Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -155,3 +155,21 @@ def test_MergeSeries(tmp_path):
155
155
156
156
with pytest .raises (ValueError ):
157
157
MergeSeries (in_files = [str (in_file )] + [str (in_4D )], allow_4D = False ).run ()
158
+
159
+
160
+ def test_MergeSeries_affines (tmp_path ):
161
+ os .chdir (str (tmp_path ))
162
+
163
+ files = ['img0.nii.gz' , 'img1.nii.gz' ]
164
+ data = np .ones ((10 , 10 , 10 ), dtype = int )
165
+ aff = np .eye (4 )
166
+ nb .Nifti1Image (data , aff , None ).to_filename (files [0 ])
167
+ # slightly alter affine
168
+ aff [0 ][0 ] = 1.00005
169
+ nb .Nifti1Image (data , aff , None ).to_filename (files [1 ])
170
+
171
+ # affine mismatch will cause this to fail
172
+ with pytest .raises (ValueError ):
173
+ MergeSeries (in_files = files ).run ()
174
+ # but works if we set a tolerance
175
+ MergeSeries (in_files = files , affine_tolerance = 1e-04 ).run ()
You can’t perform that action at this time.
0 commit comments