code: def test_orthogonal_dims():
      # Test whether conversion to nifti raises an error for non-orthogonal
      # non-spatial dimensions
      # This affine is all nicely diagonal
      aff = from_matvec(
          np.diag([2.0, 3, 4, 5, 6]), [10, 11, 12, 13, 14]
      )
      data = np.random.normal(size=(3, 4, 5, 6, 7))
      img = Image(data, vox2mni(aff))
  
      def as3d(aff):
          return from_matvec(aff[:3, :3], aff[:3, -1])
  
      assert_array_equal(get_affine(nipy2nifti(img)), as3d(aff))
      # Non-orthogonal spatial dimensions OK
      aff[:3, :3] = np.random.normal(size=(3, 3))
      img = Image(data, vox2mni(aff))
      assert_array_equal(get_affine(nipy2nifti(img)), as3d(aff))
      # Space must be orthogonal to time etc
      aff[0, 3] = 0.1
      pytest.raises(NiftiError, nipy2nifti, img)
      aff[0, 3] = 0
      assert_array_equal(get_affine(nipy2nifti(img)), as3d(aff))
      aff[3, 0] = 0.1
      pytest.raises(NiftiError, nipy2nifti, img)
      aff[3, 0] = 0
      assert_array_equal(get_affine(nipy2nifti(img)), as3d(aff))
      aff[4, 0] = 0.1
      pytest.raises(NiftiError, nipy2nifti, img)
  
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 5 for calling a global function with example usage: test_orthogonal_dims() and returns: from_matvec