code: def from_6x6_to_21x1(T):
      """Convert symmetric 6 x 6 matrices into 21 x 1 vectors.
  
      Parameters
      ----------
      T : numpy.ndarray
          An array of size (..., 6, 6).
  
      Returns
      -------
      V : numpy.ndarray
          Converted vectors of size (..., 21, 1).
  
      Notes
      -----
      The conversion of a matrix into a vector is defined as
  
          .. math::
  
              \begin{matrix}
              \mathbf{V} = & \big[
              T_{11} & T_{22} & T_{33} \\
              & \sqrt{2} T_{23} & \sqrt{2} T_{13} & \sqrt{2} T_{12} \\
              & \sqrt{2} T_{14} & \sqrt{2} T_{15} & \sqrt{2} T_{16} \\
              & \sqrt{2} T_{24} & \sqrt{2} T_{25} & \sqrt{2} T_{26} \\
              & \sqrt{2} T_{34} & \sqrt{2} T_{35} & \sqrt{2} T_{36} \\
              & T_{44} & T_{55} & T_{66} \\
              & \sqrt{2} T_{45} & \sqrt{2} T_{56} & \sqrt{2} T_{46} \big]^T
              \end{matrix}
      """
      if T.shape[-2::] != (6, 6):
          raise ValueError(
              "The shape of the input array must be (..., 6, 6)."
          )
      if not np.all(
          np.isclose(T, np.swapaxes(T, -1, -2), equal_nan=True)
      ):
          warn(
              "All matrices converted to Voigt notation are not symmetric."
          )
      C = np.sqrt(2)
      V = np.stack(
          (
              [
                  T[..., 0, 0],
                  T[..., 1, 1],
                  T[..., 2, 2],
                  C * T[..., 1, 2],
                  C * T[..., 0, 2],
                  C * T[..., 0, 1],
                  C * T[..., 0, 3],
                  C * T[..., 0, 4],
                  C * T[..., 0, 5],
                  C * T[..., 1, 3],
                  C * T[..., 1, 4],
                  C * T[..., 1, 5],
                  C * T[..., 2, 3],
                  C * T[..., 2, 4],
                  C * T[..., 2, 5],
                  T[..., 3, 3],
                  T[..., 4, 4],
                  T[..., 5, 5],
                  C * T[..., 3, 4],
                  C * T[..., 4, 5],
                  C * T[..., 3, 5],
              ]
          ),
          axis=-1,
      )[..., np.newaxis]
      return V
  
imports: from warnings import warn
  import numpy
  from dipy.reconst.base import ReconstModel
  from dipy.reconst.dti import auto_attr
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 3 for calling a global function with example usage: from_6x6_to_21x1(T) and returns: V