code: def test_cascade_of_optimizations_and_threading():
      cingulum_bundles = two_cingulum_bundles()
  
      cb1 = cingulum_bundles[0]
      cb1 = set_number_of_points(cb1, 20)
  
      test_x0 = np.array(
          [10, 4, 3, 0, 20, 10, 1.5, 1.5, 1.5, 0.0, 0.2, 0]
      )
  
      cb2 = transform_streamlines(
          cingulum_bundles[0], compose_matrix44(test_x0)
      )
      cb2 = set_number_of_points(cb2, 20)
  
      print("first rigid")
      slr = StreamlineLinearRegistration(x0=6, num_threads=1)
      slm = slr.optimize(cb1, cb2)
  
      print("then similarity")
      slr2 = StreamlineLinearRegistration(x0=7, num_threads=2)
      slm2 = slr2.optimize(cb1, cb2, slm.matrix)
  
      print("then affine")
      slr3 = StreamlineLinearRegistration(
          x0=12, options={"maxiter": 50}, num_threads=None
      )
      slm3 = slr3.optimize(cb1, cb2, slm2.matrix)
  
      assert_(slm2.fopt < slm.fopt)
      assert_(slm3.fopt < slm2.fopt)
  
imports: import numpy
  from numpy.testing import assert_, assert_equal, assert_almost_equal, assert_array_almost_equal, assert_raises
  from dipy.align.streamlinear import compose_matrix44, decompose_matrix44, BundleSumDistanceMatrixMetric, BundleMinDistanceMatrixMetric, BundleMinDistanceMetric, StreamlineLinearRegistration, StreamlineDistanceMetric, groupwise_slr, get_unique_pairs
  from dipy.tracking.streamline import center_streamlines, unlist_streamlines, relist_streamlines, transform_streamlines, set_number_of_points, Streamlines
  from dipy.io.streamline import load_tractogram
  from dipy.core.geometry import compose_matrix
  from dipy.data import get_fnames, two_cingulum_bundles, read_five_af_bundles
  from dipy.align.bundlemin import _bundle_minimum_distance_matrix, _bundle_minimum_distance, distance_matrix_mdf
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 21 for calling a global function with example usage: test_cascade_of_optimizations_and_threading() without return types