Skip to content

Commit 919b71a

Browse files
committed
DOC: Some clarifying comments in SpatialFirstSlicer
1 parent 44e8697 commit 919b71a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

nibabel/spatialimages.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ class SpatialFirstSlicer(object):
328328
Checks that an image's first three axes are spatial
329329
'''
330330
def __init__(self, img):
331+
# Local import to avoid circular import on module load
331332
from .imageclasses import spatial_axes_first
332333
if not spatial_axes_first(img):
333334
raise ValueError("Cannot predict position of spatial axes for "
@@ -365,6 +366,9 @@ def check_slicing(self, slicer, return_spatial=False):
365366
without collapsing spatial dimensions
366367
'''
367368
slicer = canonical_slicers(slicer, self.img.shape)
369+
# We can get away with this because we've checked the image's
370+
# first three axes are spatial.
371+
# More general slicers will need to be smarter, here.
368372
spatial_slices = slicer[:3]
369373
for subslicer in spatial_slices:
370374
if subslicer is None:

0 commit comments

Comments
 (0)