code: def test_mat2vec():
      mat = np.eye(4)
      tmp = np.random.rand(3, 3)
      U, s, Vt = np.linalg.svd(tmp)
      U /= np.linalg.det(U)
      Vt /= np.linalg.det(Vt)
      mat[0:3, 0:3] = np.dot(np.dot(U, np.diag(s)), Vt)
      T = Affine(mat)
      assert_almost_equal(T.as_affine(), mat)
  
file_path: nipy/nipy/algorithms/registration/tests/test_affine.py
imports: import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ....testing import assert_almost_equal
  from ..affine import Affine, Affine2D, Rigid, Rigid2D, Similarity, Similarity2D, rotation_mat2vec, slices2aff, subgrid_affine
label_desc: Use image node_id 2 for calling a global function with example usage: test_mat2vec() without return types