@@ -181,8 +181,8 @@ def test_write_3d(self):
181
181
writer_obj .set_metadata ({"affine" : np .diag ([1 , 1 , 1 , 1 ]), "original_affine" : np .diag ([1.4 , 1 , 1 , 1 ])})
182
182
writer_obj .write (image_name , verbose = True )
183
183
out = nib .load (image_name )
184
- np .testing .assert_allclose (out .get_fdata (), [[[0 , 1 , 2 ], [3 , 4 , 5 ]]])
185
- np .testing .assert_allclose (out .affine , np .diag ([1.4 , 1 , 1 , 1 ]))
184
+ np .testing .assert_allclose (out .get_fdata (), [[[0 , 1 , 2 ], [3 , 4 , 5 ]]], atol = 1e-4 , rtol = 1e-4 )
185
+ np .testing .assert_allclose (out .affine , np .diag ([1.4 , 1 , 1 , 1 ]), atol = 1e-4 , rtol = 1e-4 )
186
186
187
187
image_name = os .path .join (out_dir , "test1.nii.gz" )
188
188
img = p (np .arange (5 ).reshape ((1 , 1 , 5 )))
@@ -205,8 +205,8 @@ def test_write_4d(self):
205
205
writer_obj .set_metadata ({"affine" : np .diag ([1.4 , 1 , 1 , 1 ]), "original_affine" : np .diag ([1 , 1.4 , 1 , 1 ])})
206
206
writer_obj .write (image_name , verbose = True )
207
207
out = nib .load (image_name )
208
- np .testing .assert_allclose (out .get_fdata (), [[[[0 , 1 ], [2 , 3 ], [4 , 5 ]]]])
209
- np .testing .assert_allclose (out .affine , np .diag ([1 , 1.4 , 1 , 1 ]))
208
+ np .testing .assert_allclose (out .get_fdata (), [[[[0 , 1 ], [2 , 3 ], [4 , 5 ]]]], atol = 1e-4 , rtol = 1e-4 )
209
+ np .testing .assert_allclose (out .affine , np .diag ([1 , 1.4 , 1 , 1 ]), atol = 1e-4 , rtol = 1e-4 )
210
210
211
211
image_name = os .path .join (out_dir , "test1.nii.gz" )
212
212
img = p (np .arange (5 ).reshape ((1 , 1 , 5 , 1 )))
@@ -232,8 +232,10 @@ def test_write_5d(self):
232
232
np .testing .assert_allclose (
233
233
out .get_fdata (),
234
234
np .array ([[[[[0.0 , 1.0 ], [2.0 , 3.0 ]], [[4.0 , 5.0 ], [6.0 , 7.0 ]], [[8.0 , 9.0 ], [10.0 , 11.0 ]]]]]),
235
+ atol = 1e-4 ,
236
+ rtol = 1e-4 ,
235
237
)
236
- np .testing .assert_allclose (out .affine , np .diag ([1.4 , 1 , 1 , 1 ]))
238
+ np .testing .assert_allclose (out .affine , np .diag ([1.4 , 1 , 1 , 1 ]), atol = 1e-4 , rtol = 1e-4 )
237
239
238
240
image_name = os .path .join (out_dir , "test1.nii.gz" )
239
241
img = p (np .arange (10 ).reshape ((1 , 1 , 5 , 1 , 2 )))
0 commit comments