code: def test_patch2self_boundary(rng):
      # patch2self preserves boundaries
      S0 = 100 + np.zeros((20, 20, 20, 20))
      noise = 2 * rng.standard_normal((20, 20, 20, 20))
      S0 += noise
      S0[:10, :10, :10, :10] = 300 + noise[:10, :10, :10, :10]
  
      bvals = np.repeat(100, 20)
  
      p2s.patch2self(S0, bvals)
      assert_greater(S0[9, 9, 9, 9], 290)
      assert_less(S0[10, 10, 10, 10], 110)
  
file_path: dipy/dipy/denoise/tests/test_patch2self.py
imports: import warnings
  import numpy
  from dipy.denoise import patch2self
  from dipy.testing import assert_greater, assert_less, assert_greater_equal, assert_less_equal
  from numpy.testing import assert_array_almost_equal, assert_raises, assert_equal
  import pytest
  from dipy.sims.voxel import multi_tensor
  from dipy.core.gradients import gradient_table, generate_bvecs
  from dipy.testing.decorators import set_random_number_generator
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 2 for calling a global function with example usage: test_patch2self_boundary(rng) without return types