code: def random_vec12(subtype="affine"):
      v = np.array([0, 0, 0, 0.0, 0, 0, 1, 1, 1, 0, 0, 0])
      v[0:3] = 20 * np.random.rand(3)
      v[3:6] = np.random.rand(3)
      if subtype == "similarity":
          v[6:9] = np.random.rand()
      elif subtype == "affine":
          v[6:9] = np.random.rand(3)
          v[9:12] = np.random.rand(3)
      return v
  
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 1 for calling a global function with example usage: random_vec12(subtype) and returns: v