code: def test_qbx_and_merge(rng):
      # Generate synthetic streamlines
      bundles = bearing_bundles(4, 2)
      bundles.append(straight_bundle(1, rng=rng))
  
      streamlines = Streamlines(list(itertools.chain(*bundles)))
  
      thresholds = [10, 2, 1]
  
      qbxm = qbx_and_merge(streamlines, thresholds, rng=rng)
  
      qbxm_centroids = qbxm.centroids
  
      qbxm_clusters = qbxm.clusters
  
      qbx = QuickBundlesX(thresholds)
      tree = qbx.cluster(streamlines)
      qbx_centroids = tree.get_clusters(3).centroids
  
      assert_equal(len(qbx_centroids) > len(qbxm_centroids), True)
  
      # check that refdata clusters return streamlines in qbx_and_merge
      streamline_idx = qbxm_clusters[0].indices[0]
      assert_array_equal(
          qbxm_clusters[0][0], streamlines[streamline_idx]
      )
  
imports: import itertools
  import numpy
  from numpy.testing import assert_array_equal, assert_equal, assert_raises
  from dipy.segment.clustering import QuickBundlesX, QuickBundles, qbx_and_merge
  from dipy.segment.featurespeed import ResampleFeature
  from dipy.segment.metricspeed import AveragePointwiseEuclideanMetric, MinimumAverageDirectFlipMetric
  from dipy.tracking.streamline import set_number_of_points
  from dipy.tracking.streamline import Streamlines
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 12 for calling a global function with example usage: test_qbx_and_merge(rng) without return types