code: def test_EMMetric_image_dynamics(rng):
      metric = EMMetric(2)
  
      target_shape = (10, 10)
      # create a random image
      image = np.ndarray(target_shape, dtype=floating)
      image[...] = rng.integers(0, 10, np.size(image)).reshape(
          tuple(target_shape)
      )
      # compute the expected binary mask
      expected = (image > 0).astype(np.int32)
  
      metric.use_static_image_dynamics(image, None)
      assert_array_equal(expected, metric.static_image_mask)
  
      metric.use_moving_image_dynamics(image, None)
      assert_array_equal(expected, metric.moving_image_mask)
  
file_path: dipy/dipy/align/tests/test_metrics.py
imports: import itertools
  import numpy
  from scipy import ndimage
  from dipy.align import floating
  from dipy.align.metrics import SSDMetric, CCMetric, EMMetric
  from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_raises
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 2 for calling a global function with example usage: test_EMMetric_image_dynamics(rng) without return types