class_docstr: Class for fitting the Diffusion Kurtosis Model
docstr: Compute axial kurtosis (AK) of a diffusion kurtosis tensor [1]_
  
  Parameters
  ----------
  min_kurtosis : float (optional)
      To keep kurtosis values within a plausible biophysical range, axial
      kurtosis values that are smaller than `min_kurtosis` are replaced
      with -3./7 (theoretical kurtosis limit
      for regions that consist of water confined to spherical pores [2]_)
  max_kurtosis : float (optional)
      To keep kurtosis values within a plausible biophysical range, axial
      kurtosis values that are larger than `max_kurtosis` are replaced
      with `max_kurtosis`. Default = 10
  analytical : bool (optional)
      If True, AK is calculated from rotated diffusion kurtosis tensor,
      otherwise it will be computed from the apparent diffusion kurtosis
      values along the principal axis of the diffusion tensor
      (see notes). Default is set to True.
  
  Returns
  -------
  ak : array
      Calculated AK.
  
  Notes
  -----
  AK is defined as the directional kurtosis parallel to the fiber's main
  direction e1 [1]_, [2]_. You can compute AK using to approaches:
  
  1) AK is calculated from rotated diffusion kurtosis tensor [2]_, i.e.:
  
  .. math::
      AK = \hat{W}_{1111}
      \frac{(\lambda_{1}+\lambda_{2}+\lambda_{3})^2}{(9 \lambda_{1}^2)}
  
  2) AK can be sampled from the principal axis of the diffusion tensor:
  
  .. math::
      AK = K(\mathbf{\mathbf{e}_1)
  
  Although both approaches leads to an exact calculation of AK, the
  first approach will be referred to as the analytical method while the
  second approach will be referred to as the numerical method based on
  their analogy to the estimation strategies for MK and RK.
  
  References
  ----------
  .. [1] Jensen, J.H., Helpern, J.A., 2010. MRI quantification of
         non-Gaussian water diffusion by kurtosis analysis. NMR in
         Biomedicine 23(7): 698-710
  .. [2] Tabesh, A., Jensen, J.H., Ardekani, B.A., Helpern, J.A., 2011.
         Estimation of tensors and tensor-derived measures in diffusional
         kurtosis imaging. Magn Reson Med. 65(3), 823-836
  .. [3] Barmpoutis, A., & Zhuo, J., 2011. Diffusion kurtosis imaging:
         Robust estimation from DW-MRI using homogeneous polynomials.
         Proceedings of the 8th {IEEE} International Symposium on
         Biomedical Imaging: From Nano to Macro, ISBI 2011, 262-265.
         doi: 10.1109/ISBI.2011.5872402
docstr_tok: ["Compute","axial","kurtosis","(","AK",")","of","a","diffusion","kurtosis","tensor","[","1","]","_","Parameters","--","--","--","--","--","min_kurtosis",":","float","(","optional",")","To","keep","kurtosis","values","within","a","plausible","biophysical","range",",","axial","kurtosis","values","that","are","smaller","than","`","min_kurtosis","`","are","replaced","with","-3.\/7","(","theoretical","kurtosis","limit","for","regions","that","consist","of","water","confined","to","spherical","pores","[","2","]","_",")","max_kurtosis",":","float","(","optional",")","To","keep","kurtosis","values","within","a","plausible","biophysical","range",",","axial","kurtosis","values","that","are","larger","than","`","max_kurtosis","`","are","replaced","with","`","max_kurtosis","`",".","Default","=","10","analytical",":","bool","(","optional",")","If","True",",","AK","is","calculated","from","rotated","diffusion","kurtosis","tensor",",","otherwise","it","will","be","computed","from","the","apparent","diffusion","kurtosis","values","along","the","principal","axis","of","the","diffusion","tensor","(","see","notes",")",".","Default","is","set","to","True",".","Returns","--","--","--","-","ak",":","array","Calculated","AK",".","Notes","--","--","-","AK","is","defined","as","the","directional","kurtosis","parallel","to","the","fiber","'s","main","direction","e1","[","1","]","_",",","[","2","]","_",".","You","can","compute","AK","using","to","approaches",":","1",")","AK","is","calculated","from","rotated","diffusion","kurtosis","tensor","[","2","]","_",",","i.e",".",":","..","math",":",":","AK","=","\\hat","{","W","}","_","{","1111","}","\\frac","{","(","\\lambda_","{","1","}","+\\lambda_","{","2","}","+\\lambda_","{","3","}",")","^2","}","{","(","9","\\lambda_","{","1","}","^2",")","}","2",")","AK","can","be","sampled","from","the","principal","axis","of","the","diffusion","tensor",":","..","math",":",":","AK","=","K","(","\\mathbf","{","\\mathbf","{","e","}","_1",")","Although","both","approaches","leads","to","an","exact","calculation","of","AK",",","the","first","approach","will","be","referred","to","as","the","analytical","method","while","the","second","approach","will","be","referred","to","as","the","numerical","method","based","on","their","analogy","to","the","estimation","strategies","for","MK","and","RK",".","References","--","--","--","--","--","..","[","1","]","Jensen",",","J.H.",",","Helpern",",","J.A.",",","2010",".","MRI","quantification","of","non-Gaussian","water","diffusion","by","kurtosis","analysis",".","NMR","in","Biomedicine","23","(","7",")",":","698-710","..","[","2","]","Tabesh",",","A.",",","Jensen",",","J.H.",",","Ardekani",",","B.A.",",","Helpern",",","J.A.",",","2011",".","Estimation","of","tensors","and","tensor-derived","measures","in","diffusional","kurtosis","imaging",".","Magn","Reson","Med",".","65","(","3",")",",","823-836","..","[","3","]","Barmpoutis",",","A.",",","&","Zhuo",",","J.",",","2011",".","Diffusion","kurtosis","imaging",":","Robust","estimation","from","DW-MRI","using","homogeneous","polynomials",".","Proceedings","of","the","8th","{","IEEE","}","International","Symposium","on","Biomedical","Imaging",":","From","Nano","to","Macro",",","ISBI","2011",",","262-265.","doi",":","10.1109\/ISBI.2011.5872402"]
code: def ak(self, min_kurtosis=-3.0 / 7, max_kurtosis=10, analytical=True):
      r"""
      Compute axial kurtosis (AK) of a diffusion kurtosis tensor [1]_
  
      Parameters
      ----------
      min_kurtosis : float (optional)
          To keep kurtosis values within a plausible biophysical range, axial
          kurtosis values that are smaller than `min_kurtosis` are replaced
          with -3./7 (theoretical kurtosis limit
          for regions that consist of water confined to spherical pores [2]_)
      max_kurtosis : float (optional)
          To keep kurtosis values within a plausible biophysical range, axial
          kurtosis values that are larger than `max_kurtosis` are replaced
          with `max_kurtosis`. Default = 10
      analytical : bool (optional)
          If True, AK is calculated from rotated diffusion kurtosis tensor,
          otherwise it will be computed from the apparent diffusion kurtosis
          values along the principal axis of the diffusion tensor
          (see notes). Default is set to True.
  
      Returns
      -------
      ak : array
          Calculated AK.
  
      Notes
      -----
      AK is defined as the directional kurtosis parallel to the fiber's main
      direction e1 [1]_, [2]_. You can compute AK using to approaches:
  
      1) AK is calculated from rotated diffusion kurtosis tensor [2]_, i.e.:
  
      .. math::
          AK = \hat{W}_{1111}
          \frac{(\lambda_{1}+\lambda_{2}+\lambda_{3})^2}{(9 \lambda_{1}^2)}
  
      2) AK can be sampled from the principal axis of the diffusion tensor:
  
      .. math::
          AK = K(\mathbf{\mathbf{e}_1)
  
      Although both approaches leads to an exact calculation of AK, the
      first approach will be referred to as the analytical method while the
      second approach will be referred to as the numerical method based on
      their analogy to the estimation strategies for MK and RK.
  
      References
      ----------
      .. [1] Jensen, J.H., Helpern, J.A., 2010. MRI quantification of
             non-Gaussian water diffusion by kurtosis analysis. NMR in
             Biomedicine 23(7): 698-710
      .. [2] Tabesh, A., Jensen, J.H., Ardekani, B.A., Helpern, J.A., 2011.
             Estimation of tensors and tensor-derived measures in diffusional
             kurtosis imaging. Magn Reson Med. 65(3), 823-836
      .. [3] Barmpoutis, A., & Zhuo, J., 2011. Diffusion kurtosis imaging:
             Robust estimation from DW-MRI using homogeneous polynomials.
             Proceedings of the 8th {IEEE} International Symposium on
             Biomedical Imaging: From Nano to Macro, ISBI 2011, 262-265.
             doi: 10.1109/ISBI.2011.5872402
  
      """
      return axial_kurtosis(
          self.model_params, min_kurtosis, max_kurtosis, analytical
      )
  
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 5 for calling the DiffusionKurtosisFit obj's underlying member method code with example usage: obj.ak(min_kurtosis, max_kurtosis, analytical) and returns: axial_kurtosis