Skip to content

Commit fbd9e6e

Browse files
committed
ENH: Improve exception message
1 parent 1e15c98 commit fbd9e6e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

nibabel/spatialimages.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,11 @@ def __getitem__(self, idx):
570570
Use the slicer attribute to perform cropping and subsampling at your
571571
own risk.
572572
'''
573-
raise TypeError("Cannot slice image objects; consider slicing image "
574-
"array data with `img.dataobj[slice]` or "
575-
"`img.get_data()[slice]`")
573+
raise TypeError(
574+
"Cannot slice image objects; consider using `img.slicer[slice]` "
575+
"to generate a sliced image (see documentation for caveats) or "
576+
"slicing image array data with `img.dataobj[slice]` or "
577+
"`img.get_data()[slice]`")
576578

577579
def orthoview(self):
578580
"""Plot the image using OrthoSlicer3D

0 commit comments

Comments
 (0)