docstr: Covariance tensor model of q-space trajectory imaging [1]_.
  
  Parameters
  ----------
  gtab : dipy.core.gradients.GradientTable
      Gradient table with b-tensors.
  fit_method : str, optional
      Must be one of the following:
          'OLS' for ordinary least squares
              :func:`qti._ols_fit`
          'WLS' for weighted least squares
              :func:`qti._wls_fit`
          'SDPDc' for semidefinite programming with positivity
                  constraints applied [2]_
              :func:`qti._sdpdc_fit`
  cvxpy_solver: str, optionals
      solver for the SDP formulation. default: 'SCS'
  
  References
  ----------
  .. [1] Westin, Carl-Fredrik, et al. "Q-space trajectory imaging for
     multidimensional diffusion MRI of the human brain." Neuroimage 135
     (2016): 345-362. https://doi.org/10.1016/j.neuroimage.2016.02.039.
  .. [2] Herberthson M., Boito D., Dela Haije T., Feragen A., Westin CF.,
      Ozarslan E., "Q-space trajectory imaging with positivity
      constraints (QTI+)" in Neuroimage, Volume 238, 2021.
docstr_tok: ["Covariance","tensor","model","of","q-space","trajectory","imaging","[","1","]","_.","Parameters","--","--","--","--","--","gtab",":","dipy.core.gradients.GradientTable","Gradient","table","with","b-tensors",".","fit_method",":","str",",","optional","Must","be","one","of","the","following",":","'OLS","'","for","ordinary","least","squares",":","func",":","`","qti._ols_fit","`","'WLS","'","for","weighted","least","squares",":","func",":","`","qti._wls_fit","`","'SDPDc","'","for","semidefinite","programming","with","positivity","constraints","applied","[","2","]","_",":","func",":","`","qti._sdpdc_fit","`","cvxpy_solver",":","str",",","optionals","solver","for","the","SDP","formulation",".","default",":","'SCS'","References","--","--","--","--","--","..","[","1","]","Westin",",","Carl-Fredrik",",","et","al",".","``","Q-space","trajectory","imaging","for","multidimensional","diffusion","MRI","of","the","human","brain",".","''","Neuroimage","135","(","2016",")",":","345-362.","https",":","\/\/doi.org\/10.1016\/j.neuroimage.2016.02.039",".","..","[","2","]","Herberthson","M.",",","Boito","D.",",","Dela","Haije","T.",",","Feragen","A.",",","Westin","CF.",",","Ozarslan","E.",",","``","Q-space","trajectory","imaging","with","positivity","constraints","(","QTI+",")","''","in","Neuroimage",",","Volume","238",",","2021","."]
code: def __init__(self, gtab, fit_method="WLS", cvxpy_solver="SCS"):
      """Covariance tensor model of q-space trajectory imaging [1]_.
  
      Parameters
      ----------
      gtab : dipy.core.gradients.GradientTable
          Gradient table with b-tensors.
      fit_method : str, optional
          Must be one of the following:
              'OLS' for ordinary least squares
                  :func:`qti._ols_fit`
              'WLS' for weighted least squares
                  :func:`qti._wls_fit`
              'SDPDc' for semidefinite programming with positivity
                      constraints applied [2]_
                  :func:`qti._sdpdc_fit`
      cvxpy_solver: str, optionals
          solver for the SDP formulation. default: 'SCS'
  
      References
      ----------
      .. [1] Westin, Carl-Fredrik, et al. "Q-space trajectory imaging for
         multidimensional diffusion MRI of the human brain." Neuroimage 135
         (2016): 345-362. https://doi.org/10.1016/j.neuroimage.2016.02.039.
      .. [2] Herberthson M., Boito D., Dela Haije T., Feragen A., Westin CF.,
          Ozarslan E., "Q-space trajectory imaging with positivity
          constraints (QTI+)" in Neuroimage, Volume 238, 2021.
      """
      ReconstModel.__init__(self, gtab)
  
      if self.gtab.btens is None:
          raise ValueError(
              "QTI requires b-tensors to be defined in the gradient table."
          )
      self.X = design_matrix(self.gtab.btens)
      rank = np.linalg.matrix_rank(self.X.T @ self.X)
      if rank < 28:
          warn(
              "The combination of the b-tensor shapes, sizes, and "
              + "orientations does not enable all elements of the covariance "
              + "tensor to be estimated (rank(X.T @ X) = %s < 28)."
              % rank
          )
  
      try:
          self.fit_method = common_fit_methods[fit_method]
      except KeyError:
          raise ValueError(
              "Invalid value (%s) for 'fit_method'." % fit_method
              + " Options: 'OLS', 'WLS', 'SDPdc'."
          )
  
      self.cvxpy_solver = cvxpy_solver
      self.fit_method_name = fit_method
  
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 1 to create a new QtiModel object from inherited base classes: ReconstModel with example: obj = QtiModel(gtab, fit_method, cvxpy_solver)