code: def decompose_matrix44(mat, size=12):
      """Given a 4x4 homogeneous matrix return the parameter vector.
  
      Parameters
      ----------
      mat : array
          Homogeneous 4x4 transformation matrix
      size : int
          Size of the output vector. 3, for translation, 6 for rigid,
          7 for similarity, 9 for scaling and 12 for affine. Default is 12.
  
      Returns
      -------
      t : ndarray
          One dimensional ndarray of 3, 6, 7, 9 or 12 affine parameters.
  
      """
      scale, shear, angles, translate, _ = decompose_matrix(mat)
  
      t = np.zeros(12)
      t[:3] = translate
      if size == 3:
          return t[:3]
      t[3:6] = np.rad2deg(angles)
      if size == 6:
          return t[:6]
      if size == 7:
          t[6] = np.mean(scale)
          return t[:7]
      if size == 9:
          t[6:9] = scale
          return t[:9]
      if size == 12:
          t[6:9] = scale
          t[9:12] = shear
          return t
  
      raise ValueError("Size can be 3, 6, 7, 9 or 12")
  
imports: import logging
  import abc
  from itertools import combinations
  import numpy
  from dipy.core.optimize import Optimizer
  from dipy.align.bundlemin import _bundle_minimum_distance, _bundle_minimum_distance_asymmetric, distance_matrix_mdf
  from dipy.tracking.streamline import transform_streamlines, unlist_streamlines, center_streamlines, set_number_of_points, select_random_set_of_streamlines, length, Streamlines
  from dipy.segment.clustering import qbx_and_merge
  from dipy.core.geometry import compose_transformations, compose_matrix, decompose_matrix
  from time import time
label_desc: Use image node_id 12 for calling a global function with example usage: decompose_matrix44(mat, size) and returns: t, t, t, t, t