code: def test_nlmeans_random_noise(rng):
      S0 = 100 + 2 * rng.standard_normal((22, 23, 30))
  
      masker = np.zeros(S0.shape[:3]).astype(bool)
      masker[8:15, 8:15, 8:15] = 1
      for mask in [None, masker]:
          S0nb = non_local_means(
              S0, sigma=np.std(S0), rician=False, mask=mask
          )
  
          assert_(S0nb[mask].min() > S0[mask].min())
          assert_(S0nb[mask].max() < S0[mask].max())
          assert_equal(np.round(S0nb[mask].mean()), 100)
  
          S0nb = non_local_means(
              S0, sigma=np.std(S0), rician=False, mask=mask
          )
  
          assert_(S0nb[mask].min() > S0[mask].min())
          assert_(S0nb[mask].max() < S0[mask].max())
          assert_equal(np.round(S0nb[mask].mean()), 100)
  
file_path: dipy/dipy/denoise/tests/test_non_local_means.py
imports: import numpy
  from numpy.testing import assert_, assert_equal, assert_array_almost_equal, assert_raises
  from dipy.denoise.non_local_means import non_local_means
  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_nlmeans_random_noise(rng) without return types