@@ -148,7 +148,7 @@ def test_resample_from_to(caplog):
148
148
exp_out [1 :, :, :] = data [1 , :, :]
149
149
assert_almost_equal (out .dataobj , exp_out )
150
150
out = resample_from_to (img , trans_p_25_img )
151
- with pytest .warns (UserWarning ):
151
+ with pytest .warns (UserWarning ): # Suppress scipy warning
152
152
exp_out = spnd .affine_transform (data , [1 , 1 , 1 ], [- 0.25 , 0 , 0 ], order = 3 )
153
153
assert_almost_equal (out .dataobj , exp_out )
154
154
# Test cval
@@ -161,7 +161,7 @@ def test_resample_from_to(caplog):
161
161
assert out .__class__ == Nifti1Image
162
162
# By default, type of from_img makes no difference
163
163
n1_img = Nifti2Image (data , affine )
164
- with caplog .at_level (logging .CRITICAL ):
164
+ with caplog .at_level (logging .CRITICAL ): # Here and below, suppress logs when changing classes
165
165
out = resample_from_to (n1_img , trans_img )
166
166
assert out .__class__ == Nifti1Image
167
167
# Passed as keyword arg
@@ -254,7 +254,7 @@ def test_resample_to_output(caplog):
254
254
assert_array_equal (out_img .dataobj , np .flipud (data ))
255
255
# Subsample voxels
256
256
out_img = resample_to_output (Nifti1Image (data , np .diag ([4 , 5 , 6 , 1 ])))
257
- with pytest .warns (UserWarning ):
257
+ with pytest .warns (UserWarning ): # Suppress scipy warning
258
258
exp_out = spnd .affine_transform (data ,
259
259
[1 / 4 , 1 / 5 , 1 / 6 ],
260
260
output_shape = (5 , 11 , 19 ))
@@ -293,7 +293,7 @@ def test_resample_to_output(caplog):
293
293
img_ni1 = Nifti2Image (data , np .eye (4 ))
294
294
img_ni2 = Nifti2Image (data , np .eye (4 ))
295
295
# Default is Nifti1Image
296
- with caplog .at_level (logging .CRITICAL ):
296
+ with caplog .at_level (logging .CRITICAL ): # Here and below, suppress logs when changing classes
297
297
assert resample_to_output (img_ni2 ).__class__ == Nifti1Image
298
298
# Can be overriden
299
299
with caplog .at_level (logging .CRITICAL ):
@@ -349,7 +349,7 @@ def test_smooth_image(caplog):
349
349
img_ni1 = Nifti1Image (data , np .eye (4 ))
350
350
img_ni2 = Nifti2Image (data , np .eye (4 ))
351
351
# Default is Nifti1Image
352
- with caplog .at_level (logging .CRITICAL ):
352
+ with caplog .at_level (logging .CRITICAL ): # Here and below, suppress logs when changing classes
353
353
assert smooth_image (img_ni2 , 0 ).__class__ == Nifti1Image
354
354
# Can be overriden
355
355
with caplog .at_level (logging .CRITICAL ):
@@ -362,7 +362,7 @@ def test_smooth_image(caplog):
362
362
def test_spatial_axes_check (caplog ):
363
363
for fname in MINC_3DS + OTHER_IMGS :
364
364
img = nib .load (pjoin (DATA_DIR , fname ))
365
- with caplog .at_level (logging .CRITICAL ):
365
+ with caplog .at_level (logging .CRITICAL ): # Suppress logs when changing classes
366
366
s_img = smooth_image (img , 0 )
367
367
assert_array_equal (img .dataobj , s_img .dataobj )
368
368
with caplog .at_level (logging .CRITICAL ):
@@ -447,7 +447,7 @@ def test_conform(caplog):
447
447
assert isinstance (c , Nifti1Image )
448
448
449
449
# Test with non-default arguments.
450
- with caplog .at_level (logging .CRITICAL ):
450
+ with caplog .at_level (logging .CRITICAL ): # Suppress logs when changing classes
451
451
c = conform (anat , out_shape = (100 , 100 , 200 ), voxel_size = (2 , 2 , 1.5 ),
452
452
orientation = "LPI" , out_class = Nifti2Image )
453
453
assert c .shape == (100 , 100 , 200 )
0 commit comments