code: def test_mean_distances(rng):
      nb_slines = 10
      nb_pts = 22
      dim = 3
      a = rng.random((nb_slines, nb_pts, dim))
      b = rng.random((nb_slines, nb_pts, dim))
      diff = a - b
  
      # Test Euclidean distance (L2)
      mean_l2_dist = dipymetric.mean_euclidean_distance(a, b)
      diff_norm = np.linalg.norm(
          diff.reshape((-1, dim)), ord=2, axis=-1
      )
      mean_norm = np.mean(diff_norm.reshape((nb_slines, -1)), axis=-1)
      assert_almost_equal(mean_l2_dist, mean_norm)
  
      # Test Manhattan distance (L1)
      mean_l1_dist = dipymetric.mean_manhattan_distance(a, b)
      diff_norm = np.linalg.norm(
          diff.reshape((-1, dim)), ord=1, axis=-1
      )
      mean_norm = np.mean(diff_norm.reshape((nb_slines, -1)), axis=-1)
      assert_almost_equal(mean_l1_dist, mean_norm)
  
file_path: dipy/dipy/segment/tests/test_metric.py
imports: import itertools
  import numpy
  from numpy.testing import assert_array_equal, assert_raises, assert_almost_equal, assert_equal
  import dipy.segment.featurespeed
  import dipy.segment.metric
  import dipy.segment.metricspeed
  from dipy.testing import assert_true, assert_false, assert_greater_equal, assert_less_equal
  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_mean_distances(rng) without return types