code: def test_rigid_partial_real_bundles():
      static = fornix_streamlines()[:20]
      moving = fornix_streamlines()[20:40]
      static_center, shift = center_streamlines(static)
      moving_center, shift2 = center_streamlines(moving)
  
      print(shift2)
      mat = compose_matrix(
          translate=np.array([0, 0, 0.0]),
          angles=np.deg2rad([40, 0, 0.0]),
      )
      moved = transform_streamlines(moving_center, mat)
  
      srr = StreamlineLinearRegistration()
  
      srm = srr.optimize(static_center, moved)
      print(srm.fopt)
      print(srm.iterations)
      print(srm.funcs)
  
      moving_back = srm.transform(moved)
      print(srm.matrix)
  
      static_center = set_number_of_points(static_center, 100)
      moving_center = set_number_of_points(moving_back, 100)
  
      vol = np.zeros((100, 100, 100))
      spts = np.concatenate(static_center, axis=0)
      spts = np.round(spts).astype(int) + np.array([50, 50, 50])
  
      mpts = np.concatenate(moving_center, axis=0)
      mpts = np.round(mpts).astype(int) + np.array([50, 50, 50])
  
      for index in spts:
          i, j, k = index
          vol[i, j, k] = 1
  
      vol2 = np.zeros((100, 100, 100))
      for index in mpts:
          i, j, k = index
          vol2[i, j, k] = 1
  
      overlap = np.sum(np.logical_and(vol, vol2)) / float(np.sum(vol2))
  
      assert_equal(overlap * 100 > 40, True)
  
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 6 for calling a global function with example usage: test_rigid_partial_real_bundles() without return types