code: def to_matrix44(t, dtype=np.double):
      """
      T = to_matrix44(t)
  
      t is a vector of affine transformation parameters with size at
      least 6.
  
      size < 6 ==> error
      size == 6 ==> t is interpreted as translation + rotation
      size == 7 ==> t is interpreted as translation + rotation +
      isotropic scaling
      7 < size < 12 ==> error
      size >= 12 ==> t is interpreted as translation + rotation +
      scaling + pre-rotation
      """
      size = t.size
      T = np.eye(4, dtype=dtype)
      R = rotation_vec2mat(t[3:6])
      if size == 6:
          T[0:3, 0:3] = R
      elif size == 7:
          T[0:3, 0:3] = t[6] * R
      else:
          S = np.diag(np.exp(threshold(t[6:9], LOG_MAX_DIST)))
          Q = rotation_vec2mat(t[9:12])
          # Beware: R*s*Q
          T[0:3, 0:3] = np.dot(R, np.dot(S, Q))
      T[0:3, 3] = threshold(t[0:3], MAX_DIST)
      return T
  
imports: import numpy
  import scipy.linalg
  from nibabel.affines import apply_affine
  from transforms3d.quaternions import mat2quat, quat2axangle
  from .transform import Transform
label_desc: Use image node_id 4 for calling a global function with example usage: to_matrix44(t, dtype) and returns: T