code: def kurtosis_fractional_anisotropy(dki_params):
      r"""Compute the anisotropy of the kurtosis tensor (KFA) [1]_
  
      Parameters
      ----------
      dki_params : ndarray (x, y, z, 27) or (n, 27)
      All parameters estimated from the diffusion kurtosis model.
      Parameters are ordered as follows:
          1) Three diffusion tensor's eigenvalues
          2) Three lines of the eigenvector matrix each containing the first,
              second and third coordinates of the eigenvector
          3) Fifteen elements of the kurtosis tensor
      Returns
      -------
      kfa : array
          Calculated mean kurtosis tensor.
  
      Notes
      -----
      The KFA is defined as [1]_:
  
      .. math::
  
           KFA \equiv
           \frac{||\mathbf{W} - MKT \mathbf{I}^{(4)}||_F}{||\mathbf{W}||_F}
  
      where $W$ is the kurtosis tensor, MKT the kurtosis tensor mean, $I^(4)$ is
      the fully symmetric rank 2 isotropic tensor and $||...||_F$ is the tensor's
      Frobenius norm [1]_.
  
      References
      ----------
      .. [1] Glenn, G. R., Helpern, J. A., Tabesh, A., and Jensen, J. H. (2015).
             Quantitative assessment of diffusional kurtosis anisotropy.
             NMR in Biomedicine 28, 448–459. doi:10.1002/nbm.3271
  
      """
      Wxxxx = dki_params[..., 12]
      Wyyyy = dki_params[..., 13]
      Wzzzz = dki_params[..., 14]
      Wxxxy = dki_params[..., 15]
      Wxxxz = dki_params[..., 16]
      Wxyyy = dki_params[..., 17]
      Wyyyz = dki_params[..., 18]
      Wxzzz = dki_params[..., 19]
      Wyzzz = dki_params[..., 20]
      Wxxyy = dki_params[..., 21]
      Wxxzz = dki_params[..., 22]
      Wyyzz = dki_params[..., 23]
      Wxxyz = dki_params[..., 24]
      Wxyyz = dki_params[..., 25]
      Wxyzz = dki_params[..., 26]
  
      W = (
          1.0
          / 5.0
          * (Wxxxx + Wyyyy + Wzzzz + 2 * Wxxyy + 2 * Wxxzz + 2 * Wyyzz)
      )
  
      # Compute's equation numerator
      A = (
          (Wxxxx - W) ** 2
          + (Wyyyy - W) ** 2
          + (Wzzzz - W) ** 2
          + 4
          * (
              Wxxxy**2
              + Wxxxz**2
              + Wxyyy**2
              + Wyyyz**2
              + Wxzzz**2
              + Wyzzz**2
          )
          + 6
          * (
              (Wxxyy - W / 3) ** 2
              + (Wxxzz - W / 3) ** 2
              + (Wyyzz - W / 3) ** 2
          )
          + 12 * (Wxxyz**2 + Wxyyz**2 + Wxyzz**2)
      )
  
      # Compute's equation denominator
      B = (
          Wxxxx**2
          + Wyyyy**2
          + Wzzzz**2
          + 4
          * (
              Wxxxy**2
              + Wxxxz**2
              + Wxyyy**2
              + Wyyyz**2
              + Wxzzz**2
              + Wyzzz**2
          )
          + 6 * (Wxxyy**2 + Wxxzz**2 + Wyyzz**2)
          + 12 * (Wxxyz**2 + Wxyyz**2 + Wxyzz**2)
      )
  
      # Compute KFA
      KFA = np.zeros(A.shape)
      cond1 = B > 0  # Avoiding Singularity (if B = 0, KFA = 0)
      # Avoiding overestimating KFA for small MKT values (KFA=0, MKT < tol)
      cond2 = W > 1e-8
      cond = np.logical_and(cond1, cond2)
      KFA[cond] = np.sqrt(A[cond] / B[cond])
  
      return KFA
  
imports: import numpy
  import warnings
  import scipy.optimize
  import dipy.core.sphere
  from dipy.reconst.multi_voxel import multi_voxel_fit
  from dipy.reconst.dti import TensorFit, mean_diffusivity, from_lower_triangular, lower_triangular, decompose_tensor, MIN_POSITIVE_SIGNAL, nlls_fit_tensor, restore_fit_tensor
  from dipy.reconst.utils import dki_design_matrix
  from dipy.reconst.recspeed import local_maxima
  from dipy.reconst.base import ReconstModel
  from dipy.core.ndindex import ndindex
  from dipy.core.geometry import sphere2cart, cart2sphere, perpendicular_directions
  from dipy.core.optimize import PositiveDefiniteLeastSquares
  from dipy.data import get_sphere, get_fnames, load_sdp_constraints
  from dipy.reconst.vec_val_sum import vec_val_vect
  from dipy.core.gradients import check_multi_b
label_desc: Use image node_id 19 for calling a global function with example usage: kurtosis_fractional_anisotropy(dki_params) and returns: KFA