class_docstr: This class is intended for the ResDNN Histology Network model.
class_docstr_tok: ["This","class","is","intended","for","the","ResDNN","Histology","Network","model","."]
docstr: The model was re-trained for usage with a different basis function
  ('tournier07') like the proposed model in [1, 2].
  
  To obtain the pre-trained model, use::
  >>> resdnn_model = HistoResDNN() # skip if not have_tf
  >>> fetch_model_weights_path = get_fnames('histo_resdnn_weights') # skip if not have_tf
  >>> resdnn_model.load_model_weights(fetch_model_weights_path) # skip if not have_tf
  
  This model is designed to take as input raw DWI signal on a sphere
  (ODF) represented as SH of order 8 in the tournier basis and predict
  fODF of order 8 in the tournier basis. Effectively, this model is
  mimicking a CSD fit.
  
  Parameters
  ----------
  sh_order : int, optional
      Maximum SH order in the SH fit.  For ``sh_order``, there will be
      ``(sh_order + 1) * (sh_order + 2) / 2`` SH coefficients for a
      symmetric basis. Default: 8
  basis_type : {'tournier07', 'descoteaux07'}, optional
      ``tournier07`` (default) or ``descoteaux07``.
  verbose : bool (optional)
      Whether to show information about the processing.
      Default: False
  
  References
  ----------
  ..  [1] Nath, V., Schilling, K. G., Parvathaneni, P., Hansen,
      C. B., Hainline, A. E., Huo, Y., ... & Stepniewska, I. (2019).
      Deep learning reveals untapped information for local white-matter
      fiber reconstruction in diffusion-weighted MRI.
      Magnetic resonance imaging, 62, 220-227.
  ..  [2] Nath, V., Schilling, K. G., Hansen, C. B., Parvathaneni,
      P., Hainline, A. E., Bermudez, C., ... & Stępniewska, I. (2019).
      Deep learning captures more accurate diffusion fiber orientations
      distributions than constrained spherical deconvolution.
      arXiv preprint arXiv:1911.07927.
