code: def bundlewarp_shape_analysis(
      moving_aligned, deformed_bundle, no_disks=10, plotting=False
  ):
      """Calculate bundle shape difference profile.
  
      Bundle shape difference analysis using magnitude from BundleWarp
      displacements and BUAN.
  
      Depending on the number of points of a streamline, and the number of
      segments requested, multiple points may be considered for the computation
      of a given segment; a segment may contain information from a single point;
      or some segments may not contain information from any points. In the latter
      case, the segment will contain an ``np.nan`` value. The point-to-segment
      mapping is defined by the :func:`assignment_map`: for each segment index,
      the point information of the matching index positions, as returned by
      :func:`assignment_map`, are considered for the computation.
  
      Parameters
      ----------
      moving_aligned : Streamlines
          Linearly (affinely) moved bundle
      deformed_bundle : Streamlines
          Nonlinearly (warped) moved bundle
      no_disks : int, optional
          Number of segments to be created along the length of the bundle
      plotting : Boolean, optional
          Plot bundle shape profile
  
      Returns
      -------
      shape_profile : np.ndarray
          Float array containing bundlewarp displacement magnitudes along the
          length of the bundle
      stdv : np.ndarray
          Float array containing standard deviations
      """
      n = no_disks
      offsets, directions, colors = bundlewarp_vector_filed(
          moving_aligned, deformed_bundle
      )
  
      indx = assignment_map(deformed_bundle, deformed_bundle, n)
      indx = np.array(indx)
  
      rng = np.random.default_rng()
  
      colors = rng.random((n, 3))
  
      disks_color = []
      for _, ind in enumerate(indx):
          disks_color.append(tuple(colors[ind]))
  
      x = np.array(range(1, n + 1))
      shape_profile = np.zeros(n)
      stdv = np.zeros(n)
  
      for i in range(n):
          mask = indx == i
          if sum(mask):
              shape_profile[i] = np.mean(offsets[mask])
              stdv[i] = np.std(offsets[mask])
          else:
              shape_profile[i] = np.nan
              stdv[i] = np.nan
  
      if plotting:
          bundle_shape_profile(x, shape_profile, stdv)
  
      return shape_profile, stdv
  
file_path: dipy/dipy/align/streamwarp.py
imports: import warnings
  import numpy
  from scipy.optimize import linear_sum_assignment
  from dipy.align.streamlinear import slr_with_qbx
  from dipy.align.cpd import DeformableRegistration
  from dipy.tracking.streamline import unlist_streamlines, Streamlines
  from dipy.stats.analysis import assignment_map
  from dipy.tracking.streamline import length
  from dipy.align.bundlemin import distance_matrix_mdf
  from dipy.viz.plotting import bundle_shape_profile
  from dipy.segment.clustering import QuickBundles
  from dipy.segment.metricspeed import AveragePointwiseEuclideanMetric
label_desc: Use image node_id 5 for calling a global function with example usage: bundlewarp_shape_analysis(moving_aligned, deformed_bundle, no_disks, plotting) and returns: shape_profile,  stdv