Skip to content

Commit a12bac7

Browse files
committed
FIX: Update types based on (unmerged) annotation of fileslice
1 parent f475901 commit a12bac7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nibabel/spatialimages.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ def __getitem__(self, slicer: object) -> SpatialImgT:
395395
affine = self.slice_affine(slicer)
396396
return self.img.__class__(dataobj.copy(), affine, self.img.header)
397397

398-
def check_slicing(self, slicer: object, return_spatial: bool = False) -> tuple[slice, ...]:
398+
def check_slicing(
399+
self,
400+
slicer: object,
401+
return_spatial: bool = False,
402+
) -> tuple[slice | int | None, ...]:
399403
"""Canonicalize slicers and check for scalar indices in spatial dims
400404
401405
Parameters
@@ -426,7 +430,7 @@ def check_slicing(self, slicer: object, return_spatial: bool = False) -> tuple[s
426430
)
427431
return spatial_slices if return_spatial else canonical
428432

429-
def slice_affine(self, slicer: tuple[slice, ...]) -> np.ndarray:
433+
def slice_affine(self, slicer: object) -> np.ndarray:
430434
"""Retrieve affine for current image, if sliced by a given index
431435
432436
Applies scaling if down-sampling is applied, and adjusts the intercept

0 commit comments

Comments
 (0)