code: def compare_orientation_sets(S, T):
      r"""Computes the mean cosine distance of the best match between
      points of two sets of vectors S and T (angular similarity)
  
      Parameters
      ----------
      S : array, shape (m,d)
          First set of vectors.
      T : array, shape (n,d)
          Second set of vectors.
  
      Returns
      -------
      max_mean_cosine : float
          Maximum mean cosine distance.
  
      Examples
      --------
      >>> from dipy.core.sphere_stats import compare_orientation_sets
      >>> S=np.array([[1,0,0],[0,1,0],[0,0,1]])
      >>> T=np.array([[1,0,0],[0,0,1]])
      >>> compare_orientation_sets(S,T)
      1.0
      >>> T=np.array([[0,1,0],[1,0,0],[0,0,1]])
      >>> S=np.array([[1,0,0],[0,0,1]])
      >>> compare_orientation_sets(S,T)
      1.0
      >>> from dipy.core.sphere_stats import compare_orientation_sets
      >>> S=np.array([[-1,0,0],[0,1,0],[0,0,1]])
      >>> T=np.array([[1,0,0],[0,0,-1]])
      >>> compare_orientation_sets(S,T)
      1.0
  
      """
  
      m = len(S)
      n = len(T)
      if m < n:
          A = S.copy()
          a = m
          S = T
          T = A
          n = a
  
      v = [
          np.sum([np.abs(np.dot(p[i], T[i])) for i in range(n)])
          for p in permutations(S, n)
      ]
      return np.max(v) / float(n)
  
imports: import numpy
  import dipy.core.geometry
  from itertools import permutations
label_desc: Use image node_id 3 for calling a global function with example usage: compare_orientation_sets(S, T) and returns: unknown