code: def test_spatial_axes_first():
      # Function tests is spatial axes are first three axes in image
      # Always True for Nifti and friends
      affine = np.eye(4)
      for shape in ((2, 3), (4, 3, 2), (5, 4, 1, 2), (2, 3, 5, 2, 1)):
          for img_class in (AnalyzeImage, Nifti1Image, Nifti2Image):
              data = np.zeros(shape)
              img = img_class(data, affine)
              assert spatial_axes_first(img)
      # True for MINC images < 4D
      for fname in MINC_3DS:
          img = nib.load(pjoin(DATA_DIR, fname))
          assert len(img.shape) == 3
          assert spatial_axes_first(img)
      # False for MINC images < 4D
      for fname in MINC_4DS:
          img = nib.load(pjoin(DATA_DIR, fname))
          assert len(img.shape) == 4
          assert not spatial_axes_first(img)
  
file_path: nibabel/nibabel/tests/test_imageclasses.py
imports: import warnings
  from os.path import dirname
  from os.path import join
  import numpy
  import pytest
  import nibabel
  from nibabel import imageclasses
  from nibabel.analyze import AnalyzeImage
  from nibabel.imageclasses import spatial_axes_first
  from nibabel.nifti1 import Nifti1Image
  from nibabel.nifti2 import Nifti2Image
  from nibabel.optpkg import optional_package
label_desc: Use image node_id 1 for calling a global function with example usage: test_spatial_axes_first() without return types