code: def test_load_dim_info():
      # Test freq, phase, slice get set correctly on load
      data = np.random.normal(size=list(range(3)))
      xyz_aff = from_matvec(np.diag([2, 3, 4]), [11, 12, 13])
      in_cs = CS("ijk", name="voxels")
      out_cs = aligned_csm(3)
      # Just confirm that the default leads to no axis renaming
      ni_img = nib.Nifti1Image(data, xyz_aff)
      hdr = get_header(ni_img)
      assert hdr.get_dim_info() == (None, None, None)
      assert nifti2nipy(ni_img).coordmap == AT(in_cs, out_cs, xyz_aff)
      # But now...
      hdr.set_dim_info(freq=1)
      assert nifti2nipy(ni_img).coordmap == AT(
          CS(("i", "freq", "k"), "voxels"), out_cs, xyz_aff
      )
      hdr.set_dim_info(freq=2)
      assert nifti2nipy(ni_img).coordmap == AT(
          CS(("i", "j", "freq"), "voxels"), out_cs, xyz_aff
      )
      hdr.set_dim_info(phase=1)
      assert nifti2nipy(ni_img).coordmap == AT(
          CS(("i", "phase", "k"), "voxels"), out_cs, xyz_aff
      )
      hdr.set_dim_info(slice=0)
      assert nifti2nipy(ni_img).coordmap == AT(
          CS(("slice", "j", "k"), "voxels"), out_cs, xyz_aff
      )
      hdr.set_dim_info(freq=1, phase=0, slice=2)
      assert nifti2nipy(ni_img).coordmap == AT(
          CS(("phase", "freq", "slice"), "voxels"), out_cs, xyz_aff
      )
  
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 23 for calling a global function with example usage: test_load_dim_info() without return types