@@ -385,9 +385,10 @@ def test_get_data(self):
385385 img [0 , 0 , 0 ]
386386 # Make sure the right message gets raised:
387387 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]`" )
391392 assert_true (in_data is img .dataobj )
392393 out_data = img .get_data ()
393394 assert_true (in_data is out_data )
@@ -432,7 +433,8 @@ def test_slicer(self):
432433
433434 # Down-sample with [::2, ::2, ::2] along spatial dimensions
434435 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
436438 downsampled_img = img .slicer [tuple (sliceobj )]
437439 assert_array_equal (downsampled_img .header .get_zooms ()[:3 ],
438440 np .array (spatial_zooms ) * 2 )
0 commit comments