code: def test_scale_space_exceptions(rng):
      target_shape = (32, 32)
      # create a random image
      image = np.ndarray(target_shape, dtype=floating)
      ns = np.size(image)
      image[...] = rng.integers(0, 10, ns).reshape(tuple(target_shape))
      zeros = (image == 0).astype(np.int32)
  
      ss = ScaleSpace(image, 3)
      for invalid_level in [-1, 3, 4]:
          assert_raises(ValueError, ss.get_image, invalid_level)
  
      # Verify that the mask is correctly applied, when requested
      ss = ScaleSpace(image, 3, mask0=True)
      for level in range(3):
          img = ss.get_image(level)
          z = (img == 0).astype(np.int32)
          assert_array_equal(zeros, z)
  
file_path: dipy/dipy/align/tests/test_scalespace.py
imports: import numpy
  import scipy
  from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_raises
  from dipy.align import floating
  from dipy.align.imwarp import get_direction_and_spacings
  from dipy.align.scalespace import ScaleSpace, IsotropicScaleSpace
  from dipy.align.tests.test_imwarp import get_synthetic_warped_circle
  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_scale_space_exceptions(rng) without return types