docstr_tok: ["The","model","was","re-trained","for","usage","with","a","different","basis","function","(","'tournier07","'",")","like","the","proposed","model","in","[","1",",","2","]",".","To","obtain","the","pre-trained","model",",","use",":",":",">",">",">","resdnn_model","=","HistoResDNN","(",")","#","skip","if","not","have_tf",">",">",">","fetch_model_weights_path","=","get_fnames","(","'histo_resdnn_weights","'",")","#","skip","if","not","have_tf",">",">",">","resdnn_model.load_model_weights","(","fetch_model_weights_path",")","#","skip","if","not","have_tf","This","model","is","designed","to","take","as","input","raw","DWI","signal","on","a","sphere","(","ODF",")","represented","as","SH","of","order","8","in","the","tournier","basis","and","predict","fODF","of","order","8","in","the","tournier","basis",".","Effectively",",","this","model","is","mimicking","a","CSD","fit",".","Parameters","--","--","--","--","--","sh_order",":","int",",","optional","Maximum","SH","order","in","the","SH","fit",".","For","``","sh_order","``",",","there","will","be","``","(","sh_order","+","1",")","*","(","sh_order","+","2",")","\/","2","``","SH","coefficients","for","a","symmetric","basis",".","Default",":","8","basis_type",":","{","'tournier07","'",",","'descoteaux07","'","}",",","optional","``","tournier07","``","(","default",")","or","``","descoteaux07","``",".","verbose",":","bool","(","optional",")","Whether","to","show","information","about","the","processing",".","Default",":","False","References","--","--","--","--","--","..","[","1","]","Nath",",","V.",",","Schilling",",","K.","G.",",","Parvathaneni",",","P.",",","Hansen",",","C.","B.",",","Hainline",",","A.","E.",",","Huo",",","Y.",",","...","&","Stepniewska",",","I",".","(","2019",")",".","Deep","learning","reveals","untapped","information","for","local","white-matter","fiber","reconstruction","in","diffusion-weighted","MRI",".","Magnetic","resonance","imaging",",","62",",","220-227",".","..","[","2","]","Nath",",","V.",",","Schilling",",","K.","G.",",","Hansen",",","C.","B.",",","Parvathaneni",",","P.",",","Hainline",",","A.","E.",",","Bermudez",",","C.",",","...","&","St\u0119pniewska",",","I",".","(","2019",")",".","Deep","learning","captures","more","accurate","diffusion","fiber","orientations","distributions","than","constrained","spherical","deconvolution",".","arXiv","preprint","arXiv:1911.07927","."]
code: def __init__(
      self, sh_order=8, basis_type="tournier07", verbose=False
  ):
      r"""
      The model was re-trained for usage with a different basis function
      ('tournier07') like the proposed model in [1, 2].
  
      To obtain the pre-trained model, use::
      >>> resdnn_model = HistoResDNN() # skip if not have_tf
      >>> fetch_model_weights_path = get_fnames('histo_resdnn_weights') # skip if not have_tf
      >>> resdnn_model.load_model_weights(fetch_model_weights_path) # skip if not have_tf
  
      This model is designed to take as input raw DWI signal on a sphere
      (ODF) represented as SH of order 8 in the tournier basis and predict
      fODF of order 8 in the tournier basis. Effectively, this model is
      mimicking a CSD fit.
  
      Parameters
      ----------
      sh_order : int, optional
          Maximum SH order in the SH fit.  For ``sh_order``, there will be
          ``(sh_order + 1) * (sh_order + 2) / 2`` SH coefficients for a
          symmetric basis. Default: 8
      basis_type : {'tournier07', 'descoteaux07'}, optional
          ``tournier07`` (default) or ``descoteaux07``.
      verbose : bool (optional)
          Whether to show information about the processing.
          Default: False
  
      References
      ----------
      ..  [1] Nath, V., Schilling, K. G., Parvathaneni, P., Hansen,
          C. B., Hainline, A. E., Huo, Y., ... & Stepniewska, I. (2019).
          Deep learning reveals untapped information for local white-matter
          fiber reconstruction in diffusion-weighted MRI.
          Magnetic resonance imaging, 62, 220-227.
      ..  [2] Nath, V., Schilling, K. G., Hansen, C. B., Parvathaneni,
          P., Hainline, A. E., Bermudez, C., ... & Stępniewska, I. (2019).
          Deep learning captures more accurate diffusion fiber orientations
          distributions than constrained spherical deconvolution.
          arXiv preprint arXiv:1911.07927.
      """
  
      if not have_tf:
          raise tf()
  
      self.sh_order = sh_order
      self.sh_size = len(sph_harm_ind_list(sh_order)[0])
      self.basis_type = basis_type
  
      log_level = "INFO" if verbose else "CRITICAL"
      set_logger_level(log_level, logger)
      if self.basis_type != "tournier07":
          logger.warning(
              "Be careful, original weights were obtained "
              "from training on the tournier07 basis, "
              "unless you re-trained the network, do not "
              "change basis!"
          )
  
      # ResDNN Network Flow
      num_hidden = self.sh_size
      inputs = Input(shape=(self.sh_size,))
      x1 = Dense(400, activation="relu")(inputs)
      x2 = Dense(num_hidden, activation="relu")(x1)
      x3 = Dense(200, activation="relu")(x2)
      x4 = Dense(num_hidden, activation="linear")(x3)
      res_add = Add()([x2, x4])
      x5 = Dense(200, activation="relu")(res_add)
      x6 = Dense(num_hidden)(x5)
  
      self.model = Model(inputs=inputs, outputs=x6)
  
file_path: dipy/dipy/nn/histo_resdnn.py
imports: import logging
  import numpy
  from dipy.core.gradients import unique_bvals_magnitude, get_bval_indices
  from dipy.core.sphere import HemiSphere
  from dipy.data import get_sphere, get_fnames
  from dipy.reconst.shm import sf_to_sh, sh_to_sf, sph_harm_ind_list
  from dipy.testing.decorators import doctest_skip_parser
  from dipy.utils.optpkg import optional_package
  from dipy.nn.utils import set_logger_level
label_desc: Use image node_id 1 to create a new HistoResDNN object  with example: obj = HistoResDNN(sh_order, basis_type, verbose)