code: def test_get_direction_and_spacings():
      r"""Test direction and spacings from affine transforms"""
      xrot = 0.5
      yrot = 0.75
      zrot = 1.0
      direction_gt = eulerangles.euler2mat(zrot, yrot, xrot)
      spacings_gt = np.array([1.1, 1.2, 1.3])
      scaling_gt = np.diag(spacings_gt)
      translation_gt = np.array([1, 2, 3])
  
      affine = np.eye(4)
      affine[:3, :3] = direction_gt.dot(scaling_gt)
      affine[:3, 3] = translation_gt
  
      direction, spacings = imwarp.get_direction_and_spacings(affine, 3)
      assert_array_almost_equal(direction, direction_gt)
      assert_array_almost_equal(spacings, spacings_gt)
  
imports: import numpy
  import nibabel.eulerangles
  from numpy.testing import assert_equal, assert_array_equal, assert_array_almost_equal, assert_raises
  from dipy.core.interpolation import interpolate_scalar_2d, interpolate_scalar_3d
  from dipy.data import get_fnames
  from dipy.align import floating
  from dipy.align import imwarp
  from dipy.align import metrics
  from dipy.align import vector_fields
  from dipy.align import VerbosityLevels
  from dipy.align.imwarp import DiffeomorphicMap
  from dipy.tracking.streamline import deform_streamlines
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 6 for calling a global function with example usage: test_get_direction_and_spacings() without return types