@@ -385,9 +385,10 @@ def test_get_data(self):
385
385
img [0 , 0 , 0 ]
386
386
# Make sure the right message gets raised:
387
387
assert_equal (str (exception_manager .exception ),
388
- ("Cannot slice image objects; consider slicing image "
389
- "array data with `img.dataobj[slice]` or "
390
- "`img.get_data()[slice]`" ))
388
+ "Cannot slice image objects; consider using "
389
+ "`img.slicer[slice]` to generate a sliced image (see "
390
+ "documentation for caveats) or slicing image array data "
391
+ "with `img.dataobj[slice]` or `img.get_data()[slice]`" )
391
392
assert_true (in_data is img .dataobj )
392
393
out_data = img .get_data ()
393
394
assert_true (in_data is out_data )
@@ -432,7 +433,8 @@ def test_slicer(self):
432
433
433
434
# Down-sample with [::2, ::2, ::2] along spatial dimensions
434
435
sliceobj = [slice (None )] * len (dshape )
435
- sliceobj [img ._spatial_dims ] = [slice (None , None , 2 )] * 3
436
+ if img ._spatial_dims is not None :
437
+ sliceobj [img ._spatial_dims ] = [slice (None , None , 2 )] * 3
436
438
downsampled_img = img .slicer [tuple (sliceobj )]
437
439
assert_array_equal (downsampled_img .header .get_zooms ()[:3 ],
438
440
np .array (spatial_zooms ) * 2 )
0 commit comments