class_docstr: Slicing interface that returns a new image with an updated affine
  
  Checks that an image's first three axes are spatial
class_docstr_tok: ["Slicing","interface","that","returns","a","new","image","with","an","updated","affine","Checks","that","an","image","'s","first","three","axes","are","spatial"]
docstr: Canonicalize slicers and check for scalar indices in spatial dims
  
  Parameters
  ----------
  slicer : object
      something that can be used to slice an array as in
      ``arr[sliceobj]``
  return_spatial : bool
      return only slices along spatial dimensions (x, y, z)
  
  Returns
  -------
  slicer : object
      Validated slicer object that will slice image's `dataobj`
      without collapsing spatial dimensions
docstr_tok: ["Canonicalize","slicers","and","check","for","scalar","indices","in","spatial","dims","Parameters","--","--","--","--","--","slicer",":","object","something","that","can","be","used","to","slice","an","array","as","in","``","arr","[","sliceobj","]","``","return_spatial",":","bool","return","only","slices","along","spatial","dimensions","(","x",",","y",",","z",")","Returns","--","--","--","-","slicer",":","object","Validated","slicer","object","that","will","slice","image","'s","`","dataobj","`","without","collapsing","spatial","dimensions"]
code: def check_slicing(
      self,
      slicer: object,
      return_spatial: bool = False,
  ) -> tuple[slice | int | None, ...]:
      """Canonicalize slicers and check for scalar indices in spatial dims
  
      Parameters
      ----------
      slicer : object
          something that can be used to slice an array as in
          ``arr[sliceobj]``
      return_spatial : bool
          return only slices along spatial dimensions (x, y, z)
  
      Returns
      -------
      slicer : object
          Validated slicer object that will slice image's `dataobj`
          without collapsing spatial dimensions
      """
      canonical = canonical_slicers(slicer, self.img.shape)
      # We can get away with this because we've checked the image's
      # first three axes are spatial.
      # More general slicers will need to be smarter, here.
      spatial_slices = canonical[:3]
      for subslicer in spatial_slices:
          if subslicer is None:
              raise IndexError(
                  "New axis not permitted in spatial dimensions"
              )
          elif isinstance(subslicer, int):
              raise IndexError(
                  "Scalar indices disallowed in spatial dimensions; Use `[x]` or `x:x+1`."
              )
      return spatial_slices if return_spatial else canonical
  
imports: from __future__ import annotations
  import io
  import typing
  from collections.abc import Sequence
  from typing import Literal
  import numpy
  from .arrayproxy import ArrayLike
  from .casting import sctypes_aliases
  from .dataobj_images import DataobjImage
  from .filebasedimages import FileBasedHeader, FileBasedImage
  from .fileholders import FileMap
  from .fileslice import canonical_slicers
  from .orientations import apply_orientation, inv_ornt_aff
  from .viewers import OrthoSlicer3D
  from .volumeutils import shape_zoom_affine
label_desc: Use image node_id 3 for calling the SpatialFirstSlicer obj's underlying member method code with example usage: obj.check_slicing(slicer, return_spatial) and returns: unknown