code: def dki_prediction(dki_params, gtab, S0=1.0):
      """Predict a signal given diffusion kurtosis imaging parameters
  
      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
      gtab : a GradientTable class instance
          The gradient table for this prediction
      S0 : float or ndarray (optional)
          The non diffusion-weighted signal in every voxel, or across all
          voxels. Default: 1
  
      Returns
      -------
      S : (..., N) ndarray
          Simulated signal based on the DKI model:
  
      .. math::
  
          S=S_{0}e^{-bD+\frac{1}{6}b^{2}D^{2}K}
  
      """
      evals, evecs, kt = split_dki_param(dki_params)
  
      # Define DKI design matrix according to given gtab
      A = design_matrix(gtab)
  
      # Flat parameters and initialize pred_sig
      fevals = evals.reshape((-1, evals.shape[-1]))
      fevecs = evecs.reshape((-1,) + evecs.shape[-2:])
      fkt = kt.reshape((-1, kt.shape[-1]))
      pred_sig = np.zeros((len(fevals), len(gtab.bvals)))
      if isinstance(S0, np.ndarray):
          S0_vol = np.reshape(S0, (len(fevals)))
      else:
          S0_vol = S0
      # looping for all voxels
      for v in range(len(pred_sig)):
          DT = np.dot(
              np.dot(fevecs[v], np.diag(fevals[v])), fevecs[v].T
          )
          dt = lower_triangular(DT)
          MD = (dt[0] + dt[2] + dt[5]) / 3
          if isinstance(S0_vol, np.ndarray):
              this_S0 = S0_vol[v]
          else:
              this_S0 = S0_vol
          X = np.concatenate(
              (dt, fkt[v] * MD * MD, np.array([-np.log(this_S0)])),
              axis=0,
          )
          pred_sig[v] = np.exp(np.dot(A, X))
  
      # Reshape data according to the shape of dki_params
      pred_sig = pred_sig.reshape(
          dki_params.shape[:-1] + (pred_sig.shape[-1],)
      )
  
      return pred_sig
  
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 20 for calling a global function with example usage: dki_prediction(dki_params, gtab, S0) and returns: pred_sig