code: def test_ascm_rmse_with_nlmeans(rng):
      # checks the smoothness
      S0 = np.ones((30, 30, 30)) * 100
      S0[10:20, 10:20, 10:20] = 50
      S0[20:30, 20:30, 20:30] = 0
      S0_noise = S0 + 20 * rng.standard_normal((30, 30, 30))
      print("Original RMSE", np.sum(np.abs(S0 - S0_noise)) / np.sum(S0))
  
      S0n1 = non_local_means(
          S0_noise,
          sigma=400,
          rician=False,
          patch_radius=1,
          block_radius=1,
      )
      print(
          "Smaller patch RMSE", np.sum(np.abs(S0 - S0n1)) / np.sum(S0)
      )
      S0n2 = non_local_means(
          S0_noise,
          sigma=400,
          rician=False,
          patch_radius=2,
          block_radius=2,
      )
      print("Larger patch RMSE", np.sum(np.abs(S0 - S0n2)) / np.sum(S0))
      S0n = adaptive_soft_matching(S0, S0n1, S0n2, 400)
      print("ASCM RMSE", np.sum(np.abs(S0 - S0n)) / np.sum(S0))
  
      assert_(
          np.sum(np.abs(S0 - S0n)) / np.sum(S0)
          < np.sum(np.abs(S0 - S0n1)) / np.sum(S0)
      )
      assert_(
          np.sum(np.abs(S0 - S0n)) / np.sum(S0)
          < np.sum(np.abs(S0 - S0_noise)) / np.sum(S0)
      )
      assert_(90 < np.mean(S0n) < 110)
  
file_path: dipy/dipy/denoise/tests/test_ascm.py
imports: import numpy
  import dipy.data
  import nibabel
  from numpy.testing import assert_, assert_equal, assert_array_almost_equal
  from dipy.denoise.non_local_means import non_local_means
  from dipy.denoise.noise_estimate import estimate_sigma
  from dipy.denoise.adaptive_soft_matching import adaptive_soft_matching
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 3 for calling a global function with example usage: test_ascm_rmse_with_nlmeans(rng) without return types