code: def test_time_axes_4th():
      # Check time-like axes rolled to be 4th, and pixdims match
      data = np.random.normal(size=(2, 3, 4, 5, 6, 7))
      aff = np.diag([2.0, 3, 4, 5, 6, 7, 1])
      xyz_names = talairach_csm(3).coord_names
      in_cs = CS("ijklmn")
      for time_like in ("t", "hz", "ppm", "rads"):
          cmap = AT(in_cs, CS(xyz_names + (time_like, "q", "r")), aff)
          img = Image(data, cmap)
          # Time-like in correct position
          ni_img = nipy2nifti(img)
          assert_array_equal(ni_img.get_fdata(), data)
          assert_array_equal(
              get_header(ni_img).get_zooms(), (2, 3, 4, 5, 6, 7)
          )
          # Time-like needs reordering
          cmap = AT(in_cs, CS(xyz_names + ("q", time_like, "r")), aff)
          ni_img = nipy2nifti(Image(data, cmap))
          assert_array_equal(
              ni_img.get_fdata(), np.rollaxis(data, 4, 3)
          )
          assert_array_equal(
              get_header(ni_img).get_zooms(), (2, 3, 4, 6, 5, 7)
          )
          # And again
          cmap = AT(in_cs, CS(xyz_names + ("q", "r", time_like)), aff)
          ni_img = nipy2nifti(Image(data, cmap))
          assert_array_equal(
              ni_img.get_fdata(), np.rollaxis(data, 5, 3)
          )
          assert_array_equal(
              get_header(ni_img).get_zooms(), (2, 3, 4, 7, 5, 6)
          )
  
imports: import warnings
  from copy import copy
  import nibabel
  import numpy
  import pytest
  from nibabel.affines import from_matvec
  from nibabel.spatialimages import HeaderDataError
  from numpy.testing import assert_array_equal
  from ...core.api import AffineTransform
  from ...core.api import CoordinateSystem
  from ...core.api import Image
  from ...core.reference.spaces import aligned_csm, mni_csm, scanner_csm, talairach_csm, unknown_csm, unknown_space, vox2mni
  from ...testing import anatfile, funcfile
  from ..files import load
  from ..nibcompat import get_affine, get_header
  from ..nifti_ref import NiftiError, nifti2nipy, nipy2nifti
label_desc: Use image node_id 10 for calling a global function with example usage: test_time_axes_4th() without return types