code: def _voxel_kurtosis_maximum(dt, md, kt, sphere, gtol=1e-2):
      """Compute the maximum value of a single voxel kurtosis tensor
  
      Parameters
      ----------
      dt : array (6,)
          elements of the diffusion tensor of the voxel.
      md : float
          mean diffusivity of the voxel
      kt : array (15,)
          elements of the kurtosis tensor of the voxel.
      sphere : Sphere class instance, optional
          The sphere providing sample directions for the initial search of the
          maximum value of kurtosis.
      gtol : float, optional
          This input is to refine kurtosis maximum under the precision of the
          directions sampled on the sphere class instance. The gradient of the
          convergence procedure must be less than gtol before successful
          termination. If gtol is None, fiber direction is directly taken from
          the initial sampled directions of the given sphere object
  
      Returns
      -------
      max_value : float
          kurtosis tensor maximum value
      max_dir : array (3,)
          Cartesian coordinates of the direction of the maximal kurtosis value
  
      """
      # Estimation of maximum kurtosis candidates
      akc = directional_kurtosis(dt, md, kt, sphere.vertices)
      max_val, ind = local_maxima(akc, sphere.edges)
      n = len(max_val)
  
      # case that none maximum was find (spherical or null kurtosis tensors)
      if n == 0:
          return np.mean(akc), np.zeros(3)
  
      max_dir = sphere.vertices[ind]
  
      # Select the maximum from the candidates
      max_value = max(max_val)
      max_direction = max_dir[np.argmax(max_val.argmax)]
  
      # refine maximum direction
      if gtol is not None:
          for p in range(n):
              r, theta, phi = cart2sphere(
                  max_dir[p, 0], max_dir[p, 1], max_dir[p, 2]
              )
              ang = np.array([theta, phi])
              ang[:] = opt.fmin_bfgs(
                  _kt_maximum_converge,
                  ang,
                  args=(dt, md, kt),
                  disp=False,
                  retall=False,
                  gtol=gtol,
              )
              k_dir = np.array([sphere2cart(1.0, ang[0], ang[1])])
              k_val = directional_kurtosis(dt, md, kt, k_dir)
              if k_val > max_value:
                  max_value = k_val
                  max_direction = k_dir
  
      return max_value.item(), max_direction
  
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 16 for calling a global function with example usage: _voxel_kurtosis_maximum(dt, md, kt, sphere, gtol) and returns: max_value,  max_direction, np,  np