code: def test_compute_masked_class_stats_2d(rng):
      shape = (32, 32)
  
      # Create random labels
      labels = np.ndarray(shape, dtype=np.int32)
      labels[...] = rng.integers(2, 10, np.size(labels)).reshape(shape)
      # now label 0 is not present and label 1 occurs once
      labels[0, 0] = 1
  
      # Create random values
      values = rng.standard_normal((shape[0], shape[1])).astype(
          floating
      )
      values *= labels
      values += labels
  
      expected_means = [0, values[0, 0]] + [
          values[labels == i].mean() for i in range(2, 10)
      ]
      expected_vars = [np.inf, np.inf] + [
          values[labels == i].var() for i in range(2, 10)
      ]
  
      mask = np.ones(shape, dtype=np.int32)
      means, std_dev = em.compute_masked_class_stats_2d(
          mask, values, 10, labels
      )
      assert_array_almost_equal(means, expected_means, decimal=4)
      assert_array_almost_equal(std_dev, expected_vars, decimal=4)
  
file_path: dipy/dipy/align/tests/test_expectmax.py
imports: import numpy
  from numpy.testing import assert_equal, assert_array_equal, assert_array_almost_equal, assert_raises
  from dipy.align import floating
  from dipy.align import expectmax
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 5 for calling a global function with example usage: test_compute_masked_class_stats_2d(rng) without return types