code: def bundle_shape_similarity(
      bundle1, bundle2, rng, clust_thr=(5, 3, 1.5), threshold=6
  ):
      """Calculates bundle shape similarity between two given bundles using
      bundle adjacency (BA) metric
  
      Parameters
      ----------
      bundle1 : Streamlines
          White matter tract from one subject (eg: AF_L)
      bundle2 : Streamlines
          White matter tract from another subject (eg: AF_L)
      rng : np.random.Generator
      clust_thr : array-like, optional
          list of clustering thresholds used in quickbundlesX
      threshold : float, optional
          Threshold used for in computing bundle adjacency. Threshold controls
          how much strictness user wants while calculating shape similarity
          between two bundles. Smaller threshold means bundles should be strictly
          similar to get higher shape similarity score.
  
      Returns
      -------
      ba_value : Float
          Bundle similarity score between two tracts
  
      References
      ----------
      .. [Chandio2020] Chandio, B.Q., Risacher, S.L., Pestilli, F., Bullock, D.,
      Yeh, FC., Koudoro, S., Rokem, A., Harezlak, J., and Garyfallidis, E.
      Bundle analytics, a computational framework for investigating the
      shapes and profiles of brain pathways across populations.
      Sci Rep 10, 17149 (2020)
  
      .. [Garyfallidis12] Garyfallidis E. et al., QuickBundles a method for
                          tractography simplification, Frontiers in Neuroscience,
                          vol 6, no 175, 2012.
      """
  
      if len(bundle1) == 0 or len(bundle2) == 0:
          return 0
  
      bundle1_centroids = cluster_bundle(
          bundle1, clust_thr=clust_thr, rng=rng
      )
      bundle2_centroids = cluster_bundle(
          bundle2, clust_thr=clust_thr, rng=rng
      )
      bundle1_centroids = Streamlines(bundle1_centroids)
      bundle2_centroids = Streamlines(bundle2_centroids)
  
      ba_value = ba_analysis(
          recognized_bundle=bundle1_centroids,
          expert_bundle=bundle2_centroids,
          threshold=threshold,
      )
  
      return ba_value
  
imports: from time import time
  from itertools import chain
  import logging
  import numpy
  from dipy.tracking.streamline import set_number_of_points, nbytes, select_random_set_of_streamlines
  from dipy.segment.clustering import qbx_and_merge
  from dipy.tracking.distances import bundles_distances_mdf, bundles_distances_mam
  from dipy.align.streamlinear import StreamlineLinearRegistration, BundleMinDistanceMetric, BundleSumDistanceMatrixMetric, BundleMinDistanceAsymmetricMetric
  from dipy.tracking.streamline import Streamlines, length
  from dipy.utils.deprecator import deprecated_params
  from nibabel.affines import apply_affine
label_desc: Use image node_id 5 for calling a global function with example usage: bundle_shape_similarity(bundle1, bundle2, rng, clust_thr, threshold) and returns: ba_value, int